diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-11-13 11:53:59 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 14:55:21 -0500 |
commit | fb34d53752d5bec5acc73422e462a9c68aeeaa2a (patch) | |
tree | 6a395f2a0246cd3d721753c60af13e8f9b2e9c41 | |
parent | 576a362ad2103da481e1f6e13de01f33d3d4c7b1 (diff) |
USB: remove the auto_pm flag
This patch (as1302) removes the auto_pm flag from struct usb_device.
The flag's only purpose was to distinguish between autosuspends and
external suspends, but that information is now available in the
pm_message_t argument passed to suspend methods.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | Documentation/usb/power-management.txt | 9 | ||||
-rw-r--r-- | drivers/bluetooth/btusb.c | 2 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 8 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/usb.c | 7 | ||||
-rw-r--r-- | drivers/usb/core/driver.c | 4 | ||||
-rw-r--r-- | drivers/usb/serial/option.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/sierra.c | 2 | ||||
-rw-r--r-- | include/linux/usb.h | 2 |
8 files changed, 14 insertions, 22 deletions
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt index ad642615ad4c..8817368203d6 100644 --- a/Documentation/usb/power-management.txt +++ b/Documentation/usb/power-management.txt | |||
@@ -423,15 +423,16 @@ an URB had completed too recently. | |||
423 | 423 | ||
424 | External suspend calls should never be allowed to fail in this way, | 424 | External suspend calls should never be allowed to fail in this way, |
425 | only autosuspend calls. The driver can tell them apart by checking | 425 | only autosuspend calls. The driver can tell them apart by checking |
426 | udev->auto_pm; this flag will be set to 1 for internal PM events | 426 | the PM_EVENT_AUTO bit in the message.event argument to the suspend |
427 | (autosuspend or autoresume) and 0 for external PM events. | 427 | method; this bit will be set for internal PM events (autosuspend) and |
428 | clear for external PM events. | ||
428 | 429 | ||
429 | Many of the ingredients in the autosuspend framework are oriented | 430 | Many of the ingredients in the autosuspend framework are oriented |
430 | towards interfaces: The usb_interface structure contains the | 431 | towards interfaces: The usb_interface structure contains the |
431 | pm_usage_cnt field, and the usb_autopm_* routines take an interface | 432 | pm_usage_cnt field, and the usb_autopm_* routines take an interface |
432 | pointer as their argument. But somewhat confusingly, a few of the | 433 | pointer as their argument. But somewhat confusingly, a few of the |
433 | pieces (usb_mark_last_busy() and udev->auto_pm) use the usb_device | 434 | pieces (i.e., usb_mark_last_busy()) use the usb_device structure |
434 | structure instead. Drivers need to keep this straight; they can call | 435 | instead. Drivers need to keep this straight; they can call |
435 | interface_to_usbdev() to find the device structure for a given | 436 | interface_to_usbdev() to find the device structure for a given |
436 | interface. | 437 | interface. |
437 | 438 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 44bc8bbabf54..4d2905996751 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -1066,7 +1066,7 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) | |||
1066 | return 0; | 1066 | return 0; |
1067 | 1067 | ||
1068 | spin_lock_irq(&data->txlock); | 1068 | spin_lock_irq(&data->txlock); |
1069 | if (!(interface_to_usbdev(intf)->auto_pm && data->tx_in_flight)) { | 1069 | if (!((message.event & PM_EVENT_AUTO) && data->tx_in_flight)) { |
1070 | set_bit(BTUSB_SUSPENDING, &data->flags); | 1070 | set_bit(BTUSB_SUSPENDING, &data->flags); |
1071 | spin_unlock_irq(&data->txlock); | 1071 | spin_unlock_irq(&data->txlock); |
1072 | } else { | 1072 | } else { |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 0258289f3b3e..e2997a8d5e1b 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -1253,10 +1253,9 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1253 | { | 1253 | { |
1254 | struct hid_device *hid = usb_get_intfdata(intf); | 1254 | struct hid_device *hid = usb_get_intfdata(intf); |
1255 | struct usbhid_device *usbhid = hid->driver_data; | 1255 | struct usbhid_device *usbhid = hid->driver_data; |
1256 | struct usb_device *udev = interface_to_usbdev(intf); | ||
1257 | int status; | 1256 | int status; |
1258 | 1257 | ||
1259 | if (udev->auto_pm) { | 1258 | if (message.event & PM_EVENT_AUTO) { |
1260 | spin_lock_irq(&usbhid->lock); /* Sync with error handler */ | 1259 | spin_lock_irq(&usbhid->lock); /* Sync with error handler */ |
1261 | if (!test_bit(HID_RESET_PENDING, &usbhid->iofl) | 1260 | if (!test_bit(HID_RESET_PENDING, &usbhid->iofl) |
1262 | && !test_bit(HID_CLEAR_HALT, &usbhid->iofl) | 1261 | && !test_bit(HID_CLEAR_HALT, &usbhid->iofl) |
@@ -1281,7 +1280,7 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1281 | return -EIO; | 1280 | return -EIO; |
1282 | } | 1281 | } |
1283 | 1282 | ||
1284 | if (!ignoreled && udev->auto_pm) { | 1283 | if (!ignoreled && (message.event & PM_EVENT_AUTO)) { |
1285 | spin_lock_irq(&usbhid->lock); | 1284 | spin_lock_irq(&usbhid->lock); |
1286 | if (test_bit(HID_LED_ON, &usbhid->iofl)) { | 1285 | if (test_bit(HID_LED_ON, &usbhid->iofl)) { |
1287 | spin_unlock_irq(&usbhid->lock); | 1286 | spin_unlock_irq(&usbhid->lock); |
@@ -1294,7 +1293,8 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) | |||
1294 | hid_cancel_delayed_stuff(usbhid); | 1293 | hid_cancel_delayed_stuff(usbhid); |
1295 | hid_cease_io(usbhid); | 1294 | hid_cease_io(usbhid); |
1296 | 1295 | ||
1297 | if (udev->auto_pm && test_bit(HID_KEYS_PRESSED, &usbhid->iofl)) { | 1296 | if ((message.event & PM_EVENT_AUTO) && |
1297 | test_bit(HID_KEYS_PRESSED, &usbhid->iofl)) { | ||
1298 | /* lost race against keypresses */ | 1298 | /* lost race against keypresses */ |
1299 | status = hid_start_in(hid); | 1299 | status = hid_start_in(hid); |
1300 | if (status < 0) | 1300 | if (status < 0) |
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index 47e84ef355c5..3b48681f8a0d 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -579,7 +579,7 @@ void i2400mu_disconnect(struct usb_interface *iface) | |||
579 | * | 579 | * |
580 | * As well, the device might refuse going to sleep for whichever | 580 | * As well, the device might refuse going to sleep for whichever |
581 | * reason. In this case we just fail. For system suspend/hibernate, | 581 | * reason. In this case we just fail. For system suspend/hibernate, |
582 | * we *can't* fail. We look at usb_dev->auto_pm to see if the | 582 | * we *can't* fail. We check PM_EVENT_AUTO to see if the |
583 | * suspend call comes from the USB stack or from the system and act | 583 | * suspend call comes from the USB stack or from the system and act |
584 | * in consequence. | 584 | * in consequence. |
585 | * | 585 | * |
@@ -591,14 +591,11 @@ int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg) | |||
591 | int result = 0; | 591 | int result = 0; |
592 | struct device *dev = &iface->dev; | 592 | struct device *dev = &iface->dev; |
593 | struct i2400mu *i2400mu = usb_get_intfdata(iface); | 593 | struct i2400mu *i2400mu = usb_get_intfdata(iface); |
594 | #ifdef CONFIG_PM | ||
595 | struct usb_device *usb_dev = i2400mu->usb_dev; | ||
596 | #endif | ||
597 | unsigned is_autosuspend = 0; | 594 | unsigned is_autosuspend = 0; |
598 | struct i2400m *i2400m = &i2400mu->i2400m; | 595 | struct i2400m *i2400m = &i2400mu->i2400m; |
599 | 596 | ||
600 | #ifdef CONFIG_PM | 597 | #ifdef CONFIG_PM |
601 | if (usb_dev->auto_pm > 0) | 598 | if (pm_msg.event & PM_EVENT_AUTO) |
602 | is_autosuspend = 1; | 599 | is_autosuspend = 1; |
603 | #endif | 600 | #endif |
604 | 601 | ||
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 4f864472c5c4..8016a296010e 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1341,7 +1341,6 @@ static int usb_autopm_do_device(struct usb_device *udev, int inc_usage_cnt) | |||
1341 | int status = 0; | 1341 | int status = 0; |
1342 | 1342 | ||
1343 | usb_pm_lock(udev); | 1343 | usb_pm_lock(udev); |
1344 | udev->auto_pm = 1; | ||
1345 | udev->pm_usage_cnt += inc_usage_cnt; | 1344 | udev->pm_usage_cnt += inc_usage_cnt; |
1346 | WARN_ON(udev->pm_usage_cnt < 0); | 1345 | WARN_ON(udev->pm_usage_cnt < 0); |
1347 | if (inc_usage_cnt) | 1346 | if (inc_usage_cnt) |
@@ -1473,7 +1472,6 @@ static int usb_autopm_do_interface(struct usb_interface *intf, | |||
1473 | if (intf->condition == USB_INTERFACE_UNBOUND) | 1472 | if (intf->condition == USB_INTERFACE_UNBOUND) |
1474 | status = -ENODEV; | 1473 | status = -ENODEV; |
1475 | else { | 1474 | else { |
1476 | udev->auto_pm = 1; | ||
1477 | atomic_add(inc_usage_cnt, &intf->pm_usage_cnt); | 1475 | atomic_add(inc_usage_cnt, &intf->pm_usage_cnt); |
1478 | udev->last_busy = jiffies; | 1476 | udev->last_busy = jiffies; |
1479 | if (inc_usage_cnt >= 0 && | 1477 | if (inc_usage_cnt >= 0 && |
@@ -1707,7 +1705,6 @@ int usb_external_suspend_device(struct usb_device *udev, pm_message_t msg) | |||
1707 | 1705 | ||
1708 | do_unbind_rebind(udev, DO_UNBIND); | 1706 | do_unbind_rebind(udev, DO_UNBIND); |
1709 | usb_pm_lock(udev); | 1707 | usb_pm_lock(udev); |
1710 | udev->auto_pm = 0; | ||
1711 | status = usb_suspend_both(udev, msg); | 1708 | status = usb_suspend_both(udev, msg); |
1712 | usb_pm_unlock(udev); | 1709 | usb_pm_unlock(udev); |
1713 | return status; | 1710 | return status; |
@@ -1730,7 +1727,6 @@ int usb_external_resume_device(struct usb_device *udev, pm_message_t msg) | |||
1730 | int status; | 1727 | int status; |
1731 | 1728 | ||
1732 | usb_pm_lock(udev); | 1729 | usb_pm_lock(udev); |
1733 | udev->auto_pm = 0; | ||
1734 | status = usb_resume_both(udev, msg); | 1730 | status = usb_resume_both(udev, msg); |
1735 | udev->last_busy = jiffies; | 1731 | udev->last_busy = jiffies; |
1736 | usb_pm_unlock(udev); | 1732 | usb_pm_unlock(udev); |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 0d46bbec44b7..8751ec79a159 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -1313,7 +1313,7 @@ static int option_suspend(struct usb_serial *serial, pm_message_t message) | |||
1313 | 1313 | ||
1314 | dbg("%s entered", __func__); | 1314 | dbg("%s entered", __func__); |
1315 | 1315 | ||
1316 | if (serial->dev->auto_pm) { | 1316 | if (message.event & PM_EVENT_AUTO) { |
1317 | spin_lock_irq(&intfdata->susp_lock); | 1317 | spin_lock_irq(&intfdata->susp_lock); |
1318 | b = intfdata->in_flight; | 1318 | b = intfdata->in_flight; |
1319 | spin_unlock_irq(&intfdata->susp_lock); | 1319 | spin_unlock_irq(&intfdata->susp_lock); |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index c5c41aed106d..ac1b6449fb6a 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -1005,7 +1005,7 @@ static int sierra_suspend(struct usb_serial *serial, pm_message_t message) | |||
1005 | struct sierra_intf_private *intfdata; | 1005 | struct sierra_intf_private *intfdata; |
1006 | int b; | 1006 | int b; |
1007 | 1007 | ||
1008 | if (serial->dev->auto_pm) { | 1008 | if (message.event & PM_EVENT_AUTO) { |
1009 | intfdata = serial->private; | 1009 | intfdata = serial->private; |
1010 | spin_lock_irq(&intfdata->susp_lock); | 1010 | spin_lock_irq(&intfdata->susp_lock); |
1011 | b = intfdata->in_flight; | 1011 | b = intfdata->in_flight; |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 6e91ee4f5b81..4b6f6db544ee 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -429,7 +429,6 @@ struct usb_tt; | |||
429 | * @last_busy: time of last use | 429 | * @last_busy: time of last use |
430 | * @autosuspend_delay: in jiffies | 430 | * @autosuspend_delay: in jiffies |
431 | * @connect_time: time device was first connected | 431 | * @connect_time: time device was first connected |
432 | * @auto_pm: autosuspend/resume in progress | ||
433 | * @do_remote_wakeup: remote wakeup should be enabled | 432 | * @do_remote_wakeup: remote wakeup should be enabled |
434 | * @reset_resume: needs reset instead of resume | 433 | * @reset_resume: needs reset instead of resume |
435 | * @autosuspend_disabled: autosuspend disabled by the user | 434 | * @autosuspend_disabled: autosuspend disabled by the user |
@@ -514,7 +513,6 @@ struct usb_device { | |||
514 | int autosuspend_delay; | 513 | int autosuspend_delay; |
515 | unsigned long connect_time; | 514 | unsigned long connect_time; |
516 | 515 | ||
517 | unsigned auto_pm:1; | ||
518 | unsigned do_remote_wakeup:1; | 516 | unsigned do_remote_wakeup:1; |
519 | unsigned reset_resume:1; | 517 | unsigned reset_resume:1; |
520 | unsigned autosuspend_disabled:1; | 518 | unsigned autosuspend_disabled:1; |