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>

authored by Jean Delvare and committed by Mark M. Hoffman e84542f5 f8181762

+30 -1
+30 -1
drivers/hwmon/lm80.c
··· 304 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 315 static SENSOR_DEVICE_ATTR(in0_min, S_IWUSR | S_IRUGO, 308 316 show_in_min, set_in_min, 0); 309 317 static SENSOR_DEVICE_ATTR(in1_min, S_IWUSR | S_IRUGO, ··· 367 359 static DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, show_temp_os_hyst, 368 360 set_temp_os_hyst); 369 361 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 362 + static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0); 363 + static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 1); 364 + static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 2); 365 + static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 3); 366 + static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 4); 367 + static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 5); 368 + static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 6); 369 + static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 10); 370 + static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 11); 371 + static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 8); 372 + static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 13); 370 373 371 374 /* 372 375 * Real code ··· 424 405 &dev_attr_temp1_crit.attr, 425 406 &dev_attr_temp1_crit_hyst.attr, 426 407 &dev_attr_alarms.attr, 427 - 408 + &sensor_dev_attr_in0_alarm.dev_attr.attr, 409 + &sensor_dev_attr_in1_alarm.dev_attr.attr, 410 + &sensor_dev_attr_in2_alarm.dev_attr.attr, 411 + &sensor_dev_attr_in3_alarm.dev_attr.attr, 412 + &sensor_dev_attr_in4_alarm.dev_attr.attr, 413 + &sensor_dev_attr_in5_alarm.dev_attr.attr, 414 + &sensor_dev_attr_in6_alarm.dev_attr.attr, 415 + &sensor_dev_attr_fan1_alarm.dev_attr.attr, 416 + &sensor_dev_attr_fan2_alarm.dev_attr.attr, 417 + &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, 418 + &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, 428 419 NULL 429 420 }; 430 421