TTY: move low_latency to tty_port
authorJiri Slaby <jslaby@suse.cz>
Thu, 3 Jan 2013 14:53:05 +0000 (15:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jan 2013 06:23:16 +0000 (22:23 -0800)
One point is to have less places where we actually need tty pointer.
The other is that low_latency is bound to buffer processing and
buffers are now in tty_port. So it makes sense to move low_latency to
tty_port too.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 files changed:
arch/ia64/hp/sim/simserial.c
arch/mn10300/kernel/mn10300-serial.c
drivers/char/pcmcia/synclink_cs.c
drivers/isdn/gigaset/interface.c
drivers/net/caif/caif_serial.c
drivers/net/irda/irtty-sir.c
drivers/s390/char/con3215.c
drivers/s390/char/sclp_tty.c
drivers/s390/char/sclp_vt220.c
drivers/s390/char/tty3270.c
drivers/tty/amiserial.c
drivers/tty/ipwireless/tty.c
drivers/tty/mxser.c
drivers/tty/serial/cpm_uart/cpm_uart_core.c
drivers/tty/serial/crisv10.c
drivers/tty/serial/ifx6x60.c
drivers/tty/serial/ioc3_serial.c
drivers/tty/serial/ioc4_serial.c
drivers/tty/serial/max3100.c
drivers/tty/serial/mpsc.c
drivers/tty/serial/mrst_max3110.c
drivers/tty/serial/msm_serial_hs.c
drivers/tty/serial/serial_core.c
drivers/tty/synclink.c
drivers/tty/synclink_gt.c
drivers/tty/synclinkmp.c
drivers/tty/tty_buffer.c
include/linux/tty.h
net/irda/ircomm/ircomm_tty.c

index f8ae5d8eb1060400aacc3ca09fe9c849bc39e3b8..942022a5bc861fa6deed2695ad6ba35043f01ae9 100644 (file)
@@ -436,7 +436,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
        struct tty_port *port = &info->port;
 
        tty->driver_data = info;
-       tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
        /*
         * figure out which console to use (should be one already)
index 54ef40ceaaedfeeb2f978b481bf03d34ff5c5639..ae61bd692b4b6a317dc8a4166004e9dd158c344e 100644 (file)
@@ -537,7 +537,7 @@ static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
        count = CIRC_CNT(port->rx_inp, port->rx_outp, MNSC_BUFFER_SIZE);
        count = tty_buffer_request_room(port, count);
        if (count == 0) {
-               if (!tty->low_latency)
+               if (!port->low_latency)
                        tty_flip_buffer_push(tty);
                return;
        }
@@ -546,7 +546,7 @@ try_again:
        /* pull chars out of the hat */
        ix = ACCESS_ONCE(port->rx_outp);
        if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) {
-               if (push && !tty->low_latency)
+               if (push && !port->low_latency)
                        tty_flip_buffer_push(tty);
                return;
        }
@@ -678,7 +678,7 @@ insert:
 
        count--;
        if (count <= 0) {
-               if (!tty->low_latency)
+               if (!port->low_latency)
                        tty_flip_buffer_push(tty);
                return;
        }
index 9bdfe27b2413658cb9060c7f8fd16561169918a9..92dc7327c7aa9b333b4ae2f09771dc34c4ec3714 100644 (file)
@@ -2522,7 +2522,7 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp)
                goto cleanup;
        }
 
-       tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
        spin_lock_irqsave(&info->netlock, flags);
        if (info->netcount) {
index dd2a57eca2e7e3b89cb7a41f4586a67b1d6d07a5..6dcecd40a8192fe787a9294b5b1369caaf6b997d 100644 (file)
@@ -164,7 +164,7 @@ static int if_open(struct tty_struct *tty, struct file *filp)
 
        if (cs->port.count == 1) {
                tty_port_tty_set(&cs->port, tty);
-               tty->low_latency = 1;
+               cs->port.low_latency = 1;
        }
 
        mutex_unlock(&cs->mutex);
index 5de74e76202134402420311d1fe824c7ce57055a..666891a9a2482b37f8dec4bc98195fceb4039c31 100644 (file)
@@ -91,7 +91,7 @@ static inline void update_tty_status(struct ser_device *ser)
                ser->tty->hw_stopped << 4 |
                ser->tty->flow_stopped << 3 |
                ser->tty->packet << 2 |
-               ser->tty->low_latency << 1 |
+               ser->tty->port->low_latency << 1 |
                ser->tty->warned;
 }
 static inline void debugfs_init(struct ser_device *ser, struct tty_struct *tty)
