]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
TTY: switch tty_flip_buffer_push
authorJiri Slaby <jslaby@suse.cz>
Thu, 3 Jan 2013 14:53:06 +0000 (15:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jan 2013 06:30:15 +0000 (22:30 -0800)
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 <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
146 files changed:
arch/ia64/hp/sim/simserial.c
arch/mn10300/kernel/mn10300-serial.c
arch/parisc/kernel/pdc_cons.c
arch/um/drivers/chan.h
arch/um/drivers/chan_kern.c
arch/um/drivers/line.c
arch/xtensa/platforms/iss/console.c
drivers/char/pcmcia/synclink_cs.c
drivers/ipack/devices/ipoctal.c
drivers/isdn/gigaset/interface.c
drivers/isdn/i4l/isdn_tty.c
drivers/mmc/card/sdio_uart.c
drivers/net/usb/hso.c
drivers/s390/char/con3215.c
drivers/s390/char/sclp_tty.c
drivers/s390/char/sclp_vt220.c
drivers/staging/ccg/u_serial.c
drivers/staging/dgrp/dgrp_net_ops.c
drivers/staging/fwserial/fwserial.c
drivers/staging/serqt_usb2/serqt_usb2.c
drivers/tty/amiserial.c
drivers/tty/bfin_jtag_comm.c
drivers/tty/ehv_bytechan.c
drivers/tty/hvc/hvc_console.c
drivers/tty/hvc/hvcs.c
drivers/tty/hvc/hvsi.c
drivers/tty/ipwireless/tty.c
drivers/tty/isicom.c
drivers/tty/mxser.c
drivers/tty/n_gsm.c
drivers/tty/nozomi.c
drivers/tty/pty.c
drivers/tty/rocket.c
drivers/tty/serial/21285.c
drivers/tty/serial/8250/8250.c
drivers/tty/serial/altera_jtaguart.c
drivers/tty/serial/altera_uart.c
drivers/tty/serial/amba-pl010.c
drivers/tty/serial/amba-pl011.c
drivers/tty/serial/apbuart.c
drivers/tty/serial/ar933x_uart.c
drivers/tty/serial/arc_uart.c
drivers/tty/serial/atmel_serial.c
drivers/tty/serial/bcm63xx_uart.c
drivers/tty/serial/bfin_sport_uart.c
drivers/tty/serial/bfin_uart.c
drivers/tty/serial/clps711x.c
drivers/tty/serial/cpm_uart/cpm_uart_core.c
drivers/tty/serial/crisv10.c
drivers/tty/serial/dz.c
drivers/tty/serial/efm32-uart.c
drivers/tty/serial/icom.c
drivers/tty/serial/ifx6x60.c
drivers/tty/serial/imx.c
drivers/tty/serial/ioc3_serial.c
drivers/tty/serial/ioc4_serial.c
drivers/tty/serial/jsm/jsm_tty.c
drivers/tty/serial/kgdb_nmi.c
drivers/tty/serial/lantiq.c
drivers/tty/serial/lpc32xx_hs.c
drivers/tty/serial/m32r_sio.c
drivers/tty/serial/max3100.c
drivers/tty/serial/max310x.c
drivers/tty/serial/mcf.c
drivers/tty/serial/mfd.c
drivers/tty/serial/mpc52xx_uart.c
drivers/tty/serial/mpsc.c
drivers/tty/serial/mrst_max3110.c
drivers/tty/serial/msm_serial.c
drivers/tty/serial/msm_serial_hs.c
drivers/tty/serial/msm_smd_tty.c
drivers/tty/serial/mux.c
drivers/tty/serial/mxs-auart.c
drivers/tty/serial/netx-serial.c
drivers/tty/serial/nwpserial.c
drivers/tty/serial/omap-serial.c
drivers/tty/serial/pch_uart.c
drivers/tty/serial/pmac_zilog.c
drivers/tty/serial/pnx8xxx_uart.c
drivers/tty/serial/pxa.c
drivers/tty/serial/sa1100.c
drivers/tty/serial/samsung.c
drivers/tty/serial/sb1250-duart.c
drivers/tty/serial/sc26xx.c
drivers/tty/serial/sccnxp.c
drivers/tty/serial/serial_ks8695.c
drivers/tty/serial/serial_txx9.c
drivers/tty/serial/sh-sci.c
drivers/tty/serial/sirfsoc_uart.c
drivers/tty/serial/sn_console.c
drivers/tty/serial/sunhv.c
drivers/tty/serial/sunsab.c
drivers/tty/serial/sunsu.c
drivers/tty/serial/sunzilog.c
drivers/tty/serial/timbuart.c
drivers/tty/serial/uartlite.c
drivers/tty/serial/ucc_uart.c
drivers/tty/serial/vr41xx_siu.c
drivers/tty/serial/vt8500_serial.c
drivers/tty/serial/xilinx_uartps.c
drivers/tty/serial/zs.c
drivers/tty/synclink.c
drivers/tty/synclink_gt.c
drivers/tty/synclinkmp.c
drivers/tty/tty_buffer.c
drivers/usb/class/cdc-acm.c
drivers/usb/gadget/u_serial.c
drivers/usb/serial/aircable.c
drivers/usb/serial/ark3116.c
drivers/usb/serial/belkin_sa.c
drivers/usb/serial/cyberjack.c
drivers/usb/serial/cypress_m8.c
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/f81232.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/garmin_gps.c
drivers/usb/serial/generic.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_ti.c
drivers/usb/serial/ir-usb.c
drivers/usb/serial/iuu_phoenix.c
drivers/usb/serial/keyspan.c
drivers/usb/serial/keyspan_pda.c
drivers/usb/serial/kl5kusb105.c
drivers/usb/serial/kobil_sct.c
drivers/usb/serial/mct_u232.c
drivers/usb/serial/metro-usb.c
drivers/usb/serial/mos7720.c
drivers/usb/serial/mos7840.c
drivers/usb/serial/navman.c
drivers/usb/serial/omninet.c
drivers/usb/serial/opticon.c
drivers/usb/serial/oti6858.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/quatech2.c
drivers/usb/serial/safe_serial.c
drivers/usb/serial/sierra.c
drivers/usb/serial/spcp8x5.c
drivers/usb/serial/ssu100.c
drivers/usb/serial/symbolserial.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/usb_wwan.c
include/linux/tty.h
include/linux/tty_flip.h
net/bluetooth/rfcomm/tty.c
net/irda/ircomm/ircomm_tty.c

index 942022a5bc861fa6deed2695ad6ba35043f01ae9..da2f319fb71dd4aee116018b2340460eb28f4cfb 100644 (file)
@@ -53,9 +53,8 @@ struct tty_driver *hp_simserial_driver;
 
 static struct console *console;
 
-static void receive_chars(struct tty_struct *tty)
+static void receive_chars(struct tty_port *port)
 {
-       struct tty_port *port = tty->port;
        unsigned char ch;
        static unsigned char seen_esc = 0;
 
@@ -85,7 +84,7 @@ static void receive_chars(struct tty_struct *tty)
                if (tty_insert_flip_char(port, ch, TTY_NORMAL) == 0)
                        break;
        }
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
 }
 
 /*
@@ -94,18 +93,9 @@ static void receive_chars(struct tty_struct *tty)
 static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
 {
        struct serial_state *info = dev_id;
-       struct tty_struct *tty = tty_port_tty_get(&info->port);
 
-       if (!tty) {
-               printk(KERN_INFO "%s: tty=0 problem\n", __func__);
-               return IRQ_NONE;
-       }
-       /*
-        * pretty simple in our case, because we only get interrupts
-        * on inbound traffic
-        */
-       receive_chars(tty);
-       tty_kref_put(tty);
+       receive_chars(&info->port);
+
        return IRQ_HANDLED;
 }
 
index ae61bd692b4b6a317dc8a4166004e9dd158c344e..1dd20dbfd0983793f9ec797e8df55ae093df4992 100644 (file)
@@ -525,7 +525,6 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
 {
        struct uart_icount *icount = &port->uart.icount;
        struct tty_port *port = &port->uart.state->port;
-       struct tty_struct *tty = port->tty;
        unsigned ix;
        int count;
        u8 st, ch, push, status, overrun;
@@ -538,7 +537,7 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
        count = tty_buffer_request_room(port, count);
        if (count == 0) {
                if (!port->low_latency)
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(port);
                return;
        }
 
@@ -547,7 +546,7 @@ try_again:
        ix = ACCESS_ONCE(port->rx_outp);
        if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) {
                if (push && !port->low_latency)
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(port);
                return;
        }
 
@@ -679,7 +678,7 @@ insert:
        count--;
        if (count <= 0) {
                if (!port->low_latency)
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(port);
                return;
        }
 
index 4d92a379eb2156a5931d387ef1da2f12fe25a9d4..d5cae55195ecfd4f108b1431ecf52193b5a8d282 100644 (file)
@@ -138,10 +138,6 @@ static const struct tty_operations pdc_console_tty_ops = {
 static void pdc_console_poll(unsigned long unused)
 {
        int data, count = 0;
-       struct tty_struct *tty = tty_port_tty_get(&tty_port);
-
-       if (!tty)
-               return;
 
        while (1) {
                data = pdc_console_poll_key(NULL);
@@ -152,9 +148,7 @@ static void pdc_console_poll(unsigned long unused)
        }
 
        if (count)
-               tty_flip_buffer_push(tty);
-
-       tty_kref_put(tty);
+               tty_flip_buffer_push(&tty_port);
 
        if (pdc_cons.flags & CON_ENABLED)
                mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);
index 02b5a76e98d9da2038442b03d47c700338af634c..78f1b899996446e9e769ff703938dbb7bedc6fe6 100644 (file)
@@ -27,8 +27,7 @@ struct chan {
        void *data;
 };
 
-extern void chan_interrupt(struct line *line,
-                          struct tty_struct *tty, int irq);
+extern void chan_interrupt(struct line *line, int irq);
 extern int parse_chan_pair(char *str, struct line *line, int device,
                           const struct chan_opts *opts, char **error_out);
 extern int write_chan(struct chan *chan, const char *buf, int len,
index 795bd8102205447527f72e6d01c8d6467c8712c8..15c553c239a119259f2f948f8381e5a9a26f4ccb 100644 (file)
@@ -131,11 +131,9 @@ void chan_enable_winch(struct chan *chan, struct tty_struct *tty)
 static void line_timer_cb(struct work_struct *work)
 {
        struct line *line = container_of(work, struct line, task.work);
-       struct tty_struct *tty = tty_port_tty_get(&line->port);
 
        if (!line->throttled)
-               chan_interrupt(line, tty, line->driver->read_irq);
-       tty_kref_put(tty);
+               chan_interrupt(line, line->driver->read_irq);
 }
 
 int enable_chan(struct line *line)
@@ -546,7 +544,7 @@ int parse_chan_pair(char *str, struct line *line, int device,
        return 0;
 }
 
-void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
+void chan_interrupt(struct line *line, int irq)
 {
        struct tty_port *port = &line->port;
        struct chan *chan = line->chan_in;
@@ -570,8 +568,11 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
                reactivate_fd(chan->fd, irq);
        if (err == -EIO) {
                if (chan->primary) {
-                       if (tty != NULL)
+                       struct tty_struct *tty = tty_port_tty_get(&line->port);
+                       if (tty != NULL) {
                                tty_hangup(tty);
+                               tty_kref_put(tty);
+                       }
                        if (line->chan_out != chan)
                                close_one_chan(line->chan_out, 1);
                }
@@ -580,6 +581,5 @@ void chan_interrupt(struct line *line, struct tty_struct *tty, int irq)
                        return;
        }
  out:
-       if (tty)
-               tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
 }
index 9ffc28bd4b7a6d9b92bdd77ba0329a373f44cfd0..f1b38571f94e7996d1c83712945583e3d1e75a06 100644 (file)
@@ -19,11 +19,10 @@ static irqreturn_t line_interrupt(int irq, void *data)
 {
        struct chan *chan = data;
        struct line *line = chan->line;
-       struct tty_struct *tty = tty_port_tty_get(&line->port);
 
        if (line)
-               chan_interrupt(line, tty, irq);
-       tty_kref_put(tty);
+               chan_interrupt(line, irq);
+
        return IRQ_HANDLED;
 }
 
@@ -234,7 +233,7 @@ void line_unthrottle(struct tty_struct *tty)
        struct line *line = tty->driver_data;
 
        line->throttled = 0;
-       chan_interrupt(line, tty, line->driver->read_irq);
+       chan_interrupt(line, line->driver->read_irq);
 
        /*
         * Maybe there is enough stuff pending that calling the interrupt
index 62447d63890cab3079c75bd8a2ef787520f293a0..da9866f7fecfae1ee69f1b3bc80e3b3b2be2b7b6 100644 (file)
@@ -58,7 +58,8 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
        tty->port = &serial_port;
        spin_lock(&timer_lock);
        if (tty->count == 1) {
-               setup_timer(&serial_timer, rs_poll, (unsigned long)tty);
+               setup_timer(&serial_timer, rs_poll,
+                               (unsigned long)&serial_port);
                mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
        }
        spin_unlock(&timer_lock);
@@ -97,9 +98,7 @@ static int rs_write(struct tty_struct * tty,
 
 static void rs_poll(unsigned long priv)
 {
-       struct tty_struct* tty = (struct tty_struct*) priv;
-       struct tty_port *port = tty->port;
-
+       struct tty_port *port = (struct tty_port *)priv;
        struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
        int i = 0;
        unsigned char c;
@@ -113,7 +112,7 @@ static void rs_poll(unsigned long priv)
        }
 
        if (i)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(port);
 
 
        mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
index 92dc7327c7aa9b333b4ae2f09771dc34c4ec3714..f334aec65fc76bedfd997d1fec6976a6ddb8ed48 100644 (file)
@@ -886,7 +886,7 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom)
        issue_command(info, CHA, CMD_RXFIFO);
 }
 
-static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty)
+static void rx_ready_async(MGSLPC_INFO *info, int tcd)
 {
        struct tty_port *port = &info->port;
        unsigned char data, status, flag;
@@ -894,14 +894,6 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty)
        int work = 0;
        struct mgsl_icount *icount = &info->icount;
 
-       if (!tty) {
-               /* tty is not available anymore */
-               issue_command(info, CHA, CMD_RXRESET);
-               if (debug_level >= DEBUG_LEVEL_ISR)
-                       printk("%s(%d):rx_ready_async(tty=NULL)\n",__FILE__,__LINE__);
-               return;
-       }
-
        if (tcd) {
                /* early termination, get FIFO count from RBCL register */
                fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f);
@@ -958,7 +950,7 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty)
        }
 
        if (work)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(port);
 }
 
 
@@ -1218,7 +1210,7 @@ static irqreturn_t mgslpc_isr(int dummy, void *dev_id)
                                if (info->params.mode == MGSL_MODE_HDLC)
                                        rx_ready_hdlc(info, isr & IRQ_RXEOM);
                                else
-                                       rx_ready_async(info, isr & IRQ_RXEOM, tty);
+                                       rx_ready_async(info, isr & IRQ_RXEOM);
                        }
 
                        /* transmit IRQs */
index 8e0ed663ba9b9840301226f43ec4c5f0e16ebd47..ab20a0851dd269b5205d9a5c516dade92f4f2ec8 100644 (file)
@@ -133,8 +133,7 @@ static int ipoctal_get_icount(struct tty_struct *tty,
        return 0;
 }
 
-static void ipoctal_irq_rx(struct ipoctal_channel *channel,
-                          struct tty_struct *tty, u8 sr)
+static void ipoctal_irq_rx(struct ipoctal_channel *channel, u8 sr)
 {
        struct tty_port *port = &channel->tty_port;
        unsigned char value;
@@ -176,7 +175,7 @@ static void ipoctal_irq_rx(struct ipoctal_channel *channel,
                sr = ioread8(&channel->regs->r.sr);
        } while (isr & channel->isr_rx_rdy_mask);
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
 }
 
 static void ipoctal_irq_tx(struct ipoctal_channel *channel)
@@ -209,15 +208,11 @@ static void ipoctal_irq_tx(struct ipoctal_channel *channel)
 static void ipoctal_irq_channel(struct ipoctal_channel *channel)
 {
        u8 isr, sr;
-       struct tty_struct *tty;
 
        /* If there is no client, skip the check */
        if (!atomic_read(&channel->open))
                return;
 
-       tty = tty_port_tty_get(&channel->tty_port);
-       if (!tty)
-               return;
        /* The HW is organized in pair of channels.  See which register we need
         * to read from */
        isr = ioread8(&channel->block_regs->r.isr);
@@ -236,14 +231,13 @@ static void ipoctal_irq_channel(struct ipoctal_channel *channel)
 
        /* RX data */
        if ((isr & channel->isr_rx_rdy_mask) && (sr & SR_RX_READY))
-               ipoctal_irq_rx(channel, tty, sr);
+               ipoctal_irq_rx(channel, sr);
 
        /* TX of each character */
        if ((isr & channel->isr_tx_rdy_mask) && (sr & SR_TX_READY))
                ipoctal_irq_tx(channel);
 
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&channel->tty_port);
 }
 
 static irqreturn_t ipoctal_irq_handler(void *arg)
index 6dcecd40a8192fe787a9294b5b1369caaf6b997d..0fbf4f215d865cbb8782110ff274fd04589e8a86 100644 (file)
@@ -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);
 
index 9bb9986659e469d1dbcb1d814ba41f1294a58bcf..d8a7d832341436ce62e1dfaacc6b6578ab79e224 100644 (file)
@@ -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);
        }
 }
 
index 894078be0b9689355b575f7fce4c2ee8904d382c..c931dfe6a59cb80ac893d3d2754eac7b9a07301d 100644 (file)
@@ -381,7 +381,6 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port)
 static void sdio_uart_receive_chars(struct sdio_uart_port *port,
                                    unsigned int *status)
 {
-       struct tty_struct *tty = tty_port_tty_get(&port->port);
        unsigned int ch, flag;
        int max_count = 256;
 
@@ -418,24 +417,19 @@ static void sdio_uart_receive_chars(struct sdio_uart_port *port,
                }
 
                if ((*status & port->ignore_status_mask & ~UART_LSR_OE) == 0)
-                       if (tty)
-                               tty_insert_flip_char(&port->port, ch, flag);
+                       tty_insert_flip_char(&port->port, ch, flag);
 
                /*
                 * Overrun is special.  Since it's reported immediately,
                 * it doesn't affect the current character.
                 */
                if (*status & ~port->ignore_status_mask & UART_LSR_OE)
-                       if (tty)
-                               tty_insert_flip_char(&port->port, 0,
-                                               TTY_OVERRUN);
+                       tty_insert_flip_char(&port->port, 0, TTY_OVERRUN);
 
                *status = sdio_in(port, UART_LSR);
        } while ((*status & UART_LSR_DR) && (max_count-- > 0));
-       if (tty) {
-               tty_flip_buffer_push(tty);
-               tty_kref_put(tty);
-       }
+
+       tty_flip_buffer_push(&port->port);
 }
 
 static void sdio_uart_transmit_chars(struct sdio_uart_port *port)
index d235ca07548f8eab6bbe8cfd189039d6d4d7c705..f902a14da88cfc4987a2f30e964db8c075b0243d 100644 (file)
@@ -2035,24 +2035,23 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
        tty = tty_port_tty_get(&serial->port);
 
        /* Push data to tty */
-       if (tty) {
-               write_length_remaining = urb->actual_length -
-                       serial->curr_rx_urb_offset;
-               D1("data to push to tty");
-               while (write_length_remaining) {
-                       if (test_bit(TTY_THROTTLED, &tty->flags)) {
-                               tty_kref_put(tty);
-                               return -1;
-                       }
-                       curr_write_len = tty_insert_flip_string(&serial->port,
-                               urb->transfer_buffer + serial->curr_rx_urb_offset,
-                               write_length_remaining);
-                       serial->curr_rx_urb_offset += curr_write_len;
-                       write_length_remaining -= curr_write_len;
-                       tty_flip_buffer_push(tty);
+       write_length_remaining = urb->actual_length -
+               serial->curr_rx_urb_offset;
+       D1("data to push to tty");
+       while (write_length_remaining) {
+               if (tty && test_bit(TTY_THROTTLED, &tty->flags)) {
+                       tty_kref_put(tty);
+                       return -1;
                }
-               tty_kref_put(tty);
+               curr_write_len = tty_insert_flip_string(&serial->port,
+                       urb->transfer_buffer + serial->curr_rx_urb_offset,
+                       write_length_remaining);
+               serial->curr_rx_urb_offset += curr_write_len;
+               write_length_remaining -= curr_write_len;
+               tty_flip_buffer_push(&serial->port);
        }
+       tty_kref_put(tty);
+
        if (write_length_remaining == 0) {
                serial->curr_rx_urb_offset = 0;
                serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0;
index 41b75c5ae0d5d110be8147d632011b0df36f048f..2f58e9fde156297b06dae7f6e6badd977d765603 100644 (file)
@@ -413,7 +413,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
                        case CTRLCHAR_CTRL:
                                tty_insert_flip_char(&raw->port, cchar,
                                                TTY_NORMAL);
-                               tty_flip_buffer_push(tty);
+                               tty_flip_buffer_push(&raw->port);
                                break;
 
                        case CTRLCHAR_NONE:
@@ -427,7 +427,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
                                        count -= 2;
                                tty_insert_flip_string(&raw->port, raw->inbuf,
                                                count);
-                               tty_flip_buffer_push(tty);
+                               tty_flip_buffer_push(&raw->port);
                                break;
                        }
                } else if (req->type == RAW3215_WRITE) {
index 19b7c516c07d46c6d1414dff907c1b7b336f2bc1..14b4cb8abcc8ffb41c6c56121c97bca90616ea11 100644 (file)
@@ -343,7 +343,7 @@ sclp_tty_input(unsigned char* buf, unsigned int count)
                break;
        case CTRLCHAR_CTRL:
                tty_insert_flip_char(&sclp_port, cchar, TTY_NORMAL);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&sclp_port);
                break;
        case CTRLCHAR_NONE:
                /* send (normal) input to line discipline */
@@ -355,7 +355,7 @@ sclp_tty_input(unsigned char* buf, unsigned int count)
                        tty_insert_flip_char(&sclp_port, '\n', TTY_NORMAL);
                } else
                        tty_insert_flip_string(&sclp_port, buf, count - 2);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&sclp_port);
                break;
        }
        tty_kref_put(tty);
