diff options
-rw-r--r-- | drivers/hwmon/ltc4261.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/drivers/hwmon/ltc4261.c b/drivers/hwmon/ltc4261.c index 84a2d2872b20..487da58ec86c 100644 --- a/drivers/hwmon/ltc4261.c +++ b/drivers/hwmon/ltc4261.c | |||
@@ -165,24 +165,12 @@ static ssize_t ltc4261_show_bool(struct device *dev, | |||
165 | } | 165 | } |
166 | 166 | ||
167 | /* | 167 | /* |
168 | * These macros are used below in constructing device attribute objects | ||
169 | * for use with sysfs_create_group() to make a sysfs device file | ||
170 | * for each register. | ||
171 | */ | ||
172 | |||
173 | #define LTC4261_VALUE(name, ltc4261_cmd_idx) \ | ||
174 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, \ | ||
175 | ltc4261_show_value, NULL, ltc4261_cmd_idx) | ||
176 | |||
177 | #define LTC4261_BOOL(name, mask) \ | ||
178 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, \ | ||
179 | ltc4261_show_bool, NULL, (mask)) | ||
180 | |||
181 | /* | ||
182 | * Input voltages. | 168 | * Input voltages. |
183 | */ | 169 | */ |
184 | LTC4261_VALUE(in1_input, LTC4261_ADIN_H); | 170 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ltc4261_show_value, NULL, |
185 | LTC4261_VALUE(in2_input, LTC4261_ADIN2_H); | 171 | LTC4261_ADIN_H); |
172 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ltc4261_show_value, NULL, | ||
173 | LTC4261_ADIN2_H); | ||
186 | 174 | ||
187 | /* | 175 | /* |
188 | * Voltage alarms. The chip has only one set of voltage alarm status bits, | 176 | * Voltage alarms. The chip has only one set of voltage alarm status bits, |
@@ -192,16 +180,22 @@ LTC4261_VALUE(in2_input, LTC4261_ADIN2_H); | |||
192 | * To ensure that the alarm condition is reported to the user, report it | 180 | * To ensure that the alarm condition is reported to the user, report it |
193 | * with both voltage sensors. | 181 | * with both voltage sensors. |
194 | */ | 182 | */ |
195 | LTC4261_BOOL(in1_min_alarm, FAULT_UV); | 183 | static SENSOR_DEVICE_ATTR(in1_min_alarm, S_IRUGO, ltc4261_show_bool, NULL, |
196 | LTC4261_BOOL(in1_max_alarm, FAULT_OV); | 184 | FAULT_UV); |
197 | LTC4261_BOOL(in2_min_alarm, FAULT_UV); | 185 | static SENSOR_DEVICE_ATTR(in1_max_alarm, S_IRUGO, ltc4261_show_bool, NULL, |
198 | LTC4261_BOOL(in2_max_alarm, FAULT_OV); | 186 | FAULT_OV); |
187 | static SENSOR_DEVICE_ATTR(in2_min_alarm, S_IRUGO, ltc4261_show_bool, NULL, | ||
188 | FAULT_UV); | ||
189 | static SENSOR_DEVICE_ATTR(in2_max_alarm, S_IRUGO, ltc4261_show_bool, NULL, | ||
190 | FAULT_OV); | ||
199 | 191 | ||
200 | /* Currents (via sense resistor) */ | 192 | /* Currents (via sense resistor) */ |
201 | LTC4261_VALUE(curr1_input, LTC4261_SENSE_H); | 193 | static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, ltc4261_show_value, NULL, |
194 | LTC4261_SENSE_H); | ||
202 | 195 | ||
203 | /* Overcurrent alarm */ | 196 | /* Overcurrent alarm */ |
204 | LTC4261_BOOL(curr1_max_alarm, FAULT_OC); | 197 | static SENSOR_DEVICE_ATTR(curr1_max_alarm, S_IRUGO, ltc4261_show_bool, NULL, |
198 | FAULT_OC); | ||
205 | 199 | ||
206 | static struct attribute *ltc4261_attributes[] = { | 200 | static struct attribute *ltc4261_attributes[] = { |
207 | &sensor_dev_attr_in1_input.dev_attr.attr, | 201 | &sensor_dev_attr_in1_input.dev_attr.attr, |