Subject: [PATCH] [acpi ac] Add sysfs interface - Create drivers/acpi/drivers/ac/sysfs.c and populate it with the 1 sysfs attribute to export - Add Makefile entry Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/ac/Makefile | 1 + drivers/acpi/drivers/ac/sysfs.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 drivers/acpi/drivers/ac/sysfs.c applies-to: 0f66400f5ede2e43e24a014631a9d761c85ca30a 82a440acb923d47e43005268fdd508e1342b877f diff --git a/drivers/acpi/drivers/ac/Makefile b/drivers/acpi/drivers/ac/Makefile index 91f0082..5fbb8aa 100644 --- a/drivers/acpi/drivers/ac/Makefile +++ b/drivers/acpi/drivers/ac/Makefile @@ -3,4 +3,5 @@ obj-$(CONFIG_ACPI_AC) += ac.o ac-y := driver.o device.o event.o ac-$(CONFIG_ACPI_DM_PROC) += proc.o +ac-$(CONFIG_ACPI_DM_SYSFS) += sysfs.o diff --git a/drivers/acpi/drivers/ac/sysfs.c b/drivers/acpi/drivers/ac/sysfs.c new file mode 100644 index 0000000..9cb8b6e --- /dev/null +++ b/drivers/acpi/drivers/ac/sysfs.c @@ -0,0 +1,23 @@ +/** + * drivers/acpi/drivers/ac/sysfs.c - sysfs interface for ac driver. + * + * Copyright (C) 2005 Patrick Mochel + * + * This file is released under the GPLv2. + */ + +#include +#include "ac.h" + + +static ssize_t state_show(struct acpi_dev * ad, char * buf) +{ + struct acpi_ac * ac = dev_get_drvdata(&ad->dev); + return sprintf(buf, "%02lx", ac->a_state); +} + +static struct acpi_dev_attr ac_attrs[] = { + acpi_dev_attr_ro(state), +}; + +acpi_driver_sysfs(ac); --- 0.99.9.GIT