From 2e124b4a390ca85325fae75764bef92f0547fa25 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 3 Jan 2013 15:53:06 +0100 Subject: TTY: switch tty_flip_buffer_push Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty in many call sites. Only tty_port will needed and hence no more tty_port_tty_get in those paths. Now, the one where most of tty_port_tty_get gets removed: tty_flip_buffer_push. IOW we also closed all the races in drivers not using tty_port_tty_get at all yet. Also we move tty_flip_buffer_push declaration from include/linux/tty.h to include/linux/tty_flip.h to all others while we are changing it anyway. Signed-off-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/isdn/gigaset/interface.c | 10 +--------- drivers/isdn/i4l/isdn_tty.c | 39 ++++++++++++++++----------------------- 2 files changed, 17 insertions(+), 32 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index 6dcecd4..0fbf4f2 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c @@ -562,16 +562,8 @@ void gigaset_if_free(struct cardstate *cs) void gigaset_if_receive(struct cardstate *cs, unsigned char *buffer, size_t len) { - struct tty_struct *tty = tty_port_tty_get(&cs->port); - - if (tty == NULL) { - gig_dbg(DEBUG_IF, "receive on closed device"); - return; - } - tty_insert_flip_string(&cs->port, buffer, len); - tty_flip_buffer_push(tty); - tty_kref_put(tty); + tty_flip_buffer_push(&cs->port); } EXPORT_SYMBOL_GPL(gigaset_if_receive); diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 9bb9986..d8a7d83 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -63,16 +63,11 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb) struct tty_port *port = &info->port; int c; int len; - struct tty_struct *tty; char last; if (!info->online) return 0; - tty = port->tty; - if (!tty) - return 0; - if (!(info->mcr & UART_MCR_RTS)) return 0; @@ -110,7 +105,7 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb) tty_insert_flip_char(port, last, 0xFF); else tty_insert_flip_char(port, last, TTY_NORMAL); - tty_flip_buffer_push(tty); + tty_flip_buffer_push(port); kfree_skb(skb); return 1; @@ -127,7 +122,6 @@ isdn_tty_readmodem(void) int midx; int i; int r; - struct tty_struct *tty; modem_info *info; for (i = 0; i < ISDN_MAX_CHANNELS; i++) { @@ -145,20 +139,21 @@ isdn_tty_readmodem(void) if ((info->vonline & 1) && (info->emu.vpar[1])) isdn_audio_eval_silence(info); #endif - tty = info->port.tty; - if (tty) { - if (info->mcr & UART_MCR_RTS) { - /* CISCO AsyncPPP Hack */ - if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP)) - r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, &info->port, 0); - else - r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, &info->port, 1); - if (r) - tty_flip_buffer_push(tty); - } else - r = 1; + if (info->mcr & UART_MCR_RTS) { + /* CISCO AsyncPPP Hack */ + if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP)) + r = isdn_readbchan_tty(info->isdn_driver, + info->isdn_channel, + &info->port, 0); + else + r = isdn_readbchan_tty(info->isdn_driver, + info->isdn_channel, + &info->port, 1); + if (r) + tty_flip_buffer_push(&info->port); } else r = 1; + if (r) { info->rcvsched = 0; resched = 1; @@ -2230,7 +2225,6 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c) void isdn_tty_at_cout(char *msg, modem_info *info) { - struct tty_struct *tty; struct tty_port *port = &info->port; atemu *m = &info->emu; char *p; @@ -2248,8 +2242,7 @@ isdn_tty_at_cout(char *msg, modem_info *info) l = strlen(msg); spin_lock_irqsave(&info->readlock, flags); - tty = port->tty; - if ((port->flags & ASYNC_CLOSING) || (!tty)) { + if (port->flags & ASYNC_CLOSING) { spin_unlock_irqrestore(&info->readlock, flags); return; } @@ -2301,7 +2294,7 @@ isdn_tty_at_cout(char *msg, modem_info *info) } else { spin_unlock_irqrestore(&info->readlock, flags); - tty_flip_buffer_push(tty); + tty_flip_buffer_push(port); } } -- cgit v1.1