diff options
author | Lin Ming <ming.m.lin@intel.com> | 2010-12-13 00:39:26 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-01-12 04:27:00 -0500 |
commit | a0fcdb237fcd4eaa7e5009b28ef5be07415f287d (patch) | |
tree | d07a4950648ad9a7eaab8fd28b37685926bb23a9 /drivers/acpi/sysfs.c | |
parent | bba63a296ffab20e08d9e8252d2f0d99050ac859 (diff) |
ACPICA: Global event handler
The global event handler is called whenever a general purpose
or fixed ACPI event occurs.
Also update Linux OSL to collect events counter with
global event handler.
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/sysfs.c')
-rw-r--r-- | drivers/acpi/sysfs.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index f8588f81048a..61891e75583d 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -438,7 +438,7 @@ static void delete_gpe_attr_array(void) | |||
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | 440 | ||
441 | void acpi_os_gpe_count(u32 gpe_number) | 441 | static void gpe_count(u32 gpe_number) |
442 | { | 442 | { |
443 | acpi_gpe_count++; | 443 | acpi_gpe_count++; |
444 | 444 | ||
@@ -454,7 +454,7 @@ void acpi_os_gpe_count(u32 gpe_number) | |||
454 | return; | 454 | return; |
455 | } | 455 | } |
456 | 456 | ||
457 | void acpi_os_fixed_event_count(u32 event_number) | 457 | static void fixed_event_count(u32 event_number) |
458 | { | 458 | { |
459 | if (!all_counters) | 459 | if (!all_counters) |
460 | return; | 460 | return; |
@@ -468,6 +468,16 @@ void acpi_os_fixed_event_count(u32 event_number) | |||
468 | return; | 468 | return; |
469 | } | 469 | } |
470 | 470 | ||
471 | static void acpi_gbl_event_handler(u32 event_type, acpi_handle device, | ||
472 | u32 event_number, void *context) | ||
473 | { | ||
474 | if (event_type == ACPI_EVENT_TYPE_GPE) | ||
475 | gpe_count(event_number); | ||
476 | |||
477 | if (event_type == ACPI_EVENT_TYPE_FIXED) | ||
478 | fixed_event_count(event_number); | ||
479 | } | ||
480 | |||
471 | static int get_status(u32 index, acpi_event_status *status, | 481 | static int get_status(u32 index, acpi_event_status *status, |
472 | acpi_handle *handle) | 482 | acpi_handle *handle) |
473 | { | 483 | { |
@@ -601,6 +611,7 @@ end: | |||
601 | 611 | ||
602 | void acpi_irq_stats_init(void) | 612 | void acpi_irq_stats_init(void) |
603 | { | 613 | { |
614 | acpi_status status; | ||
604 | int i; | 615 | int i; |
605 | 616 | ||
606 | if (all_counters) | 617 | if (all_counters) |
@@ -619,6 +630,10 @@ void acpi_irq_stats_init(void) | |||
619 | if (all_counters == NULL) | 630 | if (all_counters == NULL) |
620 | goto fail; | 631 | goto fail; |
621 | 632 | ||
633 | status = acpi_install_global_event_handler(acpi_gbl_event_handler, NULL); | ||
634 | if (ACPI_FAILURE(status)) | ||
635 | goto fail; | ||
636 | |||
622 | counter_attrs = kzalloc(sizeof(struct kobj_attribute) * (num_counters), | 637 | counter_attrs = kzalloc(sizeof(struct kobj_attribute) * (num_counters), |
623 | GFP_KERNEL); | 638 | GFP_KERNEL); |
624 | if (counter_attrs == NULL) | 639 | if (counter_attrs == NULL) |