X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=drivers%2Facpi%2Fevent.c;h=0c24bd4d65629bb4647fee1958ceeac2dda424ad;hb=ce6754235b423610e91f5300e1555c2e4ee1c03a;hp=5c95863f8fa9f324c0b98d88cd40f96eb16f9ead;hpb=2843483d2eb02ad104edbe8b2429fb6a39d25063;p=cascardo%2Flinux.git diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index 5c95863f8fa9..0c24bd4d6562 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 { @@ -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