aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-06-23 19:58:53 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-06-27 19:52:52 -0400
commitde3ef1eb1cd0cc3a75f7a3661e10ed827f370ab8 (patch)
treed74445102cc3ff9680422c69603d575646420b8d
parent0847684cfc5f0e9f009919bfdcb041d60e19b856 (diff)
PM / core: Drop run_wake flag from struct dev_pm_info
The run_wake flag in struct dev_pm_info is used to indicate whether or not the device is capable of generating remote wakeup signals at run time (or in the system working state), but the distinction between runtime remote wakeup and system wakeup signaling has always been rather artificial. The only practical reason for it to exist at the core level was that ACPI and PCI treated those two cases differently, but that's not the case any more after recent changes. For this reason, get rid of the run_wake flag and, when applicable, use device_set_wakeup_capable() and device_can_wakeup() instead of device_set_run_wake() and device_run_wake(), respectively. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--Documentation/power/runtime_pm.txt7
-rw-r--r--drivers/acpi/pci_root.c5
-rw-r--r--drivers/pci/pci-acpi.c5
-rw-r--r--drivers/pci/pci.c6
-rw-r--r--drivers/pci/pcie/pme.c2
-rw-r--r--drivers/usb/dwc3/dwc3-pci.c3
-rw-r--r--drivers/usb/host/uhci-pci.c2
-rw-r--r--include/linux/pm.h1
-rw-r--r--include/linux/pm_runtime.h12
9 files changed, 11 insertions, 32 deletions
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt
index ee69d7532172..0fde3dcf077a 100644
--- a/Documentation/power/runtime_pm.txt
+++ b/Documentation/power/runtime_pm.txt
@@ -105,9 +105,9 @@ knows what to do to handle the device).
105 105
106In particular, if the driver requires remote wakeup capability (i.e. hardware 106In particular, if the driver requires remote wakeup capability (i.e. hardware
107mechanism allowing the device to request a change of its power state, such as 107mechanism allowing the device to request a change of its power state, such as
108PCI PME) for proper functioning and device_run_wake() returns 'false' for the 108PCI PME) for proper functioning and device_can_wakeup() returns 'false' for the
109device, then ->runtime_suspend() should return -EBUSY. On the other hand, if 109device, then ->runtime_suspend() should return -EBUSY. On the other hand, if
110device_run_wake() returns 'true' for the device and the device is put into a 110device_can_wakeup() returns 'true' for the device and the device is put into a
111low-power state during the execution of the suspend callback, it is expected 111low-power state during the execution of the suspend callback, it is expected
112that remote wakeup will be enabled for the device. Generally, remote wakeup 112that remote wakeup will be enabled for the device. Generally, remote wakeup
113should be enabled for all input devices put into low-power states at run time. 113should be enabled for all input devices put into low-power states at run time.
@@ -253,9 +253,6 @@ defined in include/linux/pm.h:
253 being executed for that device and it is not practical to wait for the 253 being executed for that device and it is not practical to wait for the
254 suspend to complete; means "start a resume as soon as you've suspended" 254 suspend to complete; means "start a resume as soon as you've suspended"
255 255
256 unsigned int run_wake;
257 - set if the device is capable of generating runtime wake-up events
258
259 enum rpm_status runtime_status; 256 enum rpm_status runtime_status;
260 - the runtime PM status of the device; this field's initial value is 257 - the runtime PM status of the device; this field's initial value is
261 RPM_SUSPENDED, which means that each device is initially regarded by the 258 RPM_SUSPENDED, which means that each device is initially regarded by the
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 783acbe25520..0d34e622a8b5 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -608,8 +608,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
608 pcie_no_aspm(); 608 pcie_no_aspm();
609 609
610 pci_acpi_add_bus_pm_notifier(device); 610 pci_acpi_add_bus_pm_notifier(device);
611 if (device->wakeup.flags.valid) 611 device_set_wakeup_capable(root->bus->bridge, device->wakeup.flags.valid);
612 device_set_run_wake(root->bus->bridge, true);
613 612
614 if (hotadd) { 613 if (hotadd) {
615 pcibios_resource_survey_bus(root->bus); 614 pcibios_resource_survey_bus(root->bus);
@@ -649,7 +648,7 @@ static void acpi_pci_root_remove(struct acpi_device *device)
649 pci_stop_root_bus(root->bus); 648 pci_stop_root_bus(root->bus);
650 649
651 pci_ioapic_remove(root); 650 pci_ioapic_remove(root);
652 device_set_run_wake(root->bus->bridge, false); 651 device_set_wakeup_capable(root->bus->bridge, false);
653 pci_acpi_remove_bus_pm_notifier(device); 652 pci_acpi_remove_bus_pm_notifier(device);
654 653
655 pci_remove_root_bus(root->bus); 654 pci_remove_root_bus(root->bus);
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 138a3c55d80e..e70c1c7ba1bf 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -738,7 +738,6 @@ static void pci_acpi_setup(struct device *dev)
738 return; 738 return;
739 739
740 device_set_wakeup_capable(dev, true); 740 device_set_wakeup_capable(dev, true);
741 device_set_run_wake(dev, true);
742 acpi_pci_wakeup(pci_dev, false); 741 acpi_pci_wakeup(pci_dev, false);
743} 742}
744 743
@@ -750,10 +749,8 @@ static void pci_acpi_cleanup(struct device *dev)
750 return; 749 return;
751 750
752 pci_acpi_remove_pm_notifier(adev); 751 pci_acpi_remove_pm_notifier(adev);
753 if (adev->wakeup.flags.valid) { 752 if (adev->wakeup.flags.valid)
754 device_set_wakeup_capable(dev, false); 753 device_set_wakeup_capable(dev, false);
755 device_set_run_wake(dev, false);
756 }
757} 754}
758 755
759static bool pci_acpi_bus_match(struct device *dev) 756static bool pci_acpi_bus_match(struct device *dev)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d378262d30e3..0b5302a9fdae 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2105,7 +2105,7 @@ bool pci_dev_run_wake(struct pci_dev *dev)
2105{ 2105{
2106 struct pci_bus *bus = dev->bus; 2106 struct pci_bus *bus = dev->bus;
2107 2107
2108 if (device_run_wake(&dev->dev)) 2108 if (device_can_wakeup(&dev->dev))
2109 return true; 2109 return true;
2110 2110
2111 if (!dev->pme_support) 2111 if (!dev->pme_support)
@@ -2118,7 +2118,7 @@ bool pci_dev_run_wake(struct pci_dev *dev)
2118 while (bus->parent) { 2118 while (bus->parent) {
2119 struct pci_dev *bridge = bus->self; 2119 struct pci_dev *bridge = bus->self;
2120 2120
2121 if (device_run_wake(&bridge->dev)) 2121 if (device_can_wakeup(&bridge->dev))
2122 return true; 2122 return true;
2123 2123
2124 bus = bus->parent; 2124 bus = bus->parent;
@@ -2126,7 +2126,7 @@ bool pci_dev_run_wake(struct pci_dev *dev)
2126 2126
2127 /* We have reached the root bus. */ 2127 /* We have reached the root bus. */
2128 if (bus->bridge) 2128 if (bus->bridge)
2129 return device_run_wake(bus->bridge); 2129 return device_can_wakeup(bus->bridge);
2130 2130
2131 return false; 2131 return false;
2132} 2132}
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
index 1db1615838ac..80e58d25006d 100644
--- a/drivers/pci/pcie/pme.c
+++ b/drivers/pci/pcie/pme.c
@@ -300,7 +300,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
300 */ 300 */
301static int pcie_pme_can_wakeup(struct pci_dev *dev, void *ign) 301static int pcie_pme_can_wakeup(struct pci_dev *dev, void *ign)
302{ 302{
303 device_set_run_wake(&dev->dev, true); 303 device_set_wakeup_capable(&dev->dev, true);
304 return 0; 304 return 0;
305} 305}
306 306
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index fe851544d7fb..7e995df7a797 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -230,7 +230,6 @@ static int dwc3_pci_probe(struct pci_dev *pci,
230 } 230 }
231 231
232 device_init_wakeup(dev, true); 232 device_init_wakeup(dev, true);
233 device_set_run_wake(dev, true);
234 pci_set_drvdata(pci, dwc); 233 pci_set_drvdata(pci, dwc);
235 pm_runtime_put(dev); 234 pm_runtime_put(dev);
236 235
@@ -310,7 +309,7 @@ static int dwc3_pci_runtime_suspend(struct device *dev)
310{ 309{
311 struct dwc3_pci *dwc = dev_get_drvdata(dev); 310 struct dwc3_pci *dwc = dev_get_drvdata(dev);
312 311
313 if (device_run_wake(dev)) 312 if (device_can_wakeup(dev))
314 return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D3); 313 return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D3);
315 314
316 return -EBUSY; 315 return -EBUSY;
diff --git a/drivers/usb/host/uhci-pci.c b/drivers/usb/host/uhci-pci.c
index 02260cfdedb1..49effdc0d857 100644
--- a/drivers/usb/host/uhci-pci.c
+++ b/drivers/usb/host/uhci-pci.c
@@ -131,7 +131,7 @@ static int uhci_pci_init(struct usb_hcd *hcd)
131 131
132 /* Intel controllers use non-PME wakeup signalling */ 132 /* Intel controllers use non-PME wakeup signalling */
133 if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_INTEL) 133 if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_INTEL)
134 device_set_run_wake(uhci_dev(uhci), 1); 134 device_set_wakeup_capable(uhci_dev(uhci), true);
135 135
136 /* Set up pointers to PCI-specific functions */ 136 /* Set up pointers to PCI-specific functions */
137 uhci->reset_hc = uhci_pci_reset_hc; 137 uhci->reset_hc = uhci_pci_reset_hc;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index a0894bc52bb4..b8b4df09fd8f 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -584,7 +584,6 @@ struct dev_pm_info {
584 unsigned int idle_notification:1; 584 unsigned int idle_notification:1;
585 unsigned int request_pending:1; 585 unsigned int request_pending:1;
586 unsigned int deferred_resume:1; 586 unsigned int deferred_resume:1;
587 unsigned int run_wake:1;
588 unsigned int runtime_auto:1; 587 unsigned int runtime_auto:1;
589 bool ignore_children:1; 588 bool ignore_children:1;
590 unsigned int no_callbacks:1; 589 unsigned int no_callbacks:1;
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index ca4823e675e2..2efb08a60e63 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -76,16 +76,6 @@ static inline void pm_runtime_put_noidle(struct device *dev)
76 atomic_add_unless(&dev->power.usage_count, -1, 0); 76 atomic_add_unless(&dev->power.usage_count, -1, 0);
77} 77}
78 78
79static inline bool device_run_wake(struct device *dev)
80{
81 return dev->power.run_wake;
82}
83
84static inline void device_set_run_wake(struct device *dev, bool enable)
85{
86 dev->power.run_wake = enable;
87}
88
89static inline bool pm_runtime_suspended(struct device *dev) 79static inline bool pm_runtime_suspended(struct device *dev)
90{ 80{
91 return dev->power.runtime_status == RPM_SUSPENDED 81 return dev->power.runtime_status == RPM_SUSPENDED
@@ -163,8 +153,6 @@ static inline void pm_runtime_forbid(struct device *dev) {}
163static inline void pm_suspend_ignore_children(struct device *dev, bool enable) {} 153static inline void pm_suspend_ignore_children(struct device *dev, bool enable) {}
164static inline void pm_runtime_get_noresume(struct device *dev) {} 154static inline void pm_runtime_get_noresume(struct device *dev) {}
165static inline void pm_runtime_put_noidle(struct device *dev) {} 155static inline void pm_runtime_put_noidle(struct device *dev) {}
166static inline bool device_run_wake(struct device *dev) { return false; }
167static inline void device_set_run_wake(struct device *dev, bool enable) {}
168static inline bool pm_runtime_suspended(struct device *dev) { return false; } 156static inline bool pm_runtime_suspended(struct device *dev) { return false; }
169static inline bool pm_runtime_active(struct device *dev) { return true; } 157static inline bool pm_runtime_active(struct device *dev) { return true; }
170static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 158static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }