diff options
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index e4df71ab79b3..6bc0d8c870af 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -277,12 +277,11 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
277 | [PCI_D3hot] = ACPI_STATE_D3, | 277 | [PCI_D3hot] = ACPI_STATE_D3, |
278 | [PCI_D3cold] = ACPI_STATE_D3 | 278 | [PCI_D3cold] = ACPI_STATE_D3 |
279 | }; | 279 | }; |
280 | int error = -EINVAL; | ||
280 | 281 | ||
281 | if (!handle) | ||
282 | return -ENODEV; | ||
283 | /* If the ACPI device has _EJ0, ignore the device */ | 282 | /* If the ACPI device has _EJ0, ignore the device */ |
284 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) | 283 | if (!handle || ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) |
285 | return 0; | 284 | return -ENODEV; |
286 | 285 | ||
287 | switch (state) { | 286 | switch (state) { |
288 | case PCI_D0: | 287 | case PCI_D0: |
@@ -290,9 +289,14 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
290 | case PCI_D2: | 289 | case PCI_D2: |
291 | case PCI_D3hot: | 290 | case PCI_D3hot: |
292 | case PCI_D3cold: | 291 | case PCI_D3cold: |
293 | return acpi_bus_set_power(handle, state_conv[state]); | 292 | error = acpi_bus_set_power(handle, state_conv[state]); |
294 | } | 293 | } |
295 | return -EINVAL; | 294 | |
295 | if (!error) | ||
296 | dev_printk(KERN_INFO, &dev->dev, | ||
297 | "power state changed by ACPI to D%d\n", state); | ||
298 | |||
299 | return error; | ||
296 | } | 300 | } |
297 | 301 | ||
298 | static struct pci_platform_pm_ops acpi_pci_platform_pm = { | 302 | static struct pci_platform_pm_ops acpi_pci_platform_pm = { |