index 6e4d4b62c9a849326edae6598611328b110233be..a41267197839304be5ad0deaa00b93f59e0713e7 100644 (file)
@@ -210,7 +210,7 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t
  *    been received, which can now be decapsulated and delivered for
  *    further processing 
  *
- * calling context depends on underlying driver and tty->low_latency!
+ * calling context depends on underlying driver and tty->port->low_latency!
  * for example (low_latency: 1 / 0):
  * serial.c:   uart-interrupt / softint
  * usbserial:  urb-complete-interrupt / softint
index 4c6743dd5357c39e02361368d6cddde2dc5d7e46..41b75c5ae0d5d110be8147d632011b0df36f048f 100644 (file)
@@ -968,7 +968,7 @@ static int tty3215_open(struct tty_struct *tty, struct file * filp)
 
        tty_port_tty_set(&raw->port, tty);
 
-       tty->low_latency = 0;  /* don't use bottom half for pushing chars */
+       raw->port.low_latency = 0; /* don't use bottom half for pushing chars */
        /*
         * Start up 3215 device
         */
index 3ffddbb53d2f5dc5b4f71eaef586156bd573d4e5..19b7c516c07d46c6d1414dff907c1b7b336f2bc1 100644 (file)
@@ -65,7 +65,7 @@ sclp_tty_open(struct tty_struct *tty, struct file *filp)
 {
        tty_port_tty_set(&sclp_port, tty);
        tty->driver_data = NULL;
-       tty->low_latency = 0;
+       sclp_port.low_latency = 0;
        return 0;
 }
 
