diff options
author | Oliver Neukum <oliver@neukum.org> | 2012-01-11 02:38:35 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-24 17:23:49 -0500 |
commit | 98d9a82e5f753a2483d7b4638802d60e94e5d2e4 (patch) | |
tree | 9d51467e4d07abaa8bacb02bdfc8ebdd33904b01 /drivers | |
parent | 1493138af1463112e42eebcdab5db61452821e97 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/driver.c | 37 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 2 | ||||
-rw-r--r-- | drivers/usb/core/usb.h | 1 |
3 files changed, 22 insertions, 18 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index b7dfdecc7fda..d77daf3683da 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1336,34 +1336,37 @@ int usb_suspend(struct device *dev, pm_message_t msg) | |||
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | /* The device lock is held by the PM core */ | 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); | 1341 | struct usb_device *udev = to_usb_device(dev); |
1342 | int status; | ||
1343 | 1342 | ||
1344 | /* For PM complete calls, all we do is rebind interfaces | 1343 | /* For PM complete calls, all we do is rebind interfaces |
1345 | * whose needs_binding flag is set | 1344 | * whose needs_binding flag is set |
1346 | */ | 1345 | */ |
1347 | if (msg.event == PM_EVENT_ON) { | 1346 | if (udev->state != USB_STATE_NOTATTACHED) |
1348 | if (udev->state != USB_STATE_NOTATTACHED) | 1347 | do_rebind_interfaces(udev); |
1349 | do_rebind_interfaces(udev); | 1348 | return 0; |
1350 | status = 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 | * tell the PM core in case it was autosuspended previously. | 1358 | * tell the PM core in case it was autosuspended previously. |
1354 | * Unbind the interfaces that will need rebinding later, | 1359 | * Unbind the interfaces that will need rebinding later, |
1355 | * because they fail to support reset_resume. | 1360 | * because they fail to support reset_resume. |
1356 | * (This can't be done in usb_resume_interface() | 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 { | 1364 | status = usb_resume_both(udev, msg); |
1360 | status = usb_resume_both(udev, msg); | 1365 | if (status == 0) { |
1361 | if (status == 0) { | 1366 | pm_runtime_disable(dev); |
1362 | pm_runtime_disable(dev); | 1367 | pm_runtime_set_active(dev); |
1363 | pm_runtime_set_active(dev); | 1368 | pm_runtime_enable(dev); |
1364 | pm_runtime_enable(dev); | 1369 | unbind_no_reset_resume_drivers_interfaces(udev); |
1365 | unbind_no_reset_resume_drivers_interfaces(udev); | ||
1366 | } | ||
1367 | } | 1370 | } |
1368 | 1371 | ||
1369 | /* Avoid PM error messages for devices disconnected while suspended | 1372 | /* Avoid PM error messages for devices disconnected while suspended |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 8ca9f994a280..c74ba7bbc748 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -274,7 +274,7 @@ static int usb_dev_prepare(struct device *dev) | |||
274 | static void usb_dev_complete(struct device *dev) | 274 | static void usb_dev_complete(struct device *dev) |
275 | { | 275 | { |
276 | /* Currently used only for rebinding interfaces */ | 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 | static int usb_dev_suspend(struct device *dev) | 280 | static int usb_dev_suspend(struct device *dev) |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 45e8479c377d..71648dcbe438 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
@@ -56,6 +56,7 @@ extern void usb_major_cleanup(void); | |||
56 | 56 | ||
57 | extern int usb_suspend(struct device *dev, pm_message_t msg); | 57 | extern int usb_suspend(struct device *dev, pm_message_t msg); |
58 | extern int usb_resume(struct device *dev, pm_message_t msg); | 58 | extern int usb_resume(struct device *dev, pm_message_t msg); |
59 | extern int usb_resume_complete(struct device *dev); | ||
59 | 60 | ||
60 | extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg); | 61 | extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg); |
61 | extern int usb_port_resume(struct usb_device *dev, pm_message_t msg); | 62 | extern int usb_port_resume(struct usb_device *dev, pm_message_t msg); |