]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/event.c
[MIPS] Pb1200: do register SMC 91C111
[linux-2.6-omap-h63xx.git] / drivers / acpi / event.c
index b7b143288c229bf5627ac3f8a3752d2d77394573..abec1ca94cf4bb4f54a387121c93168c944e7d9e 100644 (file)
@@ -17,6 +17,7 @@
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
 ACPI_MODULE_NAME("event");
 
+#ifdef CONFIG_ACPI_PROC_EVENT
 /* Global vars for handling event proc entry */
 static DEFINE_SPINLOCK(acpi_system_event_lock);
 int event_is_open = 0;
@@ -106,6 +107,35 @@ static const struct file_operations acpi_system_event_ops = {
        .release = acpi_system_close_event,
        .poll = acpi_system_poll_event,
 };
+#endif /* CONFIG_ACPI_PROC_EVENT */
+
+/* ACPI notifier chain */
+static BLOCKING_NOTIFIER_HEAD(acpi_chain_head);
+
+int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data)
+{
+       struct acpi_bus_event event;
+
+       strcpy(event.device_class, dev->pnp.device_class);
+       strcpy(event.bus_id, dev->pnp.bus_id);
+       event.type = type;
+       event.data = data;
+       return (blocking_notifier_call_chain(&acpi_chain_head, 0, (void *)&event)
+                        == NOTIFY_BAD) ? -EINVAL : 0;
+}
+EXPORT_SYMBOL(acpi_notifier_call_chain);
+
+int register_acpi_notifier(struct notifier_block *nb)
+{
+       return blocking_notifier_chain_register(&acpi_chain_head, nb);
+}
+EXPORT_SYMBOL(register_acpi_notifier);
+
+int unregister_acpi_notifier(struct notifier_block *nb)
+{
+       return blocking_notifier_chain_unregister(&acpi_chain_head, nb);
+}
+EXPORT_SYMBOL(unregister_acpi_notifier);
 
 #ifdef CONFIG_NET
 static unsigned int acpi_event_seqnum;
@@ -231,13 +261,14 @@ static int acpi_event_genetlink_init(void)
 }
 
 #else
-int acpi_bus_generate_netlink_event(struct acpi_device *device, u8 type,
-                                     int data)
+int acpi_bus_generate_netlink_event(const char *device_class,
+                                     const char *bus_id,
+                                     u8 type, int data)
 {
        return 0;
 }
 
-EXPORT_SYMBOL(acpi_generate_netlink_event);
+EXPORT_SYMBOL(acpi_bus_generate_netlink_event);
 
 static int acpi_event_genetlink_init(void)
 {
@@ -247,7 +278,9 @@ static int acpi_event_genetlink_init(void)
 
 static int __init acpi_event_init(void)
 {
+#ifdef CONFIG_ACPI_PROC_EVENT
        struct proc_dir_entry *entry;
+#endif
        int error = 0;
 
        if (acpi_disabled)
@@ -259,12 +292,14 @@ static int __init acpi_event_init(void)
                printk(KERN_WARNING PREFIX
                       "Failed to create genetlink family for ACPI event\n");
 
+#ifdef CONFIG_ACPI_PROC_EVENT
        /* 'event' [R] */
        entry = create_proc_entry("event", S_IRUSR, acpi_root_dir);
        if (entry)
                entry->proc_fops = &acpi_system_event_ops;
        else
                return -ENODEV;
+#endif
 
        return 0;
 }