Subject: [PATCH 006/008] [RESUBMIT] USB: serial: sierra_open() modifications From: Elina Pasheva <epasheva@xxxxxxxxxxxxxxxxxx> The following is summary of changes we have made to sierra.c driver in [PATCH 006/008] from the series dealing with improving urb handling: - Modified sierra_open() to call sierra_setup_urb() and sierra_submit_rx_urbs() functions; note urbs are allocated and submitted for each activated interface. Signed-off-by: Elina Pasheva <epasheva@xxxxxxxxxxxxxxxxxx> --- drivers/usb/serial/sierra.c | 51 ++++++++++++++-------------------- 1 file changed, 21 insertions(+), 30 deletions(-) --- a/drivers/usb/serial/sierra.c 2009-05-06 15:09:34.000000000 -0700 +++ b/drivers/usb/serial/sierra.c 2009-05-06 15:11:19.000000000 -0700 @@ -726,8 +726,9 @@ static int sierra_open(struct tty_struct struct sierra_port_private *portdata; struct usb_serial *serial = port->serial; int i; + int err; + int endpoint; struct urb *urb; - int result; portdata = usb_get_serial_port_data(port); @@ -737,42 +738,32 @@ static int sierra_open(struct tty_struct portdata->rts_state = 1; portdata->dtr_state = 1; - /* Reset low level data toggle and start reading from endpoints */ - for (i = 0; i < N_IN_URB; i++) { - urb = portdata->in_urbs[i]; - if (!urb) - continue; - if (urb->dev != serial->dev) { - dev_dbg(&port->dev, "%s: dev %p != %p\n", - __func__, urb->dev, serial->dev); - continue; - } + spin_lock_init(&portdata->lock); - /* - * make sure endpoint data toggle is synchronized with the - * device - */ - usb_clear_halt(urb->dev, urb->pipe); - - result = usb_submit_urb(urb, GFP_KERNEL); - if (result) { - dev_err(&port->dev, "submit urb %d failed (%d) %d\n", - i, result, urb->transfer_buffer_length); - } - } + endpoint = port->bulk_in_endpointAddress; + for (i = 0; i < ARRAY_SIZE(portdata->in_urbs); i++) { + urb = sierra_setup_urb(serial, endpoint, USB_DIR_IN, port, + IN_BUFLEN, GFP_KERNEL, + sierra_indat_callback); + portdata->in_urbs[i] = urb; + } + /* clear halt condition */ + usb_clear_halt(serial->dev, + usb_sndbulkpipe(serial->dev, endpoint) | USB_DIR_IN); + + err = sierra_submit_rx_urbs(port, GFP_KERNEL); + if (err) { + /* get rid of everything as in close */ + sierra_close(port); + return err; + } sierra_send_setup(port); - /* start up the interrupt endpoint if we have one */ - if (port->interrupt_in_urb) { - result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); - if (result) - dev_err(&port->dev, "submit irq_in urb failed %d\n", - result); - } return 0; } + static void sierra_dtr_rts(struct usb_serial_port *port, int on) { struct usb_serial *serial = port->serial; -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html