1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef _LINUX_HWMON_SYSFS_H
21#define _LINUX_HWMON_SYSFS_H
22
23#include <linux/device.h>
24
25struct sensor_device_attribute{
26 struct device_attribute dev_attr;
27 int index;
28};
29#define to_sensor_dev_attr(_dev_attr) \
30 container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
31
32#define SENSOR_ATTR(_name, _mode, _show, _store, _index) \
33 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
34 .index = _index }
35
36#define SENSOR_DEVICE_ATTR(_name, _mode, _show, _store, _index) \
37struct sensor_device_attribute sensor_dev_attr_##_name \
38 = SENSOR_ATTR(_name, _mode, _show, _store, _index)
39
40struct sensor_device_attribute_2 {
41 struct device_attribute dev_attr;
42 u8 index;
43 u8 nr;
44};
45#define to_sensor_dev_attr_2(_dev_attr) \
46 container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr)
47
48#define SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index) \
49 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
50 .index = _index, \
51 .nr = _nr }
52
53#define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \
54struct sensor_device_attribute_2 sensor_dev_attr_##_name \
55 = SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index)
56
57#endif
58