[PATCH] hwmon: Refactor SENSOR_DEVICE_ATTR_2
authorJim Cromie <jim.cromie@gmail.com>
Wed, 18 Jan 2006 22:10:49 +0000 (23:10 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 23 Mar 2006 22:21:50 +0000 (14:21 -0800)
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>
include/linux/hwmon-sysfs.h

index dedca6a516b4ba103a7a423b33812fa5db323307..a90c09d331c1c09fa94048e401b55cfa9970a928 100644 (file)
@@ -43,11 +43,13 @@ struct sensor_device_attribute_2 {
 #define to_sensor_dev_attr_2(_dev_attr) \
        container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr)
 
+#define SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index)        \
+       { .dev_attr = __ATTR(_name, _mode, _show, _store),      \
+         .index = _index,                                      \
+         .nr = _nr }
+
 #define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index)      \
-struct sensor_device_attribute_2 sensor_dev_attr_##_name = {   \
-       .dev_attr =     __ATTR(_name,_mode,_show,_store),       \
-       .index =        _index,                                 \
-       .nr =           _nr,                                    \
-}
+struct sensor_device_attribute_2 sensor_dev_attr_##_name               \
+       = SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index)
 
 #endif /* _LINUX_HWMON_SYSFS_H */