diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-06-14 15:25:02 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-06-16 17:30:17 -0400 |
commit | d2abdf62882d982c58e7a6b09ecdcfcc28075e2e (patch) | |
tree | d43dd7e66f4de4e044ed632a9eb6d61c61019b78 /drivers/pci/pci.c | |
parent | c12ff1df5f114484e3d8abd028769a624cc3399f (diff) |
PCI PM: Fix handling of devices without PM support by pci_target_state()
If a PCI device is not power-manageable either by the platform, or
with the help of the native PCI PM interface, pci_target_state() will
return either PCI_D3hot, or PCI_POWER_ERROR for it, depending on
whether or not the device is configured to wake up the system. Alas,
none of these return values is correct, because each of them causes
pci_prepare_to_sleep() to return error code, although it should
complete successfully in such a case.
Fix this problem by making pci_target_state() always return PCI_D0
for devices that cannot be power managed.
Cc: stable@kernel.org
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index c56a4a0355a8..7b59fd7c9575 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1284,15 +1284,14 @@ pci_power_t pci_target_state(struct pci_dev *dev) | |||
1284 | default: | 1284 | default: |
1285 | target_state = state; | 1285 | target_state = state; |
1286 | } | 1286 | } |
1287 | } else if (!dev->pm_cap) { | ||
1288 | target_state = PCI_D0; | ||
1287 | } else if (device_may_wakeup(&dev->dev)) { | 1289 | } else if (device_may_wakeup(&dev->dev)) { |
1288 | /* | 1290 | /* |
1289 | * Find the deepest state from which the device can generate | 1291 | * Find the deepest state from which the device can generate |
1290 | * wake-up events, make it the target state and enable device | 1292 | * wake-up events, make it the target state and enable device |
1291 | * to generate PME#. | 1293 | * to generate PME#. |
1292 | */ | 1294 | */ |
1293 | if (!dev->pm_cap) | ||
1294 | return PCI_POWER_ERROR; | ||
1295 | |||
1296 | if (dev->pme_support) { | 1295 | if (dev->pme_support) { |
1297 | while (target_state | 1296 | while (target_state |
1298 | && !(dev->pme_support & (1 << target_state))) | 1297 | && !(dev->pme_support & (1 << target_state))) |