Subject: [PATCH 005/008] USB: serial: sierra_close() modifications From: Elina Pasheva <epasheva@xxxxxxxxxxxxxxxxxx> The following is summary of changes we have made to sierra.c driver in [PATCH 005/008] from the series dealing with improving urb handling: - Moved sierra_close() before sierra_open() to resolve dependencies introduced by the code reorganization. - Modified sierra_close() to call sierra_stop_rx_urbs() and sierra_release_urb() functions added in previous patch. Signed-off-by: Elina Pasheva <epasheva@xxxxxxxxxxxxxxxxxx> --- drivers/usb/serial/sierra.c | 44 ++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 17 deletions(-) --- a/drivers/usb/serial/sierra.c 2009-05-04 18:24:45.000000000 -0700 +++ b/drivers/usb/serial/sierra.c 2009-05-04 18:29:01.000000000 -0700 @@ -691,6 +691,33 @@ static struct urb *sierra_setup_urb(stru return urb; } +static void sierra_close(struct usb_serial_port *port) +{ + int i; + struct usb_serial *serial = port->serial; + struct sierra_port_private *portdata; + + dev_dbg(&port->dev, "%s\n", __func__); + portdata = usb_get_serial_port_data(port); + + portdata->rts_state = 0; + portdata->dtr_state = 0; + + if (serial->dev) { + mutex_lock(&serial->disc_mutex); + if (!serial->disconnected) + sierra_send_setup(port); + mutex_unlock(&serial->disc_mutex); + + /* Stop reading urbs */ + sierra_stop_rx_urbs(port); + /* .. and release them */ + for (i = 0; i < N_IN_URB; i++) { + sierra_release_urb(portdata->in_urbs[i]); + portdata->in_urbs[i] = NULL; + } + } +} static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port, struct file *filp) @@ -762,23 +789,6 @@ static void sierra_dtr_rts(struct usb_se } } -static void sierra_close(struct usb_serial_port *port) -{ - int i; - struct usb_serial *serial = port->serial; - struct sierra_port_private *portdata; - - dev_dbg(&port->dev, "%s\n", __func__); - portdata = usb_get_serial_port_data(port); - - if (serial->dev) { - /* Stop reading/writing urbs */ - for (i = 0; i < N_IN_URB; i++) - usb_kill_urb(portdata->in_urbs[i]); - } - usb_kill_urb(port->interrupt_in_urb); -} - static int sierra_startup(struct usb_serial *serial) { struct usb_serial_port *port; -- 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