* [PATCH] PM / Wakeup: Fix initialization of wakeup-related device sysfs files
@ 2011-04-21 21:57 Rafael J. Wysocki
2011-04-22 7:57 ` Tino Keitel
2011-04-25 19:58 ` Tino Keitel
0 siblings, 2 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2011-04-21 21:57 UTC (permalink / raw)
To: Linux PM mailing list; +Cc: LKML, Alan Stern, Tino Keitel, Greg Kroah-Hartman
From: Rafael J. Wysocki <rjw@sisk.pl>
It turns out that some PCI devices are only found to be
wakeup-capable during registration, in which case, when
device_set_wakeup_capable() is called, device_is_registered() already
returns 'true' for the given device, but dpm_sysfs_add() hasn't been
called for it yet. This leads to situations in which the device's
power.can_wakeup flag is not set as requested because of failing
wakeup_sysfs_add() and its wakeup-related sysfs files are not
created, although they should be present. This is a post-2.6.38
regression introduced by commit cb8f51bdadb7969139c2e39c2defd4cde98c1
(PM: Do not create wakeup sysfs files for devices that cannot wake
up).
To work around this problem initialize the device's power.entry
field to an empty list head and make device_set_wakeup_capable()
check if it is still empty before attempting to add the devices
wakeup-related sysfs files with wakeup_sysfs_add(). Namely, if
power.entry is still empty at this point, device_pm_add() hasn't been
called yet for the device and its wakeup-related files will be
created later, so device_set_wakeup_capable() doesn't have to create
them.
Reported-by: Tino Keitel <tino.keitel@tikei.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/base/power/main.c | 1 +
drivers/base/power/wakeup.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
Index: linux-2.6/drivers/base/power/main.c
===================================================================
--- linux-2.6.orig/drivers/base/power/main.c
+++ linux-2.6/drivers/base/power/main.c
@@ -63,6 +63,7 @@ void device_pm_init(struct device *dev)
dev->power.wakeup = NULL;
spin_lock_init(&dev->power.lock);
pm_runtime_init(dev);
+ INIT_LIST_HEAD(&dev->power.entry);
}
/**
Index: linux-2.6/drivers/base/power/wakeup.c
===================================================================
--- linux-2.6.orig/drivers/base/power/wakeup.c
+++ linux-2.6/drivers/base/power/wakeup.c
@@ -258,7 +258,7 @@ void device_set_wakeup_capable(struct de
if (!!dev->power.can_wakeup == !!capable)
return;
- if (device_is_registered(dev)) {
+ if (device_is_registered(dev) && !list_empty(&dev->power.entry)) {
if (capable) {
if (wakeup_sysfs_add(dev))
return;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PM / Wakeup: Fix initialization of wakeup-related device sysfs files
2011-04-21 21:57 [PATCH] PM / Wakeup: Fix initialization of wakeup-related device sysfs files Rafael J. Wysocki
@ 2011-04-22 7:57 ` Tino Keitel
2011-04-25 19:58 ` Tino Keitel
1 sibling, 0 replies; 5+ messages in thread
From: Tino Keitel @ 2011-04-22 7:57 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM mailing list, LKML, Alan Stern, Greg Kroah-Hartman
Hi,
I'm currently travelling and therefore unable to test the patch. I'll
send feedback next Monday.
Regards,
Tino
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PM / Wakeup: Fix initialization of wakeup-related device sysfs files
2011-04-21 21:57 [PATCH] PM / Wakeup: Fix initialization of wakeup-related device sysfs files Rafael J. Wysocki
2011-04-22 7:57 ` Tino Keitel
@ 2011-04-25 19:58 ` Tino Keitel
2011-04-25 20:10 ` Rafael J. Wysocki
1 sibling, 1 reply; 5+ messages in thread
From: Tino Keitel @ 2011-04-25 19:58 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM mailing list, LKML, Alan Stern, Greg Kroah-Hartman
Hi,
the patch works fine on top of current git
(8f7544682c488dfc4117b37ed10435bb2d3d8d73). Wakeup using the keyboard
works.
Regards,
Tino
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PM / Wakeup: Fix initialization of wakeup-related device sysfs files
2011-04-25 19:58 ` Tino Keitel
@ 2011-04-25 20:10 ` Rafael J. Wysocki
2011-04-25 20:33 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2011-04-25 20:10 UTC (permalink / raw)
To: Tino Keitel, Greg Kroah-Hartman; +Cc: Linux PM mailing list, LKML, Alan Stern
On Monday, April 25, 2011, Tino Keitel wrote:
> Hi,
>
> the patch works fine on top of current git
> (8f7544682c488dfc4117b37ed10435bb2d3d8d73). Wakeup using the keyboard
> works.
Great, thanks for testing.
Greg, are you fine with https://lkml.org/lkml/2011/4/21/404 ?
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PM / Wakeup: Fix initialization of wakeup-related device sysfs files
2011-04-25 20:10 ` Rafael J. Wysocki
@ 2011-04-25 20:33 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2011-04-25 20:33 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Tino Keitel, Linux PM mailing list, LKML, Alan Stern
On Mon, Apr 25, 2011 at 10:10:16PM +0200, Rafael J. Wysocki wrote:
> On Monday, April 25, 2011, Tino Keitel wrote:
> > Hi,
> >
> > the patch works fine on top of current git
> > (8f7544682c488dfc4117b37ed10435bb2d3d8d73). Wakeup using the keyboard
> > works.
>
> Great, thanks for testing.
>
> Greg, are you fine with https://lkml.org/lkml/2011/4/21/404 ?
Yes, very much so, sorry for not giving my ack before:
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-04-25 20:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-21 21:57 [PATCH] PM / Wakeup: Fix initialization of wakeup-related device sysfs files Rafael J. Wysocki
2011-04-22 7:57 ` Tino Keitel
2011-04-25 19:58 ` Tino Keitel
2011-04-25 20:10 ` Rafael J. Wysocki
2011-04-25 20:33 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox