Commit 98d9a82e5f753a2483d7b4638802d60e94e5d2e4
Committed by
Greg Kroah-Hartman
1 parent
1493138af1
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
USB: cleanup the handling of the PM complete call
This eliminates the last instance of a function's behavior controlled by a parameter as Linus hates such things. Signed-off-by: Oliver Neukum <oneukum@suse.de> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 3 changed files with 22 additions and 18 deletions Side-by-side Diff
drivers/usb/core/driver.c
... | ... | @@ -1336,34 +1336,37 @@ |
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | /* The device lock is held by the PM core */ |
1339 | -int usb_resume(struct device *dev, pm_message_t msg) | |
1339 | +int usb_resume_complete(struct device *dev) | |
1340 | 1340 | { |
1341 | - struct usb_device *udev = to_usb_device(dev); | |
1342 | - int status; | |
1341 | + struct usb_device *udev = to_usb_device(dev); | |
1343 | 1342 | |
1344 | 1343 | /* For PM complete calls, all we do is rebind interfaces |
1345 | 1344 | * whose needs_binding flag is set |
1346 | 1345 | */ |
1347 | - if (msg.event == PM_EVENT_ON) { | |
1348 | - if (udev->state != USB_STATE_NOTATTACHED) | |
1349 | - do_rebind_interfaces(udev); | |
1350 | - status = 0; | |
1346 | + if (udev->state != USB_STATE_NOTATTACHED) | |
1347 | + do_rebind_interfaces(udev); | |
1348 | + return 0; | |
1349 | +} | |
1351 | 1350 | |
1352 | - /* For all other calls, take the device back to full power and | |
1351 | +/* The device lock is held by the PM core */ | |
1352 | +int usb_resume(struct device *dev, pm_message_t msg) | |
1353 | +{ | |
1354 | + struct usb_device *udev = to_usb_device(dev); | |
1355 | + int status; | |
1356 | + | |
1357 | + /* For all calls, take the device back to full power and | |
1353 | 1358 | * tell the PM core in case it was autosuspended previously. |
1354 | 1359 | * Unbind the interfaces that will need rebinding later, |
1355 | 1360 | * because they fail to support reset_resume. |
1356 | 1361 | * (This can't be done in usb_resume_interface() |
1357 | - * above because it doesn't own the right set of locks.) | |
1362 | + * above because it doesn't own the right set of locks.) | |
1358 | 1363 | */ |
1359 | - } else { | |
1360 | - status = usb_resume_both(udev, msg); | |
1361 | - if (status == 0) { | |
1362 | - pm_runtime_disable(dev); | |
1363 | - pm_runtime_set_active(dev); | |
1364 | - pm_runtime_enable(dev); | |
1365 | - unbind_no_reset_resume_drivers_interfaces(udev); | |
1366 | - } | |
1364 | + status = usb_resume_both(udev, msg); | |
1365 | + if (status == 0) { | |
1366 | + pm_runtime_disable(dev); | |
1367 | + pm_runtime_set_active(dev); | |
1368 | + pm_runtime_enable(dev); | |
1369 | + unbind_no_reset_resume_drivers_interfaces(udev); | |
1367 | 1370 | } |
1368 | 1371 | |
1369 | 1372 | /* Avoid PM error messages for devices disconnected while suspended |
drivers/usb/core/usb.c
... | ... | @@ -274,7 +274,7 @@ |
274 | 274 | static void usb_dev_complete(struct device *dev) |
275 | 275 | { |
276 | 276 | /* Currently used only for rebinding interfaces */ |
277 | - usb_resume(dev, PMSG_ON); /* FIXME: change to PMSG_COMPLETE */ | |
277 | + usb_resume_complete(dev); | |
278 | 278 | } |
279 | 279 | |
280 | 280 | static int usb_dev_suspend(struct device *dev) |
drivers/usb/core/usb.h
... | ... | @@ -56,6 +56,7 @@ |
56 | 56 | |
57 | 57 | extern int usb_suspend(struct device *dev, pm_message_t msg); |
58 | 58 | extern int usb_resume(struct device *dev, pm_message_t msg); |
59 | +extern int usb_resume_complete(struct device *dev); | |
59 | 60 | |
60 | 61 | extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg); |
61 | 62 | extern int usb_port_resume(struct usb_device *dev, pm_message_t msg); |