From 5e3d234456e25f664e0755c23689173588f4ca9b Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Fri, 12 Sep 2014 15:36:29 -0600 Subject: PCI: Shuffle pci-acpi.c functions to group them logically Move code around to put all the ACPI power management stuff together and all the pieces related to ACPI methods (_CBA, _HPP, _HPX) together. No functional change. Signed-off-by: Bjorn Helgaas --- drivers/pci/pci-acpi.c | 134 ++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'drivers/pci/pci-acpi.c') diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index e514d50eaddc..6ebf8edc5f3c 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -18,73 +18,6 @@ #include #include "pci.h" -/** - * pci_acpi_wake_bus - Root bus wakeup notification fork function. - * @work: Work item to handle. - */ -static void pci_acpi_wake_bus(struct work_struct *work) -{ - struct acpi_device *adev; - struct acpi_pci_root *root; - - adev = container_of(work, struct acpi_device, wakeup.context.work); - root = acpi_driver_data(adev); - pci_pme_wakeup_bus(root->bus); -} - -/** - * pci_acpi_wake_dev - PCI device wakeup notification work function. - * @handle: ACPI handle of a device the notification is for. - * @work: Work item to handle. - */ -static void pci_acpi_wake_dev(struct work_struct *work) -{ - struct acpi_device_wakeup_context *context; - struct pci_dev *pci_dev; - - context = container_of(work, struct acpi_device_wakeup_context, work); - pci_dev = to_pci_dev(context->dev); - - if (pci_dev->pme_poll) - pci_dev->pme_poll = false; - - if (pci_dev->current_state == PCI_D3cold) { - pci_wakeup_event(pci_dev); - pm_runtime_resume(&pci_dev->dev); - return; - } - - /* Clear PME Status if set. */ - if (pci_dev->pme_support) - pci_check_pme_status(pci_dev); - - pci_wakeup_event(pci_dev); - pm_runtime_resume(&pci_dev->dev); - - if (pci_dev->subordinate) - pci_pme_wakeup_bus(pci_dev->subordinate); -} - -/** - * pci_acpi_add_bus_pm_notifier - Register PM notifier for root PCI bus. - * @dev: PCI root bridge ACPI device. - */ -acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev) -{ - return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus); -} - -/** - * pci_acpi_add_pm_notifier - Register PM notifier for given PCI device. - * @dev: ACPI device to add the notifier for. - * @pci_dev: PCI device to check for the PME status if an event is signaled. - */ -acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, - struct pci_dev *pci_dev) -{ - return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); -} - phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle) { acpi_status status = AE_NOT_EXIST; @@ -346,6 +279,73 @@ int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp) } EXPORT_SYMBOL_GPL(pci_get_hp_params); +/** + * pci_acpi_wake_bus - Root bus wakeup notification fork function. + * @work: Work item to handle. + */ +static void pci_acpi_wake_bus(struct work_struct *work) +{ + struct acpi_device *adev; + struct acpi_pci_root *root; + + adev = container_of(work, struct acpi_device, wakeup.context.work); + root = acpi_driver_data(adev); + pci_pme_wakeup_bus(root->bus); +} + +/** + * pci_acpi_wake_dev - PCI device wakeup notification work function. + * @handle: ACPI handle of a device the notification is for. + * @work: Work item to handle. + */ +static void pci_acpi_wake_dev(struct work_struct *work) +{ + struct acpi_device_wakeup_context *context; + struct pci_dev *pci_dev; + + context = container_of(work, struct acpi_device_wakeup_context, work); + pci_dev = to_pci_dev(context->dev); + + if (pci_dev->pme_poll) + pci_dev->pme_poll = false; + + if (pci_dev->current_state == PCI_D3cold) { + pci_wakeup_event(pci_dev); + pm_runtime_resume(&pci_dev->dev); + return; + } + + /* Clear PME Status if set. */ + if (pci_dev->pme_support) + pci_check_pme_status(pci_dev); + + pci_wakeup_event(pci_dev); + pm_runtime_resume(&pci_dev->dev); + + if (pci_dev->subordinate) + pci_pme_wakeup_bus(pci_dev->subordinate); +} + +/** + * pci_acpi_add_bus_pm_notifier - Register PM notifier for root PCI bus. + * @dev: PCI root bridge ACPI device. + */ +acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev) +{ + return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus); +} + +/** + * pci_acpi_add_pm_notifier - Register PM notifier for given PCI device. + * @dev: ACPI device to add the notifier for. + * @pci_dev: PCI device to check for the PME status if an event is signaled. + */ +acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, + struct pci_dev *pci_dev) +{ + return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); +} + /* * _SxD returns the D-state with the highest power * (lowest D-state number) supported in the S-state "x". -- cgit v1.2.3