aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorFrans Klaver <fransklaver@gmail.com>2014-09-17 17:47:24 -0400
committerDarren Hart <dvhart@linux.intel.com>2014-09-19 12:42:11 -0400
commit28ac85f71ad1e55199302a59757ed21e082b88b1 (patch)
treee0e08c2e186cc4de9ea3d01868ecc5619d3c80d1 /drivers/platform
parent6fe3a77f6296a6c995eb08d564bafec028c15a18 (diff)
eeepc-laptop: pull out SENSOR_STORE_FUNC and SENSOR_SHOW_FUNC macros
Pull out EEEPC_SENSOR_STORE_FUNC and EEEPC_SENSOR_SHOW_FUNC. These macros define functions that call store_sys_hwmon() and show_sys_hwmon() 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')
-rw-r--r--drivers/platform/x86/eeepc-laptop.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index a85da4f837e6..ba251bb0d495 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -1038,19 +1038,25 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf)
1038 return sprintf(buf, "%d\n", get()); 1038 return sprintf(buf, "%d\n", get());
1039} 1039}
1040 1040
1041#define EEEPC_CREATE_SENSOR_ATTR(_name, _mode, _get, _set) \ 1041#define EEEPC_SENSOR_SHOW_FUNC(_name, _get) \
1042 static ssize_t show_##_name(struct device *dev, \ 1042 static ssize_t show_##_name(struct device *dev, \
1043 struct device_attribute *attr, \ 1043 struct device_attribute *attr, \
1044 char *buf) \ 1044 char *buf) \
1045 { \ 1045 { \
1046 return show_sys_hwmon(_get, buf); \ 1046 return show_sys_hwmon(_get, buf); \
1047 } \ 1047 }
1048
1049#define EEEPC_SENSOR_STORE_FUNC(_name, _set) \
1048 static ssize_t store_##_name(struct device *dev, \ 1050 static ssize_t store_##_name(struct device *dev, \
1049 struct device_attribute *attr, \ 1051 struct device_attribute *attr, \
1050 const char *buf, size_t count) \ 1052 const char *buf, size_t count) \
1051 { \ 1053 { \
1052 return store_sys_hwmon(_set, buf, count); \ 1054 return store_sys_hwmon(_set, buf, count); \
1053 } \ 1055 }
1056
1057#define EEEPC_CREATE_SENSOR_ATTR(_name, _mode, _get, _set) \
1058 EEEPC_SENSOR_SHOW_FUNC(_name, _get) \
1059 EEEPC_SENSOR_STORE_FUNC(_name, _set) \
1054 static DEVICE_ATTR(_name, _mode, show_##_name, store_##_name) 1060 static DEVICE_ATTR(_name, _mode, show_##_name, store_##_name)
1055 1061
1056EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); 1062EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL);