Skip to content

Commit

Permalink
[PATCH] hwmon: Allow sensor attributes arrays
Browse files Browse the repository at this point in the history
This patch refactors SENSOR_DEVICE_ATTR macro.  First it creates a new
macro SENSOR_ATTR() which expands to an initialization expression, then
it uses that in SENSOR_DEVICE_ATTR, which declares and initializes a
struct sensor_device_attribute.

IOW, SENSOR_ATTR() imitates __ATTR() in include/linux/device.h.

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>
  • Loading branch information
Jim Cromie authored and Greg Kroah-Hartman committed Mar 23, 2006
1 parent b0e6e96 commit 42d3b83
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions include/linux/hwmon-sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +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_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_ATTR(_name, _mode, _show, _store, _index)

struct sensor_device_attribute_2 {
struct device_attribute dev_attr;
Expand Down

0 comments on commit 42d3b83

Please sign in to comment.