* [PATCH] PCI PM: Fix handling of devices without PM support by pci_target_state()
@ 2009-06-14 19:25 Rafael J. Wysocki
2009-06-16 19:18 ` Jesse Barnes
0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2009-06-14 19:25 UTC (permalink / raw)
To: Jesse Barnes; +Cc: Linux PCI, LKML, Andreas Mohr, pm list
From: Rafael J. Wysocki <rjw@sisk.pl>
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.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
Hi Jesse,
I think this is 2.6.31 material, probably -stable too.
Best,
Rafael
---
drivers/pci/pci.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Index: linux-2.6/drivers/pci/pci.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci.c
+++ linux-2.6/drivers/pci/pci.c
@@ -1288,15 +1288,14 @@ pci_power_t pci_target_state(struct pci_
default:
target_state = state;
}
+ } else if (!dev->pm_cap) {
+ target_state = PCI_D0;
} else if (device_may_wakeup(&dev->dev)) {
/*
* Find the deepest state from which the device can generate
* wake-up events, make it the target state and enable device
* to generate PME#.
*/
- if (!dev->pm_cap)
- return PCI_POWER_ERROR;
-
if (dev->pme_support) {
while (target_state
&& !(dev->pme_support & (1 << target_state)))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI PM: Fix handling of devices without PM support by pci_target_state()
2009-06-14 19:25 [PATCH] PCI PM: Fix handling of devices without PM support by pci_target_state() Rafael J. Wysocki
@ 2009-06-16 19:18 ` Jesse Barnes
0 siblings, 0 replies; 2+ messages in thread
From: Jesse Barnes @ 2009-06-16 19:18 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux PCI, LKML, Andreas Mohr, pm list
On Sun, 14 Jun 2009 21:25:02 +0200
"Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> 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.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
> Hi Jesse,
>
> I think this is 2.6.31 material, probably -stable too.
Applied to my linux-next branch, thanks.
--
Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-16 19:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-14 19:25 [PATCH] PCI PM: Fix handling of devices without PM support by pci_target_state() Rafael J. Wysocki
2009-06-16 19:18 ` Jesse Barnes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox