Skip to content

Commit

Permalink
ACPI / PM: Do not enable multiple devices to wake up simultaneously
Browse files Browse the repository at this point in the history
If a device is enabled to wake up the system from sleep states via
/proc/acpi/wakeup and there are other devices associated with the
same wakeup GPE, all of these devices are automatically enabled to
wake up the system.  This isn't correct, because the fact the GPE is
shared need not imply that wakeup power has to be enabled for all the
devices at the same time (i.e. it is possible that one device will
have its wakeup power enabled and it will wake up the system from a
sleep state if the shared wakeup GPE is enabled, while another device
having its wakeup power disabled will not wake up the system even
though the GPE is enabled).  Rework acpi_system_write_wakeup_device()
so that it only enables wakeup for one device at a time.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Rafael J. Wysocki authored and Len Brown committed Jan 7, 2011
1 parent 9cd0314 commit b014f4f
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions drivers/acpi/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ acpi_system_write_wakeup_device(struct file *file,
char strbuf[5];
char str[5] = "";
unsigned int len = count;
struct acpi_device *found_dev = NULL;

if (len > 4)
len = 4;
Expand All @@ -363,33 +362,10 @@ acpi_system_write_wakeup_device(struct file *file,
if (!strncmp(dev->pnp.bus_id, str, 4)) {
dev->wakeup.state.enabled =
dev->wakeup.state.enabled ? 0 : 1;
found_dev = dev;
physical_device_enable_wakeup(dev);
break;
}
}
if (found_dev) {
physical_device_enable_wakeup(found_dev);
list_for_each_safe(node, next, &acpi_wakeup_device_list) {
struct acpi_device *dev = container_of(node,
struct
acpi_device,
wakeup_list);

if ((dev != found_dev) &&
(dev->wakeup.gpe_number ==
found_dev->wakeup.gpe_number)
&& (dev->wakeup.gpe_device ==
found_dev->wakeup.gpe_device)) {
printk(KERN_WARNING
"ACPI: '%s' and '%s' have the same GPE, "
"can't disable/enable one separately\n",
dev->pnp.bus_id, found_dev->pnp.bus_id);
dev->wakeup.state.enabled =
found_dev->wakeup.state.enabled;
physical_device_enable_wakeup(dev);
}
}
}
mutex_unlock(&acpi_device_lock);
return count;
}
Expand Down

0 comments on commit b014f4f

Please sign in to comment.