diff options
author | Zhang Rui <rui.zhang@intel.com> | 2008-10-27 14:01:02 -0700 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-10-28 01:53:19 -0400 |
commit | ed206fac87d65917280b6c3edd3f01125d4095c9 (patch) | |
tree | 5197b6d5fbab8f78e4451320b5a1f4f06f62f404 /drivers/acpi/system.c | |
parent | 49fdf6785fd660e18a1eb4588928f47e9fa29a9a (diff) | |
download | talos-op-linux-ed206fac87d65917280b6c3edd3f01125d4095c9.tar.gz talos-op-linux-ed206fac87d65917280b6c3edd3f01125d4095c9.zip |
ACPI: bugfix reporting of event handler status
Introduce a new flag showing whether the event has an event handler/method.
For all the GPEs and Fixed Events,
1. ACPI_EVENT_FLAG_HANDLE is cleared, it's an "invalid" ACPI event.
2. Both ACPI_EVENT_FLAG_HANDLE and ACPI_EVENT_FLAG_DISABLE are set,
it's "disabled".
3. Both ACPI_EVENT_FLAG_HANDLE and ACPI_EVENT_FLAG_ENABLE are set,
it's "enabled".
4. Both ACPI_EVENT_FLAG_HANDLE and ACPI_EVENT_FLAG_WAKE_ENABLE are set,
it's "wake_enabled".
Among other things, this prevents incorrect reporting of ACPI events
as being "invalid" when it's really just (temporarily) "disabled".
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/system.c')
-rw-r--r-- | drivers/acpi/system.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 1d74171b7940..6d348dce0810 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c @@ -167,7 +167,6 @@ static int acpi_system_sysfs_init(void) #define COUNT_ERROR 2 /* other */ #define NUM_COUNTERS_EXTRA 3 -#define ACPI_EVENT_VALID 0x01 struct event_counter { u32 count; u32 flags; @@ -312,12 +311,6 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) result = acpi_get_event_status(index - num_gpes, status); - /* - * sleep/power button GPE/Fixed Event is enabled after acpi_system_init, - * check the status at runtime and mark it as valid once it's enabled - */ - if (!result && (*status & ACPI_EVENT_FLAG_ENABLED)) - all_counters[index].flags |= ACPI_EVENT_VALID; end: return result; } @@ -346,12 +339,14 @@ static ssize_t counter_show(struct kobject *kobj, if (result) goto end; - if (!(all_counters[index].flags & ACPI_EVENT_VALID)) - size += sprintf(buf + size, " invalid"); + if (!(status & ACPI_EVENT_FLAG_HANDLE)) + size += sprintf(buf + size, " invalid"); else if (status & ACPI_EVENT_FLAG_ENABLED) - size += sprintf(buf + size, " enable"); + size += sprintf(buf + size, " enabled"); + else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED) + size += sprintf(buf + size, " wake_enabled"); else - size += sprintf(buf + size, " disable"); + size += sprintf(buf + size, " disabled"); end: size += sprintf(buf + size, "\n"); @@ -385,7 +380,7 @@ static ssize_t counter_set(struct kobject *kobj, if (result) goto end; - if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { + if (!(status & ACPI_EVENT_FLAG_HANDLE)) { printk(KERN_WARNING PREFIX "Can not change Invalid GPE/Fixed Event status\n"); return -EINVAL; |