Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] hwmon: Refactor SENSOR_DEVICE_ATTR_2

This patch refactors SENSOR_DEVICE_ATTR_2 macro, following pattern set by
SENSOR_ATTR. First it creates a new macro SENSOR_ATTR_2() which expands
to an initialization expression, then it uses that in SENSOR_DEVICE_ATTR_2,
which declares and initializes a struct sensor_device_attribute_2.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Jim Cromie and committed by
Greg Kroah-Hartman
70adca5a cdf263f1

+7 -5
+7 -5
include/linux/hwmon-sysfs.h
··· 43 43 #define to_sensor_dev_attr_2(_dev_attr) \ 44 44 container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr) 45 45 46 + #define SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index) \ 47 + { .dev_attr = __ATTR(_name, _mode, _show, _store), \ 48 + .index = _index, \ 49 + .nr = _nr } 50 + 46 51 #define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \ 47 - struct sensor_device_attribute_2 sensor_dev_attr_##_name = { \ 48 - .dev_attr = __ATTR(_name,_mode,_show,_store), \ 49 - .index = _index, \ 50 - .nr = _nr, \ 51 - } 52 + struct sensor_device_attribute_2 sensor_dev_attr_##_name \ 53 + = SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index) 52 54 53 55 #endif /* _LINUX_HWMON_SYSFS_H */