index 0eca99b98712f7db0f5c918ce79b937727e0ccb3..6c92f62623be4623cd7c950b6ab21d7d3c870be9 100644 (file)
@@ -461,14 +461,9 @@ sclp_vt220_write(struct tty_struct *tty, const unsigned char *buf, int count)
 static void
 sclp_vt220_receiver_fn(struct evbuf_header *evbuf)
 {
-       struct tty_struct *tty = tty_port_tty_get(&sclp_vt220_port);
        char *buffer;
        unsigned int count;
 
-       /* Ignore input if device is not open */
-       if (tty == NULL)
-               return;
-
        buffer = (char *) ((addr_t) evbuf + sizeof(struct evbuf_header));
        count = evbuf->length - sizeof(struct evbuf_header);
 
@@ -481,10 +476,9 @@ sclp_vt220_receiver_fn(struct evbuf_header *evbuf)
                buffer++;
                count--;
                tty_insert_flip_string(&sclp_vt220_port, buffer, count);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&sclp_vt220_port);
                break;
        }
-       tty_kref_put(tty);
 }
 
 /*
index 7df2c02d113717f529a0848cec03d482a36c8b9c..b10947ae0ac5166bda188288b952e761fe6d79b2 100644 (file)
@@ -491,12 +491,8 @@ static void gs_rx_push(unsigned long _port)
 
                req = list_first_entry(queue, struct usb_request, list);
 
-               /* discard data if tty was closed */
-               if (!tty)
-                       goto recycle;
-
                /* leave data queued if tty was rx throttled */
-               if (test_bit(TTY_THROTTLED, &tty->flags))
+               if (tty && test_bit(TTY_THROTTLED, &tty->flags))
                        break;
 
                switch (req->status) {
@@ -542,7 +538,6 @@ static void gs_rx_push(unsigned long _port)
                        }
                        port->n_read = 0;
                }
-recycle:
                list_move(&req->list, &port->read_pool);
                port->read_started--;
        }
@@ -550,8 +545,8 @@ recycle:
        /* Push from tty to ldisc; without low_latency set this is handled by
         * a workqueue, so we won't get callbacks and can hold port_lock
         */
-       if (tty && do_push)
-               tty_flip_buffer_push(tty);
+       if (do_push)
+               tty_flip_buffer_push(&port->port);
 
 
        /* We want our data queue to become empty ASAP, keeping data
index e618a667d84c4f5366ffac833fb102fc040f713c..4c7abfabf19783a573896949df2e6b408eb3e3ab 100644 (file)
@@ -234,7 +234,7 @@ static void dgrp_input(struct ch_struct *ch)
 
                tty_insert_flip_string_flags(&ch->port, myflipbuf,
                                             myflipflagbuf, len);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&ch->port);
 
                ch->ch_rxcount += len;
        }
@@ -2958,7 +2958,7 @@ check_query:
 
                                tty_buffer_request_room(&ch->port, 1);
                                tty_insert_flip_char(&ch->port, 0, TTY_BREAK);
-                               tty_flip_buffer_push(ch->ch_tun.un_tty);
+                               tty_flip_buffer_push(&ch->port);
 
                        }
 
index a2a0c43dec1c34cff78e6423ab44d4f782bf8d5a..b403393c49c3d6d217729304759ce139976f6523 100644 (file)
@@ -489,16 +489,11 @@ static void fwtty_do_hangup(struct work_struct *work)
 static void fwtty_emit_breaks(struct work_struct *work)
 {
        struct fwtty_port *port = to_port(to_delayed_work(work), emit_breaks);
-       struct tty_struct *tty;
        static const char buf[16];
        unsigned long now = jiffies;
        unsigned long elapsed = now - port->break_last;
        int n, t, c, brk = 0;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        /* generate breaks at the line rate (but at least 1) */
        n = (elapsed * port->cps) / HZ + 1;
        port->break_last = now;
@@ -514,9 +509,7 @@ static void fwtty_emit_breaks(struct work_struct *work)
                if (c < t)
                        break;
        }
-       tty_flip_buffer_push(tty);
-
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 
        if (port->mstatus & (UART_LSR_BI << 24))
                schedule_delayed_work(&port->emit_breaks, FREQ_BREAKS);
@@ -530,10 +523,6 @@ static void fwtty_pushrx(struct work_struct *work)
        struct buffered_rx *buf, *next;
        int n, c = 0;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        spin_lock_bh(&port->lock);
        list_for_each_entry_safe(buf, next, &port->buf_list, list) {
                n = tty_insert_flip_string_fixed_flag(&port->port, buf->data,
@@ -545,7 +534,11 @@ static void fwtty_pushrx(struct work_struct *work)
                                memmove(buf->data, buf->data + n, buf->n - n);
                                buf->n -= n;
                        }
-                       __fwtty_throttle(port, tty);
+                       tty = tty_port_tty_get(&port->port);
+                       if (tty) {
+                               __fwtty_throttle(port, tty);
+                               tty_kref_put(tty);
+                       }
                        break;
                } else {
                        list_del(&buf->list);
@@ -553,13 +546,11 @@ static void fwtty_pushrx(struct work_struct *work)
                }
        }
        if (c > 0)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
 
        if (list_empty(&port->buf_list))
                clear_bit(BUFFERING_RX, &port->flags);
        spin_unlock_bh(&port->lock);
-
-       tty_kref_put(tty);
 }
 
 static int fwtty_buffer_rx(struct fwtty_port *port, unsigned char *d, size_t n)
@@ -594,10 +585,6 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len)
        unsigned lsr;
        int err = 0;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return -ENOENT;
-
        fwtty_dbg(port, "%d", n);
        profile_size_distrib(port->stats.reads, n);
 
@@ -634,16 +621,20 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len)
                c = tty_insert_flip_string_fixed_flag(&port->port, data,
                                TTY_NORMAL, n);
                if (c > 0)
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(&port->port);
                n -= c;
 
                if (n) {
                        /* start buffering and throttling */
                        n -= fwtty_buffer_rx(port, &data[c], n);
 
-                       spin_lock_bh(&port->lock);
-                       __fwtty_throttle(port, tty);
-                       spin_unlock_bh(&port->lock);
+                       tty = tty_port_tty_get(&port->port);
+                       if (tty) {
+                               spin_lock_bh(&port->lock);
+                               __fwtty_throttle(port, tty);
+                               spin_unlock_bh(&port->lock);
+                               tty_kref_put(tty);
+                       }
                }
        } else
                n -= fwtty_buffer_rx(port, data, n);
@@ -654,8 +645,6 @@ static int fwtty_rx(struct fwtty_port *port, unsigned char *data, size_t len)
        }
 
 out:
-       tty_kref_put(tty);
-
        port->icount.rx += len;
        port->stats.lost += n;
        return err;
index 14965662d09cc8eb0538b5edf8deb4afd0a32fc6..df29a3de29f27ac7ce160933f4cf26fff7fefb4e 100644 (file)
@@ -290,8 +290,7 @@ static void qt_interrupt_callback(struct urb *urb)
        /* FIXME */
 }
 
-static void qt_status_change_check(struct tty_struct *tty,
-                                  struct urb *urb,
+static void qt_status_change_check(struct urb *urb,
                                   struct quatech_port *qt_port,
                                   struct usb_serial_port *port)
 {
@@ -348,7 +347,7 @@ static void qt_status_change_check(struct tty_struct *tty,
                        tty_insert_flip_char(&port->port, data[i], TTY_NORMAL);
 
        }
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static void qt_read_bulk_callback(struct urb *urb)
@@ -411,7 +410,7 @@ static void qt_read_bulk_callback(struct urb *urb)
        }
 
        if (urb->actual_length)
-               qt_status_change_check(tty, urb, qt_port, port);
+               qt_status_change_check(urb, qt_port, port);
 
        /* Continue trying to always read  */
        usb_fill_bulk_urb(port->read_urb, serial->dev,
@@ -427,7 +426,7 @@ static void qt_read_bulk_callback(struct urb *urb)
                        __func__, result);
        else {
                if (urb->actual_length) {
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(&port->port);
                        tty_schedule_flip(tty);
                }
        }
index 2d1357acbc234b1d2a3e80a53936d425fe0e5a4b..4c7d7017219325b71ebfc7f818a7d602b3842aa9 100644 (file)
@@ -251,7 +251,6 @@ static void receive_chars(struct serial_state *info)
 {
         int status;
        int serdatr;
-       struct tty_struct *tty = info->tport.tty;
        unsigned char ch, flag;
        struct  async_icount *icount;
        int oe = 0;
@@ -314,7 +313,7 @@ static void receive_chars(struct serial_state *info)
 #endif
            flag = TTY_BREAK;
            if (info->tport.flags & ASYNC_SAK)
-             do_SAK(tty);
+             do_SAK(info->tport.tty);
          } else if (status & UART_LSR_PE)
            flag = TTY_PARITY;
          else if (status & UART_LSR_FE)
@@ -331,7 +330,7 @@ static void receive_chars(struct serial_state *info)
        tty_insert_flip_char(&info->tport, ch, flag);
        if (oe == 1)
                tty_insert_flip_char(&info->tport, 0, TTY_OVERRUN);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&info->tport);
 out:
        return;
 }
index 143c38579cb5a4f729762cccd250e9b559725de2..a93a424873faf638a004a3cabbc5f381d381027a 100644 (file)
@@ -95,18 +95,16 @@ bfin_jc_emudat_manager(void *arg)
 
                /* if incoming data is ready, eat it */
                if (bfin_read_DBGSTAT() & EMUDIF) {
-                       if (tty != NULL) {
-                               uint32_t emudat = bfin_read_emudat();
-                               if (inbound_len == 0) {
-                                       pr_debug("incoming length: 0x%08x\n", emudat);
-                                       inbound_len = emudat;
-                               } else {
-                                       size_t num_chars = (4 <= inbound_len ? 4 : inbound_len);
-                                       pr_debug("  incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars);
-                                       inbound_len -= num_chars;
-                                       tty_insert_flip_string(&port, (unsigned char *)&emudat, num_chars);
-                                       tty_flip_buffer_push(tty);
-                               }
+                       uint32_t emudat = bfin_read_emudat();
+                       if (inbound_len == 0) {
+                               pr_debug("incoming length: 0x%08x\n", emudat);
+                               inbound_len = emudat;
+                       } else {
+                               size_t num_chars = (4 <= inbound_len ? 4 : inbound_len);
+                               pr_debug("  incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars);
+                               inbound_len -= num_chars;
+                               tty_insert_flip_string(&port, (unsigned char *)&emudat, num_chars);
+                               tty_flip_buffer_push(&port);
                        }
                }
 
index 5164f9a570178244617a860d4cf5d6111082103c..ed92622b8949dcdd3338388e213b67241110d3e1 100644 (file)
@@ -371,16 +371,11 @@ console_initcall(ehv_bc_console_init);
 static irqreturn_t ehv_bc_tty_rx_isr(int irq, void *data)
 {
        struct ehv_bc_data *bc = data;
-       struct tty_struct *ttys = tty_port_tty_get(&bc->port);
        unsigned int rx_count, tx_count, len;
        int count;
        char buffer[EV_BYTE_CHANNEL_MAX_BYTES];
        int ret;
 
-       /* ttys could be NULL during a hangup */
-       if (!ttys)
-               return IRQ_HANDLED;
-
        /* Find out how much data needs to be read, and then ask the TTY layer
         * if it can handle that much.  We want to ensure that every byte we
         * read from the byte channel will be accepted by the TTY layer.
@@ -422,9 +417,7 @@ static irqreturn_t ehv_bc_tty_rx_isr(int irq, void *data)
        }
 
        /* Tell the tty layer that we're done. */
-       tty_flip_buffer_push(ttys);
-
-       tty_kref_put(ttys);
+       tty_flip_buffer_push(&bc->port);
 
        return IRQ_HANDLED;
 }
index 8c2fe3a0e0911710f6acd1e4aa0eec8ac81c3772..eb255e807c0662250887beea86a2fb73081a6deb 100644 (file)
@@ -691,7 +691,7 @@ int hvc_poll(struct hvc_struct *hp)
                   a minimum for performance. */
                timeout = MIN_TIMEOUT;
 
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&hp->port);
        }
        tty_kref_put(tty);
 
index 7bfc0a924b2fa1fdeee48fbc9618d6e94fb431c1..1956593ee89d17b13d24e13c725eef8dd59cf7e7 100644 (file)
@@ -623,7 +623,7 @@ static int hvcs_io(struct hvcs_struct *hvcsd)
        spin_unlock_irqrestore(&hvcsd->lock, flags);
        /* This is synch because tty->low_latency == 1 */
        if(got)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&hvcsd->port);
 
        if (!got) {
                /* Do this _after_ the flip_buffer_push */
index 1f528b8ebf5f9998926301e66cc6e71c2cc77614..dc591290120b3b2ab11008b3055c96744dc70fd0 100644 (file)
@@ -465,7 +465,7 @@ static int hvsi_load_chunk(struct hvsi_struct *hp, struct tty_struct *tty,
        compact_inbuf(hp, packet);
 
        if (flip)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&hp->port);
 
        return 1;
 }
@@ -511,7 +511,7 @@ static irqreturn_t hvsi_interrupt(int irq, void *arg)
                /* we weren't hung up and we weren't throttled, so we can
                 * deliver the rest now */
                hvsi_send_overflow(hp);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&hp->port);
        }
        spin_unlock_irqrestore(&hp->lock, flags);
 
@@ -998,7 +998,7 @@ static void hvsi_unthrottle(struct tty_struct *tty)
        spin_lock_irqsave(&hp->lock, flags);
        if (hp->n_throttle) {
                hvsi_send_overflow(hp);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&hp->port);
        }
        spin_unlock_irqrestore(&hp->lock, flags);
 
index c43da74454326e72a3344675c7ccac642cdbe5a5..8fd72ff9436e12039abf43575d7cf17181132258 100644 (file)
@@ -160,15 +160,9 @@ static void ipw_close(struct tty_struct *linux_tty, struct file *filp)
 void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
                        unsigned int length)
 {
-       struct tty_struct *linux_tty;
        int work = 0;
 
        mutex_lock(&tty->ipw_tty_mutex);
-       linux_tty = tty->port.tty;
-       if (linux_tty == NULL) {
-               mutex_unlock(&tty->ipw_tty_mutex);
-               return;
-       }
 
        if (!tty->port.count) {
                mutex_unlock(&tty->ipw_tty_mutex);
@@ -187,7 +181,7 @@ void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
         * This may sleep if ->low_latency is set
         */
        if (work)
-               tty_flip_buffer_push(linux_tty);
+               tty_flip_buffer_push(&tty->port);
 }
 
 static void ipw_write_packet_sent_callback(void *callback_data,
index c70144f55fc07db47087f27fd6cf44e7b7143c9c..858291ca889cc869ecdd1c75c7c312997c762393 100644 (file)
@@ -637,7 +637,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
                        tty_insert_flip_char(&port->port, 0, TTY_BREAK);
                        if (port->port.flags & ASYNC_SAK)
                                do_SAK(tty);
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(&port->port);
                        break;
 
                case 2: /* Statistics            */
@@ -671,7 +671,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
                                byte_count -= 2;
                        }
                }
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
        outw(0x0000, base+0x04); /* enable interrupts */
        spin_unlock(&card->card_lock);
index e9cdfdfe06e95ceb62c73688c45d0eec05746716..ad34a202a34dc06aeaa241cf134fcd1c9079afcb 100644 (file)
@@ -2145,7 +2145,7 @@ end_intr:
         * recursive locking.
         */
        spin_unlock(&port->slock);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->port);
        spin_lock(&port->slock);
 }
 
index 4a3342d21c8f3248be06eeb3ece04fc23df49cb5..d84dcfeadce392d36fe58835152d1908f950ad62 100644 (file)
@@ -1141,7 +1141,6 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
 static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen)
 {
        struct tty_port *port;
-       struct tty_struct *tty;
        unsigned int addr = 0 ;
        u8 bits;
        int len = clen;
@@ -1174,12 +1173,8 @@ static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen)
        if (bits & 8)
                tty_insert_flip_char(port, 0, TTY_FRAME);
 
-       /* See if we have an uplink tty */
-       tty = tty_port_tty_get(port);
-       if (tty) {
-               tty_flip_buffer_push(tty);
-               tty_kref_put(tty);
-       }
+       tty_flip_buffer_push(port);
+
        gsm_control_reply(gsm, CMD_RLS, data, clen);
 }
 
@@ -1552,36 +1547,37 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int clen)
 {
        /* krefs .. */
        struct tty_port *port = &dlci->port;
-       struct tty_struct *tty = tty_port_tty_get(port);
+       struct tty_struct *tty;
        unsigned int modem = 0;
        int len = clen;
 
        if (debug & 16)
-               pr_debug("%d bytes for tty %p\n", len, tty);
-       if (tty) {
-               switch (dlci->adaption)  {
-               /* Unsupported types */
-               /* Packetised interruptible data */
-               case 4:
-                       break;
-               /* Packetised uininterruptible voice/data */
-               case 3:
-                       break;
-               /* Asynchronous serial with line state in each frame */
-               case 2:
-                       while (gsm_read_ea(&modem, *data++) == 0) {
-                               len--;
-                               if (len == 0)
-                                       return;
-                       }
+               pr_debug("%d bytes for tty\n", len);
+       switch (dlci->adaption)  {
+       /* Unsupported types */
+       /* Packetised interruptible data */
+       case 4:
+               break;
+       /* Packetised uininterruptible voice/data */
+       case 3:
+               break;
+       /* Asynchronous serial with line state in each frame */
+       case 2:
+               while (gsm_read_ea(&modem, *data++) == 0) {
+                       len--;
+                       if (len == 0)
+                               return;
+               }
+               tty = tty_port_tty_get(port);
+               if (tty) {
                        gsm_process_modem(tty, dlci, modem, clen);
-               /* Line state will go via DLCI 0 controls only */
-               case 1:
-               default:
-                       tty_insert_flip_string(port, data, len);
-                       tty_flip_buffer_push(tty);
+                       tty_kref_put(tty);
                }
-               tty_kref_put(tty);
+       /* Line state will go via DLCI 0 controls only */
+       case 1:
+       default:
+               tty_insert_flip_string(port, data, len);
+               tty_flip_buffer_push(port);
        }
 }
 
index 941fe8060ea56958f8f5cde75ef7f262a5473420..afdd7732d925e33bb929b72d3c22e36e6c64a4df 100644 (file)
@@ -1272,15 +1272,11 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id)
 
 exit_handler:
        spin_unlock(&dc->spin_mutex);
-       for (a = 0; a < NOZOMI_MAX_PORTS; a++) {
-               struct tty_struct *tty;
-               if (test_and_clear_bit(a, &dc->flip)) {
-                       tty = tty_port_tty_get(&dc->port[a].port);
-                       if (tty)
-                               tty_flip_buffer_push(tty);
-                       tty_kref_put(tty);
-               }
-       }
+
+       for (a = 0; a < NOZOMI_MAX_PORTS; a++)
+               if (test_and_clear_bit(a, &dc->flip))
+                       tty_flip_buffer_push(&dc->port[a].port);
+
        return IRQ_HANDLED;
 none:
        spin_unlock(&dc->spin_mutex);
index 3c285d398f385159f1c94b14a15fae177545cbc8..32d027c303aa04066d12c35d67e55f69b2805cdf 100644 (file)
@@ -123,7 +123,7 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
                c = tty_insert_flip_string(to->port, buf, c);
                /* And shovel */
                if (c) {
-                       tty_flip_buffer_push(to);
+                       tty_flip_buffer_push(to->port);
                        tty_wakeup(tty);
                }
        }
