aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-10-07 17:16:55 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-10-07 17:16:55 -0400
commitd727b60659a1173eb4142a5fc521ce67c28b34e1 (patch)
tree793d0fc86ecf98331024db5c86bc271cc72aa2d2 /drivers/usb
parent3ee72ca99288f1de95ec9c570e43f531c8799f06 (diff)
parent2a5306cc5f383b0e7414c75e458111afd4a563a4 (diff)
Merge branch 'pm-runtime' into pm-for-linus
* pm-runtime: PM / Tracing: build rpm-traces.c only if CONFIG_PM_RUNTIME is set PM / Runtime: Replace dev_dbg() with trace_rpm_*() PM / Runtime: Introduce trace points for tracing rpm_* functions PM / Runtime: Don't run callbacks under lock for power.irq_safe set USB: Add wakeup info to debugging messages PM / Runtime: pm_runtime_idle() can be called in atomic context PM / Runtime: Add macro to test for runtime PM events PM / Runtime: Add might_sleep() to runtime PM functions
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/class/cdc-acm.c2
-rw-r--r--drivers/usb/class/cdc-wdm.c6
-rw-r--r--drivers/usb/core/driver.c9
-rw-r--r--drivers/usb/core/hcd.c9
-rw-r--r--drivers/usb/core/hub.c15
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/usb/serial/usb_wwan.c2
7 files changed, 22 insertions, 23 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index dac7676ce21b..94e6c5c09dd8 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1305,7 +1305,7 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message)
1305 struct acm *acm = usb_get_intfdata(intf); 1305 struct acm *acm = usb_get_intfdata(intf);
1306 int cnt; 1306 int cnt;
1307 1307
1308 if (message.event & PM_EVENT_AUTO) { 1308 if (PMSG_IS_AUTO(message)) {
1309 int b; 1309 int b;
1310 1310
1311 spin_lock_irq(&acm->write_lock); 1311 spin_lock_irq(&acm->write_lock);
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 2b9ff518b509..42f180aca3fb 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -798,11 +798,11 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
798 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); 798 dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);
799 799
800 /* if this is an autosuspend the caller does the locking */ 800 /* if this is an autosuspend the caller does the locking */
801 if (!(message.event & PM_EVENT_AUTO)) 801 if (!PMSG_IS_AUTO(message))
802 mutex_lock(&desc->lock); 802 mutex_lock(&desc->lock);
803 spin_lock_irq(&desc->iuspin); 803 spin_lock_irq(&desc->iuspin);
804 804
805 if ((message.event & PM_EVENT_AUTO) && 805 if (PMSG_IS_AUTO(message) &&
806 (test_bit(WDM_IN_USE, &desc->flags) 806 (test_bit(WDM_IN_USE, &desc->flags)
807 || test_bit(WDM_RESPONDING, &desc->flags))) { 807 || test_bit(WDM_RESPONDING, &desc->flags))) {
808 spin_unlock_irq(&desc->iuspin); 808 spin_unlock_irq(&desc->iuspin);
@@ -815,7 +815,7 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
815 kill_urbs(desc); 815 kill_urbs(desc);
816 cancel_work_sync(&desc->rxwork); 816 cancel_work_sync(&desc->rxwork);
817 } 817 }
818 if (!(message.event & PM_EVENT_AUTO)) 818 if (!PMSG_IS_AUTO(message))
819 mutex_unlock(&desc->lock); 819 mutex_unlock(&desc->lock);
820 820
821 return rv; 821 return rv;
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
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 73cbbd85219f..3b9d906339ef 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1961,8 +1961,9 @@ int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg)
1961 int status; 1961 int status;
1962 int old_state = hcd->state; 1962 int old_state = hcd->state;
1963 1963
1964 dev_dbg(&rhdev->dev, "bus %s%s\n", 1964 dev_dbg(&rhdev->dev, "bus %ssuspend, wakeup %d\n",
1965 (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "suspend"); 1965 (PMSG_IS_AUTO(msg) ? "auto-" : ""),
1966 rhdev->do_remote_wakeup);
1966 if (HCD_DEAD(hcd)) { 1967 if (HCD_DEAD(hcd)) {
1967 dev_dbg(&rhdev->dev, "skipped %s of dead bus\n", "suspend"); 1968 dev_dbg(&rhdev->dev, "skipped %s of dead bus\n", "suspend");
1968 return 0; 1969 return 0;
@@ -1997,8 +1998,8 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg)
1997 int status; 1998 int status;
1998 int old_state = hcd->state; 1999 int old_state = hcd->state;
1999 2000
2000 dev_dbg(&rhdev->dev, "usb %s%s\n", 2001 dev_dbg(&rhdev->dev, "usb %sresume\n",
2001 (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); 2002 (PMSG_IS_AUTO(msg) ? "auto-" : ""));
2002 if (HCD_DEAD(hcd)) { 2003 if (HCD_DEAD(hcd)) {
2003 dev_dbg(&rhdev->dev, "skipped %s of dead bus\n", "resume"); 2004 dev_dbg(&rhdev->dev, "skipped %s of dead bus\n", "resume");
2004 return 0; 2005 return 0;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a428aa080a36..13bc83240adb 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2324,8 +2324,6 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
2324 int port1 = udev->portnum; 2324 int port1 = udev->portnum;
2325 int status; 2325 int status;
2326 2326
2327 // dev_dbg(hub->intfdev, "suspend port %d\n", port1);
2328
2329 /* enable remote wakeup when appropriate; this lets the device 2327 /* enable remote wakeup when appropriate; this lets the device
2330 * wake up the upstream hub (including maybe the root hub). 2328 * wake up the upstream hub (including maybe the root hub).
2331 * 2329 *
@@ -2342,7 +2340,7 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
2342 dev_dbg(&udev->dev, "won't remote wakeup, status %d\n", 2340 dev_dbg(&udev->dev, "won't remote wakeup, status %d\n",
2343 status); 2341 status);
2344 /* bail if autosuspend is requested */ 2342 /* bail if autosuspend is requested */
2345 if (msg.event & PM_EVENT_AUTO) 2343 if (PMSG_IS_AUTO(msg))
2346 return status; 2344 return status;
2347 } 2345 }
2348 } 2346 }
@@ -2367,12 +2365,13 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
2367 USB_CTRL_SET_TIMEOUT); 2365 USB_CTRL_SET_TIMEOUT);
2368 2366
2369 /* System sleep transitions should never fail */ 2367 /* System sleep transitions should never fail */
2370 if (!(msg.event & PM_EVENT_AUTO)) 2368 if (!PMSG_IS_AUTO(msg))
2371 status = 0; 2369 status = 0;
2372 } else { 2370 } else {
2373 /* device has up to 10 msec to fully suspend */ 2371 /* device has up to 10 msec to fully suspend */
2374 dev_dbg(&udev->dev, "usb %ssuspend\n", 2372 dev_dbg(&udev->dev, "usb %ssuspend, wakeup %d\n",
2375 (msg.event & PM_EVENT_AUTO ? "auto-" : "")); 2373 (PMSG_IS_AUTO(msg) ? "auto-" : ""),
2374 udev->do_remote_wakeup);
2376 usb_set_device_state(udev, USB_STATE_SUSPENDED); 2375 usb_set_device_state(udev, USB_STATE_SUSPENDED);
2377 msleep(10); 2376 msleep(10);
2378 } 2377 }
@@ -2523,7 +2522,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
2523 } else { 2522 } else {
2524 /* drive resume for at least 20 msec */ 2523 /* drive resume for at least 20 msec */
2525 dev_dbg(&udev->dev, "usb %sresume\n", 2524 dev_dbg(&udev->dev, "usb %sresume\n",
2526 (msg.event & PM_EVENT_AUTO ? "auto-" : "")); 2525 (PMSG_IS_AUTO(msg) ? "auto-" : ""));
2527 msleep(25); 2526 msleep(25);
2528 2527
2529 /* Virtual root hubs can trigger on GET_PORT_STATUS to 2528 /* Virtual root hubs can trigger on GET_PORT_STATUS to
@@ -2625,7 +2624,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
2625 udev = hdev->children [port1-1]; 2624 udev = hdev->children [port1-1];
2626 if (udev && udev->can_submit) { 2625 if (udev && udev->can_submit) {
2627 dev_warn(&intf->dev, "port %d nyet suspended\n", port1); 2626 dev_warn(&intf->dev, "port %d nyet suspended\n", port1);
2628 if (msg.event & PM_EVENT_AUTO) 2627 if (PMSG_IS_AUTO(msg))
2629 return -EBUSY; 2628 return -EBUSY;
2630 } 2629 }
2631 } 2630 }
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index d5d136a53b61..b18179bda0d8 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -1009,7 +1009,7 @@ static int sierra_suspend(struct usb_serial *serial, pm_message_t message)
1009 struct sierra_intf_private *intfdata; 1009 struct sierra_intf_private *intfdata;
1010 int b; 1010 int b;
1011 1011
1012 if (message.event & PM_EVENT_AUTO) { 1012 if (PMSG_IS_AUTO(message)) {
1013 intfdata = serial->private; 1013 intfdata = serial->private;
1014 spin_lock_irq(&intfdata->susp_lock); 1014 spin_lock_irq(&intfdata->susp_lock);
1015 b = intfdata->in_flight; 1015 b = intfdata->in_flight;
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index e4fad5e643d7..d555ca9567b8 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -651,7 +651,7 @@ int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message)
651 651
652 dbg("%s entered", __func__); 652 dbg("%s entered", __func__);
653 653
654 if (message.event & PM_EVENT_AUTO) { 654 if (PMSG_IS_AUTO(message)) {
655 spin_lock_irq(&intfdata->susp_lock); 655 spin_lock_irq(&intfdata->susp_lock);
656 b = intfdata->in_flight; 656 b = intfdata->in_flight;
657 spin_unlock_irq(&intfdata->susp_lock); 657 spin_unlock_irq(&intfdata->susp_lock);