Re: [linux-pm] /proc/acpi/wakeup regression in 2.6.39-rc3

From: Rafael J. Wysocki
Date: Wed Apr 20 2011 - 19:50:30 EST


On Tuesday, April 19, 2011, Tino Keitel wrote:
> Hi,
>
> I reverted some wakeup and ACPI related commits. When I reverted commit
> 7fa69baf29de8c77a6b32c054df2abb8f11f8aa4, wakeup using the keyboard
> worked again and /proc/acpi/wakeup behaved as expected.
>
> So check this, I reverted the following commits to avoid conflicts and
> build failures:
>
> c19f9a84ec807da57fd75bbd9a3f2b8269611f79
> 5190726765b40774c069e187a958e10ccd970e65
> 2a5d24286e8bdafdc272b37ec5bdd9e977b3767c
> f2b56bc808addb908a5bf435d9b942c02af9a7c4
> 7fa69baf29de8c77a6b32c054df2abb8f11f8aa4

In fact, the problem is somewhere else.

It turns out that device_is_registered() may return true before
the device's "power" directory in sysfs is created, which causes
device_set_wakeup_capable() not to set dev->power.can_wakeup and
that's why the /proc/acpi/wakeup interface doesn't work for
some devices.

Please try the patch below, it should help.

Thanks,
Rafael

---
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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/