index b5507f199b24e35546b098d6331e18daf47b0254..0eca99b98712f7db0f5c918ce79b937727e0ccb3 100644 (file)
@@ -495,7 +495,7 @@ sclp_vt220_open(struct tty_struct *tty, struct file *filp)
 {
        if (tty->count == 1) {
                tty_port_tty_set(&sclp_vt220_port, tty);
-               tty->low_latency = 0;
+               sclp_vt220_port.low_latency = 0;
                if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
                        tty->winsize.ws_row = 24;
                        tty->winsize.ws_col = 80;
index 43ea0593bdb01aafcc82ceb602e7432c32239711..3860e796b65f945a4aa73a92166356205dc589f8 100644 (file)
@@ -860,7 +860,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
                tty->driver_data = tp;
                tty->winsize.ws_row = tp->view.rows - 2;
                tty->winsize.ws_col = tp->view.cols;
-               tty->low_latency = 0;
+               tp->port.low_latency = 0;
                /* why to reassign? */
                tty_port_tty_set(&tp->port, tty);
                tp->inattr = TF_INPUT;
@@ -893,7 +893,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
        }
 
        tty_port_tty_set(&tp->port, tty);
-       tty->low_latency = 0;
+       tp->port.low_latency = 0;
        tty->winsize.ws_row = tp->view.rows - 2;
        tty->winsize.ws_col = tp->view.cols;
 
index 2e670d0c5366603291801be5ba9af528aafe426a..2d1357acbc234b1d2a3e80a53936d425fe0e5a4b 100644 (file)
@@ -1099,7 +1099,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
        state->custom_divisor = new_serial.custom_divisor;
        port->close_delay = new_serial.close_delay * HZ/100;
        port->closing_wait = new_serial.closing_wait * HZ/100;
-       tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
 check_and_exit:
        if (port->flags & ASYNC_INITIALIZED) {
@@ -1528,7 +1528,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
        if (serial_paranoia_check(info, tty->name, "rs_open"))
                return -ENODEV;
 
-       tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
        retval = startup(tty, info);
        if (retval) {
index a3ad5e14cbef1fc5de9d2a35a42e276208fe79a3..c43da74454326e72a3344675c7ccac642cdbe5a5 100644 (file)
@@ -106,7 +106,7 @@ static int ipw_open(struct tty_struct *linux_tty, struct file *filp)
 
        tty->port.tty = linux_tty;
        linux_tty->driver_data = tty;
-       linux_tty->low_latency = 1;
+       tty->port.low_latency = 1;
 
        if (tty->tty_type == TTYTYPE_MODEM)
                ipwireless_ppp_open(tty->network);
index 450c4507cb5b00ece2ffc657c3fa5dd532da216f..e9cdfdfe06e95ceb62c73688c45d0eec05746716 100644 (file)
@@ -1264,7 +1264,7 @@ static int mxser_set_serial_info(struct tty_struct *tty,
                                (new_serial.flags & ASYNC_FLAGS));
                port->close_delay = new_serial.close_delay * HZ / 100;
                port->closing_wait = new_serial.closing_wait * HZ / 100;
-               tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+               port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
                if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST &&
                                (new_serial.baud_base != info->baud_base ||
                                new_serial.custom_divisor !=
index 108122f8f3c2fc7e058751f0200b2d425e4f0199..0bb24378a3c07b2fc6301b244540ff97c066e0be 100644 (file)
@@ -508,7 +508,7 @@ static void cpm_uart_set_termios(struct uart_port *port,
 
        baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
        if (baud < HW_BUF_SPD_THRESHOLD ||
-           (pinfo->port.state && pinfo->port.state->port.tty->low_latency))
+           (pinfo->port.state && pinfo->port.state->port.low_latency))
                pinfo->rx_fifosize = 1;
        else
                pinfo->rx_fifosize = RX_BUF_SIZE;
index c82601d4dc538e4bfd201087ca045ab506afde27..52449adc09ac164089ed8f8dd9c1113a35d93dda 100644 (file)
@@ -3462,7 +3462,7 @@ set_serial_info(struct e100_serial *info,
        info->type = new_serial.type;
        info->close_delay = new_serial.close_delay;
        info->closing_wait = new_serial.closing_wait;
-       info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       info->port.low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
  check_and_exit:
        if (info->flags & ASYNC_INITIALIZED) {
@@ -4106,7 +4106,7 @@ rs_open(struct tty_struct *tty, struct file * filp)
        tty->driver_data = info;
        info->port.tty = tty;
 
-       tty->low_latency = !!(info->flags & ASYNC_LOW_LATENCY);
+       info->port.low_latency = !!(info->flags & ASYNC_LOW_LATENCY);
 
        /*
         * If the port is in the middle of closing, bail out now
index bfb634ea814572fb50409f5abc246ba18138c744..4bc6e47890b4c0f400a2d5e7715094413a5f7f0a 100644 (file)
@@ -615,7 +615,7 @@ static int ifx_port_activate(struct tty_port *port, struct tty_struct *tty)
        tty->driver_data = ifx_dev;
 
        /* allows flip string push from int context */
-       tty->low_latency = 1;
+       port->low_latency = 1;
 
        /* set flag to allows data transfer */
        set_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags);
index 0f25ce49c7f95d310c4ab4a8ae2d34f3db39bc3f..edbdc4e45075f30e6f4b47f947a8827b0db90b6d 100644 (file)
@@ -1000,7 +1000,7 @@ ioc3_change_speed(struct uart_port *the_port,
 
        the_port->ignore_status_mask = N_ALL_INPUT;
 
-       state->port.tty->low_latency = 1;
+       state->port.low_latency = 1;
 
        if (iflag & IGNPAR)
                the_port->ignore_status_mask &= ~(N_PARITY_ERROR
index 3b021b03ae56d7c7b08b0fcd5b3242191de2c4af..86f64ed89b459371fb67a28c922d70a03bf93aeb 100644 (file)
@@ -1740,7 +1740,7 @@ ioc4_change_speed(struct uart_port *the_port,
 
        the_port->ignore_status_mask = N_ALL_INPUT;
 
-       state->port.tty->low_latency = 1;
+       state->port.low_latency = 1;
 
        if (iflag & IGNPAR)
                the_port->ignore_status_mask &= ~(N_PARITY_ERROR
index 7ce3197087bbab460e1b498cb2e864304b78ea44..e238e80cd98143d1a6c988afaca525a7c478ccb3 100644 (file)
@@ -530,7 +530,7 @@ max3100_set_termios(struct uart_port *port, struct ktermios *termios,
                        MAX3100_STATUS_OE;
 
        /* we are sending char from a workqueue so enable */
-       s->port.state->port.tty->low_latency = 1;
+       s->port.state->port.low_latency = 1;
 
        if (s->poll_time > 0)
                del_timer_sync(&s->timer);
index 4bcbc66c48c4b2baea2ca8b151c7b404a01a7b2f..6f2d2ceb326a45aa2076514a7d057c542d806b6e 100644 (file)
@@ -970,7 +970,7 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi)
 #endif
                /* Following use of tty struct directly is deprecated */
                if (tty_buffer_request_room(port, bytes_in) < bytes_in) {
-                       if (tty->low_latency)
+                       if (port->low_latency)
                                tty_flip_buffer_push(tty);
                        /*
                         * If this failed then we will throw away the bytes
index 3b8df7b93b73797ee8349f390c1728b2f1f82370..4632db7a24b73b5a42ca0441aa2bdd48d57b5104 100644 (file)
@@ -495,7 +495,7 @@ static int serial_m3110_startup(struct uart_port *port)
                        | WC_BAUD_DR2;
 
        /* as we use thread to handle tx/rx, need set low latency */
-       port->state->port.tty->low_latency = 1;
+       port->state->port.low_latency = 1;
 
        if (max->irq) {
                max->read_thread = NULL;
index 11b7f5b2eb5fa25b7057bb2fd31bf66a8f08d6f8..c356ffff3c711a9f53cca21983840e1f621c13f3 100644 (file)
@@ -1400,7 +1400,7 @@ static int msm_hs_startup(struct uart_port *uport)
 
        /* do not let tty layer execute RX in global workqueue, use a
         * dedicated workqueue managed by this driver */
-       uport->state->port.tty->low_latency = 1;
+       uport->state->port.low_latency = 1;
 
        /* turn on uart clk */
        ret = msm_hs_init_clk_locked(uport);
index 675343a20f24889cdaf7d9e97dc59d60a17dce4f..b5c4e64f2990ae1c34a66c8438774a0f4475b88b 100644 (file)
@@ -867,9 +867,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
        port->closing_wait    = closing_wait;
        if (new_info->xmit_fifo_size)
                uport->fifosize = new_info->xmit_fifo_size;
-       if (port->tty)
-               port->tty->low_latency =
-                       (uport->flags & UPF_LOW_LATENCY) ? 1 : 0;
+       port->low_latency = (uport->flags & UPF_LOW_LATENCY) ? 1 : 0;
 
  check_and_exit:
        retval = 0;
@@ -1565,7 +1563,8 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
         */
        tty->driver_data = state;
        state->uart_port->state = state;
-       tty->low_latency = (state->uart_port->flags & UPF_LOW_LATENCY) ? 1 : 0;
+       state->port.low_latency =
+               (state->uart_port->flags & UPF_LOW_LATENCY) ? 1 : 0;
        tty_port_tty_set(port, tty);
 
        /*
index 33656b35db058ce2ee0ad7c3be20aa6373198dff..2f6967d61a80e68d9146e41193969d2292271de0 100644 (file)
@@ -3415,7 +3415,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
                goto cleanup;
        }
        
-       info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
        spin_lock_irqsave(&info->netlock, flags);
        if (info->netcount) {
index 473d7406db830700aa94f3b1b11f5a4dc286bc55..9a0358a1e0dd43a37aa4a63bdf0a7b08182fd5f8 100644 (file)
@@ -682,7 +682,7 @@ static int open(struct tty_struct *tty, struct file *filp)
        }
 
        mutex_lock(&info->port.mutex);
-       info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
        spin_lock_irqsave(&info->netlock, flags);
        if (info->netcount) {
index f5794f3d840feb2585b60f8b63d0f4bc921f57ba..419f58ff4a1307f6220aeb598ffeee754543a6e0 100644 (file)
@@ -761,7 +761,7 @@ static int open(struct tty_struct *tty, struct file *filp)
                goto cleanup;
        }
 
-       info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
        spin_lock_irqsave(&info->netlock, flags);
        if (info->netcount) {
index 31873e42602a98ba29cf2b98708ce3080337bc53..1bfe97a8e2eba6f4be46c6f52587d738cb164632 100644 (file)
@@ -364,7 +364,7 @@ void tty_schedule_flip(struct tty_struct *tty)
 {
        struct tty_bufhead *buf = &tty->port->buf;
        unsigned long flags;
-       WARN_ON(tty->low_latency);
+       WARN_ON(tty->port->low_latency);
 
        spin_lock_irqsave(&buf->lock, flags);
        if (buf->tail != NULL)
@@ -538,7 +538,7 @@ static void flush_to_ldisc(struct work_struct *work)
  */
 void tty_flush_to_ldisc(struct tty_struct *tty)
 {
-       if (!tty->low_latency)
+       if (!tty->port->low_latency)
                flush_work(&tty->port->buf.work);
 }
 
@@ -547,7 +547,8 @@ void tty_flush_to_ldisc(struct tty_struct *tty)
  *     @tty: tty to push
  *
  *     Queue a push of the terminal flip buffers to the line discipline. This
- *     function must not be called from IRQ context if tty->low_latency is set.
+ *     function must not be called from IRQ context if port->low_latency is
+ *     set.
  *
  *     In the event of the queue being busy for flipping the work will be
  *     held off and retried later.
@@ -565,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->low_latency)
+       if (tty->port->low_latency)
                flush_to_ldisc(&buf->work);
        else
                schedule_work(&buf->work);
index 8db1b569c37a4cb5bb6965adc420bff2030fb47c..f16a47a13a0926991ea7f6cdcadb77d75752ae57 100644 (file)
@@ -202,7 +202,8 @@ struct tty_port {
        unsigned long           iflags;         /* TTYP_ internal flags */
 #define TTYP_FLUSHING                  1  /* Flushing to ldisc in progress */
 #define TTYP_FLUSHPENDING              2  /* Queued buffer flush pending */
-       unsigned char           console:1;      /* port is a console */
+       unsigned char           console:1,      /* port is a console */
+                               low_latency:1;  /* direct buffer flush */
        struct mutex            mutex;          /* Locking */
        struct mutex            buf_mutex;      /* Buffer alloc lock */
        unsigned char           *xmit_buf;      /* Optional buffer */
@@ -254,7 +255,7 @@ struct tty_struct {
        int count;
        struct winsize winsize;         /* termios mutex */
        unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
-       unsigned char low_latency:1, warned:1;
+       unsigned char warned:1;
        unsigned char ctrl_status;      /* ctrl_lock */
        unsigned int receive_room;      /* Bytes free for queue */
 
index 14b08e376f9fdb430b02bcbc59904f63069565d4..2491f6f538713105b7eb4b7f541459aac0f64ad2 100644 (file)
@@ -452,7 +452,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
                   self->line, self->port.count);
 
        /* Not really used by us, but lets do it anyway */
-       tty->low_latency = (self->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       self->port.low_latency = (self->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
        /*
         * If the port is the middle of closing, bail out now