index 5848a767001aeaf48934af58f1c8491141f1dd9c..8073cc0dff59ce45b68c4a9e731919bd0b6322df 100644 (file)
@@ -315,9 +315,8 @@ static inline int rocket_paranoia_check(struct r_port *info,
  *  that receive data is present on a serial port.  Pulls data from FIFO, moves it into the 
  *  tty layer.  
  */
-static void rp_do_receive(struct r_port *info,
-                         struct tty_struct *tty,
-                         CHANNEL_t * cp, unsigned int ChanStatus)
+static void rp_do_receive(struct r_port *info, CHANNEL_t *cp,
+               unsigned int ChanStatus)
 {
        unsigned int CharNStat;
        int ToRecv, wRecv, space;
@@ -416,7 +415,7 @@ static void rp_do_receive(struct r_port *info,
                        cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp));
        }
        /*  Push the data up to the tty layer */
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&info->port);
 }
 
 /*
@@ -495,7 +494,6 @@ static void rp_do_transmit(struct r_port *info)
 static void rp_handle_port(struct r_port *info)
 {
        CHANNEL_t *cp;
-       struct tty_struct *tty;
        unsigned int IntMask, ChanStatus;
 
        if (!info)
@@ -506,12 +504,7 @@ static void rp_handle_port(struct r_port *info)
                                "info->flags & NOT_INIT\n");
                return;
        }
-       tty = tty_port_tty_get(&info->port);
-       if (!tty) {
-               printk(KERN_WARNING "rp: WARNING: rp_handle_port called with "
-                               "tty==NULL\n");
-               return;
-       }
+
        cp = &info->channel;
 
        IntMask = sGetChanIntID(cp) & info->intmask;
@@ -520,7 +513,7 @@ static void rp_handle_port(struct r_port *info)
 #endif
        ChanStatus = sGetChanStatus(cp);
        if (IntMask & RXF_TRIG) {       /* Rx FIFO trigger level */
-               rp_do_receive(info, tty, cp, ChanStatus);
+               rp_do_receive(info, cp, ChanStatus);
        }
        if (IntMask & DELTA_CD) {       /* CD change  */
 #if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || defined(ROCKET_DEBUG_HANGUP))
@@ -528,10 +521,15 @@ static void rp_handle_port(struct r_port *info)
                       (ChanStatus & CD_ACT) ? "on" : "off");
 #endif
                if (!(ChanStatus & CD_ACT) && info->cd_status) {
+                       struct tty_struct *tty;
 #ifdef ROCKET_DEBUG_HANGUP
                        printk(KERN_INFO "CD drop, calling hangup.\n");
 #endif
-                       tty_hangup(tty);
+                       tty = tty_port_tty_get(&info->port);
+                       if (tty) {
+                               tty_hangup(tty);
+                               tty_kref_put(tty);
+                       }
                }
                info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0;
                wake_up_interruptible(&info->port.open_wait);
@@ -544,7 +542,6 @@ static void rp_handle_port(struct r_port *info)
                printk(KERN_INFO "DSR change...\n");
        }
 #endif
-       tty_kref_put(tty);
 }
 
 /*
index a44345a2dbb47622e0f7370f77e61f17b7351ece..c7e8b60b61776bd1f2ea5da9d65e11cb83799a50 100644 (file)
@@ -85,7 +85,6 @@ static void serial21285_enable_ms(struct uart_port *port)
 static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
 {
        struct uart_port *port = dev_id;
-       struct tty_struct *tty = port->state->port.tty;
        unsigned int status, ch, flag, rxs, max_count = 256;
 
        status = *CSR_UARTFLG;
@@ -115,7 +114,7 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
 
                status = *CSR_UARTFLG;
        }
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->state->port);
 
        return IRQ_HANDLED;
 }
index 5fb6577b94dc9b30c8479766c28ae687d52f3ff8..0d771ec16750072537c7021a9c0117acf0fbfdcd 100644 (file)
@@ -1323,7 +1323,6 @@ unsigned char
 serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr)
 {
        struct uart_port *port = &up->port;
-       struct tty_struct *tty = port->state->port.tty;
        unsigned char ch;
        int max_count = 256;
        char flag;
@@ -1388,7 +1387,7 @@ ignore_char:
                lsr = serial_in(up, UART_LSR);
        } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0));
        spin_unlock(&port->lock);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->state->port);
        spin_lock(&port->lock);
        return lsr;
 }
index 872f14ae43d29f52aa79a79193c21a6f89b7adae..84b90fd48063fd9440f4dc63725e584b8e1d5460 100644 (file)
@@ -139,7 +139,7 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp)
                uart_insert_char(port, 0, 0, ch, flag);
        }
 
-       tty_flip_buffer_push(port->state->port.tty);
+       tty_flip_buffer_push(&port->state->port);
 }
 
 static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp)
index 684a0808e1c70f4e2ad05cee113d3b8109ab4c19..e133c8814bb5b36c68d1ee246c45c37cb2204293 100644 (file)
@@ -231,7 +231,7 @@ static void altera_uart_rx_chars(struct altera_uart *pp)
                                 flag);
        }
 
-       tty_flip_buffer_push(port->state->port.tty);
+       tty_flip_buffer_push(&port->state->port);
 }
 
 static void altera_uart_tx_chars(struct altera_uart *pp)
index 22317dd16474b05b04a5afe9200b455180a6b5af..c3684051952778b568cbe73177196d12a7ef7f38 100644 (file)
@@ -116,7 +116,6 @@ static void pl010_enable_ms(struct uart_port *port)
 
 static void pl010_rx_chars(struct uart_amba_port *uap)
 {
-       struct tty_struct *tty = uap->port.state->port.tty;
        unsigned int status, ch, flag, rsr, max_count = 256;
 
        status = readb(uap->port.membase + UART01x_FR);
@@ -165,7 +164,7 @@ static void pl010_rx_chars(struct uart_amba_port *uap)
                status = readb(uap->port.membase + UART01x_FR);
        }
        spin_unlock(&uap->port.lock);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&uap->port.state->port);
        spin_lock(&uap->port.lock);
 }
 
index e1257d17f5f01e4cbf973bfd0b7c92f03d4729d9..3ea5408fcbeb07e236f04ea11c961058e032cb3a 100644 (file)
@@ -699,7 +699,6 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap,
                               bool readfifo)
 {
        struct tty_port *port = &uap->port.state->port;
-       struct tty_struct *tty = port->tty;
        struct pl011_sgbuf *sgbuf = use_buf_b ?
                &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a;
        struct device *dev = uap->dmarx.chan->device->dev;
@@ -754,7 +753,7 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap,
        dev_vdbg(uap->port.dev,
                 "Took %d chars from DMA buffer and %d chars from the FIFO\n",
                 dma_count, fifotaken);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
        spin_lock(&uap->port.lock);
 }
 
@@ -1076,12 +1075,10 @@ static void pl011_enable_ms(struct uart_port *port)
 
 static void pl011_rx_chars(struct uart_amba_port *uap)
 {
-       struct tty_struct *tty = uap->port.state->port.tty;
-
        pl011_fifo_to_tty(uap);
 
        spin_unlock(&uap->port.lock);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&uap->port.state->port);
        /*
         * If we were temporarily out of DMA mode for a while,
         * attempt to switch back to DMA mode again.
index 59ae2b53e765bf4a3e070f65fcce6e43ea6bee32..6331464d9101156b66d8af7628bb5784806dfb93 100644 (file)
@@ -78,7 +78,6 @@ static void apbuart_enable_ms(struct uart_port *port)
 
 static void apbuart_rx_chars(struct uart_port *port)
 {
-       struct tty_struct *tty = port->state->port.tty;
        unsigned int status, ch, rsr, flag;
        unsigned int max_chars = port->fifosize;
 
@@ -126,7 +125,7 @@ static void apbuart_rx_chars(struct uart_port *port)
                status = UART_GET_STATUS(port);
        }
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->state->port);
 }
 
 static void apbuart_tx_chars(struct uart_port *port)
index 6ca5dd615f9e38b2f380d23fe6006d4deb3d3bb4..27f20c57abede4ec6874ec4f1de5654b6d618da9 100644 (file)
@@ -298,10 +298,8 @@ static void ar933x_uart_set_termios(struct uart_port *port,
 static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)
 {
        struct tty_port *port = &up->port.state->port;
-       struct tty_struct *tty;
        int max_count = 256;
 
-       tty = tty_port_tty_get(port);
        do {
                unsigned int rdata;
                unsigned char ch;
@@ -324,10 +322,7 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)
                        tty_insert_flip_char(port, ch, TTY_NORMAL);
        } while (max_count-- > 0);
 
-       if (tty) {
-               tty_flip_buffer_push(tty);
-               tty_kref_put(tty);
-       }
+       tty_flip_buffer_push(port);
 }
 
 static void ar933x_uart_tx_chars(struct ar933x_uart_port *up)
index b4686010431284846df5d443b9257b237b764862..da734222e53775832240b16168b9364171ee3889 100644 (file)
@@ -211,12 +211,8 @@ static void arc_serial_start_tx(struct uart_port *port)
 
 static void arc_serial_rx_chars(struct arc_uart_port *uart)
 {
-       struct tty_struct *tty = tty_port_tty_get(&uart->port.state->port);
        unsigned int status, ch, flg = 0;
 
-       if (!tty)
-               return;
-
        /*
         * UART has 4 deep RX-FIFO. Driver's recongnition of this fact
         * is very subtle. Here's how ...
@@ -252,10 +248,8 @@ static void arc_serial_rx_chars(struct arc_uart_port *uart)
                uart_insert_char(&uart->port, status, RXOERR, ch, flg);
 
 done:
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&uart->port.state->port);
        }
-
-       tty_kref_put(tty);
 }
 
 /*
index 929567038c5a27fd2d2707cb8e0f78475e98073e..d4a7c241b751279d3422f6d024b45cbb1a04a2de 100644 (file)
@@ -774,7 +774,7 @@ static void atmel_rx_from_ring(struct uart_port *port)
         * uart_start(), which takes the lock.
         */
        spin_unlock(&port->lock);
-       tty_flip_buffer_push(port->state->port.tty);
+       tty_flip_buffer_push(&port->state->port);
        spin_lock(&port->lock);
 }
 
@@ -782,7 +782,6 @@ static void atmel_rx_from_dma(struct uart_port *port)
 {
        struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        struct atmel_dma_buffer *pdc;
        int rx_idx = atmel_port->pdc_rx_idx;
        unsigned int head;
@@ -850,7 +849,7 @@ static void atmel_rx_from_dma(struct uart_port *port)
         * uart_start(), which takes the lock.
         */
        spin_unlock(&port->lock);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(tport);
        spin_lock(&port->lock);
 
        UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT);
index de30b190972811f737222a341cf3bacb78a71f67..719594e5fc219aafe5826730e1a4af659f7639b9 100644 (file)
@@ -236,14 +236,12 @@ static const char *bcm_uart_type(struct uart_port *port)
 static void bcm_uart_do_rx(struct uart_port *port)
 {
        struct tty_port *port = &port->state->port;
-       struct tty_struct *tty;
        unsigned int max_count;
 
        /* limit number of char read in interrupt, should not be
         * higher than fifo size anyway since we're much faster than
         * serial port */
        max_count = 32;
-       tty = port->tty;
        do {
                unsigned int iestat, c, cstat;
                char flag;
@@ -305,7 +303,7 @@ static void bcm_uart_do_rx(struct uart_port *port)
 
        } while (--max_count);
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
 }
 
 /*
index e4d3ac2e8992f952c57a142e7dd63c7fb723c508..487c173b0f72f107f1c671175908e47936f98186 100644 (file)
@@ -150,7 +150,6 @@ static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id)
 {
        struct sport_uart_port *up = dev_id;
        struct tty_port *port = &up->port.state->port;
-       struct tty_struct *tty = tport->tty;
        unsigned int ch;
 
        spin_lock(&up->port.lock);
@@ -162,7 +161,8 @@ static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id)
                if (!uart_handle_sysrq_char(&up->port, ch))
                        tty_insert_flip_char(port, ch, TTY_NORMAL);
        }
-       tty_flip_buffer_push(tty);
+       /* XXX this won't deadlock with lowlat? */
+       tty_flip_buffer_push(port);
 
        spin_unlock(&up->port.lock);
 
index 2e2b2c1cb72252d607dd747305cb354c68dd2cb7..12dceda9db3390d64a13022a639a973c9d653286 100644 (file)
@@ -223,7 +223,6 @@ static void bfin_serial_enable_ms(struct uart_port *port)
 #ifdef CONFIG_SERIAL_BFIN_PIO
 static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
 {
-       struct tty_struct *tty = NULL;
        unsigned int status, ch, flg;
        static struct timeval anomaly_start = { .tv_sec = 0 };
 
@@ -242,11 +241,9 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
                        return;
                }
 
-       if (!uart->port.state || !uart->port.state->port.tty)
+       if (!uart->port.state)
                return;
 #endif
-       tty = uart->port.state->port.tty;
-
        if (ANOMALY_05000363) {
                /* The BF533 (and BF561) family of processors have a nice anomaly
                 * where they continuously generate characters for a "single" break.
@@ -325,7 +322,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
        uart_insert_char(&uart->port, status, OE, ch, flg);
 
  ignore_char:
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&uart->port.state->port);
 }
 
 static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
@@ -426,7 +423,6 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
 
 static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
 {
-       struct tty_struct *tty = uart->port.state->port.tty;
        int i, flg, status;
 
        status = UART_GET_LSR(uart);
@@ -471,7 +467,7 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
        }
 
  dma_ignore_char:
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&uart->port.state->port);
 }
 
 void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
index 3fd2526d121eef6eb70c14dc7dbc4a003841e245..bfb17968c8dbbe86ad91902c94f02a824c0a81c3 100644 (file)
@@ -85,12 +85,8 @@ static void uart_clps711x_enable_ms(struct uart_port *port)
 static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id)
 {
        struct uart_port *port = dev_id;
-       struct tty_struct *tty = tty_port_tty_get(&port->state->port);
        unsigned int status, ch, flg;
 
-       if (!tty)
-               return IRQ_HANDLED;
-
        for (;;) {
                status = clps_readl(SYSFLG(port));
                if (status & SYSFLG_URXFE)
@@ -130,9 +126,7 @@ static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id)
                uart_insert_char(port, status, UARTDR_OVERR, ch, flg);
        }
 
-       tty_flip_buffer_push(tty);
-
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->state->port);
 
        return IRQ_HANDLED;
 }
index 0bb24378a3c07b2fc6301b244540ff97c066e0be..97f4e1858649f42d4bc126431927325962f5bae1 100644 (file)
@@ -246,7 +246,6 @@ static void cpm_uart_int_rx(struct uart_port *port)
        unsigned char ch;
        u8 *cp;
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
        cbd_t __iomem *bdp;
        u16 status;
@@ -323,7 +322,7 @@ static void cpm_uart_int_rx(struct uart_port *port)
        pinfo->rx_cur = bdp;
 
        /* activate BH processing */
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(tport);
 
        return;
 
index 52449adc09ac164089ed8f8dd9c1113a35d93dda..45acf103433e691f5feb2bac28c82f4d4c0aa826 100644 (file)
@@ -2104,17 +2104,10 @@ static int force_eop_if_needed(struct e100_serial *info)
 
 static void flush_to_flip_buffer(struct e100_serial *info)
 {
-       struct tty_struct *tty;
        struct etrax_recv_buffer *buffer;
        unsigned long flags;
 
        local_irq_save(flags);
-       tty = info->port.tty;
-
-       if (!tty) {
-               local_irq_restore(flags);
-               return;
-       }
 
        while ((buffer = info->first_recv_buffer) != NULL) {
                unsigned int count = buffer->length;
@@ -2138,7 +2131,7 @@ static void flush_to_flip_buffer(struct e100_serial *info)
        local_irq_restore(flags);
 
        /* This includes a check for low-latency */
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&info->port);
 }
 
 static void check_flush_timeout(struct e100_serial *info)
@@ -2274,12 +2267,6 @@ static
 struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info)
 {
        unsigned long data_read;
-       struct tty_struct *tty = info->port.tty;
-
-       if (!tty) {
-               printk("!NO TTY!\n");
-               return info;
-       }
 
        /* Read data and status at the same time */
        data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]);
@@ -2382,7 +2369,7 @@ more_data:
                goto more_data;
        }
 
-       tty_flip_buffer_push(info->port.tty);
+       tty_flip_buffer_push(&info->port);
        return info;
 }
 
index 6491b8644a7f2e84730082f37041207989764b71..2f2b2e538a542adcd111b8cf66573815f9d3b845 100644 (file)
@@ -187,7 +187,6 @@ static inline void dz_receive_chars(struct dz_mux *mux)
 {
        struct uart_port *uport;
        struct dz_port *dport = &mux->dport[0];
-       struct tty_struct *tty = NULL;
        struct uart_icount *icount;
        int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 };
        unsigned char ch, flag;
@@ -197,7 +196,6 @@ static inline void dz_receive_chars(struct dz_mux *mux)
        while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) {
                dport = &mux->dport[LINE(status)];
                uport = &dport->port;
-               tty = uport->state->port.tty;   /* point to the proper dev */
 
                ch = UCHAR(status);             /* grab the char */
                flag = TTY_NORMAL;
@@ -249,7 +247,7 @@ static inline void dz_receive_chars(struct dz_mux *mux)
        }
        for (i = 0; i < DZ_NB_PORT; i++)
                if (lines_rx[i])
-                       tty_flip_buffer_push(mux->dport[i].port.state->port.tty);
+                       tty_flip_buffer_push(&mux->dport[i].port.state->port);
 }
 
 /*
index bdf67b0cb8b667723a4fda2719fc38055dae84a9..de14bd7dce108309493a3e3d093591ebcc777503 100644 (file)
@@ -249,12 +249,9 @@ static irqreturn_t efm32_uart_rxirq(int irq, void *data)
        int handled = IRQ_NONE;
        struct uart_port *port = &efm_port->port;
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty;
 
        spin_lock(&port->lock);
 
-       tty = tty_kref_get(tport->tty);
-
        if (irqflag & UARTn_IF_RXDATAV) {
                efm32_uart_write32(efm_port, UARTn_IF_RXDATAV, UARTn_IFC);
                efm32_uart_rx_chars(efm_port);
@@ -270,10 +267,7 @@ static irqreturn_t efm32_uart_rxirq(int irq, void *data)
                handled = IRQ_HANDLED;
        }
 
-       if (tty) {
-               tty_flip_buffer_push(tty);
-               tty_kref_put(tty);
-       }
+       tty_flip_buffer_push(tport);
 
        spin_unlock(&port->lock);
 
index 54903ee5e5abecb5b45960a7fc45d5ccb3337e2e..bc9e6b017b05c24a99f61a13ed78f123c0ccf13d 100644 (file)
@@ -735,7 +735,6 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port)
 {
        short int count, rcv_buff;
        struct tty_port *port = &icom_port->uart_port.state->port;
-       struct tty_struct *tty = port->tty;
        unsigned short int status;
        struct uart_icount *icount;
        unsigned long offset;
@@ -835,7 +834,7 @@ ignore_char:
                status = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].flags);
        }
        icom_port->next_rcv = rcv_buff;
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
 }
 
 static void process_interrupt(u16 port_int_reg,
index 4bc6e47890b4c0f400a2d5e7715094413a5f7f0a..6a6668bbb3308549a97b659fa575f1ea5a68334e 100644 (file)
@@ -669,12 +669,8 @@ static const struct tty_operations ifx_spi_serial_ops = {
 static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev,
                                    unsigned char *chars, size_t size)
 {
-       struct tty_struct *tty = tty_port_tty_get(&ifx_dev->tty_port);
-       if (!tty)
-               return;
        tty_insert_flip_string(&ifx_dev->tty_port, chars, size);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&ifx_dev->tty_port);
 }
 
 /**
index f60c4028b6e1eb961a062cd2613a42c5e6ef6342..be26345bf6a4e0944b8dbb6212bf33856ed36bb0 100644 (file)
@@ -518,7 +518,6 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
        unsigned int rx, flg, ignored = 0;
        struct tty_struct *tty = sport->port.state->port.tty;
        struct tty_port *port = &sport->port.state->port;
-       struct tty_struct *tty = port->tty;
        unsigned long flags, temp;
 
        spin_lock_irqsave(&sport->port.lock, flags);
@@ -576,7 +575,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
 
 out:
        spin_unlock_irqrestore(&sport->port.lock, flags);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
        return IRQ_HANDLED;
 }
 
index edbdc4e45075f30e6f4b47f947a8827b0db90b6d..6e4c715c5d26e102200a8794980ff2391a8c5792 100644 (file)
@@ -1393,7 +1393,6 @@ static inline int do_read(struct uart_port *the_port, char *buf, int len)
  */
 static int receive_chars(struct uart_port *the_port)
 {
-       struct tty_struct *tty;
        unsigned char ch[MAX_CHARS];
        int read_count = 0, read_room, flip = 0;
        struct uart_state *state = the_port->state;
@@ -1403,14 +1402,11 @@ static int receive_chars(struct uart_port *the_port)
        /* Make sure all the pointers are "good" ones */
        if (!state)
                return 0;
-       if (!state->port.tty)
-               return 0;
 
        if (!(port->ip_flags & INPUT_ENABLE))
                return 0;
 
        spin_lock_irqsave(&the_port->lock, pflags);
-       tty = state->port.tty;
 
        read_count = do_read(the_port, ch, MAX_CHARS);
        if (read_count > 0) {
@@ -1422,7 +1418,7 @@ static int receive_chars(struct uart_port *the_port)
        spin_unlock_irqrestore(&the_port->lock, pflags);
 
        if (flip)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&state->port);
 
        return read_count;
 }
