OpenCloudOS-Kernel/drivers/base/power
Rafael J. Wysocki 22110faf8c PM / Wakeup: Fix initialization of wakeup-related device sysfs files
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 cb8f51bdad
(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-and-tested-by: Tino Keitel <tino.keitel@tikei.de>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-04-26 11:33:09 +02:00
..
Makefile PM: Remove CONFIG_PM_OPS 2011-03-15 00:43:15 +01:00
generic_ops.c PM / Runtime: Generic resume shouldn't set RPM_ACTIVE unconditionally 2010-12-24 15:04:06 +01:00
main.c PM / Wakeup: Fix initialization of wakeup-related device sysfs files 2011-04-26 11:33:09 +02:00
opp.c PM / OPP: opp_find_freq_exact() documentation fix 2011-03-15 00:43:17 +01:00
power.h PM: Do not create wakeup sysfs files for devices that cannot wake up 2011-03-15 00:43:14 +01:00
runtime.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sysfs.c PM: Do not create wakeup sysfs files for devices that cannot wake up 2011-03-15 00:43:14 +01:00
trace.c PM: Use appropriate printk() priority level in trace.c 2011-03-15 00:43:14 +01:00
wakeup.c PM / Wakeup: Fix initialization of wakeup-related device sysfs files 2011-04-26 11:33:09 +02:00