aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2012-03-27 03:43:25 -0400
committerLen Brown <len.brown@intel.com>2012-03-30 02:21:18 -0400
commitb24e5098853653554baf6ec975b9e855f3d6e5c0 (patch)
treebe93ad39b826c64907bb48dceea034db5b91fc24 /drivers/pci
parent0090def6c37c8ea29508a435e581f2ef26fea10f (diff)
ACPI, PCI: Move acpi_dev_run_wake() to ACPI core
acpi_dev_run_wake() is a generic function which can be used by other subsystem too. Rename it to acpi_pm_device_run_wake, to be consistent with acpi_pm_device_sleep_wake. Then move it to ACPI core. Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-acpi.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 060fd22a1103..0f150f271c2a 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -277,40 +277,6 @@ static int acpi_pci_sleep_wake(struct pci_dev *dev, bool enable)
277 return 0; 277 return 0;
278} 278}
279 279
280/**
281 * acpi_dev_run_wake - Enable/disable wake-up for given device.
282 * @phys_dev: Device to enable/disable the platform to wake-up the system for.
283 * @enable: Whether enable or disable the wake-up functionality.
284 *
285 * Find the ACPI device object corresponding to @pci_dev and try to
286 * enable/disable the GPE associated with it.
287 */
288static int acpi_dev_run_wake(struct device *phys_dev, bool enable)
289{
290 struct acpi_device *dev;
291 acpi_handle handle;
292
293 if (!device_run_wake(phys_dev))
294 return -EINVAL;
295
296 handle = DEVICE_ACPI_HANDLE(phys_dev);
297 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &dev))) {
298 dev_dbg(phys_dev, "ACPI handle has no context in %s!\n",
299 __func__);
300 return -ENODEV;
301 }
302
303 if (enable) {
304 acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0);
305 acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number);
306 } else {
307 acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number);
308 acpi_disable_wakeup_device_power(dev);
309 }
310
311 return 0;
312}
313
314static void acpi_pci_propagate_run_wake(struct pci_bus *bus, bool enable) 280static void acpi_pci_propagate_run_wake(struct pci_bus *bus, bool enable)
315{ 281{
316 while (bus->parent) { 282 while (bus->parent) {
@@ -318,14 +284,14 @@ static void acpi_pci_propagate_run_wake(struct pci_bus *bus, bool enable)
318 284
319 if (bridge->pme_interrupt) 285 if (bridge->pme_interrupt)
320 return; 286 return;
321 if (!acpi_dev_run_wake(&bridge->dev, enable)) 287 if (!acpi_pm_device_run_wake(&bridge->dev, enable))
322 return; 288 return;
323 bus = bus->parent; 289 bus = bus->parent;
324 } 290 }
325 291
326 /* We have reached the root bus. */ 292 /* We have reached the root bus. */
327 if (bus->bridge) 293 if (bus->bridge)
328 acpi_dev_run_wake(bus->bridge, enable); 294 acpi_pm_device_run_wake(bus->bridge, enable);
329} 295}
330 296
331static int acpi_pci_run_wake(struct pci_dev *dev, bool enable) 297static int acpi_pci_run_wake(struct pci_dev *dev, bool enable)
@@ -333,7 +299,7 @@ static int acpi_pci_run_wake(struct pci_dev *dev, bool enable)
333 if (dev->pme_interrupt) 299 if (dev->pme_interrupt)
334 return 0; 300 return 0;
335 301
336 if (!acpi_dev_run_wake(&dev->dev, enable)) 302 if (!acpi_pm_device_run_wake(&dev->dev, enable))
337 return 0; 303 return 0;
338 304
339 acpi_pci_propagate_run_wake(dev->bus, enable); 305 acpi_pci_propagate_run_wake(dev->bus, enable);