summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/usb_wwan.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2014-05-26 21:23:32 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-28 02:04:08 +0400
commitb0a9aa6da8088b722326a858ab572a13b5b6f9cb (patch)
treedb589f9068c18440b5687e3b9835bc5fa723dc41 /drivers/usb/serial/usb_wwan.c
parent8bb7ec65d600fd513aa94b50078a6329df612daa (diff)
downloadlinux-b0a9aa6da8088b722326a858ab572a13b5b6f9cb.tar.xz
USB: usb_wwan: 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/usb_wwan.c')
-rw-r--r--drivers/usb/serial/usb_wwan.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index bbcbdaa16c17..2932d9cfb166 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -395,7 +395,6 @@ int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port)
}
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);
@@ -429,8 +428,11 @@ void usb_wwan_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);
@@ -645,11 +647,12 @@ int usb_wwan_resume(struct usb_serial *serial)
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;
+ portdata = usb_get_serial_port_data(port);
+
if (port->interrupt_in_urb) {
err = usb_submit_urb(port->interrupt_in_urb,
GFP_ATOMIC);