USB: serial: remove unnecessary bulk-urb re-fills
authorJohan Hovold <jhovold@gmail.com>
Sun, 6 Nov 2011 18:06:30 +0000 (19:06 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Nov 2011 18:35:27 +0000 (10:35 -0800)
Remove unnecessary re-fills of bulk urbs whose fields have not changed
since port probe.

Compile-only tested.

Cc: Matthias Bruestle and Harald Welte <support@reiner-sct.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/cyberjack.c
drivers/usb/serial/garmin_gps.c
drivers/usb/serial/io_ti.c
drivers/usb/serial/omninet.c

index 2b220e811bf16623094aca0e2f62e589b522477d..98bf83349838acdb1a98bb5e2a1861aef495e13f 100644 (file)
@@ -207,7 +207,6 @@ static void cyberjack_close(struct usb_serial_port *port)
 static int cyberjack_write(struct tty_struct *tty,
        struct usb_serial_port *port, const unsigned char *buf, int count)
 {
-       struct usb_serial *serial = port->serial;
        struct cyberjack_private *priv = usb_get_serial_port_data(port);
        unsigned long flags;
        int result;
@@ -260,13 +259,7 @@ static int cyberjack_write(struct tty_struct *tty,
                priv->wrsent = length;
 
                /* set up our urb */
-               usb_fill_bulk_urb(port->write_urb, serial->dev,
-                             usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress),
-                             port->write_urb->transfer_buffer, length,
-                             ((serial->type->write_bulk_callback) ?
-                              serial->type->write_bulk_callback :
-                              cyberjack_write_bulk_callback),
-                             port);
+               port->write_urb->transfer_buffer_length = length;
 
                /* send the data out the bulk port */
                result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
@@ -447,13 +440,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
                priv->wrsent += length;
 
                /* set up our urb */
-               usb_fill_bulk_urb(port->write_urb, port->serial->dev,
-                             usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress),
-                             port->write_urb->transfer_buffer, length,
-                             ((port->serial->type->write_bulk_callback) ?
-                              port->serial->type->write_bulk_callback :
-                              cyberjack_write_bulk_callback),
-                             port);
+               port->write_urb->transfer_buffer_length = length;
 
                /* send the data out the bulk port */
                result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
index d39da13d3dba42b15c7ecb05e5b663fcd5cf1234..bf12565f8e87319ff82e6861ef9ef821677ef7ea 100644 (file)
@@ -1276,7 +1276,6 @@ static void garmin_read_int_callback(struct urb *urb)
        unsigned long flags;
        int retval;
        struct usb_serial_port *port = urb->context;
-       struct usb_serial *serial = port->serial;
        struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
        unsigned char *data = urb->transfer_buffer;
        int status = urb->status;
@@ -1310,12 +1309,6 @@ static void garmin_read_int_callback(struct urb *urb)
                if (0 == (garmin_data_p->flags & FLAGS_BULK_IN_ACTIVE)) {
 
                        /* bulk data available */
-                       usb_fill_bulk_urb(port->read_urb, serial->dev,
-                                       usb_rcvbulkpipe(serial->dev,
-                                               port->bulk_in_endpointAddress),
-                                       port->read_urb->transfer_buffer,
-                                       port->read_urb->transfer_buffer_length,
-                                       garmin_read_bulk_callback, port);
                        retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
                        if (retval) {
                                dev_err(&port->dev,
index 589f11a0f7e222d065afd4a7ee02945ad0529470..e44d375edaad2a785eacd7eabcfbba5d03cc26e3 100644 (file)
@@ -2106,12 +2106,7 @@ static void edge_send(struct tty_struct *tty)
                                port->write_urb->transfer_buffer);
 
        /* set up our urb */
-       usb_fill_bulk_urb(port->write_urb, port->serial->dev,
-                          usb_sndbulkpipe(port->serial->dev,
-                                           port->bulk_out_endpointAddress),
-                          port->write_urb->transfer_buffer, count,
-                          edge_bulk_out_callback,
-                          port);
+       port->write_urb->transfer_buffer_length = count;
 
        /* send the data out the bulk port */
        result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
index f3824641099ae5a1403105b159a9d2f900b07c43..45a8c55881d348cb52747c9c241d6573c17f0fc3 100644 (file)
@@ -148,13 +148,6 @@ static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port)
        tty_port_tty_set(&wport->port, tty);
 
        /* Start reading from the device */
-       usb_fill_bulk_urb(port->read_urb, serial->dev,
-                       usb_rcvbulkpipe(serial->dev,
-                               port->bulk_in_endpointAddress),
-                       port->read_urb->transfer_buffer,
-                       port->read_urb->transfer_buffer_length,
-                       omninet_read_bulk_callback, port);
-
        result = usb_submit_urb(port->read_urb, GFP_KERNEL);
        if (result)
                dev_err(&port->dev,
@@ -211,11 +204,6 @@ static void omninet_read_bulk_callback(struct urb *urb)
        }
 
        /* Continue trying to always read  */
-       usb_fill_bulk_urb(urb, port->serial->dev,
-                       usb_rcvbulkpipe(port->serial->dev,
-                                       port->bulk_in_endpointAddress),
-                       urb->transfer_buffer, urb->transfer_buffer_length,
-                       omninet_read_bulk_callback, port);
        result = usb_submit_urb(urb, GFP_ATOMIC);
        if (result)
                dev_err(&port->dev,