Commit de3ef1eb authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 0847684c
...@@ -105,9 +105,9 @@ knows what to do to handle the device). ...@@ -105,9 +105,9 @@ knows what to do to handle the device).
In particular, if the driver requires remote wakeup capability (i.e. hardware In particular, if the driver requires remote wakeup capability (i.e. hardware
mechanism allowing the device to request a change of its power state, such as mechanism allowing the device to request a change of its power state, such as
PCI PME) for proper functioning and device_run_wake() returns 'false' for the PCI PME) for proper functioning and device_can_wakeup() returns 'false' for the
device, then ->runtime_suspend() should return -EBUSY. On the other hand, if device, then ->runtime_suspend() should return -EBUSY. On the other hand, if
device_run_wake() returns 'true' for the device and the device is put into a device_can_wakeup() returns 'true' for the device and the device is put into a
low-power state during the execution of the suspend callback, it is expected low-power state during the execution of the suspend callback, it is expected
that remote wakeup will be enabled for the device. Generally, remote wakeup that remote wakeup will be enabled for the device. Generally, remote wakeup
should be enabled for all input devices put into low-power states at run time. should 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,9 +253,6 @@ defined in include/linux/pm.h:
being executed for that device and it is not practical to wait for the being executed for that device and it is not practical to wait for the
suspend to complete; means "start a resume as soon as you've suspended" suspend to complete; means "start a resume as soon as you've suspended"
unsigned int run_wake;
- set if the device is capable of generating runtime wake-up events
enum rpm_status runtime_status; enum rpm_status runtime_status;
- the runtime PM status of the device; this field's initial value is - the runtime PM status of the device; this field's initial value is
RPM_SUSPENDED, which means that each device is initially regarded by the RPM_SUSPENDED, which means that each device is initially regarded by the
......
...@@ -608,8 +608,7 @@ static int acpi_pci_root_add(struct acpi_device *device, ...@@ -608,8 +608,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
pcie_no_aspm(); pcie_no_aspm();
pci_acpi_add_bus_pm_notifier(device); pci_acpi_add_bus_pm_notifier(device);
if (device->wakeup.flags.valid) device_set_wakeup_capable(root->bus->bridge, device->wakeup.flags.valid);
device_set_run_wake(root->bus->bridge, true);
if (hotadd) { if (hotadd) {
pcibios_resource_survey_bus(root->bus); pcibios_resource_survey_bus(root->bus);
...@@ -649,7 +648,7 @@ static void acpi_pci_root_remove(struct acpi_device *device) ...@@ -649,7 +648,7 @@ static void acpi_pci_root_remove(struct acpi_device *device)
pci_stop_root_bus(root->bus); pci_stop_root_bus(root->bus);
pci_ioapic_remove(root); pci_ioapic_remove(root);
device_set_run_wake(root->bus->bridge, false); device_set_wakeup_capable(root->bus->bridge, false);
pci_acpi_remove_bus_pm_notifier(device); pci_acpi_remove_bus_pm_notifier(device);
pci_remove_root_bus(root->bus); pci_remove_root_bus(root->bus);
......
...@@ -738,7 +738,6 @@ static void pci_acpi_setup(struct device *dev) ...@@ -738,7 +738,6 @@ static void pci_acpi_setup(struct device *dev)
return; return;
device_set_wakeup_capable(dev, true); device_set_wakeup_capable(dev, true);
device_set_run_wake(dev, true);
acpi_pci_wakeup(pci_dev, false); acpi_pci_wakeup(pci_dev, false);
} }
...@@ -750,10 +749,8 @@ static void pci_acpi_cleanup(struct device *dev) ...@@ -750,10 +749,8 @@ static void pci_acpi_cleanup(struct device *dev)
return; return;
pci_acpi_remove_pm_notifier(adev); pci_acpi_remove_pm_notifier(adev);
if (adev->wakeup.flags.valid) { if (adev->wakeup.flags.valid)
device_set_wakeup_capable(dev, false); device_set_wakeup_capable(dev, false);
device_set_run_wake(dev, false);
}
} }
static bool pci_acpi_bus_match(struct device *dev) static bool pci_acpi_bus_match(struct device *dev)
......
...@@ -2105,7 +2105,7 @@ bool pci_dev_run_wake(struct pci_dev *dev) ...@@ -2105,7 +2105,7 @@ bool pci_dev_run_wake(struct pci_dev *dev)
{ {
struct pci_bus *bus = dev->bus; struct pci_bus *bus = dev->bus;
if (device_run_wake(&dev->dev)) if (device_can_wakeup(&dev->dev))
return true; return true;
if (!dev->pme_support) if (!dev->pme_support)
...@@ -2118,7 +2118,7 @@ bool pci_dev_run_wake(struct pci_dev *dev) ...@@ -2118,7 +2118,7 @@ bool pci_dev_run_wake(struct pci_dev *dev)
while (bus->parent) { while (bus->parent) {
struct pci_dev *bridge = bus->self; struct pci_dev *bridge = bus->self;
if (device_run_wake(&bridge->dev)) if (device_can_wakeup(&bridge->dev))
return true; return true;
bus = bus->parent; bus = bus->parent;
...@@ -2126,7 +2126,7 @@ bool pci_dev_run_wake(struct pci_dev *dev) ...@@ -2126,7 +2126,7 @@ bool pci_dev_run_wake(struct pci_dev *dev)
/* We have reached the root bus. */ /* We have reached the root bus. */
if (bus->bridge) if (bus->bridge)
return device_run_wake(bus->bridge); return device_can_wakeup(bus->bridge);
return false; return false;
} }
......
...@@ -300,7 +300,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context) ...@@ -300,7 +300,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
*/ */
static int pcie_pme_can_wakeup(struct pci_dev *dev, void *ign) static int pcie_pme_can_wakeup(struct pci_dev *dev, void *ign)
{ {
device_set_run_wake(&dev->dev, true); device_set_wakeup_capable(&dev->dev, true);
return 0; return 0;
} }
......
...@@ -230,7 +230,6 @@ static int dwc3_pci_probe(struct pci_dev *pci, ...@@ -230,7 +230,6 @@ static int dwc3_pci_probe(struct pci_dev *pci,
} }
device_init_wakeup(dev, true); device_init_wakeup(dev, true);
device_set_run_wake(dev, true);
pci_set_drvdata(pci, dwc); pci_set_drvdata(pci, dwc);
pm_runtime_put(dev); pm_runtime_put(dev);
...@@ -310,7 +309,7 @@ static int dwc3_pci_runtime_suspend(struct device *dev) ...@@ -310,7 +309,7 @@ static int dwc3_pci_runtime_suspend(struct device *dev)
{ {
struct dwc3_pci *dwc = dev_get_drvdata(dev); struct dwc3_pci *dwc = dev_get_drvdata(dev);
if (device_run_wake(dev)) if (device_can_wakeup(dev))
return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D3); return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D3);
return -EBUSY; return -EBUSY;
......
...@@ -131,7 +131,7 @@ static int uhci_pci_init(struct usb_hcd *hcd) ...@@ -131,7 +131,7 @@ static int uhci_pci_init(struct usb_hcd *hcd)
/* Intel controllers use non-PME wakeup signalling */ /* Intel controllers use non-PME wakeup signalling */
if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_INTEL) if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_INTEL)
device_set_run_wake(uhci_dev(uhci), 1); device_set_wakeup_capable(uhci_dev(uhci), true);
/* Set up pointers to PCI-specific functions */ /* Set up pointers to PCI-specific functions */
uhci->reset_hc = uhci_pci_reset_hc; uhci->reset_hc = uhci_pci_reset_hc;
......
...@@ -584,7 +584,6 @@ struct dev_pm_info { ...@@ -584,7 +584,6 @@ struct dev_pm_info {
unsigned int idle_notification:1; unsigned int idle_notification:1;
unsigned int request_pending:1; unsigned int request_pending:1;
unsigned int deferred_resume:1; unsigned int deferred_resume:1;
unsigned int run_wake:1;
unsigned int runtime_auto:1; unsigned int runtime_auto:1;
bool ignore_children:1; bool ignore_children:1;
unsigned int no_callbacks:1; unsigned int no_callbacks:1;
......
...@@ -76,16 +76,6 @@ static inline void pm_runtime_put_noidle(struct device *dev) ...@@ -76,16 +76,6 @@ static inline void pm_runtime_put_noidle(struct device *dev)
atomic_add_unless(&dev->power.usage_count, -1, 0); atomic_add_unless(&dev->power.usage_count, -1, 0);
} }
static inline bool device_run_wake(struct device *dev)
{
return dev->power.run_wake;
}
static inline void device_set_run_wake(struct device *dev, bool enable)
{
dev->power.run_wake = enable;
}
static inline bool pm_runtime_suspended(struct device *dev) static inline bool pm_runtime_suspended(struct device *dev)
{ {
return dev->power.runtime_status == RPM_SUSPENDED return dev->power.runtime_status == RPM_SUSPENDED
...@@ -163,8 +153,6 @@ static inline void pm_runtime_forbid(struct device *dev) {} ...@@ -163,8 +153,6 @@ static inline void pm_runtime_forbid(struct device *dev) {}
static inline void pm_suspend_ignore_children(struct device *dev, bool enable) {} static inline void pm_suspend_ignore_children(struct device *dev, bool enable) {}
static inline void pm_runtime_get_noresume(struct device *dev) {} static inline void pm_runtime_get_noresume(struct device *dev) {}
static inline void pm_runtime_put_noidle(struct device *dev) {} static inline void pm_runtime_put_noidle(struct device *dev) {}
static inline bool device_run_wake(struct device *dev) { return false; }
static inline void device_set_run_wake(struct device *dev, bool enable) {}
static inline bool pm_runtime_suspended(struct device *dev) { return false; } static inline bool pm_runtime_suspended(struct device *dev) { return false; }
static inline bool pm_runtime_active(struct device *dev) { return true; } static inline bool pm_runtime_active(struct device *dev) { return true; }
static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment