USB: sierra: minimise no-suspend window during close
authorJohan Hovold <jhovold@gmail.com>
Mon, 26 May 2014 17:23:08 +0000 (19:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 May 2014 22:04:05 +0000 (15:04 -0700)
Move usb_autopm_get_interface_no_resume to the end of close(). This
makes the window during which suspend is prevented before the final put
in USB serial core slightly smaller.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/sierra.c

index 967331964f361eda9170377180c9bd8abaf5cca1..be4a759b3aed66afa027cd742ffc9aa1b8e4da44 100644 (file)
@@ -769,8 +769,6 @@ static void sierra_close(struct usb_serial_port *port)
 
        portdata = usb_get_serial_port_data(port);
 
-       usb_autopm_get_interface_no_resume(serial->interface);
-
        spin_lock_irq(&intfdata->susp_lock);
        portdata->opened = 0;
        if (--intfdata->open_ports == 0)
@@ -796,6 +794,8 @@ static void sierra_close(struct usb_serial_port *port)
                sierra_release_urb(portdata->in_urbs[i]);
                portdata->in_urbs[i] = NULL;
        }
+
+       usb_autopm_get_interface_no_resume(serial->interface);
 }
 
 static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port)