index 86f64ed89b459371fb67a28c922d70a03bf93aeb..e2520abcb1c49ace0225748691cc3071e6d66931 100644 (file)
@@ -2340,7 +2340,6 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf,
  */
 static void receive_chars(struct uart_port *the_port)
 {
-       struct tty_struct *tty;
        unsigned char ch[IOC4_MAX_CHARS];
        int read_count, request_count = IOC4_MAX_CHARS;
        struct uart_icount *icount;
@@ -2350,11 +2349,8 @@ static void receive_chars(struct uart_port *the_port)
        /* Make sure all the pointers are "good" ones */
        if (!state)
                return;
-       if (!state->port.tty)
-               return;
 
        spin_lock_irqsave(&the_port->lock, pflags);
-       tty = state->port.tty;
 
        request_count = tty_buffer_request_room(&state->port, IOC4_MAX_CHARS);
 
@@ -2369,7 +2365,7 @@ static void receive_chars(struct uart_port *the_port)
 
        spin_unlock_irqrestore(&the_port->lock, pflags);
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&state->port);
 }
 
 /**
index c9ce00dd1f8aed8607e297583afca85c5941099e..00f250ae14c55b49c990dd9c24eabc33353c4973 100644 (file)
@@ -654,7 +654,7 @@ void jsm_input(struct jsm_channel *ch)
        spin_unlock_irqrestore(&ch->ch_lock, lock_flags);
 
        /* Tell the tty layer its okay to "eat" the data now */
-       tty_flip_buffer_push(tp);
+       tty_flip_buffer_push(port);
 
        jsm_dbg(IOCTL, &ch->ch_bd->pci_dev, "finish\n");
 }
index ba2ef627d9c673bc5846c66061a75aa0f29dbec2..26a50b0c868b408fd89e001aaa3ff45b0629e524 100644 (file)
@@ -202,7 +202,6 @@ bool kgdb_nmi_poll_knock(void)
 static void kgdb_nmi_tty_receiver(unsigned long data)
 {
        struct kgdb_nmi_tty_priv *priv = (void *)data;
-       struct tty_struct *tty;
        char ch;
 
        tasklet_schedule(&priv->tlet);
@@ -210,16 +209,9 @@ static void kgdb_nmi_tty_receiver(unsigned long data)
        if (likely(!kgdb_nmi_tty_enabled || !kfifo_len(&priv->fifo)))
                return;
 
-       /* Port is there, but tty might be hung up, check. */
-       tty = tty_port_tty_get(kgdb_nmi_port);
-       if (!tty)
-               return;
-
        while (kfifo_out(&priv->fifo, &ch, 1))
                tty_insert_flip_char(&priv->port, ch, TTY_NORMAL);
-       tty_flip_buffer_push(priv->port.tty);
-
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&priv->port);
 }
 
 static int kgdb_nmi_tty_activate(struct tty_port *port, struct tty_struct *tty)
index 1933fe3c98dd7b1cfe163cc1def6634db653d4af..15733da757c66b22012845f81443b5bf13c96f05 100644 (file)
@@ -163,21 +163,15 @@ static int
 lqasc_rx_chars(struct uart_port *port)
 {
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tty_port_tty_get(tport);
        unsigned int ch = 0, rsr = 0, fifocnt;
 
-       if (!tty) {
-               dev_dbg(port->dev, "%s:tty is busy now", __func__);
-               return -EBUSY;
-       }
-       fifocnt =
-               ltq_r32(port->membase + LTQ_ASC_FSTAT) & ASCFSTAT_RXFFLMASK;
+       fifocnt = ltq_r32(port->membase + LTQ_ASC_FSTAT) & ASCFSTAT_RXFFLMASK;
        while (fifocnt--) {
                u8 flag = TTY_NORMAL;
                ch = ltq_r8(port->membase + LTQ_ASC_RBUF);
                rsr = (ltq_r32(port->membase + LTQ_ASC_STATE)
                        & ASCSTATE_ANY) | UART_DUMMY_UER_RX;
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(tport);
                port->icount.rx++;
 
                /*
@@ -219,9 +213,10 @@ lqasc_rx_chars(struct uart_port *port)
                         */
                        tty_insert_flip_char(tport, 0, TTY_OVERRUN);
        }
+
        if (ch != 0)
-               tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+               tty_flip_buffer_push(tport);
+
        return 0;
 }
 
index 5cd180564c033697e37f085be5e4047bcb672ab0..c8448e6f52e580b662d273fb56e8555b31f1e4bb 100644 (file)
@@ -259,16 +259,6 @@ static void __serial_lpc32xx_rx(struct uart_port *port)
 {
        struct tty_port *tport = &port->state->port;
        unsigned int tmp, flag;
-       struct tty_struct *tty = tty_port_tty_get(tport);
-
-       if (!tty) {
-               /* Discard data: no tty available */
-               while (!(readl(LPC32XX_HSUART_FIFO(port->membase)) &
-                        LPC32XX_HSU_RX_EMPTY))
-                       ;
-
-               return;
-       }
 
        /* Read data from FIFO and push into terminal */
        tmp = readl(LPC32XX_HSUART_FIFO(port->membase));
@@ -289,8 +279,7 @@ static void __serial_lpc32xx_rx(struct uart_port *port)
 
                tmp = readl(LPC32XX_HSUART_FIFO(port->membase));
        }
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(tport);
 }
 
 static void __serial_lpc32xx_tx(struct uart_port *port)
@@ -367,8 +356,7 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id)
        /* Data received? */
        if (status & (LPC32XX_HSU_RX_TIMEOUT_INT | LPC32XX_HSU_RX_TRIG_INT)) {
                __serial_lpc32xx_rx(port);
-               if (tty)
-                       tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(tport);
        }
 
        /* Transmit data request? */
index 2e9a390f2ac44364574b3deac7abb18e02d26767..bb1afa0922e1ac1a2fe7664240a2df2fc71b1b53 100644 (file)
@@ -301,7 +301,6 @@ static void m32r_sio_enable_ms(struct uart_port *port)
 static void receive_chars(struct uart_sio_port *up, int *status)
 {
        struct tty_port *port = &up->port.state->port;
-       struct tty_struct *tty = tport->tty;
        unsigned char ch;
        unsigned char flag;
        int max_count = 256;
@@ -369,7 +368,7 @@ static void receive_chars(struct uart_sio_port *up, int *status)
        ignore_char:
                *status = serial_in(up, UART_LSR);
        } while ((*status & UART_LSR_DR) && (max_count-- > 0));
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
 }
 
 static void transmit_chars(struct uart_sio_port *up)
index e238e80cd98143d1a6c988afaca525a7c478ccb3..791e1dfb8b110bb6482c245679d7c4dd3a13d682 100644 (file)
@@ -311,8 +311,8 @@ static void max3100_work(struct work_struct *w)
                        }
                }
 
-               if (rxchars > 16 && s->port.state->port.tty != NULL) {
-                       tty_flip_buffer_push(s->port.state->port.tty);
+               if (rxchars > 16) {
+                       tty_flip_buffer_push(&s->port.state->port);
                        rxchars = 0;
                }
                if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
@@ -324,8 +324,8 @@ static void max3100_work(struct work_struct *w)
                  (!uart_circ_empty(xmit) &&
                   !uart_tx_stopped(&s->port))));
 
-       if (rxchars > 0 && s->port.state->port.tty != NULL)
-               tty_flip_buffer_push(s->port.state->port.tty);
+       if (rxchars > 0)
+               tty_flip_buffer_push(&s->port.state->port);
 }
 
 static irqreturn_t max3100_irq(int irqno, void *dev_id)
index a801f6872cad41764470c38eb51b52be94945f1d..0c2422cb04ea780bec20b0ed04cc2362df42c3cd 100644 (file)
@@ -460,10 +460,6 @@ static int max310x_set_ref_clk(struct max310x_port *s)
 static void max310x_handle_rx(struct max310x_port *s, unsigned int rxlen)
 {
        unsigned int sts = 0, ch = 0, flag;
-       struct tty_struct *tty = tty_port_tty_get(&s->port.state->port);
-
-       if (!tty)
-               return;
 
        if (unlikely(rxlen >= MAX310X_FIFO_SIZE)) {
                dev_warn(s->port.dev, "Possible RX FIFO overrun %d\n", rxlen);
@@ -516,9 +512,7 @@ static void max310x_handle_rx(struct max310x_port *s, unsigned int rxlen)
                                 ch, flag);
        }
 
-       tty_flip_buffer_push(tty);
-
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&s->port.state->port);
 }
 
 static void max310x_handle_tx(struct max310x_port *s)
index fcd56ab6053fb8031638b505f001052b28edbca6..7ed99274572f39b0427b904d1ae5423e75a7c3d2 100644 (file)
@@ -310,7 +310,7 @@ static void mcf_rx_chars(struct mcf_uart *pp)
                uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag);
        }
 
-       tty_flip_buffer_push(port->state->port.tty);
+       tty_flip_buffer_push(&port->state->port);
 }
 
 /****************************************************************************/
index 60d585ab4870300210b6837507895edd08682b12..5f4765a7a5c54d6d3b845c9e9f7df402978afbff 100644 (file)
@@ -388,12 +388,8 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
        struct hsu_dma_chan *chan = up->rxc;
        struct uart_port *port = &up->port;
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        int count;
 
-       if (!tty)
-               return;
-
        /*
         * First need to know how many is already transferred,
         * then check if its a timeout DMA irq, and return
@@ -438,7 +434,7 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
                                         | (0x1 << 16)
                                         | (0x1 << 24)  /* timeout bit, see HSU Errata 1 */
                                         );
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(tport);
 
        chan_writel(chan, HSU_CH_CR, 0x3);
 
@@ -461,13 +457,9 @@ static void serial_hsu_stop_rx(struct uart_port *port)
 
 static inline void receive_chars(struct uart_hsu_port *up, int *status)
 {
-       struct tty_struct *tty = up->port.state->port.tty;
        unsigned int ch, flag;
        unsigned int max_count = 256;
 
-       if (!tty)
-               return;
-
        do {
                ch = serial_in(up, UART_RX);
                flag = TTY_NORMAL;
@@ -523,7 +515,7 @@ static inline void receive_chars(struct uart_hsu_port *up, int *status)
        ignore_char:
                *status = serial_in(up, UART_LSR);
        } while ((*status & UART_LSR_DR) && max_count--);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&up->port.state->port);
 }
 
 static void transmit_chars(struct uart_hsu_port *up)
index 0145aeb7721cb79f58139314407edb77ae73e528..c0e1fad51be76f5969b71b561983cf6b6bba9b92 100644 (file)
@@ -942,7 +942,6 @@ static inline int
 mpc52xx_uart_int_rx_chars(struct uart_port *port)
 {
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        unsigned char ch, flag;
        unsigned short status;
 
@@ -1000,7 +999,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
        }
 
        spin_unlock(&port->lock);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(tport);
        spin_lock(&port->lock);
 
        return psc_ops->raw_rx_rdy(port);
index 6f2d2ceb326a45aa2076514a7d057c542d806b6e..bc24f4931670d1e70d9bda922a2d3d0341636e0f 100644 (file)
@@ -938,7 +938,6 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi)
 {
        struct mpsc_rx_desc *rxre;
        struct tty_port *port = &pi->port.state->port;
-       struct tty_struct *tty = port->tty;
        u32     cmdstat, bytes_in, i;
        int     rc = 0;
        u8      *bp;
@@ -971,7 +970,7 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi)
                /* Following use of tty struct directly is deprecated */
                if (tty_buffer_request_room(port, bytes_in) < bytes_in) {
                        if (port->low_latency)
-                               tty_flip_buffer_push(tty);
+                               tty_flip_buffer_push(port);
                        /*
                         * If this failed then we will throw away the bytes
                         * but must do so to clear interrupts.
@@ -1081,7 +1080,7 @@ next_frame:
        if ((readl(pi->sdma_base + SDMA_SDCM) & SDMA_SDCM_ERD) == 0)
                mpsc_start_rx(pi);
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
        return rc;
 }
 
index 4632db7a24b73b5a42ca0441aa2bdd48d57b5104..f641c232beca99137cff5739ccb4b008ea881574 100644 (file)
@@ -340,7 +340,6 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
 {
        struct uart_port *port = &max->port;
        struct tty_port *tport;
-       struct tty_struct *tty;
        char buf[M3110_RX_FIFO_DEPTH];
        int r, w, usable;
 
@@ -349,9 +348,6 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
                return 0;
 
        tport = &port->state->port;
-       tty = tty_port_tty_get(tport);
-       if (!tty)
-               return 0;
 
        for (r = 0, w = 0; r < len; r++) {
                if (str[r] & MAX3110_BREAK &&
@@ -366,10 +362,8 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
                }
        }
 
-       if (!w) {
-               tty_kref_put(tty);
+       if (!w)
                return 0;
-       }
 
        for (r = 0; w; r += usable, w -= usable) {
                usable = tty_buffer_request_room(tport, w);
@@ -378,8 +372,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
                        port->icount.rx += usable;
                }
        }
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(tport);
 
        return r;
 }
index cb787c0e279aaf0fcab12c55fae23c5374841009..b11e99797fd8016815feb7d9999b0f35df62eb3b 100644 (file)
@@ -92,7 +92,6 @@ static void msm_enable_ms(struct uart_port *port)
 static void handle_rx_dm(struct uart_port *port, unsigned int misr)
 {
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        unsigned int sr;
        int count = 0;
        struct msm_port *msm_port = UART_TO_MSM(port);
@@ -138,7 +137,7 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr)
                count -= 4;
        }
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(tport);
        if (misr & (UART_IMR_RXSTALE))
                msm_write(port, UART_CR_CMD_RESET_STALE_INT, UART_CR);
        msm_write(port, 0xFFFFFF, UARTDM_DMRX);
@@ -148,7 +147,6 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr)
 static void handle_rx(struct uart_port *port)
 {
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        unsigned int sr;
 
        /*
@@ -191,7 +189,7 @@ static void handle_rx(struct uart_port *port)
                        tty_insert_flip_char(tport, c, flag);
        }
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(tport);
 }
 
 static void reset_dm_count(struct uart_port *port)
index c356ffff3c711a9f53cca21983840e1f621c13f3..4a942c78347e43e930bec1f1ee67c6854432180b 100644 (file)
@@ -981,9 +981,8 @@ static void msm_hs_tty_flip_buffer_work(struct work_struct *work)
 {
        struct msm_hs_port *msm_uport =
                        container_of(work, struct msm_hs_port, rx.tty_work);
-       struct tty_struct *tty = msm_uport->uport.state->port.tty;
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&msm_uport->uport.state->port);
 }
 
 /*
index b43b4ec3926907010b01e03b40e49897fb5e26b0..e722ff163d91ec420b3a5a82028a6d568169c550 100644 (file)
@@ -80,7 +80,7 @@ static void smd_tty_notify(void *priv, unsigned event)
                        pr_err("OOPS - smd_tty_buffer mismatch?!");
                }
 
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&info->port);
        }
 
        /* XXX only when writable and necessary */
index 83b21686020eda6e8279673b1960c5cc04a74752..7fd6aaaacd8e530ee5355110ecdc48e1ab5d51d8 100644 (file)
@@ -244,7 +244,6 @@ static void mux_read(struct uart_port *port)
 {
        struct tty_port *tport = &port->state->port;
        int data;
-       struct tty_struct *tty = tport->tty;
        __u32 start_count = port->icount.rx;
 
        while(1) {
@@ -270,9 +269,8 @@ static void mux_read(struct uart_port *port)
                tty_insert_flip_char(tport, data & 0xFF, TTY_NORMAL);
        }
        
-       if (start_count != port->icount.rx) {
-               tty_flip_buffer_push(tty);
-       }
+       if (start_count != port->icount.rx)
+               tty_flip_buffer_push(tport);
 }
 
 /**
index 37a0046ef5317bfb2e0f3ebcdbb218659a305e77..df0ba32f88adb964d0e89e5fa7d4aad566accd04 100644 (file)
@@ -364,7 +364,6 @@ out:
 
 static void mxs_auart_rx_chars(struct mxs_auart_port *s)
 {
-       struct tty_struct *tty = s->port.state->port.tty;
        u32 stat = 0;
 
        for (;;) {
@@ -375,7 +374,7 @@ static void mxs_auart_rx_chars(struct mxs_auart_port *s)
        }
 
        writel(stat, s->port.membase + AUART_STAT);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&s->port.state->port);
 }
 
 static int mxs_auart_request_port(struct uart_port *u)
@@ -458,7 +457,6 @@ static void dma_rx_callback(void *arg)
 {
        struct mxs_auart_port *s = (struct mxs_auart_port *) arg;
        struct tty_port *port = &s->port.state->port;
-       struct tty_struct *tty = port->tty;
        int count;
        u32 stat;
 
@@ -472,7 +470,7 @@ static void dma_rx_callback(void *arg)
        tty_insert_flip_string(port, s->rx_dma_buf, count);
 
        writel(stat, s->port.membase + AUART_STAT);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
 
        /* start the next DMA for RX. */
        mxs_auart_dma_prep_rx(s);
index d40da78e7c8513fb7fc8f1064ffda22e5827280e..b9a40ed70be2de379ce98087025447c5652b5ec5 100644 (file)
@@ -199,7 +199,6 @@ static void netx_txint(struct uart_port *port)
 static void netx_rxint(struct uart_port *port)
 {
        unsigned char rx, flg, status;
-       struct tty_struct *tty = port->state->port.tty;
 
        while (!(readl(port->membase + UART_FR) & FR_RXFE)) {
                rx = readl(port->membase + UART_DR);
@@ -237,8 +236,7 @@ static void netx_rxint(struct uart_port *port)
                uart_insert_char(port, status, SR_OE, rx, flg);
        }
 
-       tty_flip_buffer_push(tty);
-       return;
+       tty_flip_buffer_push(&port->state->port);
 }
 
 static irqreturn_t netx_int(int irq, void *dev_id)
index 10d64a3697fba78827f23ddb83a0b5de933c7868..77287c54f331682425403e045b0548c7f460590c 100644 (file)
@@ -129,7 +129,6 @@ static irqreturn_t nwpserial_interrupt(int irq, void *dev_id)
 {
        struct nwpserial_port *up = dev_id;
        struct tty_port *port = &up->port.state->port;
-       struct tty_struct *tty = port->tty;
        irqreturn_t ret;
        unsigned int iir;
        unsigned char ch;
@@ -150,7 +149,7 @@ static irqreturn_t nwpserial_interrupt(int irq, void *dev_id)
                        tty_insert_flip_char(port, ch, TTY_NORMAL);
        } while (dcr_read(up->dcr_host, UART_LSR) & UART_LSR_DR);
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(port);
        ret = IRQ_HANDLED;
 
        /* clear interrupt */
index ec90651d661aab90a0a0ec96a214896fb4c99ae5..6f3dbf740f05fe22fdcac3074cc23087ccdf71ad 100644 (file)
@@ -483,7 +483,6 @@ static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
 static irqreturn_t serial_omap_irq(int irq, void *dev_id)
 {
        struct uart_omap_port *up = dev_id;
-       struct tty_struct *tty = up->port.state->port.tty;
        unsigned int iir, lsr;
        unsigned int type;
        irqreturn_t ret = IRQ_NONE;
@@ -530,7 +529,7 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
 
        spin_unlock(&up->port.lock);
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&up->port.state->port);
 
        pm_runtime_mark_last_busy(up->dev);
        pm_runtime_put_autosuspend(up->dev);
index 967f1cb311f3336d5bde34a9425dff99d5996588..8b40a1fc9681410dc89371e703d45906f0236d1e 100644 (file)
@@ -593,17 +593,9 @@ static int push_rx(struct eg20t_port *priv, const unsigned char *buf,
 {
        struct uart_port *port = &priv->port;
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty;
-
-       tty = tty_port_tty_get(tport);
-       if (!tty) {
-               dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
-               return -EBUSY;
-       }
 
        tty_insert_flip_string(tport, buf, size);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(tport);
 
        return 0;
 }
@@ -744,19 +736,12 @@ static void pch_dma_rx_complete(void *arg)
 {
        struct eg20t_port *priv = arg;
        struct uart_port *port = &priv->port;
-       struct tty_struct *tty = tty_port_tty_get(&port->state->port);
        int count;
 
-       if (!tty) {
-               dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
-               return;
-       }
-
        dma_sync_sg_for_cpu(port->dev, &priv->sg_rx, 1, DMA_FROM_DEVICE);
        count = dma_push_rx(priv, priv->trigger_level);
        if (count)
-               tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+               tty_flip_buffer_push(&port->state->port);
        async_tx_ack(priv->desc_rx);
        pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT |
                                            PCH_UART_HAL_RX_ERR_INT);
index 73a3f295e7c41a155e64b8bab6b6373af8d53cf4..b1785f58b6e37e8e70f7242a38f40ae1b71f6b84 100644 (file)
@@ -227,21 +227,19 @@ static void pmz_interrupt_control(struct uart_pmac_port *uap, int enable)
        write_zsreg(uap, R1, uap->curregs[1]);
 }
 
-static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)
+static bool pmz_receive_chars(struct uart_pmac_port *uap)
 {
        struct tty_port *port;
-       struct tty_struct *tty = NULL;
        unsigned char ch, r1, drop, error, flag;
        int loops = 0;
 
        /* Sanity check, make sure the old bug is no longer happening */
-       if (uap->port.state == NULL || uap->port.state->port.tty == NULL) {
+       if (uap->port.state == NULL) {
                WARN_ON(1);
                (void)read_zsdata(uap);
-               return NULL;
+               return false;
        }
        port = &uap->port.state->port;
-       tty = port->tty; /* TOCTOU above */
 
        while (1) {
                error = 0;
@@ -330,11 +328,11 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)
                        break;
        }
 
-       return tty;
+       return true;
  flood:
        pmz_interrupt_control(uap, 0);
        pmz_error("pmz: rx irq flood !\n");
-       return tty;
+       return true;
 }
 
 static void pmz_status_handle(struct uart_pmac_port *uap)
