aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/system.c
diff options
context:
space:
mode:
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 62ec75e79120..bfc216a11fdd 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -176,7 +176,6 @@ static int acpi_system_sysfs_init(void)
176#define COUNT_ERROR 2 /* other */ 176#define COUNT_ERROR 2 /* other */
177#define NUM_COUNTERS_EXTRA 3 177#define NUM_COUNTERS_EXTRA 3
178 178
179#define ACPI_EVENT_VALID 0x01
180struct event_counter { 179struct event_counter {
181 u32 count; 180 u32 count;
182 u32 flags; 181 u32 flags;
@@ -321,12 +320,6 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle)
321 } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) 320 } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS))
322 result = acpi_get_event_status(index - num_gpes, status); 321 result = acpi_get_event_status(index - num_gpes, status);
323 322
324 /*
325 * sleep/power button GPE/Fixed Event is enabled after acpi_system_init,
326 * check the status at runtime and mark it as valid once it's enabled
327 */
328 if (!result && (*status & ACPI_EVENT_FLAG_ENABLED))
329 all_counters[index].flags |= ACPI_EVENT_VALID;
330end: 323end:
331 return result; 324 return result;
332} 325}
@@ -355,12 +348,14 @@ static ssize_t counter_show(struct kobject *kobj,
355 if (result) 348 if (result)
356 goto end; 349 goto end;
357 350
358 if (!(all_counters[index].flags & ACPI_EVENT_VALID)) 351 if (!(status & ACPI_EVENT_FLAG_HANDLE))
359 size += sprintf(buf + size, " invalid"); 352 size += sprintf(buf + size, " invalid");
360 else if (status & ACPI_EVENT_FLAG_ENABLED) 353 else if (status & ACPI_EVENT_FLAG_ENABLED)
361 size += sprintf(buf + size, " enable"); 354 size += sprintf(buf + size, " enabled");
355 else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED)
356 size += sprintf(buf + size, " wake_enabled");
362 else 357 else
363 size += sprintf(buf + size, " disable"); 358 size += sprintf(buf + size, " disabled");
364 359
365end: 360end:
366 size += sprintf(buf + size, "\n"); 361 size += sprintf(buf + size, "\n");
@@ -394,7 +389,7 @@ static ssize_t counter_set(struct kobject *kobj,
394 if (result) 389 if (result)
395 goto end; 390 goto end;
396 391
397 if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { 392 if (!(status & ACPI_EVENT_FLAG_HANDLE)) {
398 printk(KERN_WARNING PREFIX 393 printk(KERN_WARNING PREFIX
399 "Can not change Invalid GPE/Fixed Event status\n"); 394 "Can not change Invalid GPE/Fixed Event status\n");
400 return -EINVAL; 395 return -EINVAL;