diff options
author | Johan Hovold <jhovold@gmail.com> | 2014-05-26 21:23:09 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-28 02:04:05 +0400 |
commit | c2e45d704723723e5691c7b4bcd0ff4aeb813522 (patch) | |
tree | 8b6a04df0e6cb961036fae3ddfcf07d7696e8f52 /drivers/usb/serial | |
parent | 0287d5c5cda82ebe87e79e5a298f40f0ca05e5ef (diff) | |
download | linux-c2e45d704723723e5691c7b4bcd0ff4aeb813522.tar.xz |
USB: sierra: do not resume I/O on closing ports
Use tty-port initialised flag rather than private flag to determine when
port is closing down.
Since the tty-port flag is set prior to dropping DTR/RTS (when HUPCL is
set) this avoid submitting the read urbs when resuming the interface in
dtr_rts() only to immediately kill them again in shutdown().
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/sierra.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index be4a759b3aed..6f7f01eb556a 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -316,7 +316,6 @@ struct sierra_port_private { int dsr_state; int dcd_state; int ri_state; - unsigned int opened:1; }; static int sierra_send_setup(struct usb_serial_port *port) @@ -769,8 +768,11 @@ static void sierra_close(struct usb_serial_port *port) portdata = usb_get_serial_port_data(port); + /* + * Need to take susp_lock to make sure port is not already being + * resumed, but no need to hold it due to ASYNC_INITIALIZED. + */ spin_lock_irq(&intfdata->susp_lock); - portdata->opened = 0; if (--intfdata->open_ports == 0) serial->interface->needs_remote_wakeup = 0; spin_unlock_irq(&intfdata->susp_lock); @@ -826,7 +828,6 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port) goto err_submit; spin_lock_irq(&intfdata->susp_lock); - portdata->opened = 1; if (++intfdata->open_ports == 1) serial->interface->needs_remote_wakeup = 1; spin_unlock_irq(&intfdata->susp_lock); @@ -1025,16 +1026,14 @@ static int sierra_resume(struct usb_serial *serial) { struct usb_serial_port *port; struct sierra_intf_private *intfdata = usb_get_serial_data(serial); - struct sierra_port_private *portdata; int ec = 0; int i, err; spin_lock_irq(&intfdata->susp_lock); for (i = 0; i < serial->num_ports; i++) { port = serial->port[i]; - portdata = usb_get_serial_port_data(port); - if (!portdata || !portdata->opened) + if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) continue; err = sierra_submit_delayed_urbs(port); |