aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/driver.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2011-08-19 17:49:48 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-08-19 17:49:48 -0400
commit5b1b0b812a7b1a5b968c5d06d90d1cb88621b941 (patch)
treedd57943592e4152147d1a5667b082e5f30faaf83 /drivers/usb/core/driver.c
parent311aab73d273eb22be976055f6cab224f7279d5e (diff)
PM / Runtime: Add macro to test for runtime PM events
This patch (as1482) adds a macro for testing whether or not a pm_message value represents an autosuspend or autoresume (i.e., a runtime PM) event. Encapsulating this notion seems preferable to open-coding the test all over the place. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/usb/core/driver.c')
-rw-r--r--drivers/usb/core/driver.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 34e3da5aa72a..e03042883c68 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1046,8 +1046,7 @@ static int usb_resume_device(struct usb_device *udev, pm_message_t msg)
1046 /* Non-root devices on a full/low-speed bus must wait for their 1046 /* Non-root devices on a full/low-speed bus must wait for their
1047 * companion high-speed root hub, in case a handoff is needed. 1047 * companion high-speed root hub, in case a handoff is needed.
1048 */ 1048 */
1049 if (!(msg.event & PM_EVENT_AUTO) && udev->parent && 1049 if (!PMSG_IS_AUTO(msg) && udev->parent && udev->bus->hs_companion)
1050 udev->bus->hs_companion)
1051 device_pm_wait_for_dev(&udev->dev, 1050 device_pm_wait_for_dev(&udev->dev,
1052 &udev->bus->hs_companion->root_hub->dev); 1051 &udev->bus->hs_companion->root_hub->dev);
1053 1052
@@ -1075,7 +1074,7 @@ static int usb_suspend_interface(struct usb_device *udev,
1075 1074
1076 if (driver->suspend) { 1075 if (driver->suspend) {
1077 status = driver->suspend(intf, msg); 1076 status = driver->suspend(intf, msg);
1078 if (status && !(msg.event & PM_EVENT_AUTO)) 1077 if (status && !PMSG_IS_AUTO(msg))
1079 dev_err(&intf->dev, "%s error %d\n", 1078 dev_err(&intf->dev, "%s error %d\n",
1080 "suspend", status); 1079 "suspend", status);
1081 } else { 1080 } else {
@@ -1189,7 +1188,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1189 status = usb_suspend_interface(udev, intf, msg); 1188 status = usb_suspend_interface(udev, intf, msg);
1190 1189
1191 /* Ignore errors during system sleep transitions */ 1190 /* Ignore errors during system sleep transitions */
1192 if (!(msg.event & PM_EVENT_AUTO)) 1191 if (!PMSG_IS_AUTO(msg))
1193 status = 0; 1192 status = 0;
1194 if (status != 0) 1193 if (status != 0)
1195 break; 1194 break;
@@ -1199,7 +1198,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1199 status = usb_suspend_device(udev, msg); 1198 status = usb_suspend_device(udev, msg);
1200 1199
1201 /* Again, ignore errors during system sleep transitions */ 1200 /* Again, ignore errors during system sleep transitions */
1202 if (!(msg.event & PM_EVENT_AUTO)) 1201 if (!PMSG_IS_AUTO(msg))
1203 status = 0; 1202 status = 0;
1204 } 1203 }
1205 1204