Commit 76acae04 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Linus Torvalds

ACPI: Make /proc/acpi/wakeup interface handle PCI devices (again)

Make the ACPI /proc/acpi/wakeup interface set the appropriate wake-up bits
of physical devices corresponding to the ACPI devices and make those bits
be set initially for devices that are enabled to wake up by default.  This
is needed to restore the 2.6.26 and earlier behavior for the PCI devices
that were previously handled correctly with the help of the
/proc/acpi/wakeup interface.
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 95bf14bf
...@@ -165,8 +165,11 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) ...@@ -165,8 +165,11 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
"firmware_node"); "firmware_node");
ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
"physical_node"); "physical_node");
if (acpi_dev->wakeup.flags.valid) if (acpi_dev->wakeup.flags.valid) {
device_set_wakeup_capable(dev, true); device_set_wakeup_capable(dev, true);
device_set_wakeup_enable(dev,
acpi_dev->wakeup.state.enabled);
}
} }
return 0; return 0;
......
...@@ -377,6 +377,14 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) ...@@ -377,6 +377,14 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
return 0; return 0;
} }
static void physical_device_enable_wakeup(struct acpi_device *adev)
{
struct device *dev = acpi_get_physical_device(adev->handle);
if (dev && device_can_wakeup(dev))
device_set_wakeup_enable(dev, adev->wakeup.state.enabled);
}
static ssize_t static ssize_t
acpi_system_write_wakeup_device(struct file *file, acpi_system_write_wakeup_device(struct file *file,
const char __user * buffer, const char __user * buffer,
...@@ -411,6 +419,7 @@ acpi_system_write_wakeup_device(struct file *file, ...@@ -411,6 +419,7 @@ acpi_system_write_wakeup_device(struct file *file,
} }
} }
if (found_dev) { if (found_dev) {
physical_device_enable_wakeup(found_dev);
list_for_each_safe(node, next, &acpi_wakeup_device_list) { list_for_each_safe(node, next, &acpi_wakeup_device_list) {
struct acpi_device *dev = container_of(node, struct acpi_device *dev = container_of(node,
struct struct
...@@ -428,6 +437,7 @@ acpi_system_write_wakeup_device(struct file *file, ...@@ -428,6 +437,7 @@ acpi_system_write_wakeup_device(struct file *file,
dev->pnp.bus_id, found_dev->pnp.bus_id); dev->pnp.bus_id, found_dev->pnp.bus_id);
dev->wakeup.state.enabled = dev->wakeup.state.enabled =
found_dev->wakeup.state.enabled; found_dev->wakeup.state.enabled;
physical_device_enable_wakeup(dev);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment