diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-07-23 19:18:53 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-07-23 19:18:53 -0400 |
commit | 85dbb3d05ec6d063f6f8ad4d6dfc13793d566374 (patch) | |
tree | f1e8512350cf5a371e475f76673fc7cd67d211ba | |
parent | 9a3c4145af32125c5ee39c0272662b47307a8323 (diff) |
ACPI / PCI: Use ACPI_COMPANION() instead of ACPI_HANDLE()
The ACPI_HANDLE() macro evaluates ACPI_COMPANION() internally to
return the handle of the device's ACPI companion, so it is much
more straightforward and efficient to use ACPI_COMPANION()
directly to obtain the device's ACPI companion object instead of
using ACPI_HANDLE() and acpi_bus_get_device() on the returned
handle for the same thing.
Use ACPI_COMPANION() instead of ACPI_HANDLE() in the PCI ACPI support
code.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/pci/pci-acpi.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index ca4927ba8433..740efa8be969 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -170,14 +170,13 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) | |||
170 | 170 | ||
171 | static bool acpi_pci_power_manageable(struct pci_dev *dev) | 171 | static bool acpi_pci_power_manageable(struct pci_dev *dev) |
172 | { | 172 | { |
173 | acpi_handle handle = ACPI_HANDLE(&dev->dev); | 173 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); |
174 | 174 | return adev ? acpi_device_power_manageable(adev) : false; | |
175 | return handle ? acpi_bus_power_manageable(handle) : false; | ||
176 | } | 175 | } |
177 | 176 | ||
178 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 177 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
179 | { | 178 | { |
180 | acpi_handle handle = ACPI_HANDLE(&dev->dev); | 179 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); |
181 | static const u8 state_conv[] = { | 180 | static const u8 state_conv[] = { |
182 | [PCI_D0] = ACPI_STATE_D0, | 181 | [PCI_D0] = ACPI_STATE_D0, |
183 | [PCI_D1] = ACPI_STATE_D1, | 182 | [PCI_D1] = ACPI_STATE_D1, |
@@ -188,7 +187,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
188 | int error = -EINVAL; | 187 | int error = -EINVAL; |
189 | 188 | ||
190 | /* If the ACPI device has _EJ0, ignore the device */ | 189 | /* If the ACPI device has _EJ0, ignore the device */ |
191 | if (!handle || acpi_has_method(handle, "_EJ0")) | 190 | if (!adev || acpi_has_method(adev->handle, "_EJ0")) |
192 | return -ENODEV; | 191 | return -ENODEV; |
193 | 192 | ||
194 | switch (state) { | 193 | switch (state) { |
@@ -202,7 +201,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
202 | case PCI_D1: | 201 | case PCI_D1: |
203 | case PCI_D2: | 202 | case PCI_D2: |
204 | case PCI_D3hot: | 203 | case PCI_D3hot: |
205 | error = acpi_bus_set_power(handle, state_conv[state]); | 204 | error = acpi_device_set_power(adev, state_conv[state]); |
206 | } | 205 | } |
207 | 206 | ||
208 | if (!error) | 207 | if (!error) |
@@ -214,9 +213,8 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
214 | 213 | ||
215 | static bool acpi_pci_can_wakeup(struct pci_dev *dev) | 214 | static bool acpi_pci_can_wakeup(struct pci_dev *dev) |
216 | { | 215 | { |
217 | acpi_handle handle = ACPI_HANDLE(&dev->dev); | 216 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); |
218 | 217 | return adev ? acpi_device_can_wakeup(adev) : false; | |
219 | return handle ? acpi_bus_can_wakeup(handle) : false; | ||
220 | } | 218 | } |
221 | 219 | ||
222 | static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable) | 220 | static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable) |