aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/system.c
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2008-10-27 17:01:02 -0400
committerLen Brown <len.brown@intel.com>2008-10-28 01:53:19 -0400
commited206fac87d65917280b6c3edd3f01125d4095c9 (patch)
tree5197b6d5fbab8f78e4451320b5a1f4f06f62f404 /drivers/acpi/system.c
parent49fdf6785fd660e18a1eb4588928f47e9fa29a9a (diff)
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.c19
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)
167#define COUNT_ERROR 2 /* other */ 167#define COUNT_ERROR 2 /* other */
168#define NUM_COUNTERS_EXTRA 3 168#define NUM_COUNTERS_EXTRA 3
169 169
170#define ACPI_EVENT_VALID 0x01
171struct event_counter { 170struct event_counter {
172 u32 count; 171 u32 count;
173 u32 flags; 172 u32 flags;
@@ -312,12 +311,6 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle)
312 } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) 311 } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS))
313 result = acpi_get_event_status(index - num_gpes, status); 312 result = acpi_get_event_status(index - num_gpes, status);
314 313
315 /*
316 * sleep/power button GPE/Fixed Event is enabled after acpi_system_init,
317 * check the status at runtime and mark it as valid once it's enabled
318 */
319 if (!result && (*status & ACPI_EVENT_FLAG_ENABLED))
320 all_counters[index].flags |= ACPI_EVENT_VALID;
321end: 314end:
322 return result; 315 return result;
323} 316}
@@ -346,12 +339,14 @@ static ssize_t counter_show(struct kobject *kobj,
346 if (result) 339 if (result)
347 goto end; 340 goto end;
348 341
349 if (!(all_counters[index].flags & ACPI_EVENT_VALID)) 342 if (!(status & ACPI_EVENT_FLAG_HANDLE))
350 size += sprintf(buf + size, " invalid"); 343 size += sprintf(buf + size, " invalid");
351 else if (status & ACPI_EVENT_FLAG_ENABLED) 344 else if (status & ACPI_EVENT_FLAG_ENABLED)
352 size += sprintf(buf + size, " enable"); 345 size += sprintf(buf + size, " enabled");
346 else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED)
347 size += sprintf(buf + size, " wake_enabled");
353 else 348 else
354 size += sprintf(buf + size, " disable"); 349 size += sprintf(buf + size, " disabled");
355 350
356end: 351end:
357 size += sprintf(buf + size, "\n"); 352 size += sprintf(buf + size, "\n");
@@ -385,7 +380,7 @@ static ssize_t counter_set(struct kobject *kobj,
385 if (result) 380 if (result)
386 goto end; 381 goto end;
387 382
388 if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { 383 if (!(status & ACPI_EVENT_FLAG_HANDLE)) {
389 printk(KERN_WARNING PREFIX 384 printk(KERN_WARNING PREFIX
390 "Can not change Invalid GPE/Fixed Event status\n"); 385 "Can not change Invalid GPE/Fixed Event status\n");
391 return -EINVAL; 386 return -EINVAL;