Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6

* 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
  ACPI / PM: Avoid infinite recurrence while registering power resources
  PM / Wakeup: Fix initialization of wakeup-related device sysfs files
This commit is contained in:
Linus Torvalds 2011-04-27 15:20:00 -07:00
commit be6b694713
3 changed files with 6 additions and 1 deletions

View File

@ -943,6 +943,10 @@ static int acpi_bus_get_flags(struct acpi_device *device)
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
device->flags.lockable = 1; device->flags.lockable = 1;
/* Power resources cannot be power manageable. */
if (device->device_type == ACPI_BUS_TYPE_POWER)
return 0;
/* Presence of _PS0|_PR0 indicates 'power manageable' */ /* Presence of _PS0|_PR0 indicates 'power manageable' */
status = acpi_get_handle(device->handle, "_PS0", &temp); status = acpi_get_handle(device->handle, "_PS0", &temp);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))

View File

@ -63,6 +63,7 @@ void device_pm_init(struct device *dev)
dev->power.wakeup = NULL; dev->power.wakeup = NULL;
spin_lock_init(&dev->power.lock); spin_lock_init(&dev->power.lock);
pm_runtime_init(dev); pm_runtime_init(dev);
INIT_LIST_HEAD(&dev->power.entry);
} }
/** /**

View File

@ -258,7 +258,7 @@ void device_set_wakeup_capable(struct device *dev, bool capable)
if (!!dev->power.can_wakeup == !!capable) if (!!dev->power.can_wakeup == !!capable)
return; return;
if (device_is_registered(dev)) { if (device_is_registered(dev) && !list_empty(&dev->power.entry)) {
if (capable) { if (capable) {
if (wakeup_sysfs_add(dev)) if (wakeup_sysfs_add(dev))
return; return;