Subject: [PATCH] [acpi driver model] Add event interface to AC driver - Create drivers/acpi/drivers/ac/event.c - Fill in notify function (+/- from original driver) - Add declaration macro - Add Makefile entry Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/ac/Makefile | 2 +- drivers/acpi/drivers/ac/event.c | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletions(-) create mode 100644 drivers/acpi/drivers/ac/event.c applies-to: 83ad324825c822abd540156306634ab0c098660e f67dec2b69366431e791d1e874070f5487d50ccf diff --git a/drivers/acpi/drivers/ac/Makefile b/drivers/acpi/drivers/ac/Makefile index 2e12353..a5b6bb2 100644 --- a/drivers/acpi/drivers/ac/Makefile +++ b/drivers/acpi/drivers/ac/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_ACPI_AC) += ac.o -ac-y := driver.o device.o +ac-y := driver.o device.o event.o diff --git a/drivers/acpi/drivers/ac/event.c b/drivers/acpi/drivers/ac/event.c new file mode 100644 index 0000000..b114ad6 --- /dev/null +++ b/drivers/acpi/drivers/ac/event.c @@ -0,0 +1,42 @@ +/** + * + * drivers/acpi/drivers/ac/event.c - ACPI Event notification for ac + * + * Copyright (C) 2006 Patrick Mochel + * + * Based on drivers/acpi/ac.c, which was: + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * + * + * This file is released under the GPLv2. + */ + + +#include +#include "ac.h" + + +#define ACPI_AC_NOTIFY_STATUS 0x80 + +static void ac_notify(acpi_handle handle, u32 event, void * data) +{ + struct acpi_dev * ad = data; + struct acpi_ac * ac = dev_get_drvdata(&ad->dev); + + ACPI_FUNCTION_TRACE(__FUNCTION__); + + switch (event) { + case ACPI_AC_NOTIFY_STATUS: + ac_get_state(ac); + acpi_bus_generate_event(ad->acpi_device, event, ac->a_state); + break; + default: + err("Unsupported event: [%#x]", event); + break; + } + return_VOID; +} + + +acpi_device_event(ac); --- 0.99.9.GIT