@@ -455,7 +453,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)
        struct uart_pmac_port *uap_a;
        struct uart_pmac_port *uap_b;
        int rc = IRQ_NONE;
-       struct tty_struct *tty;
+       bool push;
        u8 r3;
 
        uap_a = pmz_get_port_A(uap);
@@ -468,7 +466,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)
        pmz_debug("irq, r3: %x\n", r3);
 #endif
        /* Channel A */
-       tty = NULL;
+       push = false;
        if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
                if (!ZS_IS_OPEN(uap_a)) {
                        pmz_debug("ChanA interrupt while not open !\n");
@@ -479,21 +477,21 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)
                if (r3 & CHAEXT)
                        pmz_status_handle(uap_a);
                if (r3 & CHARxIP)
-                       tty = pmz_receive_chars(uap_a);
+                       push = pmz_receive_chars(uap_a);
                if (r3 & CHATxIP)
                        pmz_transmit_chars(uap_a);
                rc = IRQ_HANDLED;
        }
  skip_a:
        spin_unlock(&uap_a->port.lock);
-       if (tty != NULL)
-               tty_flip_buffer_push(tty);
+       if (push)
+               tty_flip_buffer_push(&uap->port.state->port);
 
        if (!uap_b)
                goto out;
 
        spin_lock(&uap_b->port.lock);
-       tty = NULL;
+       push = false;
        if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
                if (!ZS_IS_OPEN(uap_b)) {
                        pmz_debug("ChanB interrupt while not open !\n");
@@ -504,15 +502,15 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id)
                if (r3 & CHBEXT)
                        pmz_status_handle(uap_b);
                if (r3 & CHBRxIP)
-                       tty = pmz_receive_chars(uap_b);
+                       push = pmz_receive_chars(uap_b);
                if (r3 & CHBTxIP)
                        pmz_transmit_chars(uap_b);
                rc = IRQ_HANDLED;
        }
  skip_b:
        spin_unlock(&uap_b->port.lock);
-       if (tty != NULL)
-               tty_flip_buffer_push(tty);
+       if (push)
+               tty_flip_buffer_push(&uap->port.state->port);
 
  out:
        return rc;
index 0aa75a97531c77622e2aff05988e3a04fe242d69..7e277a5384a7679d22a64dd92234d3b5c9e17c43 100644 (file)
@@ -181,7 +181,6 @@ static void pnx8xxx_enable_ms(struct uart_port *port)
 
 static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
 {
-       struct tty_struct *tty = sport->port.state->port.tty;
        unsigned int status, ch, flg;
 
        status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
@@ -238,7 +237,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
                status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
                         ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
        }
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&sport->port.state->port);
 }
 
 static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport)
index 2764828251f5bec273fd9f56cd6cf5764f4cb12a..3b671bc3f96626a43924d25feb96eacde6819d1a 100644 (file)
@@ -98,7 +98,6 @@ static void serial_pxa_stop_rx(struct uart_port *port)
 
 static inline void receive_chars(struct uart_pxa_port *up, int *status)
 {
-       struct tty_struct *tty = up->port.state->port.tty;
        unsigned int ch, flag;
        int max_count = 256;
 
@@ -168,7 +167,7 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status)
        ignore_char:
                *status = serial_in(up, UART_LSR);
        } while ((*status & UART_LSR_DR) && (max_count-- > 0));
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&up->port.state->port);
 
        /* work around Errata #20 according to
         * Intel(R) PXA27x Processor Family
index 5d4b9b449b4a9cd0e3b5a7f348ab4dadcb1a094e..af6b3e3ad24d18cc48c00736570c8c758403adad 100644 (file)
@@ -188,7 +188,6 @@ static void sa1100_enable_ms(struct uart_port *port)
 static void
 sa1100_rx_chars(struct sa1100_port *sport)
 {
-       struct tty_struct *tty = sport->port.state->port.tty;
        unsigned int status, ch, flg;
 
        status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
@@ -233,7 +232,7 @@ sa1100_rx_chars(struct sa1100_port *sport)
                status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
                         UTSR0_TO_SM(UART_GET_UTSR0(sport));
        }
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&sport->port.state->port);
 }
 
 static void sa1100_tx_chars(struct sa1100_port *sport)
index 0684529eb2ad28736dd4f32a5e9d7c13b28cc8ce..3aa3c4c83f8bffda27602c3dfc498272d635ad78 100644 (file)
@@ -220,7 +220,6 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
 {
        struct s3c24xx_uart_port *ourport = dev_id;
        struct uart_port *port = &ourport->port;
-       struct tty_struct *tty = port->state->port.tty;
        unsigned int ufcon, ch, flag, ufstat, uerstat;
        unsigned long flags;
        int max_count = 64;
@@ -298,7 +297,7 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id)
  ignore_char:
                continue;
        }
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->state->port);
 
  out:
        spin_unlock_irqrestore(&port->lock, flags);
index f76b1688c5c864fc1a7d8f2619f04a1d0566acab..a7cdec2962dd8cb117a028a39b644e378129aec3 100644 (file)
@@ -384,7 +384,7 @@ static void sbd_receive_chars(struct sbd_port *sport)
                uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag);
        }
 
-       tty_flip_buffer_push(uport->state->port.tty);
+       tty_flip_buffer_push(&uport->state->port);
 }
 
 static void sbd_transmit_chars(struct sbd_port *sport)
index 0cd0e4ac12a658d5f60ecdcdd86c3c75c35ac89d..c9735680762d87fc3362dd62e1eab528e1bcb027 100644 (file)
@@ -136,20 +136,17 @@ static void sc26xx_disable_irq(struct uart_port *port, int mask)
        WRITE_SC(port, IMR, up->imr);
 }
 
-static struct tty_struct *receive_chars(struct uart_port *port)
+static bool receive_chars(struct uart_port *port)
 {
        struct tty_port *tport = NULL;
-       struct tty_struct *tty = NULL;
        int limit = 10000;
        unsigned char ch;
        char flag;
        u8 status;
 
        /* FIXME what is this trying to achieve? */
-       if (port->state != NULL) {              /* Unopened serial console */
+       if (port->state != NULL)                /* Unopened serial console */
                tport = &port->state->port;
-               tty = tport->tty;
-       }
 
        while (limit-- > 0) {
                status = READ_SC_PORT(port, SR);
@@ -191,7 +188,7 @@ static struct tty_struct *receive_chars(struct uart_port *port)
 
                tty_insert_flip_char(tport, ch, flag);
        }
-       return tty;
+       return !!tport;
 }
 
 static void transmit_chars(struct uart_port *port)
@@ -221,36 +218,36 @@ static void transmit_chars(struct uart_port *port)
 static irqreturn_t sc26xx_interrupt(int irq, void *dev_id)
 {
        struct uart_sc26xx_port *up = dev_id;
-       struct tty_struct *tty;
        unsigned long flags;
+       bool push;
        u8 isr;
 
        spin_lock_irqsave(&up->port[0].lock, flags);
 
-       tty = NULL;
+       push = false;
        isr = READ_SC(&up->port[0], ISR);
        if (isr & ISR_TXRDYA)
            transmit_chars(&up->port[0]);
        if (isr & ISR_RXRDYA)
-           tty = receive_chars(&up->port[0]);
+           push = receive_chars(&up->port[0]);
 
        spin_unlock(&up->port[0].lock);
 
-       if (tty)
-               tty_flip_buffer_push(tty);
+       if (push)
+               tty_flip_buffer_push(&up->port[0].state->port);
 
        spin_lock(&up->port[1].lock);
 
-       tty = NULL;
+       push = false;
        if (isr & ISR_TXRDYB)
            transmit_chars(&up->port[1]);
        if (isr & ISR_RXRDYB)
-           tty = receive_chars(&up->port[1]);
+           push = receive_chars(&up->port[1]);
 
        spin_unlock_irqrestore(&up->port[1].lock, flags);
 
-       if (tty)
-               tty_flip_buffer_push(tty);
+       if (push)
+               tty_flip_buffer_push(&up->port[1].state->port);
 
        return IRQ_HANDLED;
 }
index 418b495e3233dc6c2dd7fb15a75af33d9568d9b5..2ced871becff95c9f0f61caea3d6e64a0b923c82 100644 (file)
@@ -285,10 +285,6 @@ static void sccnxp_handle_rx(struct uart_port *port)
 {
        u8 sr;
        unsigned int ch, flag;
-       struct tty_struct *tty = tty_port_tty_get(&port->state->port);
-
-       if (!tty)
-               return;
 
        for (;;) {
                sr = sccnxp_port_read(port, SCCNXP_SR_REG);
@@ -333,9 +329,7 @@ static void sccnxp_handle_rx(struct uart_port *port)
                uart_insert_char(port, sr, SR_OVR, ch, flag);
        }
 
-       tty_flip_buffer_push(tty);
-
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->state->port);
 }
 
 static void sccnxp_handle_tx(struct uart_port *port)
index 9bd004f9da89aaea87d7bb54bdb9f7d37900f9da..e1caa99e3d3b50b20b8d4349577367f01f18ca38 100644 (file)
@@ -153,7 +153,6 @@ static void ks8695uart_disable_ms(struct uart_port *port)
 static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id)
 {
        struct uart_port *port = dev_id;
-       struct tty_struct *tty = port->state->port.tty;
        unsigned int status, ch, lsr, flg, max_count = 256;
 
        status = UART_GET_LSR(port);            /* clears pending LSR interrupts */
@@ -200,7 +199,7 @@ static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id)
 ignore_char:
                status = UART_GET_LSR(port);
        }
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->state->port);
 
        return IRQ_HANDLED;
 }
index b52b21aeb250ac319902c86dcf2a8ed015b337e6..fe48a0c2b4cab88c4b1bdb4d3ef09aa93dd0d4b2 100644 (file)
@@ -277,7 +277,6 @@ static void serial_txx9_initialize(struct uart_port *port)
 static inline void
 receive_chars(struct uart_txx9_port *up, unsigned int *status)
 {
-       struct tty_struct *tty = up->port.state->port.tty;
        unsigned char ch;
        unsigned int disr = *status;
        int max_count = 256;
@@ -346,7 +345,7 @@ receive_chars(struct uart_txx9_port *up, unsigned int *status)
                disr = sio_in(up, TXX9_SIDISR);
        } while (!(disr & TXX9_SIDISR_UVALID) && (max_count-- > 0));
        spin_unlock(&up->port.lock);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&up->port.state->port);
        spin_lock(&up->port.lock);
        *status = disr;
 }
index ecef748f5385c6c612a78c4f1668bf29c9b1722c..15641861994920b4c68c184ce57844e93b11bb8e 100644 (file)
@@ -597,7 +597,6 @@ static void sci_receive_chars(struct uart_port *port)
 {
        struct sci_port *sci_port = to_sci_port(port);
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        int i, count, copied = 0;
        unsigned short status;
        unsigned char flag;
@@ -675,7 +674,7 @@ static void sci_receive_chars(struct uart_port *port)
 
        if (copied) {
                /* Tell the rest of the system the news. New characters! */
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(tport);
        } else {
                serial_port_in(port, SCxSR); /* dummy read */
                serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
@@ -722,7 +721,6 @@ static int sci_handle_errors(struct uart_port *port)
        int copied = 0;
        unsigned short status = serial_port_in(port, SCxSR);
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        struct sci_port *s = to_sci_port(port);
 
        /*
@@ -783,7 +781,7 @@ static int sci_handle_errors(struct uart_port *port)
        }
 
        if (copied)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(tport);
 
        return copied;
 }
@@ -791,7 +789,6 @@ static int sci_handle_errors(struct uart_port *port)
 static int sci_handle_fifo_overrun(struct uart_port *port)
 {
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        struct sci_port *s = to_sci_port(port);
        struct plat_sci_reg *reg;
        int copied = 0;
@@ -806,7 +803,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
                port->icount.overrun++;
 
                tty_insert_flip_char(tport, 0, TTY_OVERRUN);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(tport);
 
                dev_notice(port->dev, "overrun error\n");
                copied++;
@@ -820,7 +817,6 @@ static int sci_handle_breaks(struct uart_port *port)
        int copied = 0;
        unsigned short status = serial_port_in(port, SCxSR);
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        struct sci_port *s = to_sci_port(port);
 
        if (uart_handle_break(port))
@@ -842,7 +838,7 @@ static int sci_handle_breaks(struct uart_port *port)
        }
 
        if (copied)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(tport);
 
        copied += sci_handle_fifo_overrun(port);
 
@@ -1299,7 +1295,6 @@ static void sci_dma_rx_complete(void *arg)
 {
        struct sci_port *s = arg;
        struct uart_port *port = &s->port;
-       struct tty_struct *tty = port->state->port.tty;
        unsigned long flags;
        int count;
 
@@ -1314,7 +1309,7 @@ static void sci_dma_rx_complete(void *arg)
        spin_unlock_irqrestore(&port->lock, flags);
 
        if (count)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->state->port);
 
        schedule_work(&s->work_rx);
 }
@@ -1408,7 +1403,6 @@ static void work_fn_rx(struct work_struct *work)
        if (dma_async_is_tx_complete(s->chan_rx, s->active_rx, NULL, NULL) !=
            DMA_SUCCESS) {
                /* Handle incomplete DMA receive */
-               struct tty_struct *tty = port->state->port.tty;
                struct dma_chan *chan = s->chan_rx;
                struct shdma_desc *sh_desc = container_of(desc,
                                        struct shdma_desc, async_tx);
@@ -1424,7 +1418,7 @@ static void work_fn_rx(struct work_struct *work)
                spin_unlock_irqrestore(&port->lock, flags);
 
                if (count)
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(&port->state->port);
 
                sci_submit_rx(s);
 
index 142217cd01f47850e93f974f13b2383f7f80e5af..8f3d6c091accb32266c94573da0d0d8096efa47c 100644 (file)
@@ -206,11 +206,6 @@ static unsigned int
 sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count)
 {
        unsigned int ch, rx_count = 0;
-       struct tty_struct *tty;
-
-       tty = tty_port_tty_get(&port->state->port);
-       if (!tty)
-               return -ENODEV;
 
        while (!(rd_regl(port, SIRFUART_RX_FIFO_STATUS) &
                                        SIRFUART_FIFOEMPTY_MASK(port))) {
@@ -224,8 +219,7 @@ sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count)
        }
 
        port->icount.rx += rx_count;
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->state->port);
 
        return rx_count;
 }
index 283232c64656f7ac7320bf9af5763b5d86400f05..f51ffdc696fd4f753aff688e5e8d0fb8e0e07779 100644 (file)
@@ -459,7 +459,6 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags)
 {
        struct tty_port *tport = NULL;
        int ch;
-       struct tty_struct *tty;
 
        if (!port) {
                printk(KERN_ERR "sn_receive_chars - port NULL so can't receive\n");
@@ -474,11 +473,6 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags)
        if (port->sc_port.state) {
                /* The serial_core stuffs are initialized, use them */
                tport = &port->sc_port.state->port;
-               tty = tport->tty;
-       }
-       else {
-               /* Not registered yet - can't pass to tty layer.  */
-               tty = NULL;
        }
 
        while (port->sc_ops->sal_input_pending()) {
@@ -518,15 +512,15 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags)
 #endif /* CONFIG_MAGIC_SYSRQ */
 
                /* record the character to pass up to the tty layer */
-               if (tty) {
+               if (tport) {
                        if (tty_insert_flip_char(tport, ch, TTY_NORMAL) == 0)
                                break;
                }
                port->sc_port.icount.rx++;
        }
 
-       if (tty)
-               tty_flip_buffer_push(tty);
+       if (tport)
+               tty_flip_buffer_push(tport);
 }
 
 /**
index defe92b19e16797c36a9864ca05e9c1ae2d09c18..ba60708053e0f740920d89b6fe76dd68666d8bd1 100644 (file)
@@ -181,17 +181,17 @@ static struct sunhv_ops bywrite_ops = {
 
 static struct sunhv_ops *sunhv_ops = &bychar_ops;
 
-static struct tty_struct *receive_chars(struct uart_port *port)
+static struct tty_port *receive_chars(struct uart_port *port)
 {
-       struct tty_struct *tty = NULL;
+       struct tty_port *tport = NULL;
 
        if (port->state != NULL)                /* Unopened serial console */
-               tty = port->state->port.tty;
+               tport = &port->state->port;
 
        if (sunhv_ops->receive_chars(port))
                sun_do_break();
 
-       return tty;
+       return tport;
 }
 
 static void transmit_chars(struct uart_port *port)
@@ -214,16 +214,16 @@ static void transmit_chars(struct uart_port *port)
 static irqreturn_t sunhv_interrupt(int irq, void *dev_id)
 {
        struct uart_port *port = dev_id;
-       struct tty_struct *tty;
+       struct tty_port *tport;
        unsigned long flags;
 
        spin_lock_irqsave(&port->lock, flags);
-       tty = receive_chars(port);
+       tport = receive_chars(port);
        transmit_chars(port);
        spin_unlock_irqrestore(&port->lock, flags);
 
-       if (tty)
-               tty_flip_buffer_push(tty);
+       if (tport)
+               tty_flip_buffer_push(tport);
 
        return IRQ_HANDLED;
 }
index 4abc4d43a8e885480e801842cdc419f0c4892c50..8de2213664e0c8bd655fcd2ce5d19d6cd23de05b 100644 (file)
@@ -107,22 +107,19 @@ static __inline__ void sunsab_cec_wait(struct uart_sunsab_port *up)
                udelay(1);
 }
 
