aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2012-12-22 18:02:54 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-03 07:09:41 -0500
commit38a9a67a281eeebcd7cccf87f0e371f58ae625e3 (patch)
tree91f8dd1862d8f46739d01d89299eed82fe3a6545 /drivers/pci
parentd2e5f0c16ad60a7208fd371233e63b73c990ece2 (diff)
ACPI / PCI: Move the _PRT setup and cleanup code to pci-acpi.c
Move the code related to _PRT setup and removal and to power resources from acpi_pci_bind() and acpi_pci_unbind() to the .setup() and .cleanup() callbacks in acpi_pci_bus and remove acpi_pci_bind() and acpi_pci_unbind() that have no purpose any more. Accordingly, remove the code related to device .bind() and .unbind() operations from the ACPI PCI root bridge driver. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Acked-by: Toshi Kani <toshi.kani@hp.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-acpi.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index b98106c110e7..42736e213f25 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -320,12 +320,33 @@ static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle)
320 return 0; 320 return 0;
321} 321}
322 322
323static void acpi_pci_wakeup_setup(struct device *dev) 323static void pci_acpi_setup(struct device *dev)
324{ 324{
325 struct acpi_device *adev = acpi_dev_pm_get_node(dev);
326 struct pci_dev *pci_dev = to_pci_dev(dev); 325 struct pci_dev *pci_dev = to_pci_dev(dev);
326 acpi_handle handle = ACPI_HANDLE(dev);
327 struct acpi_device *adev;
328 acpi_status status;
329 acpi_handle dummy;
327 330
328 if (!adev || !adev->wakeup.flags.valid) 331 /*
332 * Evaluate and parse _PRT, if exists. This code allows parsing of
333 * _PRT objects within the scope of non-bridge devices. Note that
334 * _PRTs within the scope of a PCI bridge assume the bridge's
335 * subordinate bus number.
336 *
337 * TBD: Can _PRTs exist within the scope of non-bridge PCI devices?
338 */
339 status = acpi_get_handle(handle, METHOD_NAME__PRT, &dummy);
340 if (ACPI_SUCCESS(status)) {
341 unsigned char bus;
342
343 bus = pci_dev->subordinate ?
344 pci_dev->subordinate->number : pci_dev->bus->number;
345 acpi_pci_irq_add_prt(handle, pci_domain_nr(pci_dev->bus), bus);
346 }
347
348 acpi_power_resource_register_device(dev, handle);
349 if (acpi_bus_get_device(handle, &adev) || !adev->wakeup.flags.valid)
329 return; 350 return;
330 351
331 device_set_wakeup_capable(dev, true); 352 device_set_wakeup_capable(dev, true);
@@ -336,23 +357,30 @@ static void acpi_pci_wakeup_setup(struct device *dev)
336 device_set_run_wake(dev, true); 357 device_set_run_wake(dev, true);
337} 358}
338 359
339static void acpi_pci_wakeup_cleanup(struct device *dev) 360static void pci_acpi_cleanup(struct device *dev)
340{ 361{
341 struct acpi_device *adev = acpi_dev_pm_get_node(dev); 362 struct pci_dev *pci_dev = to_pci_dev(dev);
363 acpi_handle handle = ACPI_HANDLE(dev);
364 struct acpi_device *adev;
342 365
343 if (adev && adev->wakeup.flags.valid) { 366 if (!acpi_bus_get_device(handle, &adev) && adev->wakeup.flags.valid) {
344 device_set_wakeup_capable(dev, false); 367 device_set_wakeup_capable(dev, false);
345 device_set_run_wake(dev, false); 368 device_set_run_wake(dev, false);
346 pci_acpi_remove_pm_notifier(adev); 369 pci_acpi_remove_pm_notifier(adev);
347 } 370 }
371 acpi_power_resource_unregister_device(dev, handle);
372
373 if (pci_dev->subordinate)
374 acpi_pci_irq_del_prt(pci_domain_nr(pci_dev->bus),
375 pci_dev->subordinate->number);
348} 376}
349 377
350static struct acpi_bus_type acpi_pci_bus = { 378static struct acpi_bus_type acpi_pci_bus = {
351 .bus = &pci_bus_type, 379 .bus = &pci_bus_type,
352 .find_device = acpi_pci_find_device, 380 .find_device = acpi_pci_find_device,
353 .find_bridge = acpi_pci_find_root_bridge, 381 .find_bridge = acpi_pci_find_root_bridge,
354 .setup = acpi_pci_wakeup_setup, 382 .setup = pci_acpi_setup,
355 .cleanup = acpi_pci_wakeup_cleanup, 383 .cleanup = pci_acpi_cleanup,
356}; 384};
357 385
358static int __init acpi_pci_init(void) 386static int __init acpi_pci_init(void)