diff options
author | Shaohua Li <shaohua.li@intel.com> | 2008-08-27 22:04:29 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-09-23 23:04:43 -0400 |
commit | 6bd00a61ab63d4ceb635ae0316353c11c900b8d8 (patch) | |
tree | 249e417279df1448f1ad43c135c22990b5dde2cb /drivers/acpi/bus.c | |
parent | db350b084dc2cf816288643861ce07b0562dd723 (diff) |
ACPI: introduce notifier change to avoid duplicates
The battery driver already registers notification handler.
To avoid registering notification handler again,
introduce a notifier chain in global system notifier handler
and use it in dock driver.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/bus.c')
-rw-r--r-- | drivers/acpi/bus.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index ccae305ee55..0dc44945725 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -496,6 +496,19 @@ static int acpi_bus_check_scope(struct acpi_device *device) | |||
496 | return 0; | 496 | return 0; |
497 | } | 497 | } |
498 | 498 | ||
499 | static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list); | ||
500 | int register_acpi_bus_notifier(struct notifier_block *nb) | ||
501 | { | ||
502 | return blocking_notifier_chain_register(&acpi_bus_notify_list, nb); | ||
503 | } | ||
504 | EXPORT_SYMBOL_GPL(register_acpi_bus_notifier); | ||
505 | |||
506 | void unregister_acpi_bus_notifier(struct notifier_block *nb) | ||
507 | { | ||
508 | blocking_notifier_chain_unregister(&acpi_bus_notify_list, nb); | ||
509 | } | ||
510 | EXPORT_SYMBOL_GPL(unregister_acpi_bus_notifier); | ||
511 | |||
499 | /** | 512 | /** |
500 | * acpi_bus_notify | 513 | * acpi_bus_notify |
501 | * --------------- | 514 | * --------------- |
@@ -506,6 +519,8 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) | |||
506 | int result = 0; | 519 | int result = 0; |
507 | struct acpi_device *device = NULL; | 520 | struct acpi_device *device = NULL; |
508 | 521 | ||
522 | blocking_notifier_call_chain(&acpi_bus_notify_list, | ||
523 | type, (void *)handle); | ||
509 | 524 | ||
510 | if (acpi_bus_get_device(handle, &device)) | 525 | if (acpi_bus_get_device(handle, &device)) |
511 | return; | 526 | return; |