diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-11-29 17:47:05 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-12-03 18:51:54 -0500 |
commit | ceb6c9c862c86423f41c1e20ecf8d454f837f519 (patch) | |
tree | 23b6b5cb563720c9562977f4835d004c1d12f7bd | |
parent | 6ed23b806e73bdd5b17722df507b0f4570c606b6 (diff) |
USB / PM: Drop CONFIG_PM_RUNTIME from the USB core
After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
selected) PM_RUNTIME is always set if PM is set, so quite a few
depend on CONFIG_PM (or even dropped in some cases).
Replace CONFIG_PM_RUNTIME with CONFIG_PM in the USB core code
and documentation.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/ABI/stable/sysfs-bus-usb | 14 | ||||
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-usb | 19 | ||||
-rw-r--r-- | Documentation/usb/power-management.txt | 17 | ||||
-rw-r--r-- | drivers/usb/core/driver.c | 6 | ||||
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 11 | ||||
-rw-r--r-- | drivers/usb/core/hcd.c | 12 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 6 | ||||
-rw-r--r-- | drivers/usb/core/port.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/sysfs.c | 13 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/usb.h | 23 | ||||
-rw-r--r-- | drivers/usb/host/ehci-pci.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/sl811-hcd.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/u132-hcd.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/xhci-hub.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/xhci.c | 29 | ||||
-rw-r--r-- | drivers/usb/phy/phy-msm-usb.c | 2 | ||||
-rw-r--r-- | include/linux/usb.h | 2 | ||||
-rw-r--r-- | include/linux/usb/hcd.h | 7 |
19 files changed, 69 insertions, 112 deletions
diff --git a/Documentation/ABI/stable/sysfs-bus-usb b/Documentation/ABI/stable/sysfs-bus-usb index e2bc700a6f9c..831f15d9672f 100644 --- a/Documentation/ABI/stable/sysfs-bus-usb +++ b/Documentation/ABI/stable/sysfs-bus-usb | |||
@@ -32,10 +32,9 @@ Date: January 2008 | |||
32 | KernelVersion: 2.6.25 | 32 | KernelVersion: 2.6.25 |
33 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> | 33 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> |
34 | Description: | 34 | Description: |
35 | If CONFIG_PM_RUNTIME is enabled then this file | 35 | If CONFIG_PM is enabled, then this file is present. When read, |
36 | is present. When read, it returns the total time (in msec) | 36 | it returns the total time (in msec) that the USB device has been |
37 | that the USB device has been connected to the machine. This | 37 | connected to the machine. This file is read-only. |
38 | file is read-only. | ||
39 | Users: | 38 | Users: |
40 | PowerTOP <powertop@lists.01.org> | 39 | PowerTOP <powertop@lists.01.org> |
41 | https://01.org/powertop/ | 40 | https://01.org/powertop/ |
@@ -45,10 +44,9 @@ Date: January 2008 | |||
45 | KernelVersion: 2.6.25 | 44 | KernelVersion: 2.6.25 |
46 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> | 45 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> |
47 | Description: | 46 | Description: |
48 | If CONFIG_PM_RUNTIME is enabled then this file | 47 | If CONFIG_PM is enabled, then this file is present. When read, |
49 | is present. When read, it returns the total time (in msec) | 48 | it returns the total time (in msec) that the USB device has been |
50 | that the USB device has been active, i.e. not in a suspended | 49 | active, i.e. not in a suspended state. This file is read-only. |
51 | state. This file is read-only. | ||
52 | 50 | ||
53 | Tools can use this file and the connected_duration file to | 51 | Tools can use this file and the connected_duration file to |
54 | compute the percentage of time that a device has been active. | 52 | compute the percentage of time that a device has been active. |
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index 614d451cee41..e5cc7633d013 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb | |||
@@ -104,16 +104,15 @@ What: /sys/bus/usb/devices/.../power/usb2_hardware_lpm | |||
104 | Date: September 2011 | 104 | Date: September 2011 |
105 | Contact: Andiry Xu <andiry.xu@amd.com> | 105 | Contact: Andiry Xu <andiry.xu@amd.com> |
106 | Description: | 106 | Description: |
107 | If CONFIG_PM_RUNTIME is set and a USB 2.0 lpm-capable device | 107 | If CONFIG_PM is set and a USB 2.0 lpm-capable device is plugged |
108 | is plugged in to a xHCI host which support link PM, it will | 108 | in to a xHCI host which support link PM, it will perform a LPM |
109 | perform a LPM test; if the test is passed and host supports | 109 | test; if the test is passed and host supports USB2 hardware LPM |
110 | USB2 hardware LPM (xHCI 1.0 feature), USB2 hardware LPM will | 110 | (xHCI 1.0 feature), USB2 hardware LPM will be enabled for the |
111 | be enabled for the device and the USB device directory will | 111 | device and the USB device directory will contain a file named |
112 | contain a file named power/usb2_hardware_lpm. The file holds | 112 | power/usb2_hardware_lpm. The file holds a string value (enable |
113 | a string value (enable or disable) indicating whether or not | 113 | or disable) indicating whether or not USB2 hardware LPM is |
114 | USB2 hardware LPM is enabled for the device. Developer can | 114 | enabled for the device. Developer can write y/Y/1 or n/N/0 to |
115 | write y/Y/1 or n/N/0 to the file to enable/disable the | 115 | the file to enable/disable the feature. |
116 | feature. | ||
117 | 116 | ||
118 | What: /sys/bus/usb/devices/.../removable | 117 | What: /sys/bus/usb/devices/.../removable |
119 | Date: February 2012 | 118 | Date: February 2012 |
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt index 7b90fe034c4b..b5f83911732a 100644 --- a/Documentation/usb/power-management.txt +++ b/Documentation/usb/power-management.txt | |||
@@ -47,14 +47,15 @@ dynamic PM is implemented in the USB subsystem, although system PM is | |||
47 | covered to some extent (see Documentation/power/*.txt for more | 47 | covered to some extent (see Documentation/power/*.txt for more |
48 | information about system PM). | 48 | information about system PM). |
49 | 49 | ||
50 | Note: Dynamic PM support for USB is present only if the kernel was | 50 | System PM support is present only if the kernel was built with CONFIG_SUSPEND |
51 | built with CONFIG_USB_SUSPEND enabled (which depends on | 51 | or CONFIG_HIBERNATION enabled. Dynamic PM support for USB is present whenever |
52 | CONFIG_PM_RUNTIME). System PM support is present only if the kernel | 52 | the kernel was built with CONFIG_PM enabled. |
53 | was built with CONFIG_SUSPEND or CONFIG_HIBERNATION enabled. | 53 | |
54 | 54 | [Historically, dynamic PM support for USB was present only if the | |
55 | (Starting with the 3.10 kernel release, dynamic PM support for USB is | 55 | kernel had been built with CONFIG_USB_SUSPEND enabled (which depended on |
56 | present whenever the kernel was built with CONFIG_PM_RUNTIME enabled. | 56 | CONFIG_PM_RUNTIME). Starting with the 3.10 kernel release, dynamic PM support |
57 | The CONFIG_USB_SUSPEND option has been eliminated.) | 57 | for USB was present whenever the kernel was built with CONFIG_PM_RUNTIME |
58 | enabled. The CONFIG_USB_SUSPEND option had been eliminated.] | ||
58 | 59 | ||
59 | 60 | ||
60 | What is Remote Wakeup? | 61 | What is Remote Wakeup? |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 9bffd26cea05..874dec31a111 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1493,10 +1493,6 @@ int usb_resume(struct device *dev, pm_message_t msg) | |||
1493 | return status; | 1493 | return status; |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | #endif /* CONFIG_PM */ | ||
1497 | |||
1498 | #ifdef CONFIG_PM_RUNTIME | ||
1499 | |||
1500 | /** | 1496 | /** |
1501 | * usb_enable_autosuspend - allow a USB device to be autosuspended | 1497 | * usb_enable_autosuspend - allow a USB device to be autosuspended |
1502 | * @udev: the USB device which may be autosuspended | 1498 | * @udev: the USB device which may be autosuspended |
@@ -1876,7 +1872,7 @@ int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) | |||
1876 | return ret; | 1872 | return ret; |
1877 | } | 1873 | } |
1878 | 1874 | ||
1879 | #endif /* CONFIG_PM_RUNTIME */ | 1875 | #endif /* CONFIG_PM */ |
1880 | 1876 | ||
1881 | struct bus_type usb_bus_type = { | 1877 | struct bus_type usb_bus_type = { |
1882 | .name = "usb", | 1878 | .name = "usb", |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index efc953119ce2..9eb1cff28bd4 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -429,7 +429,6 @@ static int check_root_hub_suspended(struct device *dev) | |||
429 | return 0; | 429 | return 0; |
430 | } | 430 | } |
431 | 431 | ||
432 | #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) | ||
433 | static int suspend_common(struct device *dev, bool do_wakeup) | 432 | static int suspend_common(struct device *dev, bool do_wakeup) |
434 | { | 433 | { |
435 | struct pci_dev *pci_dev = to_pci_dev(dev); | 434 | struct pci_dev *pci_dev = to_pci_dev(dev); |
@@ -528,7 +527,6 @@ static int resume_common(struct device *dev, int event) | |||
528 | } | 527 | } |
529 | return retval; | 528 | return retval; |
530 | } | 529 | } |
531 | #endif /* SLEEP || RUNTIME */ | ||
532 | 530 | ||
533 | #ifdef CONFIG_PM_SLEEP | 531 | #ifdef CONFIG_PM_SLEEP |
534 | 532 | ||
@@ -607,8 +605,6 @@ static int hcd_pci_restore(struct device *dev) | |||
607 | 605 | ||
608 | #endif /* CONFIG_PM_SLEEP */ | 606 | #endif /* CONFIG_PM_SLEEP */ |
609 | 607 | ||
610 | #ifdef CONFIG_PM_RUNTIME | ||
611 | |||
612 | static int hcd_pci_runtime_suspend(struct device *dev) | 608 | static int hcd_pci_runtime_suspend(struct device *dev) |
613 | { | 609 | { |
614 | int retval; | 610 | int retval; |
@@ -630,13 +626,6 @@ static int hcd_pci_runtime_resume(struct device *dev) | |||
630 | return retval; | 626 | return retval; |
631 | } | 627 | } |
632 | 628 | ||
633 | #else | ||
634 | |||
635 | #define hcd_pci_runtime_suspend NULL | ||
636 | #define hcd_pci_runtime_resume NULL | ||
637 | |||
638 | #endif /* CONFIG_PM_RUNTIME */ | ||
639 | |||
640 | const struct dev_pm_ops usb_hcd_pci_pm_ops = { | 629 | const struct dev_pm_ops usb_hcd_pci_pm_ops = { |
641 | .suspend = hcd_pci_suspend, | 630 | .suspend = hcd_pci_suspend, |
642 | .suspend_noirq = hcd_pci_suspend_noirq, | 631 | .suspend_noirq = hcd_pci_suspend_noirq, |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index a6efb4184f2b..278be0515e8e 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -2258,10 +2258,6 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
2258 | return status; | 2258 | return status; |
2259 | } | 2259 | } |
2260 | 2260 | ||
2261 | #endif /* CONFIG_PM */ | ||
2262 | |||
2263 | #ifdef CONFIG_PM_RUNTIME | ||
2264 | |||
2265 | /* Workqueue routine for root-hub remote wakeup */ | 2261 | /* Workqueue routine for root-hub remote wakeup */ |
2266 | static void hcd_resume_work(struct work_struct *work) | 2262 | static void hcd_resume_work(struct work_struct *work) |
2267 | { | 2263 | { |
@@ -2293,7 +2289,7 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd) | |||
2293 | } | 2289 | } |
2294 | EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub); | 2290 | EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub); |
2295 | 2291 | ||
2296 | #endif /* CONFIG_PM_RUNTIME */ | 2292 | #endif /* CONFIG_PM */ |
2297 | 2293 | ||
2298 | /*-------------------------------------------------------------------------*/ | 2294 | /*-------------------------------------------------------------------------*/ |
2299 | 2295 | ||
@@ -2476,7 +2472,7 @@ struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver, | |||
2476 | init_timer(&hcd->rh_timer); | 2472 | init_timer(&hcd->rh_timer); |
2477 | hcd->rh_timer.function = rh_timer_func; | 2473 | hcd->rh_timer.function = rh_timer_func; |
2478 | hcd->rh_timer.data = (unsigned long) hcd; | 2474 | hcd->rh_timer.data = (unsigned long) hcd; |
2479 | #ifdef CONFIG_PM_RUNTIME | 2475 | #ifdef CONFIG_PM |
2480 | INIT_WORK(&hcd->wakeup_work, hcd_resume_work); | 2476 | INIT_WORK(&hcd->wakeup_work, hcd_resume_work); |
2481 | #endif | 2477 | #endif |
2482 | 2478 | ||
@@ -2790,7 +2786,7 @@ error_create_attr_group: | |||
2790 | hcd->rh_registered = 0; | 2786 | hcd->rh_registered = 0; |
2791 | spin_unlock_irq(&hcd_root_hub_lock); | 2787 | spin_unlock_irq(&hcd_root_hub_lock); |
2792 | 2788 | ||
2793 | #ifdef CONFIG_PM_RUNTIME | 2789 | #ifdef CONFIG_PM |
2794 | cancel_work_sync(&hcd->wakeup_work); | 2790 | cancel_work_sync(&hcd->wakeup_work); |
2795 | #endif | 2791 | #endif |
2796 | mutex_lock(&usb_bus_list_lock); | 2792 | mutex_lock(&usb_bus_list_lock); |
@@ -2858,7 +2854,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) | |||
2858 | hcd->rh_registered = 0; | 2854 | hcd->rh_registered = 0; |
2859 | spin_unlock_irq (&hcd_root_hub_lock); | 2855 | spin_unlock_irq (&hcd_root_hub_lock); |
2860 | 2856 | ||
2861 | #ifdef CONFIG_PM_RUNTIME | 2857 | #ifdef CONFIG_PM |
2862 | cancel_work_sync(&hcd->wakeup_work); | 2858 | cancel_work_sync(&hcd->wakeup_work); |
2863 | #endif | 2859 | #endif |
2864 | 2860 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b649fef2e35d..c9596525ba8c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1737,7 +1737,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1737 | * - If user has indicated to prevent autosuspend by passing | 1737 | * - If user has indicated to prevent autosuspend by passing |
1738 | * usbcore.autosuspend = -1 then keep autosuspend disabled. | 1738 | * usbcore.autosuspend = -1 then keep autosuspend disabled. |
1739 | */ | 1739 | */ |
1740 | #ifdef CONFIG_PM_RUNTIME | 1740 | #ifdef CONFIG_PM |
1741 | if (hdev->dev.power.autosuspend_delay >= 0) | 1741 | if (hdev->dev.power.autosuspend_delay >= 0) |
1742 | pm_runtime_set_autosuspend_delay(&hdev->dev, 0); | 1742 | pm_runtime_set_autosuspend_delay(&hdev->dev, 0); |
1743 | #endif | 1743 | #endif |
@@ -3449,7 +3449,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) | |||
3449 | return status; | 3449 | return status; |
3450 | } | 3450 | } |
3451 | 3451 | ||
3452 | #ifdef CONFIG_PM_RUNTIME | 3452 | #ifdef CONFIG_PM |
3453 | 3453 | ||
3454 | int usb_remote_wakeup(struct usb_device *udev) | 3454 | int usb_remote_wakeup(struct usb_device *udev) |
3455 | { | 3455 | { |
@@ -4856,7 +4856,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
4856 | udev->state != USB_STATE_NOTATTACHED) { | 4856 | udev->state != USB_STATE_NOTATTACHED) { |
4857 | if (portstatus & USB_PORT_STAT_ENABLE) { | 4857 | if (portstatus & USB_PORT_STAT_ENABLE) { |
4858 | status = 0; /* Nothing to do */ | 4858 | status = 0; /* Nothing to do */ |
4859 | #ifdef CONFIG_PM_RUNTIME | 4859 | #ifdef CONFIG_PM |
4860 | } else if (udev->state == USB_STATE_SUSPENDED && | 4860 | } else if (udev->state == USB_STATE_SUSPENDED && |
4861 | udev->persist_enabled) { | 4861 | udev->persist_enabled) { |
4862 | /* For a suspended device, treat this as a | 4862 | /* For a suspended device, treat this as a |
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index cd3f9dc24a06..210618319f10 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c | |||
@@ -72,7 +72,7 @@ static void usb_port_device_release(struct device *dev) | |||
72 | kfree(port_dev); | 72 | kfree(port_dev); |
73 | } | 73 | } |
74 | 74 | ||
75 | #ifdef CONFIG_PM_RUNTIME | 75 | #ifdef CONFIG_PM |
76 | static int usb_port_runtime_resume(struct device *dev) | 76 | static int usb_port_runtime_resume(struct device *dev) |
77 | { | 77 | { |
78 | struct usb_port *port_dev = to_usb_port(dev); | 78 | struct usb_port *port_dev = to_usb_port(dev); |
@@ -171,7 +171,7 @@ static int usb_port_runtime_suspend(struct device *dev) | |||
171 | #endif | 171 | #endif |
172 | 172 | ||
173 | static const struct dev_pm_ops usb_port_pm_ops = { | 173 | static const struct dev_pm_ops usb_port_pm_ops = { |
174 | #ifdef CONFIG_PM_RUNTIME | 174 | #ifdef CONFIG_PM |
175 | .runtime_suspend = usb_port_runtime_suspend, | 175 | .runtime_suspend = usb_port_runtime_suspend, |
176 | .runtime_resume = usb_port_runtime_resume, | 176 | .runtime_resume = usb_port_runtime_resume, |
177 | #endif | 177 | #endif |
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 1236c6011c70..d26973844a4d 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -334,14 +334,6 @@ static void remove_persist_attributes(struct device *dev) | |||
334 | &dev_attr_persist.attr, | 334 | &dev_attr_persist.attr, |
335 | power_group_name); | 335 | power_group_name); |
336 | } | 336 | } |
337 | #else | ||
338 | |||
339 | #define add_persist_attributes(dev) 0 | ||
340 | #define remove_persist_attributes(dev) do {} while (0) | ||
341 | |||
342 | #endif /* CONFIG_PM */ | ||
343 | |||
344 | #ifdef CONFIG_PM_RUNTIME | ||
345 | 337 | ||
346 | static ssize_t connected_duration_show(struct device *dev, | 338 | static ssize_t connected_duration_show(struct device *dev, |
347 | struct device_attribute *attr, char *buf) | 339 | struct device_attribute *attr, char *buf) |
@@ -585,10 +577,13 @@ static void remove_power_attributes(struct device *dev) | |||
585 | 577 | ||
586 | #else | 578 | #else |
587 | 579 | ||
580 | #define add_persist_attributes(dev) 0 | ||
581 | #define remove_persist_attributes(dev) do {} while (0) | ||
582 | |||
588 | #define add_power_attributes(dev) 0 | 583 | #define add_power_attributes(dev) 0 |
589 | #define remove_power_attributes(dev) do {} while (0) | 584 | #define remove_power_attributes(dev) do {} while (0) |
590 | 585 | ||
591 | #endif /* CONFIG_PM_RUNTIME */ | 586 | #endif /* CONFIG_PM */ |
592 | 587 | ||
593 | 588 | ||
594 | /* Descriptor fields */ | 589 | /* Descriptor fields */ |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 2dd2362198d2..2a92b97f0144 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -49,7 +49,7 @@ const char *usbcore_name = "usbcore"; | |||
49 | 49 | ||
50 | static bool nousb; /* Disable USB when built into kernel image */ | 50 | static bool nousb; /* Disable USB when built into kernel image */ |
51 | 51 | ||
52 | #ifdef CONFIG_PM_RUNTIME | 52 | #ifdef CONFIG_PM |
53 | static int usb_autosuspend_delay = 2; /* Default delay value, | 53 | static int usb_autosuspend_delay = 2; /* Default delay value, |
54 | * in seconds */ | 54 | * in seconds */ |
55 | module_param_named(autosuspend, usb_autosuspend_delay, int, 0644); | 55 | module_param_named(autosuspend, usb_autosuspend_delay, int, 0644); |
@@ -348,11 +348,9 @@ static const struct dev_pm_ops usb_device_pm_ops = { | |||
348 | .thaw = usb_dev_thaw, | 348 | .thaw = usb_dev_thaw, |
349 | .poweroff = usb_dev_poweroff, | 349 | .poweroff = usb_dev_poweroff, |
350 | .restore = usb_dev_restore, | 350 | .restore = usb_dev_restore, |
351 | #ifdef CONFIG_PM_RUNTIME | ||
352 | .runtime_suspend = usb_runtime_suspend, | 351 | .runtime_suspend = usb_runtime_suspend, |
353 | .runtime_resume = usb_runtime_resume, | 352 | .runtime_resume = usb_runtime_resume, |
354 | .runtime_idle = usb_runtime_idle, | 353 | .runtime_idle = usb_runtime_idle, |
355 | #endif | ||
356 | }; | 354 | }; |
357 | 355 | ||
358 | #endif /* CONFIG_PM */ | 356 | #endif /* CONFIG_PM */ |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index b1b34d0557c9..7eb1e26798e5 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
@@ -75,6 +75,14 @@ extern int usb_resume_complete(struct device *dev); | |||
75 | extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg); | 75 | extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg); |
76 | extern int usb_port_resume(struct usb_device *dev, pm_message_t msg); | 76 | extern int usb_port_resume(struct usb_device *dev, pm_message_t msg); |
77 | 77 | ||
78 | extern void usb_autosuspend_device(struct usb_device *udev); | ||
79 | extern int usb_autoresume_device(struct usb_device *udev); | ||
80 | extern int usb_remote_wakeup(struct usb_device *dev); | ||
81 | extern int usb_runtime_suspend(struct device *dev); | ||
82 | extern int usb_runtime_resume(struct device *dev); | ||
83 | extern int usb_runtime_idle(struct device *dev); | ||
84 | extern int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable); | ||
85 | |||
78 | #else | 86 | #else |
79 | 87 | ||
80 | static inline int usb_port_suspend(struct usb_device *udev, pm_message_t msg) | 88 | static inline int usb_port_suspend(struct usb_device *udev, pm_message_t msg) |
@@ -87,20 +95,6 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg) | |||
87 | return 0; | 95 | return 0; |
88 | } | 96 | } |
89 | 97 | ||
90 | #endif | ||
91 | |||
92 | #ifdef CONFIG_PM_RUNTIME | ||
93 | |||
94 | extern void usb_autosuspend_device(struct usb_device *udev); | ||
95 | extern int usb_autoresume_device(struct usb_device *udev); | ||
96 | extern int usb_remote_wakeup(struct usb_device *dev); | ||
97 | extern int usb_runtime_suspend(struct device *dev); | ||
98 | extern int usb_runtime_resume(struct device *dev); | ||
99 | extern int usb_runtime_idle(struct device *dev); | ||
100 | extern int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable); | ||
101 | |||
102 | #else | ||
103 | |||
104 | #define usb_autosuspend_device(udev) do {} while (0) | 98 | #define usb_autosuspend_device(udev) do {} while (0) |
105 | static inline int usb_autoresume_device(struct usb_device *udev) | 99 | static inline int usb_autoresume_device(struct usb_device *udev) |
106 | { | 100 | { |
@@ -111,6 +105,7 @@ static inline int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) | |||
111 | { | 105 | { |
112 | return 0; | 106 | return 0; |
113 | } | 107 | } |
108 | |||
114 | #endif | 109 | #endif |
115 | 110 | ||
116 | extern struct bus_type usb_bus_type; | 111 | extern struct bus_type usb_bus_type; |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index ca7b964124af..851006a0d97b 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -305,7 +305,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | #ifdef CONFIG_PM_RUNTIME | 308 | #ifdef CONFIG_PM |
309 | if (ehci->no_selective_suspend && device_can_wakeup(&pdev->dev)) | 309 | if (ehci->no_selective_suspend && device_can_wakeup(&pdev->dev)) |
310 | ehci_warn(ehci, "selective suspend/wakeup unavailable\n"); | 310 | ehci_warn(ehci, "selective suspend/wakeup unavailable\n"); |
311 | #endif | 311 | #endif |
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index ad0c348e68e9..25fb1da8d3d7 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * and usb-storage. | 22 | * and usb-storage. |
23 | * | 23 | * |
24 | * TODO: | 24 | * TODO: |
25 | * - usb suspend/resume triggered by sl811 (with PM_RUNTIME) | 25 | * - usb suspend/resume triggered by sl811 |
26 | * - various issues noted in the code | 26 | * - various issues noted in the code |
27 | * - performance work; use both register banks; ... | 27 | * - performance work; use both register banks; ... |
28 | * - use urb->iso_frame_desc[] with ISO transfers | 28 | * - use urb->iso_frame_desc[] with ISO transfers |
@@ -1752,8 +1752,7 @@ sl811h_probe(struct platform_device *dev) | |||
1752 | #ifdef CONFIG_PM | 1752 | #ifdef CONFIG_PM |
1753 | 1753 | ||
1754 | /* for this device there's no useful distinction between the controller | 1754 | /* for this device there's no useful distinction between the controller |
1755 | * and its root hub, except that the root hub only gets direct PM calls | 1755 | * and its root hub. |
1756 | * when CONFIG_PM_RUNTIME is enabled. | ||
1757 | */ | 1756 | */ |
1758 | 1757 | ||
1759 | static int | 1758 | static int |
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index c0671750671f..bf86630b3cea 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c | |||
@@ -3144,8 +3144,7 @@ static int u132_probe(struct platform_device *pdev) | |||
3144 | #ifdef CONFIG_PM | 3144 | #ifdef CONFIG_PM |
3145 | /* | 3145 | /* |
3146 | * for this device there's no useful distinction between the controller | 3146 | * for this device there's no useful distinction between the controller |
3147 | * and its root hub, except that the root hub only gets direct PM calls | 3147 | * and its root hub. |
3148 | * when CONFIG_PM_RUNTIME is enabled. | ||
3149 | */ | 3148 | */ |
3150 | static int u132_suspend(struct platform_device *pdev, pm_message_t state) | 3149 | static int u132_suspend(struct platform_device *pdev, pm_message_t state) |
3151 | { | 3150 | { |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 696160d48ae8..f674abd76865 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -1146,7 +1146,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
1146 | set_bit(port_index, &bus_state->bus_suspended); | 1146 | set_bit(port_index, &bus_state->bus_suspended); |
1147 | } | 1147 | } |
1148 | /* USB core sets remote wake mask for USB 3.0 hubs, | 1148 | /* USB core sets remote wake mask for USB 3.0 hubs, |
1149 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME | 1149 | * including the USB 3.0 roothub, but only if CONFIG_PM |
1150 | * is enabled, so also enable remote wake here. | 1150 | * is enabled, so also enable remote wake here. |
1151 | */ | 1151 | */ |
1152 | if (hcd->self.root_hub->do_remote_wakeup | 1152 | if (hcd->self.root_hub->do_remote_wakeup |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2a5d45b4cb15..61173ca9cb8f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -4024,7 +4024,7 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, | |||
4024 | return ret; | 4024 | return ret; |
4025 | } | 4025 | } |
4026 | 4026 | ||
4027 | #ifdef CONFIG_PM_RUNTIME | 4027 | #ifdef CONFIG_PM |
4028 | 4028 | ||
4029 | /* BESL to HIRD Encoding array for USB2 LPM */ | 4029 | /* BESL to HIRD Encoding array for USB2 LPM */ |
4030 | static int xhci_besl_encoding[16] = {125, 150, 200, 300, 400, 500, 1000, 2000, | 4030 | static int xhci_besl_encoding[16] = {125, 150, 200, 300, 400, 500, 1000, 2000, |
@@ -4239,24 +4239,8 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
4239 | return 0; | 4239 | return 0; |
4240 | } | 4240 | } |
4241 | 4241 | ||
4242 | #else | ||
4243 | |||
4244 | int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | ||
4245 | struct usb_device *udev, int enable) | ||
4246 | { | ||
4247 | return 0; | ||
4248 | } | ||
4249 | |||
4250 | int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | ||
4251 | { | ||
4252 | return 0; | ||
4253 | } | ||
4254 | |||
4255 | #endif /* CONFIG_PM_RUNTIME */ | ||
4256 | |||
4257 | /*---------------------- USB 3.0 Link PM functions ------------------------*/ | 4242 | /*---------------------- USB 3.0 Link PM functions ------------------------*/ |
4258 | 4243 | ||
4259 | #ifdef CONFIG_PM | ||
4260 | /* Service interval in nanoseconds = 2^(bInterval - 1) * 125us * 1000ns / 1us */ | 4244 | /* Service interval in nanoseconds = 2^(bInterval - 1) * 125us * 1000ns / 1us */ |
4261 | static unsigned long long xhci_service_interval_to_ns( | 4245 | static unsigned long long xhci_service_interval_to_ns( |
4262 | struct usb_endpoint_descriptor *desc) | 4246 | struct usb_endpoint_descriptor *desc) |
@@ -4687,6 +4671,17 @@ int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd, | |||
4687 | } | 4671 | } |
4688 | #else /* CONFIG_PM */ | 4672 | #else /* CONFIG_PM */ |
4689 | 4673 | ||
4674 | int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | ||
4675 | struct usb_device *udev, int enable) | ||
4676 | { | ||
4677 | return 0; | ||
4678 | } | ||
4679 | |||
4680 | int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | ||
4681 | { | ||
4682 | return 0; | ||
4683 | } | ||
4684 | |||
4690 | int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd, | 4685 | int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd, |
4691 | struct usb_device *udev, enum usb3_link_state state) | 4686 | struct usb_device *udev, enum usb3_link_state state) |
4692 | { | 4687 | { |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 7843ef7dd0ff..29be0e654ecc 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
@@ -1761,7 +1761,7 @@ static int msm_otg_remove(struct platform_device *pdev) | |||
1761 | return 0; | 1761 | return 0; |
1762 | } | 1762 | } |
1763 | 1763 | ||
1764 | #ifdef CONFIG_PM_RUNTIME | 1764 | #ifdef CONFIG_PM |
1765 | static int msm_otg_runtime_idle(struct device *dev) | 1765 | static int msm_otg_runtime_idle(struct device *dev) |
1766 | { | 1766 | { |
1767 | struct msm_otg *motg = dev_get_drvdata(dev); | 1767 | struct msm_otg *motg = dev_get_drvdata(dev); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 447a7e2fc19b..f89c24a03bd9 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -637,7 +637,7 @@ static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index) | |||
637 | #endif | 637 | #endif |
638 | 638 | ||
639 | /* USB autosuspend and autoresume */ | 639 | /* USB autosuspend and autoresume */ |
640 | #ifdef CONFIG_PM_RUNTIME | 640 | #ifdef CONFIG_PM |
641 | extern void usb_enable_autosuspend(struct usb_device *udev); | 641 | extern void usb_enable_autosuspend(struct usb_device *udev); |
642 | extern void usb_disable_autosuspend(struct usb_device *udev); | 642 | extern void usb_disable_autosuspend(struct usb_device *udev); |
643 | 643 | ||
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index cd96a2bc3388..668898e29d0e 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -93,7 +93,7 @@ struct usb_hcd { | |||
93 | 93 | ||
94 | struct timer_list rh_timer; /* drives root-hub polling */ | 94 | struct timer_list rh_timer; /* drives root-hub polling */ |
95 | struct urb *status_urb; /* the current status urb */ | 95 | struct urb *status_urb; /* the current status urb */ |
96 | #ifdef CONFIG_PM_RUNTIME | 96 | #ifdef CONFIG_PM |
97 | struct work_struct wakeup_work; /* for remote wakeup */ | 97 | struct work_struct wakeup_work; /* for remote wakeup */ |
98 | #endif | 98 | #endif |
99 | 99 | ||
@@ -625,16 +625,13 @@ extern int usb_find_interface_driver(struct usb_device *dev, | |||
625 | extern void usb_root_hub_lost_power(struct usb_device *rhdev); | 625 | extern void usb_root_hub_lost_power(struct usb_device *rhdev); |
626 | extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg); | 626 | extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg); |
627 | extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); | 627 | extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); |
628 | #endif /* CONFIG_PM */ | ||
629 | |||
630 | #ifdef CONFIG_PM_RUNTIME | ||
631 | extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); | 628 | extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); |
632 | #else | 629 | #else |
633 | static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) | 630 | static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) |
634 | { | 631 | { |
635 | return; | 632 | return; |
636 | } | 633 | } |
637 | #endif /* CONFIG_PM_RUNTIME */ | 634 | #endif /* CONFIG_PM */ |
638 | 635 | ||
639 | /*-------------------------------------------------------------------------*/ | 636 | /*-------------------------------------------------------------------------*/ |
640 | 637 | ||