X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Facpi%2Fevent.c;h=0c24bd4d65629bb4647fee1958ceeac2dda424ad;hb=5d279dcf98350ac3cbfa43c6aa62f4305408f2df;hp=a2b9304596ce920596d29494421e9bf0163ca2f3;hpb=3e069ee0c30d6f28b79e409ef2df1ffa427897ae;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index a2b9304..0c24bd4 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c @@ -102,6 +102,7 @@ static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait) } static const struct file_operations acpi_system_event_ops = { + .owner = THIS_MODULE, .open = acpi_system_open_event, .read = acpi_system_read_event, .release = acpi_system_close_event, @@ -109,6 +110,34 @@ static const struct file_operations acpi_system_event_ops = { }; #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; struct acpi_genl_event { @@ -240,7 +269,7 @@ int acpi_bus_generate_netlink_event(const char *device_class, return 0; } -EXPORT_SYMBOL(acpi_generate_netlink_event); +EXPORT_SYMBOL(acpi_bus_generate_netlink_event); static int acpi_event_genetlink_init(void) { @@ -266,10 +295,9 @@ static int __init acpi_event_init(void) #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 + entry = proc_create("event", S_IRUSR, acpi_root_dir, + &acpi_system_event_ops); + if (!entry) return -ENODEV; #endif