Commit b0a9aa6d authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

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: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8bb7ec65
...@@ -48,7 +48,6 @@ struct usb_wwan_port_private { ...@@ -48,7 +48,6 @@ struct usb_wwan_port_private {
struct urb *out_urbs[N_OUT_URB]; struct urb *out_urbs[N_OUT_URB];
u8 *out_buffer[N_OUT_URB]; u8 *out_buffer[N_OUT_URB];
unsigned long out_busy; /* Bit vector of URBs in use */ unsigned long out_busy; /* Bit vector of URBs in use */
int opened;
struct usb_anchor delayed; struct usb_anchor delayed;
/* Settings for the port */ /* Settings for the port */
......
...@@ -395,7 +395,6 @@ int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -395,7 +395,6 @@ int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port)
} }
spin_lock_irq(&intfdata->susp_lock); spin_lock_irq(&intfdata->susp_lock);
portdata->opened = 1;
if (++intfdata->open_ports == 1) if (++intfdata->open_ports == 1)
serial->interface->needs_remote_wakeup = 1; serial->interface->needs_remote_wakeup = 1;
spin_unlock_irq(&intfdata->susp_lock); spin_unlock_irq(&intfdata->susp_lock);
...@@ -429,8 +428,11 @@ void usb_wwan_close(struct usb_serial_port *port) ...@@ -429,8 +428,11 @@ void usb_wwan_close(struct usb_serial_port *port)
portdata = usb_get_serial_port_data(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); spin_lock_irq(&intfdata->susp_lock);
portdata->opened = 0;
if (--intfdata->open_ports == 0) if (--intfdata->open_ports == 0)
serial->interface->needs_remote_wakeup = 0; serial->interface->needs_remote_wakeup = 0;
spin_unlock_irq(&intfdata->susp_lock); spin_unlock_irq(&intfdata->susp_lock);
...@@ -645,11 +647,12 @@ int usb_wwan_resume(struct usb_serial *serial) ...@@ -645,11 +647,12 @@ int usb_wwan_resume(struct usb_serial *serial)
spin_lock_irq(&intfdata->susp_lock); spin_lock_irq(&intfdata->susp_lock);
for (i = 0; i < serial->num_ports; i++) { for (i = 0; i < serial->num_ports; i++) {
port = serial->port[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; continue;
portdata = usb_get_serial_port_data(port);
if (port->interrupt_in_urb) { if (port->interrupt_in_urb) {
err = usb_submit_urb(port->interrupt_in_urb, err = usb_submit_urb(port->interrupt_in_urb,
GFP_ATOMIC); GFP_ATOMIC);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment