diff options
-rw-r--r-- | drivers/acpi/event.c | 28 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 3 |
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index 5c95863f8fa9..5479dc0eeeec 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c | |||
@@ -109,6 +109,34 @@ static const struct file_operations acpi_system_event_ops = { | |||
109 | }; | 109 | }; |
110 | #endif /* CONFIG_ACPI_PROC_EVENT */ | 110 | #endif /* CONFIG_ACPI_PROC_EVENT */ |
111 | 111 | ||
112 | /* ACPI notifier chain */ | ||
113 | BLOCKING_NOTIFIER_HEAD(acpi_chain_head); | ||
114 | |||
115 | int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data) | ||
116 | { | ||
117 | struct acpi_bus_event event; | ||
118 | |||
119 | strcpy(event.device_class, dev->pnp.device_class); | ||
120 | strcpy(event.bus_id, dev->pnp.bus_id); | ||
121 | event.type = type; | ||
122 | event.data = data; | ||
123 | return (blocking_notifier_call_chain(&acpi_chain_head, 0, (void *)&event) | ||
124 | == NOTIFY_BAD) ? -EINVAL : 0; | ||
125 | } | ||
126 | EXPORT_SYMBOL(acpi_notifier_call_chain); | ||
127 | |||
128 | int register_acpi_notifier(struct notifier_block *nb) | ||
129 | { | ||
130 | return blocking_notifier_chain_register(&acpi_chain_head, nb); | ||
131 | } | ||
132 | EXPORT_SYMBOL(register_acpi_notifier); | ||
133 | |||
134 | int unregister_acpi_notifier(struct notifier_block *nb) | ||
135 | { | ||
136 | return blocking_notifier_chain_unregister(&acpi_chain_head, nb); | ||
137 | } | ||
138 | EXPORT_SYMBOL(unregister_acpi_notifier); | ||
139 | |||
112 | #ifdef CONFIG_NET | 140 | #ifdef CONFIG_NET |
113 | static unsigned int acpi_event_seqnum; | 141 | static unsigned int acpi_event_seqnum; |
114 | struct acpi_genl_event { | 142 | struct acpi_genl_event { |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index fb7171b1bd22..3f9f1417ff09 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -321,6 +321,9 @@ struct acpi_bus_event { | |||
321 | 321 | ||
322 | extern struct kobject *acpi_kobj; | 322 | extern struct kobject *acpi_kobj; |
323 | extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); | 323 | extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); |
324 | extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); | ||
325 | extern int register_acpi_notifier(struct notifier_block *); | ||
326 | extern int unregister_acpi_notifier(struct notifier_block *); | ||
324 | /* | 327 | /* |
325 | * External Functions | 328 | * External Functions |
326 | */ | 329 | */ |