diff options
author | Frans Klaver <fransklaver@gmail.com> | 2014-09-17 23:47:22 +0200 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-09-19 18:42:11 +0200 |
commit | 9797132577aa53734f4e980f9008f617947fddc9 (patch) | |
tree | d650837e9f6f9a3f8f32b20611c83dea070d6ddb /drivers/platform/x86/eeepc-laptop.c | |
parent | eeepc-laptop: use DEVICE_ATTR* to instantiate device_attributes (diff) | |
download | linux-9797132577aa53734f4e980f9008f617947fddc9.tar.xz linux-9797132577aa53734f4e980f9008f617947fddc9.zip |
eeepc-laptop: pull out ACPI_STORE_FUNC and ACPI_SHOW_FUNC macros
Pull out macros EEEPC_ACPI_STORE_FUNC and EEEPC_ACPI_SHOW_FUNC. These
macros define functions that call store_sys_acpi() and show_sys_acpi()
respectively. This helps prevent duplication later on.
Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/eeepc-laptop.c')
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index db26f78cfc41..c6d765fec8e9 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c @@ -295,19 +295,25 @@ static ssize_t show_sys_acpi(struct device *dev, int cm, char *buf) return sprintf(buf, "%d\n", value); } -#define EEEPC_CREATE_DEVICE_ATTR(_name, _mode, _cm) \ +#define EEEPC_ACPI_SHOW_FUNC(_name, _cm) \ static ssize_t _name##_show(struct device *dev, \ struct device_attribute *attr, \ char *buf) \ { \ return show_sys_acpi(dev, _cm, buf); \ - } \ + } + +#define EEEPC_ACPI_STORE_FUNC(_name, _cm) \ static ssize_t _name##_store(struct device *dev, \ struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return store_sys_acpi(dev, _cm, buf, count); \ - } \ + } + +#define EEEPC_CREATE_DEVICE_ATTR(_name, _mode, _cm) \ + EEEPC_ACPI_SHOW_FUNC(_name, _cm) \ + EEEPC_ACPI_STORE_FUNC(_name, _cm) \ static DEVICE_ATTR(_name, _mode, _name##_show, _name##_store) EEEPC_CREATE_DEVICE_ATTR(camera, 0644, CM_ASL_CAMERA); |