diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-acpi.c | 71 |
1 files changed, 4 insertions, 67 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 63d6618a4804..1af4008182fd 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -20,8 +20,6 @@ | |||
20 | #include <linux/pm_qos.h> | 20 | #include <linux/pm_qos.h> |
21 | #include "pci.h" | 21 | #include "pci.h" |
22 | 22 | ||
23 | static DEFINE_MUTEX(pci_acpi_pm_notify_mtx); | ||
24 | |||
25 | /** | 23 | /** |
26 | * pci_acpi_wake_bus - Wake-up notification handler for root buses. | 24 | * pci_acpi_wake_bus - Wake-up notification handler for root buses. |
27 | * @handle: ACPI handle of a device the notification is for. | 25 | * @handle: ACPI handle of a device the notification is for. |
@@ -69,67 +67,6 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context) | |||
69 | } | 67 | } |
70 | 68 | ||
71 | /** | 69 | /** |
72 | * add_pm_notifier - Register PM notifier for given ACPI device. | ||
73 | * @dev: ACPI device to add the notifier for. | ||
74 | * @context: PCI device or bus to check for PME status if an event is signaled. | ||
75 | * | ||
76 | * NOTE: @dev need not be a run-wake or wake-up device to be a valid source of | ||
77 | * PM wake-up events. For example, wake-up events may be generated for bridges | ||
78 | * if one of the devices below the bridge is signaling PME, even if the bridge | ||
79 | * itself doesn't have a wake-up GPE associated with it. | ||
80 | */ | ||
81 | static acpi_status add_pm_notifier(struct acpi_device *dev, | ||
82 | acpi_notify_handler handler, | ||
83 | void *context) | ||
84 | { | ||
85 | acpi_status status = AE_ALREADY_EXISTS; | ||
86 | |||
87 | mutex_lock(&pci_acpi_pm_notify_mtx); | ||
88 | |||
89 | if (dev->wakeup.flags.notifier_present) | ||
90 | goto out; | ||
91 | |||
92 | status = acpi_install_notify_handler(dev->handle, | ||
93 | ACPI_SYSTEM_NOTIFY, | ||
94 | handler, context); | ||
95 | if (ACPI_FAILURE(status)) | ||
96 | goto out; | ||
97 | |||
98 | dev->wakeup.flags.notifier_present = true; | ||
99 | |||
100 | out: | ||
101 | mutex_unlock(&pci_acpi_pm_notify_mtx); | ||
102 | return status; | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * remove_pm_notifier - Unregister PM notifier from given ACPI device. | ||
107 | * @dev: ACPI device to remove the notifier from. | ||
108 | */ | ||
109 | static acpi_status remove_pm_notifier(struct acpi_device *dev, | ||
110 | acpi_notify_handler handler) | ||
111 | { | ||
112 | acpi_status status = AE_BAD_PARAMETER; | ||
113 | |||
114 | mutex_lock(&pci_acpi_pm_notify_mtx); | ||
115 | |||
116 | if (!dev->wakeup.flags.notifier_present) | ||
117 | goto out; | ||
118 | |||
119 | status = acpi_remove_notify_handler(dev->handle, | ||
120 | ACPI_SYSTEM_NOTIFY, | ||
121 | handler); | ||
122 | if (ACPI_FAILURE(status)) | ||
123 | goto out; | ||
124 | |||
125 | dev->wakeup.flags.notifier_present = false; | ||
126 | |||
127 | out: | ||
128 | mutex_unlock(&pci_acpi_pm_notify_mtx); | ||
129 | return status; | ||
130 | } | ||
131 | |||
132 | /** | ||
133 | * pci_acpi_add_bus_pm_notifier - Register PM notifier for given PCI bus. | 70 | * pci_acpi_add_bus_pm_notifier - Register PM notifier for given PCI bus. |
134 | * @dev: ACPI device to add the notifier for. | 71 | * @dev: ACPI device to add the notifier for. |
135 | * @pci_bus: PCI bus to walk checking for PME status if an event is signaled. | 72 | * @pci_bus: PCI bus to walk checking for PME status if an event is signaled. |
@@ -137,7 +74,7 @@ static acpi_status remove_pm_notifier(struct acpi_device *dev, | |||
137 | acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev, | 74 | acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev, |
138 | struct pci_bus *pci_bus) | 75 | struct pci_bus *pci_bus) |
139 | { | 76 | { |
140 | return add_pm_notifier(dev, pci_acpi_wake_bus, pci_bus); | 77 | return acpi_add_pm_notifier(dev, pci_acpi_wake_bus, pci_bus); |
141 | } | 78 | } |
142 | 79 | ||
143 | /** | 80 | /** |
@@ -146,7 +83,7 @@ acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev, | |||
146 | */ | 83 | */ |
147 | acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev) | 84 | acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev) |
148 | { | 85 | { |
149 | return remove_pm_notifier(dev, pci_acpi_wake_bus); | 86 | return acpi_remove_pm_notifier(dev, pci_acpi_wake_bus); |
150 | } | 87 | } |
151 | 88 | ||
152 | /** | 89 | /** |
@@ -157,7 +94,7 @@ acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev) | |||
157 | acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, | 94 | acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, |
158 | struct pci_dev *pci_dev) | 95 | struct pci_dev *pci_dev) |
159 | { | 96 | { |
160 | return add_pm_notifier(dev, pci_acpi_wake_dev, pci_dev); | 97 | return acpi_add_pm_notifier(dev, pci_acpi_wake_dev, pci_dev); |
161 | } | 98 | } |
162 | 99 | ||
163 | /** | 100 | /** |
@@ -166,7 +103,7 @@ acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, | |||
166 | */ | 103 | */ |
167 | acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev) | 104 | acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev) |
168 | { | 105 | { |
169 | return remove_pm_notifier(dev, pci_acpi_wake_dev); | 106 | return acpi_remove_pm_notifier(dev, pci_acpi_wake_dev); |
170 | } | 107 | } |
171 | 108 | ||
172 | phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle) | 109 | phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle) |