-static struct tty_struct *
+static struct tty_port *
 receive_chars(struct uart_sunsab_port *up,
              union sab82532_irq_status *stat)
 {
        struct tty_port *port = NULL;
-       struct tty_struct *tty = NULL;
        unsigned char buf[32];
        int saw_console_brk = 0;
        int free_fifo = 0;
        int count = 0;
        int i;
 
-       if (up->port.state != NULL) {           /* Unopened serial console */
+       if (up->port.state != NULL)             /* Unopened serial console */
                port = &up->port.state->port;
-               tty = port->tty;
-       }
 
        /* Read number of BYTES (Character + Status) available. */
        if (stat->sreg.isr0 & SAB82532_ISR0_RPF) {
@@ -139,7 +136,7 @@ receive_chars(struct uart_sunsab_port *up,
        if (stat->sreg.isr0 & SAB82532_ISR0_TIME) {
                sunsab_cec_wait(up);
                writeb(SAB82532_CMDR_RFRD, &up->regs->w.cmdr);
-               return tty;
+               return port;
        }
 
        if (stat->sreg.isr0 & SAB82532_ISR0_RFO)
@@ -219,7 +216,7 @@ receive_chars(struct uart_sunsab_port *up,
        if (saw_console_brk)
                sun_do_break();
 
-       return tty;
+       return port;
 }
 
 static void sunsab_stop_tx(struct uart_port *);
@@ -302,7 +299,7 @@ static void check_status(struct uart_sunsab_port *up,
 static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
 {
        struct uart_sunsab_port *up = dev_id;
-       struct tty_struct *tty;
+       struct tty_port *port = NULL;
        union sab82532_irq_status status;
        unsigned long flags;
        unsigned char gis;
@@ -316,12 +313,11 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
        if (gis & 2)
                status.sreg.isr1 = readb(&up->regs->r.isr1);
 
-       tty = NULL;
        if (status.stat) {
                if ((status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME |
                                         SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) ||
                    (status.sreg.isr1 & SAB82532_ISR1_BRK))
-                       tty = receive_chars(up, &status);
+                       port = receive_chars(up, &status);
                if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) ||
                    (status.sreg.isr1 & SAB82532_ISR1_CSC))
                        check_status(up, &status);
@@ -331,8 +327,8 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id)
 
        spin_unlock_irqrestore(&up->port.lock, flags);
 
-       if (tty)
-               tty_flip_buffer_push(tty);
+       if (port)
+               tty_flip_buffer_push(port);
 
        return IRQ_HANDLED;
 }
index 52325968b06c9395ecb7315756491ab86d7211d8..e343d6670854e3b0fa097a0e66135daa065ce2b9 100644 (file)
@@ -315,11 +315,10 @@ static void sunsu_enable_ms(struct uart_port *port)
        spin_unlock_irqrestore(&up->port.lock, flags);
 }
 
-static struct tty_struct *
+static void
 receive_chars(struct uart_sunsu_port *up, unsigned char *status)
 {
        struct tty_port *port = &up->port.state->port;
-       struct tty_struct *tty = port->tty;
        unsigned char ch, flag;
        int max_count = 256;
        int saw_console_brk = 0;
@@ -391,8 +390,6 @@ receive_chars(struct uart_sunsu_port *up, unsigned char *status)
 
        if (saw_console_brk)
                sun_do_break();
-
-       return tty;
 }
 
 static void transmit_chars(struct uart_sunsu_port *up)
@@ -461,20 +458,16 @@ static irqreturn_t sunsu_serial_interrupt(int irq, void *dev_id)
        spin_lock_irqsave(&up->port.lock, flags);
 
        do {
-               struct tty_struct *tty;
-
                status = serial_inp(up, UART_LSR);
-               tty = NULL;
                if (status & UART_LSR_DR)
-                       tty = receive_chars(up, &status);
+                       receive_chars(up, &status);
                check_modem_status(up);
                if (status & UART_LSR_THRE)
                        transmit_chars(up);
 
                spin_unlock_irqrestore(&up->port.lock, flags);
 
-               if (tty)
-                       tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&up->port.state->port);
 
                spin_lock_irqsave(&up->port.lock, flags);
 
index 4a11be3849f663a2acb43ad21f409b33c90088e3..27669ff3d4463b0c023f7eb1120b8ed96792e39f 100644 (file)
@@ -323,19 +323,15 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up,
        }
 }
 
-static struct tty_struct *
+static struct tty_port *
 sunzilog_receive_chars(struct uart_sunzilog_port *up,
                       struct zilog_channel __iomem *channel)
 {
        struct tty_port *port = NULL;
-       struct tty_struct *tty;
        unsigned char ch, r1, flag;
 
-       tty = NULL;
-       if (up->port.state != NULL) {           /* Unopened serial console */
+       if (up->port.state != NULL)             /* Unopened serial console */
                port = &up->port.state->port;
-               tty = port->tty;                /* mouse => tty is NULL */
-       }
 
        for (;;) {
 
@@ -403,7 +399,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
                        tty_insert_flip_char(port, 0, TTY_OVERRUN);
        }
 
-       return tty;
+       return port;
 }
 
 static void sunzilog_status_handle(struct uart_sunzilog_port *up,
@@ -536,21 +532,21 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id)
        while (up) {
                struct zilog_channel __iomem *channel
                        = ZILOG_CHANNEL_FROM_PORT(&up->port);
-               struct tty_struct *tty;
+               struct tty_port *port;
                unsigned char r3;
 
                spin_lock(&up->port.lock);
                r3 = read_zsreg(channel, R3);
 
                /* Channel A */
-               tty = NULL;
+               port = NULL;
                if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
                        writeb(RES_H_IUS, &channel->control);
                        ZSDELAY();
                        ZS_WSYNC(channel);
 
                        if (r3 & CHARxIP)
-                               tty = sunzilog_receive_chars(up, channel);
+                               port = sunzilog_receive_chars(up, channel);
                        if (r3 & CHAEXT)
                                sunzilog_status_handle(up, channel);
                        if (r3 & CHATxIP)
@@ -558,22 +554,22 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id)
                }
                spin_unlock(&up->port.lock);
 
-               if (tty)
-                       tty_flip_buffer_push(tty);
+               if (port)
+                       tty_flip_buffer_push(port);
 
                /* Channel B */
                up = up->next;
                channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
 
                spin_lock(&up->port.lock);
-               tty = NULL;
+               port = NULL;
                if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
                        writeb(RES_H_IUS, &channel->control);
                        ZSDELAY();
                        ZS_WSYNC(channel);
 
                        if (r3 & CHBRxIP)
-                               tty = sunzilog_receive_chars(up, channel);
+                               port = sunzilog_receive_chars(up, channel);
                        if (r3 & CHBEXT)
                                sunzilog_status_handle(up, channel);
                        if (r3 & CHBTxIP)
@@ -581,8 +577,8 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id)
                }
                spin_unlock(&up->port.lock);
 
-               if (tty)
-                       tty_flip_buffer_push(tty);
+               if (port)
+                       tty_flip_buffer_push(port);
 
                up = up->next;
        }
index f40c634f7528aec059ade69354080d89f6076e37..6818410a2bead339f1d9ec6cc1188a06a3599e07 100644 (file)
@@ -100,7 +100,7 @@ static void timbuart_rx_chars(struct uart_port *port)
        }
 
        spin_unlock(&port->lock);
-       tty_flip_buffer_push(port->state->port.tty);
+       tty_flip_buffer_push(tport);
        spin_lock(&port->lock);
 
        dev_dbg(port->dev, "%s - total read %d bytes\n",
index 5caf1f0ebc8244ef26f7d2730b7d9870c40f1400..5486505e87c74bf7dbc7e4d8840a6ab207722cb1 100644 (file)
@@ -156,7 +156,7 @@ static irqreturn_t ulite_isr(int irq, void *dev_id)
 
        /* work done? */
        if (n > 1) {
-               tty_flip_buffer_push(port->state->port.tty);
+               tty_flip_buffer_push(&port->state->port);
                return IRQ_HANDLED;
        } else {
                return IRQ_NONE;
index 7a2378627fa5d8fc51d56ad9d0f992e7bcf32a43..7355303dad9968082da43b8b84fc3f745dda11a6 100644 (file)
@@ -470,7 +470,6 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port)
        unsigned char ch, *cp;
        struct uart_port *port = &qe_port->port;
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tport->tty;
        struct qe_bd *bdp;
        u16 status;
        unsigned int flg;
@@ -531,7 +530,7 @@ error_return:
        qe_port->rx_cur = bdp;
 
        /* Activate BH processing */
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(tport);
 
        return;
 
index 62ee0166bc65e3bab5316f2c014cfd42de27341e..f655997f44af21328db8dfcd750402ef6f10a6d7 100644 (file)
@@ -313,12 +313,10 @@ static void siu_break_ctl(struct uart_port *port, int ctl)
 
 static inline void receive_chars(struct uart_port *port, uint8_t *status)
 {
-       struct tty_struct *tty;
        uint8_t lsr, ch;
        char flag;
        int max_count = RX_MAX_COUNT;
 
-       tty = port->state->port.tty;
        lsr = *status;
 
        do {
@@ -365,7 +363,7 @@ static inline void receive_chars(struct uart_port *port, uint8_t *status)
                lsr = siu_read(port, UART_LSR);
        } while ((lsr & UART_LSR_DR) && (max_count-- > 0));
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->state->port);
 
        *status = lsr;
 }
index 7f4112423f3dfe354a8ce9fe05d764b7610b4df7..f1a398c672fa386989b23a24f9f0611d5e6286fa 100644 (file)
@@ -137,15 +137,6 @@ static void vt8500_enable_ms(struct uart_port *port)
 static void handle_rx(struct uart_port *port)
 {
        struct tty_port *tport = &port->state->port;
-       struct tty_struct *tty = tty_port_tty_get(tport);
-       if (!tty) {
-               /* Discard data: no tty available */
-               int count = (vt8500_read(port, VT8500_URFIDX) & 0x1f00) >> 8;
-               u16 ch;
-               while (count--)
-                       ch = readw(port->membase + VT8500_RXFIFO);
-               return;
-       }
 
        /*
         * Handle overrun
@@ -178,8 +169,7 @@ static void handle_rx(struct uart_port *port)
                        tty_insert_flip_char(tport, c, flag);
        }
 
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(tport);
 }
 
 static void handle_tx(struct uart_port *port)
index 9ab910370c566942fc7513ed38635f0171c47fcd..82a3151e393c239ece245e4ffc743978113cde60 100644 (file)
 static irqreturn_t xuartps_isr(int irq, void *dev_id)
 {
        struct uart_port *port = (struct uart_port *)dev_id;
-       struct tty_struct *tty;
        unsigned long flags;
        unsigned int isrstatus, numbytes;
        unsigned int data;
        char status = TTY_NORMAL;
 
-       /* Get the tty which could be NULL so don't assume it's valid */
-       tty = tty_port_tty_get(&port->state->port);
-
        spin_lock_irqsave(&port->lock, flags);
 
        /* Read the interrupt status register to determine which
@@ -187,14 +183,11 @@ static irqreturn_t xuartps_isr(int irq, void *dev_id)
                        } else if (isrstatus & XUARTPS_IXR_OVERRUN)
                                port->icount.overrun++;
 
-                       if (tty)
-                               uart_insert_char(port, isrstatus,
-                                               XUARTPS_IXR_OVERRUN, data,
-                                               status);
+                       uart_insert_char(port, isrstatus, XUARTPS_IXR_OVERRUN,
+                                       data, status);
                }
                spin_unlock(&port->lock);
-               if (tty)
-                       tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->state->port);
                spin_lock(&port->lock);
        }
 
@@ -237,7 +230,6 @@ static irqreturn_t xuartps_isr(int irq, void *dev_id)
 
        /* be sure to release the lock and tty before leaving */
        spin_unlock_irqrestore(&port->lock, flags);
-       tty_kref_put(tty);
 
        return IRQ_HANDLED;
 }
index 92c00b24d0df961f62b47b39dd0bffc40de2f47e..6a169877109b264ff8d060ba8b5929adfc0c78a0 100644 (file)
@@ -603,7 +603,7 @@ static void zs_receive_chars(struct zs_port *zport)
                uart_insert_char(uport, status, Rx_OVR, ch, flag);
        }
 
-       tty_flip_buffer_push(uport->state->port.tty);
+       tty_flip_buffer_push(&uport->state->port);
 }
 
 static void zs_raw_transmit_chars(struct zs_port *zport)
index 2f6967d61a80e68d9146e41193969d2292271de0..555fdc0ed0f1f647aee3f538df0ab128b1f95199 100644 (file)
@@ -1439,7 +1439,6 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info )
        u16 status;
        int work = 0;
        unsigned char DataByte;
-       struct tty_struct *tty = info->port.tty;
        struct  mgsl_icount *icount = &info->icount;
        
        if ( debug_level >= DEBUG_LEVEL_ISR )   
@@ -1501,7 +1500,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info )
                        if (status & RXSTATUS_BREAK_RECEIVED) {
                                flag = TTY_BREAK;
                                if (info->port.flags & ASYNC_SAK)
-                                       do_SAK(tty);
+                                       do_SAK(info->port.tty);
                        } else if (status & RXSTATUS_PARITY_ERROR)
                                flag = TTY_PARITY;
                        else if (status & RXSTATUS_FRAMING_ERROR)
@@ -1524,7 +1523,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info )
        }
                        
        if(work)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&info->port);
 }
 
 /* mgsl_isr_misc()
index 9a0358a1e0dd43a37aa4a63bdf0a7b08182fd5f8..fced6acc74ee31c75e44ba2243d377cf19c01db6 100644 (file)
@@ -1854,7 +1854,6 @@ static void hdlcdev_exit(struct slgt_info *info)
  */
 static void rx_async(struct slgt_info *info)
 {
-       struct tty_struct *tty = info->port.tty;
        struct mgsl_icount *icount = &info->icount;
        unsigned int start, end;
        unsigned char *p;
@@ -1915,8 +1914,8 @@ static void rx_async(struct slgt_info *info)
                        break;
        }
 
-       if (tty && chars)
-               tty_flip_buffer_push(tty);
+       if (chars)
+               tty_flip_buffer_push(&info->port);
 }
 
 /*
index 419f58ff4a1307f6220aeb598ffeee754543a6e0..e4a2904af5651719c9fd3df2f00fe266ddd0dba7 100644 (file)
@@ -2167,7 +2167,6 @@ static void isr_rxrdy(SLMP_INFO * info)
 {
        u16 status;
        unsigned char DataByte;
-       struct tty_struct *tty = info->port.tty;
        struct  mgsl_icount *icount = &info->icount;
 
        if ( debug_level >= DEBUG_LEVEL_ISR )
@@ -2225,8 +2224,7 @@ static void isr_rxrdy(SLMP_INFO * info)
                        icount->frame,icount->overrun);
        }
 
-       if ( tty )
-               tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&info->port);
 }
 
 static void isr_txeom(SLMP_INFO * info, unsigned char status)
index 1bfe97a8e2eba6f4be46c6f52587d738cb164632..b6efacadf23b7d02741dfb2b794c8dee586e7c6a 100644 (file)
@@ -544,7 +544,7 @@ void tty_flush_to_ldisc(struct tty_struct *tty)
 
 /**
  *     tty_flip_buffer_push    -       terminal
- *     @tty: tty to push
+ *     @port: tty port to push
  *
  *     Queue a push of the terminal flip buffers to the line discipline. This
  *     function must not be called from IRQ context if port->low_latency is
@@ -556,9 +556,9 @@ void tty_flush_to_ldisc(struct tty_struct *tty)
  *     Locking: tty buffer lock. Driver locks in low latency mode.
  */
 
-void tty_flip_buffer_push(struct tty_struct *tty)
+void tty_flip_buffer_push(struct tty_port *port)
 {
-       struct tty_bufhead *buf = &tty->port->buf;
+       struct tty_bufhead *buf = &port->buf;
        unsigned long flags;
 
        spin_lock_irqsave(&buf->lock, flags);
@@ -566,7 +566,7 @@ void tty_flip_buffer_push(struct tty_struct *tty)
                buf->tail->commit = buf->tail->used;
        spin_unlock_irqrestore(&buf->lock, flags);
 
-       if (tty->port->low_latency)
+       if (port->low_latency)
                flush_to_ldisc(&buf->work);
        else
                schedule_work(&buf->work);
index 20dc2add27ba6ecbe8d5d70476c976b285f1f3d2..15b36e2efa85be6cf59fe2310ed9acb6e4bbeb44 100644 (file)
@@ -410,20 +410,12 @@ static int acm_submit_read_urbs(struct acm *acm, gfp_t mem_flags)
 
 static void acm_process_read_urb(struct acm *acm, struct urb *urb)
 {
-       struct tty_struct *tty;
-
        if (!urb->actual_length)
                return;
 
-       tty = tty_port_tty_get(&acm->port);
-       if (!tty)
-               return;
-
        tty_insert_flip_string(&acm->port, urb->transfer_buffer,
                        urb->actual_length);
-       tty_flip_buffer_push(tty);
-
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&acm->port);
 }
 
 static void acm_read_bulk_callback(struct urb *urb)
index 3560799d530a953f2b15a9257115c8f1db60dac1..ca4fc3d3e7ff12e67dc0108fb1bdb6691d067ad0 100644 (file)
@@ -551,8 +551,8 @@ static void gs_rx_push(unsigned long _port)
        /* Push from tty to ldisc; without low_latency set this is handled by
         * a workqueue, so we won't get callbacks and can hold port_lock
         */
-       if (tty && do_push)
-               tty_flip_buffer_push(tty);
+       if (do_push)
+               tty_flip_buffer_push(&port->port);
 
 
        /* We want our data queue to become empty ASAP, keeping data
index 3bb1f8f11fc87012bf9e33f4cf15eef299c92cfc..6e320cec397dc77fc9ec3d8aadb39bb4fcc5a70f 100644 (file)
@@ -140,16 +140,11 @@ static void aircable_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        char *data = (char *)urb->transfer_buffer;
-       struct tty_struct *tty;
        int has_headers;
        int count;
        int len;
        int i;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        has_headers = (urb->actual_length > 2 && data[0] == RX_HEADER_0);
 
        count = 0;
@@ -160,8 +155,7 @@ static void aircable_process_read_urb(struct urb *urb)
        }
 
        if (count)
-               tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+               tty_flip_buffer_push(&port->port);
 }
 
 static struct usb_serial_driver aircable_device = {
index 1614feb6a76e26fdf6431ba3c1ce966c52c0529c..cbd904b8fba55f42ec07ed0d3a741878b516157c 100644 (file)
@@ -674,7 +674,6 @@ static void ark3116_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        struct ark3116_private *priv = usb_get_serial_port_data(port);
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        char tty_flag = TTY_NORMAL;
        unsigned long flags;
@@ -689,10 +688,6 @@ static void ark3116_process_read_urb(struct urb *urb)
        if (!urb->actual_length)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        if (lsr & UART_LSR_BRK_ERROR_BITS) {
                if (lsr & UART_LSR_BI)
                        tty_flag = TTY_BREAK;
@@ -707,8 +702,7 @@ static void ark3116_process_read_urb(struct urb *urb)
        }
        tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag,
                                                        urb->actual_length);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static struct usb_serial_driver ark3116_device = {
index 7ba2c0bdcec95f62f09b5462b11e2a05512d7aaa..84217e78ded4005e8bcdc273a72c665c8eab09e1 100644 (file)
@@ -242,7 +242,6 @@ static void belkin_sa_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        struct belkin_sa_private *priv = usb_get_serial_port_data(port);
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        unsigned long flags;
        unsigned char status;
@@ -259,10 +258,6 @@ static void belkin_sa_process_read_urb(struct urb *urb)
        if (!urb->actual_length)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        if (status & BELKIN_SA_LSR_ERR) {
                /* Break takes precedence over parity, which takes precedence
                 * over framing errors. */
