diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2014-09-12 17:36:29 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-09-12 22:01:38 -0400 |
commit | 5e3d234456e25f664e0755c23689173588f4ca9b (patch) | |
tree | 9c851a20e560d86c5b59bb4a3d376504587c4724 /drivers/pci | |
parent | abbfec34e1df3073429cd6b0fad1c26635597799 (diff) |
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 <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-acpi.c | 134 |
1 files changed, 67 insertions, 67 deletions
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 @@ | |||
18 | #include <linux/pm_qos.h> | 18 | #include <linux/pm_qos.h> |
19 | #include "pci.h" | 19 | #include "pci.h" |
20 | 20 | ||
21 | /** | ||
22 | * pci_acpi_wake_bus - Root bus wakeup notification fork function. | ||
23 | * @work: Work item to handle. | ||
24 | */ | ||
25 | static void pci_acpi_wake_bus(struct work_struct *work) | ||
26 | { | ||
27 | struct acpi_device *adev; | ||
28 | struct acpi_pci_root *root; | ||
29 | |||
30 | adev = container_of(work, struct acpi_device, wakeup.context.work); | ||
31 | root = acpi_driver_data(adev); | ||
32 | pci_pme_wakeup_bus(root->bus); | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * pci_acpi_wake_dev - PCI device wakeup notification work function. | ||
37 | * @handle: ACPI handle of a device the notification is for. | ||
38 | * @work: Work item to handle. | ||
39 | */ | ||
40 | static void pci_acpi_wake_dev(struct work_struct *work) | ||
41 | { | ||
42 | struct acpi_device_wakeup_context *context; | ||
43 | struct pci_dev *pci_dev; | ||
44 | |||
45 | context = container_of(work, struct acpi_device_wakeup_context, work); | ||
46 | pci_dev = to_pci_dev(context->dev); | ||
47 | |||
48 | if (pci_dev->pme_poll) | ||
49 | pci_dev->pme_poll = false; | ||
50 | |||
51 | if (pci_dev->current_state == PCI_D3cold) { | ||
52 | pci_wakeup_event(pci_dev); | ||
53 | pm_runtime_resume(&pci_dev->dev); | ||
54 | return; | ||
55 | } | ||
56 | |||
57 | /* Clear PME Status if set. */ | ||
58 | if (pci_dev->pme_support) | ||
59 | pci_check_pme_status(pci_dev); | ||
60 | |||
61 | pci_wakeup_event(pci_dev); | ||
62 | pm_runtime_resume(&pci_dev->dev); | ||
63 | |||
64 | if (pci_dev->subordinate) | ||
65 | pci_pme_wakeup_bus(pci_dev->subordinate); | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * pci_acpi_add_bus_pm_notifier - Register PM notifier for root PCI bus. | ||
70 | * @dev: PCI root bridge ACPI device. | ||
71 | */ | ||
72 | acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev) | ||
73 | { | ||
74 | return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus); | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * pci_acpi_add_pm_notifier - Register PM notifier for given PCI device. | ||
79 | * @dev: ACPI device to add the notifier for. | ||
80 | * @pci_dev: PCI device to check for the PME status if an event is signaled. | ||
81 | */ | ||
82 | acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, | ||
83 | struct pci_dev *pci_dev) | ||
84 | { | ||
85 | return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); | ||
86 | } | ||
87 | |||
88 | phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle) | 21 | phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle) |
89 | { | 22 | { |
90 | acpi_status status = AE_NOT_EXIST; | 23 | acpi_status status = AE_NOT_EXIST; |
@@ -346,6 +279,73 @@ int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp) | |||
346 | } | 279 | } |
347 | EXPORT_SYMBOL_GPL(pci_get_hp_params); | 280 | EXPORT_SYMBOL_GPL(pci_get_hp_params); |
348 | 281 | ||
282 | /** | ||
283 | * pci_acpi_wake_bus - Root bus wakeup notification fork function. | ||
284 | * @work: Work item to handle. | ||
285 | */ | ||
286 | static void pci_acpi_wake_bus(struct work_struct *work) | ||
287 | { | ||
288 | struct acpi_device *adev; | ||
289 | struct acpi_pci_root *root; | ||
290 | |||
291 | adev = container_of(work, struct acpi_device, wakeup.context.work); | ||
292 | root = acpi_driver_data(adev); | ||
293 | pci_pme_wakeup_bus(root->bus); | ||
294 | } | ||
295 | |||
296 | /** | ||
297 | * pci_acpi_wake_dev - PCI device wakeup notification work function. | ||
298 | * @handle: ACPI handle of a device the notification is for. | ||
299 | * @work: Work item to handle. | ||
300 | */ | ||
301 | static void pci_acpi_wake_dev(struct work_struct *work) | ||
302 | { | ||
303 | struct acpi_device_wakeup_context *context; | ||
304 | struct pci_dev *pci_dev; | ||
305 | |||
306 | context = container_of(work, struct acpi_device_wakeup_context, work); | ||
307 | pci_dev = to_pci_dev(context->dev); | ||
308 | |||
309 | if (pci_dev->pme_poll) | ||
310 | pci_dev->pme_poll = false; | ||
311 | |||
312 | if (pci_dev->current_state == PCI_D3cold) { | ||
313 | pci_wakeup_event(pci_dev); | ||
314 | pm_runtime_resume(&pci_dev->dev); | ||
315 | return; | ||
316 | } | ||
317 | |||
318 | /* Clear PME Status if set. */ | ||
319 | if (pci_dev->pme_support) | ||
320 | pci_check_pme_status(pci_dev); | ||
321 | |||
322 | pci_wakeup_event(pci_dev); | ||
323 | pm_runtime_resume(&pci_dev->dev); | ||
324 | |||
325 | if (pci_dev->subordinate) | ||
326 | pci_pme_wakeup_bus(pci_dev->subordinate); | ||
327 | } | ||
328 | |||
329 | /** | ||
330 | * pci_acpi_add_bus_pm_notifier - Register PM notifier for root PCI bus. | ||
331 | * @dev: PCI root bridge ACPI device. | ||
332 | */ | ||
333 | acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev) | ||
334 | { | ||
335 | return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus); | ||
336 | } | ||
337 | |||
338 | /** | ||
339 | * pci_acpi_add_pm_notifier - Register PM notifier for given PCI device. | ||
340 | * @dev: ACPI device to add the notifier for. | ||
341 | * @pci_dev: PCI device to check for the PME status if an event is signaled. | ||
342 | */ | ||
343 | acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, | ||
344 | struct pci_dev *pci_dev) | ||
345 | { | ||
346 | return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); | ||
347 | } | ||
348 | |||
349 | /* | 349 | /* |
350 | * _SxD returns the D-state with the highest power | 350 | * _SxD returns the D-state with the highest power |
351 | * (lowest D-state number) supported in the S-state "x". | 351 | * (lowest D-state number) supported in the S-state "x". |