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 /drivers | |
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>
Diffstat (limited to 'drivers')
-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 |
6 files changed, 9 insertions, 16 deletions
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; |