@@ -281,8 +276,7 @@ static void belkin_sa_process_read_urb(struct urb *urb)
 
        tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag,
                                                        urb->actual_length);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static void belkin_sa_set_termios(struct tty_struct *tty,
index e6976a974472e2fa5b9c9fe79385c1e030cc71b9..629bd2894506344e2177d4191d1b9e4a19a8b6f4 100644 (file)
@@ -324,7 +324,6 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
        struct usb_serial_port *port = urb->context;
        struct cyberjack_private *priv = usb_get_serial_port_data(port);
        struct device *dev = &port->dev;
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        short todo;
        int result;
@@ -337,16 +336,10 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
                return;
        }
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty) {
-               dev_dbg(dev, "%s - ignoring since device not open\n", __func__);
-               return;
-       }
        if (urb->actual_length) {
                tty_insert_flip_string(&port->port, data, urb->actual_length);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 
        spin_lock(&priv->lock);
 
index ac14e3eb95ea1a29b61d39286d3f041694a6fede..8efa19d0e9fba756d37f7ea1f0b0d7e813ab9610 100644 (file)
@@ -1214,10 +1214,10 @@ static void cypress_read_int_callback(struct urb *urb)
                spin_unlock_irqrestore(&priv->lock, flags);
 
        /* process read if there is data other than line status */
-       if (tty && bytes > i) {
+       if (bytes > i) {
                tty_insert_flip_string_fixed_flag(&port->port, data + i,
                                tty_flag, bytes - i);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
 
        spin_lock_irqsave(&priv->lock, flags);
index b5fa738512ca785559ecff49c8238949fb52f688..ebe45fa0ed50a3722ed7feae0750558ffea7fdad 100644 (file)
@@ -1399,9 +1399,7 @@ static void digi_read_bulk_callback(struct urb *urb)
 
 static int digi_read_inb_callback(struct urb *urb)
 {
-
        struct usb_serial_port *port = urb->context;
-       struct tty_struct *tty;
        struct digi_port *priv = usb_get_serial_port_data(port);
        int opcode = ((unsigned char *)urb->transfer_buffer)[0];
        int len = ((unsigned char *)urb->transfer_buffer)[1];
@@ -1425,7 +1423,6 @@ static int digi_read_inb_callback(struct urb *urb)
                return -1;
        }
 
-       tty = tty_port_tty_get(&port->port);
        spin_lock(&priv->dp_port_lock);
 
        /* check for throttle; if set, do not resubmit read urb */
@@ -1435,7 +1432,7 @@ static int digi_read_inb_callback(struct urb *urb)
                priv->dp_throttle_restart = 1;
 
        /* receive data */
-       if (tty && opcode == DIGI_CMD_RECEIVE_DATA) {
+       if (opcode == DIGI_CMD_RECEIVE_DATA) {
                /* get flag from port_status */
                flag = 0;
 
@@ -1457,11 +1454,10 @@ static int digi_read_inb_callback(struct urb *urb)
                if (len > 0) {
                        tty_insert_flip_string_fixed_flag(&port->port, data,
                                        flag, len);
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(&port->port);
                }
        }
        spin_unlock(&priv->dp_port_lock);
-       tty_kref_put(tty);
 
        if (opcode == DIGI_CMD_RECEIVE_DISABLE)
                dev_dbg(&port->dev, "%s: got RECEIVE_DISABLE\n", __func__);
index 6b880c33d25872a4a90e16a888a92e01888443f6..b1b2dc64b50be013eab09a2dd5ce535875aeeb5a 100644 (file)
@@ -100,7 +100,6 @@ static void f81232_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        struct f81232_private *priv = usb_get_serial_port_data(port);
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        char tty_flag = TTY_NORMAL;
        unsigned long flags;
@@ -117,10 +116,6 @@ static void f81232_process_read_urb(struct urb *urb)
        if (!urb->actual_length)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        /* break takes precedence over parity, */
        /* which takes precedence over framing errors */
        if (line_status & UART_BREAK_ERROR)
@@ -145,8 +140,7 @@ static void f81232_process_read_urb(struct urb *urb)
                                                        urb->actual_length);
        }
 
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static int set_control_lines(struct usb_device *dev, u8 value)
index eb59ba3789adb209d1f99f1de0239ae9ae92a91d..a96083b7fabc671eea72137aac03789f7a69b413 100644 (file)
@@ -2040,25 +2040,19 @@ static int ftdi_process_packet(struct usb_serial_port *port,
 static void ftdi_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
-       struct tty_struct *tty;
        struct ftdi_private *priv = usb_get_serial_port_data(port);
        char *data = (char *)urb->transfer_buffer;
        int i;
        int len;
        int count = 0;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        for (i = 0; i < urb->actual_length; i += priv->max_packet_size) {
                len = min_t(int, urb->actual_length - i, priv->max_packet_size);
                count += ftdi_process_packet(port, priv, &data[i], len);
        }
 
        if (count)
-               tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+               tty_flip_buffer_push(&port->port);
 }
 
 static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
index 498b5f0da639dd19df2588afd232f1d5b5c55063..1a07b12ef341a08e2bdb880d3d446054dccd5339 100644 (file)
@@ -252,14 +252,11 @@ static inline int isAbortTrfCmnd(const unsigned char *buf)
 static void send_to_tty(struct usb_serial_port *port,
                        char *data, unsigned int actual_length)
 {
-       struct tty_struct *tty = tty_port_tty_get(&port->port);
-
-       if (tty && actual_length) {
+       if (actual_length) {
                usb_serial_debug_data(&port->dev, __func__, actual_length, data);
                tty_insert_flip_string(&port->port, data, actual_length);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 }
 
 
index 3780f6a501b392006c94ec9fca21b51048abfa7e..4c5c23f1cae5db8a5ff157cbe0277dfb4bc42e5d 100644 (file)
@@ -313,17 +313,12 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_submit_read_urbs);
 void usb_serial_generic_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
-       struct tty_struct *tty;
        char *ch = (char *)urb->transfer_buffer;
        int i;
 
        if (!urb->actual_length)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        /* The per character mucking around with sysrq path it too slow for
           stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases
           where the USB serial is not a console anyway */
@@ -335,8 +330,7 @@ void usb_serial_generic_process_read_urb(struct urb *urb)
                                tty_insert_flip_char(&port->port, *ch, TTY_NORMAL);
                }
        }
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 EXPORT_SYMBOL_GPL(usb_serial_generic_process_read_urb);
 
index f96b91da964fa4cdf8c03d495eabb10e4398d9f3..b00e5cbf741f16b63071c8273c7f69eaa279ca6d 100644 (file)
@@ -232,8 +232,8 @@ static void  process_rcvd_data(struct edgeport_serial *edge_serial,
                                unsigned char *buffer, __u16 bufferLength);
 static void process_rcvd_status(struct edgeport_serial *edge_serial,
                                __u8 byte2, __u8 byte3);
-static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
-                               unsigned char *data, int length);
+static void edge_tty_recv(struct usb_serial_port *port, unsigned char *data,
+               int length);
 static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr);
 static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
                                __u8 lsr, __u8 data);
@@ -1752,7 +1752,6 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
        struct device *dev = &edge_serial->serial->dev->dev;
        struct usb_serial_port *port;
        struct edgeport_port *edge_port;
-       struct tty_struct *tty;
        __u16 lastBufferLength;
        __u16 rxLen;
 
@@ -1860,14 +1859,11 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
                                                        edge_serial->rxPort];
                                edge_port = usb_get_serial_port_data(port);
                                if (edge_port->open) {
-                                       tty = tty_port_tty_get(
-                                               &edge_port->port->port);
-                                       if (tty) {
-                                               dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n",
-                                                       __func__, rxLen, edge_serial->rxPort);
-                                               edge_tty_recv(edge_port->port, tty, buffer, rxLen);
-                                               tty_kref_put(tty);
-                                       }
+                                       dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n",
+                                               __func__, rxLen,
+                                               edge_serial->rxPort);
+                                       edge_tty_recv(edge_port->port, buffer,
+                                                       rxLen);
                                        edge_port->icount.rx += rxLen;
                                }
                                buffer += rxLen;
@@ -2017,8 +2013,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
  * edge_tty_recv
  *     this function passes data on to the tty flip buffer
  *****************************************************************************/
-static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
-                                       unsigned char *data, int length)
+static void edge_tty_recv(struct usb_serial_port *port, unsigned char *data,
+               int length)
 {
        int cnt;
 
@@ -2030,7 +2026,7 @@ static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
        data += cnt;
        length -= cnt;
 
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 
@@ -2086,14 +2082,9 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
        }
 
        /* Place LSR data byte into Rx buffer */
-       if (lsrData) {
-               struct tty_struct *tty =
-                               tty_port_tty_get(&edge_port->port->port);
-               if (tty) {
-                       edge_tty_recv(edge_port->port, tty, &data, 1);
-                       tty_kref_put(tty);
-               }
-       }
+       if (lsrData)
+               edge_tty_recv(edge_port->port, &data, 1);
+
        /* update input line counters */
        icount = &edge_port->icount;
        if (newLsr & LSR_BREAK)
index 1286a0b2e2b7c300d9488dce8ae02635f3b4bc4d..d6485be49ebf48b99e45437af501c2385d806a88 100644 (file)
@@ -201,8 +201,8 @@ static int closing_wait = EDGE_CLOSING_WAIT;
 static bool ignore_cpu_rev;
 static int default_uart_mode;          /* RS232 */
 
-static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
-                         unsigned char *data, int length);
+static void edge_tty_recv(struct usb_serial_port *port, unsigned char *data,
+               int length);
 
 static void stop_read(struct edgeport_port *edge_port);
 static int restart_read(struct edgeport_port *edge_port);
@@ -1540,7 +1540,6 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
        struct async_icount *icount;
        __u8 new_lsr = (__u8)(lsr & (__u8)(LSR_OVER_ERR | LSR_PAR_ERR |
                                                LSR_FRM_ERR | LSR_BREAK));
-       struct tty_struct *tty;
 
        dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, new_lsr);
 
@@ -1554,13 +1553,8 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
                new_lsr &= (__u8)(LSR_OVER_ERR | LSR_BREAK);
 
        /* Place LSR data byte into Rx buffer */
-       if (lsr_data) {
-               tty = tty_port_tty_get(&edge_port->port->port);
-               if (tty) {
-                       edge_tty_recv(edge_port->port, tty, &data, 1);
-                       tty_kref_put(tty);
-               }
-       }
+       if (lsr_data)
+               edge_tty_recv(edge_port->port, &data, 1);
 
        /* update input line counters */
        icount = &edge_port->icount;
@@ -1676,7 +1670,6 @@ static void edge_bulk_in_callback(struct urb *urb)
        struct edgeport_port *edge_port = urb->context;
        struct device *dev = &edge_port->port->dev;
        unsigned char *data = urb->transfer_buffer;
-       struct tty_struct *tty;
        int retval = 0;
        int port_number;
        int status = urb->status;
@@ -1715,18 +1708,16 @@ static void edge_bulk_in_callback(struct urb *urb)
                ++data;
        }
 
-       tty = tty_port_tty_get(&edge_port->port->port);
-       if (tty && urb->actual_length) {
+       if (urb->actual_length) {
                usb_serial_debug_data(dev, __func__, urb->actual_length, data);
                if (edge_port->close_pending)
                        dev_dbg(dev, "%s - close pending, dropping data on the floor\n",
                                                                __func__);
                else
-                       edge_tty_recv(edge_port->port, tty, data,
+                       edge_tty_recv(edge_port->port, data,
                                        urb->actual_length);
                edge_port->icount.rx += urb->actual_length;
        }
-       tty_kref_put(tty);
 
 exit:
        /* continue read unless stopped */
@@ -1741,8 +1732,8 @@ exit:
                dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval);
 }
 
-static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
-                                       unsigned char *data, int length)
+static void edge_tty_recv(struct usb_serial_port *port, unsigned char *data,
+               int length)
 {
        int queued;
 
@@ -1750,7 +1741,7 @@ static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
        if (queued < length)
                dev_err(&port->dev, "%s - dropping data, %d bytes lost\n",
                        __func__, length - queued);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static void edge_bulk_out_callback(struct urb *urb)
index 171dae1f4a62cd87038e7fa104ad2adbd0b0cfe9..716930ab1bb1931b114b82572717565d820b9c04 100644 (file)
@@ -287,7 +287,6 @@ static void ir_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        unsigned char *data = urb->transfer_buffer;
-       struct tty_struct *tty;
 
        if (!urb->actual_length)
                return;
@@ -302,12 +301,8 @@ static void ir_process_read_urb(struct urb *urb)
        if (urb->actual_length == 1)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
        tty_insert_flip_string(&port->port, data + 1, urb->actual_length - 1);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static void ir_set_termios_callback(struct urb *urb)
index dd0d910730c7a3f2ce60425b294bf3e5561a91c1..ff77027160aab7eca0ac78e4f78ae1c8e7f01877 100644 (file)
@@ -581,7 +581,6 @@ static void read_buf_callback(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        unsigned char *data = urb->transfer_buffer;
-       struct tty_struct *tty;
        int status = urb->status;
 
        if (status) {
@@ -592,14 +591,12 @@ static void read_buf_callback(struct urb *urb)
        }
 
        dev_dbg(&port->dev, "%s - %i chars to write\n", __func__, urb->actual_length);
-       tty = tty_port_tty_get(&port->port);
        if (data == NULL)
                dev_dbg(&port->dev, "%s - data is NULL !!!\n", __func__);
-       if (tty && urb->actual_length && data) {
+       if (urb->actual_length && data) {
                tty_insert_flip_string(&port->port, data, urb->actual_length);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
        iuu_led_activity_on(urb);
 }
 
index 14a219ba4ee62578a3b264d738b845739d0fa124..f6d7f68fa43cbff922dae8c9dedc6726577f5649 100644 (file)
@@ -291,7 +291,6 @@ static void usa26_indat_callback(struct urb *urb)
        int                     i, err;
        int                     endpoint;
        struct usb_serial_port  *port;
-       struct tty_struct       *tty;
        unsigned char           *data = urb->transfer_buffer;
        int status = urb->status;
 
@@ -304,8 +303,7 @@ static void usa26_indat_callback(struct urb *urb)
        }
 
        port =  urb->context;
-       tty = tty_port_tty_get(&port->port);
-       if (tty && urb->actual_length) {
+       if (urb->actual_length) {
                /* 0x80 bit is error flag */
                if ((data[0] & 0x80) == 0) {
                        /* no errors on individual bytes, only
@@ -332,9 +330,8 @@ static void usa26_indat_callback(struct urb *urb)
                                                flag);
                        }
                }
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -447,7 +444,6 @@ static void usa28_indat_callback(struct urb *urb)
 {
        int                     err;
        struct usb_serial_port  *port;
-       struct tty_struct       *tty;
        unsigned char           *data;
        struct keyspan_port_private             *p_priv;
        int status = urb->status;
@@ -470,13 +466,11 @@ static void usa28_indat_callback(struct urb *urb)
                p_priv = usb_get_serial_port_data(port);
                data = urb->transfer_buffer;
 
-               tty = tty_port_tty_get(&port->port);
-               if (tty && urb->actual_length) {
+               if (urb->actual_length) {
                        tty_insert_flip_string(&port->port, data,
                                        urb->actual_length);
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(&port->port);
                }
-               tty_kref_put(tty);
 
                /* Resubmit urb so we continue receiving */
                err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -671,7 +665,6 @@ static void usa49_indat_callback(struct urb *urb)
        int                     i, err;
        int                     endpoint;
        struct usb_serial_port  *port;
-       struct tty_struct       *tty;
        unsigned char           *data = urb->transfer_buffer;
        int status = urb->status;
 
@@ -684,8 +677,7 @@ static void usa49_indat_callback(struct urb *urb)
        }
 
        port =  urb->context;
-       tty = tty_port_tty_get(&port->port);
-       if (tty && urb->actual_length) {
+       if (urb->actual_length) {
                /* 0x80 bit is error flag */
                if ((data[0] & 0x80) == 0) {
                        /* no error on any byte */
@@ -706,9 +698,8 @@ static void usa49_indat_callback(struct urb *urb)
                                                flag);
                        }
                }
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 
        /* Resubmit urb so we continue receiving */
        err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -721,7 +712,6 @@ static void usa49wg_indat_callback(struct urb *urb)
        int                     i, len, x, err;
        struct usb_serial       *serial;
        struct usb_serial_port  *port;
-       struct tty_struct       *tty;
        unsigned char           *data = urb->transfer_buffer;
        int status = urb->status;
 
@@ -746,7 +736,6 @@ static void usa49wg_indat_callback(struct urb *urb)
                                return;
                        }
                        port = serial->port[data[i++]];
-                       tty = tty_port_tty_get(&port->port);
                        len = data[i++];
 
                        /* 0x80 bit is error flag */
@@ -774,8 +763,7 @@ static void usa49wg_indat_callback(struct urb *urb)
                                        i += 2;
                                }
                        }
-                       tty_flip_buffer_push(tty);
-                       tty_kref_put(tty);
+                       tty_flip_buffer_push(&port->port);
                }
        }
 
@@ -796,7 +784,6 @@ static void usa90_indat_callback(struct urb *urb)
        int                     endpoint;
        struct usb_serial_port  *port;
        struct keyspan_port_private             *p_priv;
-       struct tty_struct       *tty;
        unsigned char           *data = urb->transfer_buffer;
        int status = urb->status;
 
@@ -812,7 +799,6 @@ static void usa90_indat_callback(struct urb *urb)
        p_priv = usb_get_serial_port_data(port);
 
        if (urb->actual_length) {
-               tty = tty_port_tty_get(&port->port);
                /* if current mode is DMA, looks like usa28 format
                   otherwise looks like usa26 data format */
 
@@ -848,8 +834,7 @@ static void usa90_indat_callback(struct urb *urb)
                                }
                        }
                }
-               tty_flip_buffer_push(tty);
-               tty_kref_put(tty);
+               tty_flip_buffer_push(&port->port);
        }
 
        /* Resubmit urb so we continue receiving */
