Subject: [PATCH] [acpi driver events] Add infrastructure for fixed events - Add fields to struct acpi_device_event - e_fixed[], an array of u32 events that should be listened for - e_num_fixed, the number of events - e_fixed_event, the event to pass down to the generic event handler. - Add acpi_device_event_fixed() declaration macro Signed-off-by: Patrick Mochel --- include/acpi/event.h | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) applies-to: 315e54ac73df771cfcfc6777ccea0d931dd4a10e 452281fac54c1999a26734dd45de42e1edd1f0f7 diff --git a/include/acpi/event.h b/include/acpi/event.h index b48a408..9413600 100644 --- a/include/acpi/event.h +++ b/include/acpi/event.h @@ -4,6 +4,10 @@ struct acpi_device_event { u32 e_type; acpi_notify_handler e_handler; + + u32 e_num_fixed; + u32 * e_fixed; + u32 e_fixed_event; }; @@ -28,6 +32,35 @@ struct acpi_device_event __name##_event /** + * This macro should be used by drivers that want to + * install a handler for a fixed event, and optionally + * a regular event (for control method-based devices). + * + * This follows the same rules as acpi_device_event() + * above, but also requires that the driver declare an + * array of fixed events (of type 'u32') that for which + * an internal handler is registered. + * + * The second parameter is the event that is passed to + * the notify handler (->e_handler()) when the fixed + * event is raised. + * + * For an example, please see the button driver, which + * is one of the devices that can actually generate fixed + * events. + */ + +#define acpi_device_event_fixed(__name, __event) \ +struct acpi_device_event __name##_event = { \ + .e_type = ACPI_DEVICE_NOTIFY, \ + .e_handler = __name##_notify, \ + .e_num_fixed = ARRAY_SIZE(__name##_fixed), \ + .e_fixed = __name##_fixed, \ + .e_fixed_event = __event, \ +} + + +/** * This macro should be used by drivers that do not * have any event handlers to register. * (It's still defined, but as an empty structure.) --- 0.99.9.GIT