Skip to contentSkip to conversation

pc87360 refactor SENSOR_DEVICE_ATTR

PATCH New Jim Cromie 1 participant 1 message Aug 2, 2005 Hardware monitoring

lore
Share & tools
lore

Jim Cromie

author
#0 lore raw

PATCH 18/23 pc87360 refactor SENSOR_DEVICE_ATTR

refactor SENSOR_DEVICE_ATTR to separate the variable declaraion and initialization from the initialization expression 'assigned' to it, making it more friendly to array initialization.

[jimc@harpo pset]$ diffstat 15-sda-arry-initializer

 hwmon-sysfs.h |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

-------------- next part --------------

include/linux/hwmon-sysfs.h +7 -4
diff -ruNp -X exclude-diffs lxE-5/include/linux/hwmon-sysfs.h lxF-1/include/linux/hwmon-sysfs.h
@@ -27,10 +27,13 @@ struct sensor_device_attribute{
 #define to_sensor_dev_attr(_dev_attr) \
 	container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
 
-#define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index)	\
-struct sensor_device_attribute sensor_dev_attr_##_name = {	\
-	.dev_attr =	__ATTR(_name,_mode,_show,_store),	\
-	.index =	_index,					\
+#define __SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index)	\
+	{ .dev_attr =	__ATTR(_name,_mode,_show,_store),	\
+	  .index =	_index,					\
 }
 
+#define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index)	\
+struct sensor_device_attribute sensor_dev_attr_##_name		\
+	= __SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index)
+
 #endif /* _LINUX_HWMON_SYSFS_H */