index 334b1a295c6b32fdcfad343bfd44dbf88594d7fd..3b17d5d13dc86aa8fa9ebe8b6a290572c57a6323 100644 (file)
@@ -138,7 +138,6 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work)
 static void keyspan_pda_rx_interrupt(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int retval;
        int status = urb->status;
@@ -163,14 +162,12 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
        /* see if the message is data or a status interrupt */
        switch (data[0]) {
        case 0:
-               tty = tty_port_tty_get(&port->port);
                 /* rest of message is rx data */
-               if (tty && urb->actual_length) {
+               if (urb->actual_length) {
                        tty_insert_flip_string(&port->port, data + 1,
                                                urb->actual_length - 1);
-                       tty_flip_buffer_push(tty);
+                       tty_flip_buffer_push(&port->port);
                }
-               tty_kref_put(tty);
                break;
        case 1:
                /* status interrupt */
index 8ee0825ad7004ffcc9b2fc7e5510ae5bd1f52cb4..769d910ae0a5d789cf933659867fee715fc6be8a 100644 (file)
@@ -389,7 +389,6 @@ static void klsi_105_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        unsigned char *data = urb->transfer_buffer;
-       struct tty_struct *tty;
        unsigned len;
 
        /* empty urbs seem to happen, we ignore them */
@@ -401,10 +400,6 @@ static void klsi_105_process_read_urb(struct urb *urb)
                return;
        }
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        len = get_unaligned_le16(data);
        if (len > urb->actual_length - KLSI_HDR_LEN) {
                dev_dbg(&port->dev, "%s - packet length mismatch\n", __func__);
@@ -412,8 +407,7 @@ static void klsi_105_process_read_urb(struct urb *urb)
        }
 
        tty_insert_flip_string(&port->port, data + KLSI_HDR_LEN, len);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static void klsi_105_set_termios(struct tty_struct *tty,
index 135c8b4b26f74f277885af3f2fd2def295a3eda5..903d938e174ba074d85ebeff36ba1a9da39a2074 100644 (file)
@@ -324,7 +324,6 @@ static void kobil_read_int_callback(struct urb *urb)
 {
        int result;
        struct usb_serial_port *port = urb->context;
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int status = urb->status;
 
@@ -333,8 +332,7 @@ static void kobil_read_int_callback(struct urb *urb)
                return;
        }
 
-       tty = tty_port_tty_get(&port->port);
-       if (tty && urb->actual_length) {
+       if (urb->actual_length) {
 
                /* BEGIN DEBUG */
                /*
@@ -354,9 +352,8 @@ static void kobil_read_int_callback(struct urb *urb)
                /* END DEBUG */
 
                tty_insert_flip_string(&port->port, data, urb->actual_length);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 
        result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
        dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result);
index ba20bb037b28fe82e26403a1f2293af58f271dcc..f42528e05d7b639f90905e9d3496d36e7a111cc2 100644 (file)
@@ -531,7 +531,6 @@ static void mct_u232_read_int_callback(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        struct mct_u232_private *priv = usb_get_serial_port_data(port);
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int retval;
        int status = urb->status;
@@ -561,13 +560,9 @@ static void mct_u232_read_int_callback(struct urb *urb)
         */
        if (urb->transfer_buffer_length > 2) {
                if (urb->actual_length) {
-                       tty = tty_port_tty_get(&port->port);
-                       if (tty) {
-                               tty_insert_flip_string(&port->port, data,
-                                               urb->actual_length);
-                               tty_flip_buffer_push(tty);
-                       }
-                       tty_kref_put(tty);
+                       tty_insert_flip_string(&port->port, data,
+                                       urb->actual_length);
+                       tty_flip_buffer_push(&port->port);
                }
                goto exit;
        }
index 6264f3974ea7b4c4e0491a30503e865ecc05f471..bf3c7a23553efbe73d1c12b4e7b910d506fed474 100644 (file)
@@ -95,7 +95,6 @@ static void metrousb_read_int_callback(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        struct metrousb_private *metro_priv = usb_get_serial_port_data(port);
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int throttled = 0;
        int result = 0;
@@ -124,15 +123,13 @@ static void metrousb_read_int_callback(struct urb *urb)
 
 
        /* Set the data read from the usb port into the serial port buffer. */
-       tty = tty_port_tty_get(&port->port);
-       if (tty && urb->actual_length) {
+       if (urb->actual_length) {
                /* Loop through the data copying each byte to the tty layer. */
                tty_insert_flip_string(&port->port, data, urb->actual_length);
 
                /* Force the data to the tty layer. */
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 
        /* Set any port variables. */
        spin_lock_irqsave(&metro_priv->lock, flags);
index 22818fb765e0c0026c57b2e532c32b5ce0bfa7b8..e0ebec3b5d6ae077aa4ac0347e8a33470f8dc6c3 100644 (file)
@@ -899,7 +899,6 @@ static void mos7720_bulk_in_callback(struct urb *urb)
        int retval;
        unsigned char *data ;
        struct usb_serial_port *port;
-       struct tty_struct *tty;
        int status = urb->status;
 
        if (status) {
@@ -913,12 +912,10 @@ static void mos7720_bulk_in_callback(struct urb *urb)
 
        data = urb->transfer_buffer;
 
-       tty = tty_port_tty_get(&port->port);
-       if (tty && urb->actual_length) {
+       if (urb->actual_length) {
                tty_insert_flip_string(&port->port, data, urb->actual_length);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 
        if (port->read_urb->status != -EINPROGRESS) {
                retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
index 3ddd7a1f7ff30b2f68237913dd4d68e2ada1c27d..809fb329eca5f945d13c25e75f74bf79145389df 100644 (file)
@@ -744,7 +744,6 @@ static void mos7840_bulk_in_callback(struct urb *urb)
        struct usb_serial *serial;
        struct usb_serial_port *port;
        struct moschip_port *mos7840_port;
-       struct tty_struct *tty;
        int status = urb->status;
 
        mos7840_port = urb->context;
@@ -774,12 +773,8 @@ static void mos7840_bulk_in_callback(struct urb *urb)
 
        if (urb->actual_length) {
                struct tty_port *tport = &mos7840_port->port->port;
-               tty = tty_port_tty_get(tport);
-               if (tty) {
-                       tty_insert_flip_string(tport, data, urb->actual_length);
-                       tty_flip_buffer_push(tty);
-                       tty_kref_put(tty);
-               }
+               tty_insert_flip_string(tport, data, urb->actual_length);
+               tty_flip_buffer_push(tport);
                mos7840_port->icount.rx += urb->actual_length;
                smp_wmb();
                dev_dbg(&port->dev, "mos7840_port->icount.rx is %d:\n", mos7840_port->icount.rx);
index 0d96a1a7b9e5a92a286b763d3f82244a7165dde0..38725fc8c2c8b7c4c6be2ab130c31c55abb3ac78 100644 (file)
@@ -32,7 +32,6 @@ static void navman_read_int_callback(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        unsigned char *data = urb->transfer_buffer;
-       struct tty_struct *tty;
        int status = urb->status;
        int result;
 
@@ -55,12 +54,10 @@ static void navman_read_int_callback(struct urb *urb)
 
        usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
 
-       tty = tty_port_tty_get(&port->port);
-       if (tty && urb->actual_length) {
+       if (urb->actual_length) {
                tty_insert_flip_string(&port->port, data, urb->actual_length);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 
 exit:
        result = usb_submit_urb(urb, GFP_ATOMIC);
index 338191bae5a3bf1ceba301772d9c30e35acfafc1..1e1cafe287e4e63f7b7c23a18fd9b66965228e2e 100644 (file)
@@ -174,14 +174,9 @@ static void omninet_read_bulk_callback(struct urb *urb)
        }
 
        if (urb->actual_length && header->oh_len) {
-               struct tty_struct *tty = tty_port_tty_get(&port->port);
-               if (tty) {
-                       tty_insert_flip_string(&port->port,
-                                       data + OMNINET_DATAOFFSET,
-                                       header->oh_len);
-                       tty_flip_buffer_push(tty);
-                       tty_kref_put(tty);
-               }
+               tty_insert_flip_string(&port->port, data + OMNINET_DATAOFFSET,
+                               header->oh_len);
+               tty_flip_buffer_push(&port->port);
        }
 
        /* Continue trying to always read  */
index d3b74e50aff1628605c68cc88ea02886903ef6d7..e13e1a4d3e1e0901d09195280ae6f7fd4cf386fc 100644 (file)
@@ -51,15 +51,8 @@ struct opticon_private {
 static void opticon_process_data_packet(struct usb_serial_port *port,
                                        const unsigned char *buf, size_t len)
 {
-       struct tty_struct *tty;
-
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        tty_insert_flip_string(&port->port, buf, len);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static void opticon_process_status_packet(struct usb_serial_port *port,
index 7a53fe9f3af30e3ceea9343ff01aeb4967983178..a958fd41b5b312a699b5d963d8db1a49ea56810b 100644 (file)
@@ -820,7 +820,6 @@ static void oti6858_read_bulk_callback(struct urb *urb)
 {
        struct usb_serial_port *port =  urb->context;
        struct oti6858_private *priv = usb_get_serial_port_data(port);
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        unsigned long flags;
        int status = urb->status;
@@ -835,12 +834,10 @@ static void oti6858_read_bulk_callback(struct urb *urb)
                return;
        }
 
-       tty = tty_port_tty_get(&port->port);
-       if (tty != NULL && urb->actual_length > 0) {
+       if (urb->actual_length > 0) {
                tty_insert_flip_string(&port->port, data, urb->actual_length);
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
        }
-       tty_kref_put(tty);
 
        /* schedule the interrupt urb */
        result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
index 00047f3c7293fd7a83235679af66969f74ebee5d..54adc9125e5c1e9eb29b37573433e0d6324dce0e 100644 (file)
@@ -772,7 +772,6 @@ static void pl2303_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        struct pl2303_private *priv = usb_get_serial_port_data(port);
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        char tty_flag = TTY_NORMAL;
        unsigned long flags;
@@ -789,10 +788,6 @@ static void pl2303_process_read_urb(struct urb *urb)
        if (!urb->actual_length)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        /* break takes precedence over parity, */
        /* which takes precedence over framing errors */
        if (line_status & UART_BREAK_ERROR)
@@ -817,8 +812,7 @@ static void pl2303_process_read_urb(struct urb *urb)
                                                        urb->actual_length);
        }
 
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 /* All of the device info needed for the PL2303 SIO serial converter */
index 5dccc4f957dff1b4ed0f5b5a8d78e8080cef7d06..6850745808c3932e3167f2d85c76636465eecec4 100644 (file)
@@ -609,7 +609,6 @@ void qt2_process_read_urb(struct urb *urb)
        struct qt2_serial_private *serial_priv;
        struct usb_serial_port *port;
        struct qt2_port_private *port_priv;
-       struct tty_struct *tty;
        bool escapeflag;
        unsigned char *ch;
        int i;
@@ -620,15 +619,11 @@ void qt2_process_read_urb(struct urb *urb)
                return;
 
        ch = urb->transfer_buffer;
-       tty = NULL;
        serial = urb->context;
        serial_priv = usb_get_serial_data(serial);
        port = serial->port[serial_priv->current_port];
        port_priv = usb_get_serial_port_data(port);
 
-       if (port_priv->is_open)
-               tty = tty_port_tty_get(&port->port);
-
        for (i = 0; i < urb->actual_length; i++) {
                ch = (unsigned char *)urb->transfer_buffer + i;
                if ((i <= (len - 3)) &&
@@ -666,10 +661,7 @@ void qt2_process_read_urb(struct urb *urb)
                                                 __func__);
                                        break;
                                }
-                               if (tty) {
-                                       tty_flip_buffer_push(tty);
-                                       tty_kref_put(tty);
-                               }
+                               tty_flip_buffer_push(&port->port);
 
                                newport = *(ch + 3);
 
@@ -683,10 +675,6 @@ void qt2_process_read_urb(struct urb *urb)
                                serial_priv->current_port = newport;
                                port = serial->port[serial_priv->current_port];
                                port_priv = usb_get_serial_port_data(port);
-                               if (port_priv->is_open)
-                                       tty = tty_port_tty_get(&port->port);
-                               else
-                                       tty = NULL;
                                i += 3;
                                escapeflag = true;
                                break;
@@ -716,10 +704,7 @@ void qt2_process_read_urb(struct urb *urb)
                tty_insert_flip_string(&port->port, ch, 1);
        }
 
-       if (tty) {
-               tty_flip_buffer_push(tty);
-               tty_kref_put(tty);
-       }
+       tty_flip_buffer_push(&port->port);
 }
 
 static void qt2_write_bulk_callback(struct urb *urb)
index ad12e9e2c7ee4c096deebefd3988017258c22a7c..21cd7bf2a8cc90322044596fda6a58af5d3e67f6 100644 (file)
@@ -207,38 +207,31 @@ static void safe_process_read_urb(struct urb *urb)
        unsigned char *data = urb->transfer_buffer;
        unsigned char length = urb->actual_length;
        int actual_length;
-       struct tty_struct *tty;
        __u16 fcs;
 
        if (!length)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
        if (!safe)
                goto out;
 
        fcs = fcs_compute10(data, length, CRC10_INITFCS);
        if (fcs) {
                dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);
-               goto err;
+               return;
        }
 
        actual_length = data[length - 2] >> 2;
        if (actual_length > (length - 2)) {
                dev_err(&port->dev, "%s - inconsistent lengths %d:%d\n",
                                __func__, actual_length, length);
-               goto err;
+               return;
        }
        dev_info(&urb->dev->dev, "%s - actual: %d\n", __func__, actual_length);
        length = actual_length;
 out:
        tty_insert_flip_string(&port->port, data, length);
-       tty_flip_buffer_push(tty);
-err:
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static int safe_prepare_write_buffer(struct usb_serial_port *port,
index 64e53fda149b08c3554b4f60447ade1b2ac6a284..70aee8d59f232278d7a33be77822d5535d26cdcb 100644 (file)
@@ -569,7 +569,6 @@ static void sierra_indat_callback(struct urb *urb)
        int err;
        int endpoint;
        struct usb_serial_port *port;
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int status = urb->status;
 
@@ -581,16 +580,12 @@ static void sierra_indat_callback(struct urb *urb)
                        " endpoint %02x\n", __func__, status, endpoint);
        } else {
                if (urb->actual_length) {
-                       tty = tty_port_tty_get(&port->port);
-                       if (tty) {
-                               tty_insert_flip_string(&port->port, data,
-                                       urb->actual_length);
-                               tty_flip_buffer_push(tty);
-
-                               tty_kref_put(tty);
-                               usb_serial_debug_data(&port->dev, __func__,
-                                                     urb->actual_length, data);
-                       }
+                       tty_insert_flip_string(&port->port, data,
+                               urb->actual_length);
+                       tty_flip_buffer_push(&port->port);
+
+                       usb_serial_debug_data(&port->dev, __func__,
+                                             urb->actual_length, data);
                } else {
                        dev_dbg(&port->dev, "%s: empty read urb"
                                " received\n", __func__);
index 04e3731527245527b3cb85c17daa7b1ca1cbc32d..91ff8e3bddbd76a4daa3502d17dd2aaab96ac154 100644 (file)
@@ -462,7 +462,6 @@ static void spcp8x5_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        struct spcp8x5_private *priv = usb_get_serial_port_data(port);
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        unsigned long flags;
        u8 status;
@@ -481,9 +480,6 @@ static void spcp8x5_process_read_urb(struct urb *urb)
        if (!urb->actual_length)
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
 
        if (status & UART_STATE_TRANSIENT_MASK) {
                /* break takes precedence over parity, which takes precedence
@@ -500,15 +496,19 @@ static void spcp8x5_process_read_urb(struct urb *urb)
                if (status & UART_OVERRUN_ERROR)
                        tty_insert_flip_char(&port->port, 0, TTY_OVERRUN);
 
-               if (status & UART_DCD)
-                       usb_serial_handle_dcd_change(port, tty,
-                                  priv->line_status & MSR_STATUS_LINE_DCD);
+               if (status & UART_DCD) {
+                       struct tty_struct *tty = tty_port_tty_get(&port->port);
+                       if (tty) {
+                               usb_serial_handle_dcd_change(port, tty,
+                                      priv->line_status & MSR_STATUS_LINE_DCD);
+                               tty_kref_put(tty);
+                       }
+               }
        }
 
        tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag,
                                                        urb->actual_length);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static int spcp8x5_wait_modem_info(struct usb_serial_port *port,
index 38713156e957352d6bfce772dcdb9733073887e0..58bc7e793524180a5dea4c602c479ede32d7aec6 100644 (file)
@@ -582,7 +582,7 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr,
 
 }
 
-static int ssu100_process_packet(struct urb *urb)
+static void ssu100_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
        char *packet = (char *)urb->transfer_buffer;
@@ -609,7 +609,7 @@ static int ssu100_process_packet(struct urb *urb)
                ch = packet;
 
        if (!len)
-               return 0;       /* status only */
+               return; /* status only */
 
        if (port->port.console && port->sysrq) {
                for (i = 0; i < len; i++, ch++) {
@@ -619,24 +619,7 @@ static int ssu100_process_packet(struct urb *urb)
        } else
                tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len);
 
-       return len;
-}
-
-static void ssu100_process_read_urb(struct urb *urb)
-{
-       struct usb_serial_port *port = urb->context;
-       struct tty_struct *tty;
-       int count;
-
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
-       count = ssu100_process_packet(urb);
-
-       if (count)
-               tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&port->port);
 }
 
 static struct usb_serial_driver ssu100_device = {
index 2ffa6ae3b5edc87909b4177bf398b320b3d96dad..be05e6caf9a3c501f617c92cee83a6ba84469a28 100644 (file)
@@ -48,7 +48,6 @@ static void symbol_int_callback(struct urb *urb)
        unsigned char *data = urb->transfer_buffer;
        struct usb_serial_port *port = priv->port;
        int status = urb->status;
-       struct tty_struct *tty;
        int result;
        int data_length;
 
@@ -82,13 +81,8 @@ static void symbol_int_callback(struct urb *urb)
                 * we pretty much just ignore the size and send everything
                 * else to the tty layer.
                 */
-               tty = tty_port_tty_get(&port->port);
-               if (tty) {
-                       tty_insert_flip_string(&port->port, &data[1],
-                                       data_length);
-                       tty_flip_buffer_push(tty);
-                       tty_kref_put(tty);
-               }
+               tty_insert_flip_string(&port->port, &data[1], data_length);
+               tty_flip_buffer_push(&port->port);
        } else {
                dev_dbg(&priv->udev->dev,
                        "Improper amount of data received from the device, "
index 05077e3c7631d644960c411703169e10ec8e45a1..39cb9b807c3cf998842c39267e9d217b82460e59 100644 (file)
@@ -121,8 +121,8 @@ static void ti_interrupt_callback(struct urb *urb);
 static void ti_bulk_in_callback(struct urb *urb);
 static void ti_bulk_out_callback(struct urb *urb);
 
-static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty,
-       unsigned char *data, int length);
+static void ti_recv(struct usb_serial_port *port, unsigned char *data,
+               int length);
 static void ti_send(struct ti_port *tport);
 static int ti_set_mcr(struct ti_port *tport, unsigned int mcr);
 static int ti_get_lsr(struct ti_port *tport);
@@ -1118,7 +1118,6 @@ static void ti_bulk_in_callback(struct urb *urb)
        struct device *dev = &urb->dev->dev;
        int status = urb->status;
        int retval = 0;
-       struct tty_struct *tty;
 
        switch (status) {
        case 0:
@@ -1145,23 +1144,18 @@ static void ti_bulk_in_callback(struct urb *urb)
                return;
        }
 
-       tty = tty_port_tty_get(&port->port);
-       if (tty) {
-               if (urb->actual_length) {
-                       usb_serial_debug_data(dev, __func__, urb->actual_length,
-                                             urb->transfer_buffer);
+       if (urb->actual_length) {
+               usb_serial_debug_data(dev, __func__, urb->actual_length,
+                                     urb->transfer_buffer);
 
-                       if (!tport->tp_is_open)
-                               dev_dbg(dev, "%s - port closed, dropping data\n",
-                                       __func__);
-                       else
-                               ti_recv(port, tty, urb->transfer_buffer,
-                                               urb->actual_length);
-                       spin_lock(&tport->tp_lock);
-                       tport->tp_icount.rx += urb->actual_length;
-                       spin_unlock(&tport->tp_lock);
-               }
-               tty_kref_put(tty);
+               if (!tport->tp_is_open)
+                       dev_dbg(dev, "%s - port closed, dropping data\n",
+                               __func__);
+               else
+                       ti_recv(port, urb->transfer_buffer, urb->actual_length);
+               spin_lock(&tport->tp_lock);
+               tport->tp_icount.rx += urb->actual_length;
+               spin_unlock(&tport->tp_lock);
        }
 
 exit:
@@ -1209,8 +1203,8 @@ static void ti_bulk_out_callback(struct urb *urb)
 }
 
 
-static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty,
-       unsigned char *data, int length)
+static void ti_recv(struct usb_serial_port *port, unsigned char *data,
+               int length)
 {
        int cnt;
 
@@ -1222,11 +1216,10 @@ static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty,
                        if (cnt == 0)
                                break;
                }
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&port->port);
                data += cnt;
                length -= cnt;
        } while (length > 0);
-
 }
 
 
index 293b460030cb2c5a67addcf2d721fac43e2e257f..a547c91e3c0557c609d2b52712699af9ada6c7d4 100644 (file)
@@ -275,7 +275,6 @@ static void usb_wwan_indat_callback(struct urb *urb)
        int err;
        int endpoint;
        struct usb_serial_port *port;
-       struct tty_struct *tty;
        struct device *dev;
        unsigned char *data = urb->transfer_buffer;
        int status = urb->status;
@@ -288,16 +287,12 @@ static void usb_wwan_indat_callback(struct urb *urb)
                dev_dbg(dev, "%s: nonzero status: %d on endpoint %02x.\n",
                        __func__, status, endpoint);
        } else {
-               tty = tty_port_tty_get(&port->port);
-               if (tty) {
-                       if (urb->actual_length) {
-                               tty_insert_flip_string(&port->port, data,
-                                               urb->actual_length);
-                               tty_flip_buffer_push(tty);
-                       } else
-                               dev_dbg(dev, "%s: empty read urb received\n", __func__);
-                       tty_kref_put(tty);
-               }
+               if (urb->actual_length) {
+                       tty_insert_flip_string(&port->port, data,
+                                       urb->actual_length);
+                       tty_flip_buffer_push(&port->port);
+               } else
+                       dev_dbg(dev, "%s: empty read urb received\n", __func__);
 
                /* Resubmit urb so we continue receiving */
                err = usb_submit_urb(urb, GFP_ATOMIC);
index f16a47a13a0926991ea7f6cdcadb77d75752ae57..f89acd1ed6d3f1735c3a1605cb6caa279a2ff040 100644 (file)
@@ -387,7 +387,6 @@ extern void do_SAK(struct tty_struct *tty);
 extern void __do_SAK(struct tty_struct *tty);
 extern void disassociate_ctty(int priv);
 extern void no_tty(void);
-extern void tty_flip_buffer_push(struct tty_struct *tty);
 extern void tty_flush_to_ldisc(struct tty_struct *tty);
 extern void tty_buffer_free_all(struct tty_port *port);
 extern void tty_buffer_flush(struct tty_struct *tty);
index 5cb694aba322564346836826cacdb81889d6f778..c5572807633a44b63414293d4bee3849c572b6c4 100644 (file)
@@ -10,6 +10,7 @@ extern int tty_prepare_flip_string(struct tty_port *port,
                unsigned char **chars, size_t size);
 extern int tty_prepare_flip_string_flags(struct tty_port *port,
                unsigned char **chars, char **flags, size_t size);
+extern void tty_flip_buffer_push(struct tty_port *port);
 void tty_schedule_flip(struct tty_struct *tty);
 
 static inline int tty_insert_flip_char(struct tty_port *port,
index cbec3b64287199f9d94b6476b624984f8e6831ce..b6e44ad6cca6e691556f630bcb056373684203ad 100644 (file)
@@ -541,23 +541,21 @@ int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
 static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb)
 {
        struct rfcomm_dev *dev = dlc->owner;
-       struct tty_struct *tty;
 
        if (!dev) {
                kfree_skb(skb);
                return;
        }
 
-       tty = dev->port.tty;
-       if (!tty || !skb_queue_empty(&dev->pending)) {
+       if (!skb_queue_empty(&dev->pending)) {
                skb_queue_tail(&dev->pending, skb);
                return;
        }
 
-       BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len);
+       BT_DBG("dlc %p len %d", dlc, skb->len);
 
        tty_insert_flip_string(&dev->port, skb->data, skb->len);
-       tty_flip_buffer_push(tty);
+       tty_flip_buffer_push(&dev->port);
 
        kfree_skb(skb);
 }
@@ -621,14 +619,10 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig)
 /* ---- TTY functions ---- */
 static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev)
 {
-       struct tty_struct *tty = dev->port.tty;
        struct sk_buff *skb;
        int inserted = 0;
 
-       if (!tty)
-               return;
-
-       BT_DBG("dev %p tty %p", dev, tty);
+       BT_DBG("dev %p", dev);
 
        rfcomm_dlc_lock(dev->dlc);
 
@@ -641,7 +635,7 @@ static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev)
        rfcomm_dlc_unlock(dev->dlc);
 
        if (inserted > 0)
-               tty_flip_buffer_push(tty);
+               tty_flip_buffer_push(&dev->port);
 }
 
 static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
index 2491f6f538713105b7eb4b7f541459aac0f64ad2..9a5fd3c3e530c5dc82c04ccf04abf0f93b0f3a28 100644 (file)
@@ -1136,14 +1136,14 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
                ircomm_tty_send_initial_parameters(self);
                ircomm_tty_link_established(self);
        }
+       tty_kref_put(tty);
 
        /*
         * Use flip buffer functions since the code may be called from interrupt
         * context
         */
        tty_insert_flip_string(&self->port, skb->data, skb->len);
-       tty_flip_buffer_push(tty);
-       tty_kref_put(tty);
+       tty_flip_buffer_push(&self->port);
 
        /* No need to kfree_skb - see ircomm_ttp_data_indication() */