Subject: [PATCH] [acpi driver model] Add event interface header - Create include/acpi/event.h - Define struct acpi_device_event for describing the event that a driver wants to register a handler for. Containing: - e_type - defaults to ACPI_DEVICE_NOTIFY, which is the event that most drivers want. - e_handler - the callback routine for the event - Define macros for defining the event, and a couple of macros for the header files to use when referencing the event structures. Signed-off-by: Patrick Mochel --- include/acpi/event.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-) create mode 100644 include/acpi/event.h applies-to: 1795edbb973e1d59d438d9f3516f22ebaeb26dde 58fefe7b0c8eda03d015244a177d0818ab8f1388 diff --git a/include/acpi/event.h b/include/acpi/event.h new file mode 100644 index 0000000..b48a408 --- /dev/null +++ b/include/acpi/event.h @@ -0,0 +1,53 @@ + +#include + +struct acpi_device_event { + u32 e_type; + acpi_notify_handler e_handler; +}; + + +/** + * This macro should be used by drivers to declare a + * single DEVICE_NOTIFY event. + * + * The driver should define the function 'foo_notify', + * where "foo" is the name of their driver. + * The foo_notify function should be the same type as + * 'acpi_notify_handler', which is defined in + * include/acpi/acpixf.h. + * + * For a simple example, see the AC driver. + */ + +#define acpi_device_event(__name)\ +struct acpi_device_event __name##_event = { \ + .e_type = ACPI_DEVICE_NOTIFY, \ + .e_handler = __name##_notify, \ +} + + +/** + * 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.) + */ + +#define acpi_device_event_none(__name) \ +struct acpi_device_event __name##_event = { } + + + +/** + * The following macros are used by the ACPI driver + * model header files to ease in initializing the + * driver structures. + * They are not for use by individual drivers. + */ + +#define acpi_device_event_extern(__name) \ +extern struct acpi_device_event __name##_event + + +#define acpi_device_event_ref(__name) &__name##_event + --- 0.99.9.GIT