USB: removal of tty->low_latency hack dating back to the old serial code
authorOliver Neukum <oliver@neukum.org>
Mon, 20 Apr 2009 15:28:53 +0000 (17:28 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 23 Apr 2009 21:15:29 +0000 (14:15 -0700)
This removes tty->low_latency from all USB serial drivers that push
data into the tty layer at hard interrupt context. It's no longer needed
and actually harmful.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18 files changed:
drivers/usb/serial/cyberjack.c
drivers/usb/serial/cypress_m8.c
drivers/usb/serial/empeg.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/ipaq.c
drivers/usb/serial/ipw.c
drivers/usb/serial/iuu_phoenix.c
drivers/usb/serial/kobil_sct.c
drivers/usb/serial/mos7720.c
drivers/usb/serial/mos7840.c
drivers/usb/serial/opticon.c
drivers/usb/serial/option.c
drivers/usb/serial/sierra.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/visor.c

index 858bdd0..dd501bb 100644 (file)
@@ -175,13 +175,6 @@ static int  cyberjack_open(struct tty_struct *tty,
        dbg("%s - usb_clear_halt", __func__);
        usb_clear_halt(port->serial->dev, port->write_urb->pipe);
 
-       /* force low_latency on so that our tty_push actually forces
-        * the data through, otherwise it is scheduled, and with high
-        * data rates (like with OHCI) data can get lost.
-        */
-       if (tty)
-               tty->low_latency = 1;
-
        priv = usb_get_serial_port_data(port);
        spin_lock_irqsave(&priv->lock, flags);
        priv->rdtodo = 0;
index eae4740..e568710 100644 (file)
@@ -656,10 +656,6 @@ static int cypress_open(struct tty_struct *tty,
        priv->rx_flags = 0;
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       /* setting to zero could cause data loss */
-       if (tty)
-               tty->low_latency = 1;
-
        /* raise both lines and set termios */
        spin_lock_irqsave(&priv->lock, flags);
        priv->line_control = CONTROL_DTR | CONTROL_RTS;
index 8a69cce..c709ec4 100644 (file)
@@ -478,12 +478,6 @@ static void empeg_set_termios(struct tty_struct *tty,
        termios->c_cflag
                |= CS8;         /* character size 8 bits */
 
-       /*
-        * Force low_latency on; otherwise the pushes are scheduled;
-        * this is bad as it opens up the possibility of dropping bytes
-        * on the floor.  We don't want to drop bytes on the floor. :)
-        */
-       tty->low_latency = 1;
        tty_encode_baud_rate(tty, 115200, 115200);
 }
 
index a26a0e2..586d30f 100644 (file)
@@ -973,14 +973,6 @@ static int garmin_open(struct tty_struct *tty,
 
        dbg("%s - port %d", __func__, port->number);
 
-       /*
-        * Force low_latency on so that our tty_push actually forces the data
-        * through, otherwise it is scheduled, and with high data rates (like
-        * with OHCI) data can get lost.
-        */
-       if (tty)
-               tty->low_latency = 1;
-
        spin_lock_irqsave(&garmin_data_p->lock, flags);
        garmin_data_p->mode  = initial_mode;
        garmin_data_p->count = 0;
index 9d57cac..4cec990 100644 (file)
@@ -122,12 +122,6 @@ int usb_serial_generic_open(struct tty_struct *tty,
 
        dbg("%s - port %d", __func__, port->number);
 
-       /* force low_latency on so that our tty_push actually forces the data
-          through, otherwise it is scheduled, and with high data rates (like
-          with OHCI) data can get lost. */
-       if (tty)
-               tty->low_latency = 1;
-
        /* clear the throttle flags */
        spin_lock_irqsave(&port->lock, flags);
        port->throttled = 0;
index e85c8c0..fb4a73d 100644 (file)
@@ -193,8 +193,6 @@ static const struct divisor_table_entry divisor_table[] = {
 /* local variables */
 static int debug;
 
-static int low_latency = 1;    /* tty low latency flag, on by default */
-
 static atomic_t CmdUrbs;       /* Number of outstanding Command Write Urbs */
 
 
@@ -867,9 +865,6 @@ static int edge_open(struct tty_struct *tty,
        if (edge_port == NULL)
                return -ENODEV;
 
-       if (tty)
-               tty->low_latency = low_latency;
-
        /* see if we've set up our endpoint info yet (can't set it up
           in edge_startup as the structures were not set up at that time.) */
        serial = port->serial;
@@ -3299,6 +3294,3 @@ MODULE_FIRMWARE("edgeport/down2.fw");
 
 module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
-
-module_param(low_latency, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(low_latency, "Low latency enabled or not");
index c3cdd00..513b25e 100644 (file)
@@ -76,7 +76,6 @@ struct edgeport_uart_buf_desc {
 #define EDGE_READ_URB_STOPPING 1
 #define EDGE_READ_URB_STOPPED  2
 
-#define EDGE_LOW_LATENCY       1
 #define EDGE_CLOSING_WAIT      4000    /* in .01 sec */
 
 #define EDGE_OUT_BUF_SIZE      1024
@@ -232,7 +231,6 @@ static unsigned short OperationalBuildNumber;
 
 static int debug;
 
-static int low_latency = EDGE_LOW_LATENCY;
 static int closing_wait = EDGE_CLOSING_WAIT;
 static int ignore_cpu_rev;
 static int default_uart_mode;          /* RS232 */
@@ -1850,9 +1848,6 @@ static int edge_open(struct tty_struct *tty,
        if (edge_port == NULL)
                return -ENODEV;
 
-       if (tty)
-               tty->low_latency = low_latency;
-
        port_number = port->number - port->serial->minor;
        switch (port_number) {
        case 0:
@@ -3008,9 +3003,6 @@ MODULE_FIRMWARE("edgeport/down3.bin");
 module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
 
-module_param(low_latency, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(low_latency, "Low latency enabled or not");
-
 module_param(closing_wait, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs");
 
index ef92095..cd62825 100644 (file)
@@ -631,13 +631,7 @@ static int ipaq_open(struct tty_struct *tty,
                priv->free_len += PACKET_SIZE;
        }
 
-       /*
-        * Force low latency on. This will immediately push data to the line
-        * discipline instead of queueing.
-        */
-
        if (tty) {
-               tty->low_latency = 1;
                /* FIXME: These two are bogus */
                tty->raw = 1;
                tty->real_raw = 1;
index f530032..da2a2b4 100644 (file)
@@ -207,9 +207,6 @@ static int ipw_open(struct tty_struct *tty,
        if (!buf_flow_init)
                return -ENOMEM;
 
-       if (tty)
-               tty->low_latency = 1;
-
        /* --1: Tell the modem to initialize (we think) From sniffs this is
         *      always the first thing that gets sent to the modem during
         *      opening of the device */
index 2314c6a..4473d44 100644 (file)
@@ -1051,7 +1051,6 @@ static int iuu_open(struct tty_struct *tty,
                tty->termios->c_oflag = 0;
                tty->termios->c_iflag = 0;
                priv->termios_initialized = 1;
-               tty->low_latency = 1;
                priv->poll = 0;
         }
        spin_unlock_irqrestore(&priv->lock, flags);
index 6286baa..c148544 100644 (file)
@@ -231,13 +231,7 @@ static int kobil_open(struct tty_struct *tty,
        /* someone sets the dev to 0 if the close method has been called */
        port->interrupt_in_urb->dev = port->serial->dev;
 
-
-       /* force low_latency on so that our tty_push actually forces
-        * the data through, otherwise it is scheduled, and with high
-        * data rates (like with OHCI) data can get lost.
-        */
        if (tty) {
-               tty->low_latency = 1;
 
                /* Default to echo off and other sane device settings */
                tty->termios->c_lflag = 0;
index e772cc0..24e3b5d 100644 (file)
@@ -446,13 +446,6 @@ static int mos7720_open(struct tty_struct *tty,
        data = 0x0c;
        send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data);
 
-       /* force low_latency on so that our tty_push actually forces *
-        * the data through,otherwise it is scheduled, and with      *
-        * high data rates (like with OHCI) data can get lost.       */
-
-       if (tty)
-               tty->low_latency = 1;
-
        /* see if we've set up our endpoint info yet   *
         * (can't set it up in mos7720_startup as the  *
         * structures were not set up at that time.)   */
index 499b7b8..84fb1dc 100644 (file)
@@ -1007,12 +1007,6 @@ static int mos7840_open(struct tty_struct *tty,
        status = mos7840_set_reg_sync(port, mos7840_port->ControlRegOffset,
                                                                        Data);
 
-       /* force low_latency on so that our tty_push actually forces *
-        * the data through,otherwise it is scheduled, and with      *
-        * high data rates (like with OHCI) data can get lost.       */
-       if (tty)
-               tty->low_latency = 1;
-
        /* Check to see if we've set up our endpoint info yet    *
         * (can't set it up in mos7840_startup as the structures *
         * were not set up at that time.)                        */
index 839583d..b500ad1 100644 (file)
@@ -159,14 +159,6 @@ static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port,
        priv->port = port;
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       /*
-        * Force low_latency on so that our tty_push actually forces the data
-        * through, otherwise it is scheduled, and with high data rates (like
-        * with OHCI) data can get lost.
-        */
-       if (tty)
-               tty->low_latency = 1;
-
        /* Start reading from the device */
        usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev,
                          usb_rcvbulkpipe(priv->udev,
index 47bd070..7817b82 100644 (file)
@@ -936,9 +936,6 @@ static int option_open(struct tty_struct *tty,
                                usb_pipeout(urb->pipe), 0); */
        }
 
-       if (tty)
-               tty->low_latency = 1;
-
        option_send_setup(tty, port);
 
        return 0;
index 7da3775..913225c 100644 (file)
@@ -598,9 +598,6 @@ static int sierra_open(struct tty_struct *tty,
                }
        }
 
-       if (tty)
-               tty->low_latency = 1;
-
        sierra_send_setup(tty, port);
 
        /* start up the interrupt endpoint if we have one */
index 9c4c700..0a64bac 100644 (file)
 
 #define TI_TRANSFER_TIMEOUT    2
 
-#define TI_DEFAULT_LOW_LATENCY 0
 #define TI_DEFAULT_CLOSING_WAIT        4000            /* in .01 secs */
 
 /* supported setserial flags */
-#define TI_SET_SERIAL_FLAGS    (ASYNC_LOW_LATENCY)
+#define TI_SET_SERIAL_FLAGS    0
 
 /* read urb states */
 #define TI_READ_URB_RUNNING    0
@@ -161,7 +160,6 @@ static int ti_buf_get(struct circ_buf *cb, char *buf, int count);
 
 /* module parameters */
 static int debug;
-static int low_latency = TI_DEFAULT_LOW_LATENCY;
 static int closing_wait = TI_DEFAULT_CLOSING_WAIT;
 static ushort vendor_3410[TI_EXTRA_VID_PID_COUNT];
 static unsigned int vendor_3410_count;
@@ -296,10 +294,6 @@ MODULE_FIRMWARE("mts_edge.fw");
 module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes");
 
-module_param(low_latency, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(low_latency,
-               "TTY low_latency flag, 0=off, 1=on, default is off");
-
 module_param(closing_wait, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(closing_wait,
     "Maximum wait for data to drain in close, in .01 secs, default is 4000");
@@ -448,7 +442,6 @@ static int ti_startup(struct usb_serial *serial)
                spin_lock_init(&tport->tp_lock);
                tport->tp_uart_base_addr = (i == 0 ?
                                TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR);
-               tport->tp_flags = low_latency ? ASYNC_LOW_LATENCY : 0;
                tport->tp_closing_wait = closing_wait;
                init_waitqueue_head(&tport->tp_msr_wait);
                init_waitqueue_head(&tport->tp_write_wait);
@@ -528,10 +521,6 @@ static int ti_open(struct tty_struct *tty,
        if (mutex_lock_interruptible(&tdev->td_open_close_lock))
                return -ERESTARTSYS;
 
-       if (tty)
-               tty->low_latency =
-                               (tport->tp_flags & ASYNC_LOW_LATENCY) ? 1 : 0;
-
        port_number = port->number - port->serial->minor;
 
        memset(&(tport->tp_icount), 0x00, sizeof(tport->tp_icount));
@@ -1454,7 +1443,6 @@ static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport,
                return -EFAULT;
 
        tport->tp_flags = new_serial.flags & TI_SET_SERIAL_FLAGS;
-       tty->low_latency = (tport->tp_flags & ASYNC_LOW_LATENCY) ? 1 : 0;
        tport->tp_closing_wait = new_serial.closing_wait;
 
        return 0;
index 4facce3..5ac414b 100644 (file)
@@ -296,14 +296,6 @@ static int visor_open(struct tty_struct *tty, struct usb_serial_port *port,
        priv->throttled = 0;
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       /*
-        * Force low_latency on so that our tty_push actually forces the data
-        * through, otherwise it is scheduled, and with high data rates (like
-        * with OHCI) data can get lost.
-        */
-       if (tty)
-               tty->low_latency = 1;
-
        /* Start reading from the device */
        usb_fill_bulk_urb(port->read_urb, serial->dev,
                           usb_rcvbulkpipe(serial->dev,