Skip to content

Commit

Permalink
USB: fix wrong order of events in usb serial suspension
Browse files Browse the repository at this point in the history
if a subdriver has an additional suspend method, it must be called
first to allow the subdriver to return -EBUSY, because the second
half cannot be easily undone.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Sep 23, 2009
1 parent 807fcb5 commit 81e5b23
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,15 +1157,19 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)

serial->suspending = 1;

if (serial->type->suspend) {
r = serial->type->suspend(serial, message);
if (r < 0)
goto err_out;
}

for (i = 0; i < serial->num_ports; ++i) {
port = serial->port[i];
if (port)
kill_traffic(port);
}

if (serial->type->suspend)
r = serial->type->suspend(serial, message);

err_out:
return r;
}
EXPORT_SYMBOL(usb_serial_suspend);
Expand Down

0 comments on commit 81e5b23

Please sign in to comment.