diff options
author | Oliver Neukum <oliver@neukum.org> | 2009-07-21 02:47:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 09:46:29 -0400 |
commit | 81e5b23cd206d46d4872d25f3d7ff67a0f355c71 (patch) | |
tree | 55f5c327daacc5feb91724c4294a61997817d103 /drivers/usb | |
parent | 807fcb5e19877d339a4cc56f2c6ddaf3a147457a (diff) |
USB: fix wrong order of events in usb serial suspension
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 54bb37d41916..45975b4984ea 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1157,15 +1157,19 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) | |||
1157 | 1157 | ||
1158 | serial->suspending = 1; | 1158 | serial->suspending = 1; |
1159 | 1159 | ||
1160 | if (serial->type->suspend) { | ||
1161 | r = serial->type->suspend(serial, message); | ||
1162 | if (r < 0) | ||
1163 | goto err_out; | ||
1164 | } | ||
1165 | |||
1160 | for (i = 0; i < serial->num_ports; ++i) { | 1166 | for (i = 0; i < serial->num_ports; ++i) { |
1161 | port = serial->port[i]; | 1167 | port = serial->port[i]; |
1162 | if (port) | 1168 | if (port) |
1163 | kill_traffic(port); | 1169 | kill_traffic(port); |
1164 | } | 1170 | } |
1165 | 1171 | ||
1166 | if (serial->type->suspend) | 1172 | err_out: |
1167 | r = serial->type->suspend(serial, message); | ||
1168 | |||
1169 | return r; | 1173 | return r; |
1170 | } | 1174 | } |
1171 | EXPORT_SYMBOL(usb_serial_suspend); | 1175 | EXPORT_SYMBOL(usb_serial_suspend); |