diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-01-05 09:40:38 -0500 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-07 20:39:45 -0500 |
commit | e84542f5db655d1ce7b4890832f0e5d19aae965d (patch) | |
tree | ea5a3e9ca5e9cb0810c91277450413ee89619391 /drivers/hwmon/lm80.c | |
parent | f8181762a04a3ff7878d3ec5c013bce9c771d4f7 (diff) |
hwmon: (lm80) Add individual alarm files
The new libsensors needs these individual alarm files.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/lm80.c')
-rw-r--r-- | drivers/hwmon/lm80.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index 612807c786e2..a2ca055f3922 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c | |||
@@ -304,6 +304,14 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, | |||
304 | return sprintf(buf, "%u\n", data->alarms); | 304 | return sprintf(buf, "%u\n", data->alarms); |
305 | } | 305 | } |
306 | 306 | ||
307 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | ||
308 | char *buf) | ||
309 | { | ||
310 | int bitnr = to_sensor_dev_attr(attr)->index; | ||
311 | struct lm80_data *data = lm80_update_device(dev); | ||
312 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | ||
313 | } | ||
314 | |||
307 | static SENSOR_DEVICE_ATTR(in0_min, S_IWUSR | S_IRUGO, | 315 | static SENSOR_DEVICE_ATTR(in0_min, S_IWUSR | S_IRUGO, |
308 | show_in_min, set_in_min, 0); | 316 | show_in_min, set_in_min, 0); |
309 | static SENSOR_DEVICE_ATTR(in1_min, S_IWUSR | S_IRUGO, | 317 | static SENSOR_DEVICE_ATTR(in1_min, S_IWUSR | S_IRUGO, |
@@ -359,6 +367,17 @@ static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp_os_max, | |||
359 | static DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temp_os_hyst, | 367 | static DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temp_os_hyst, |
360 | set_temp_os_hyst); | 368 | set_temp_os_hyst); |
361 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 369 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
370 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); | ||
371 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); | ||
372 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); | ||
373 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); | ||
374 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 4); | ||
375 | static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 5); | ||
376 | static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 6); | ||
377 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 10); | ||
378 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 11); | ||
379 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 8); | ||
380 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 13); | ||
362 | 381 | ||
363 | /* | 382 | /* |
364 | * Real code | 383 | * Real code |
@@ -405,7 +424,17 @@ static struct attribute *lm80_attributes[] = { | |||
405 | &dev_attr_temp1_crit.attr, | 424 | &dev_attr_temp1_crit.attr, |
406 | &dev_attr_temp1_crit_hyst.attr, | 425 | &dev_attr_temp1_crit_hyst.attr, |
407 | &dev_attr_alarms.attr, | 426 | &dev_attr_alarms.attr, |
408 | 427 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | |
428 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
429 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
430 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
431 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
432 | &sensor_dev_attr_in5_alarm.dev_attr.attr, | ||
433 | &sensor_dev_attr_in6_alarm.dev_attr.attr, | ||
434 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
435 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
436 | &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, | ||
437 | &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, | ||
409 | NULL | 438 | NULL |
410 | }; | 439 | }; |
411 | 440 | ||