diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2018-12-10 17:02:18 -0500 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2019-02-18 17:23:29 -0500 |
| commit | 86b9f565002954d32983f424a795f070ec6f6bbf (patch) | |
| tree | c4048e3fd187431629de26b8eb15d2b948d4500d /drivers/hwmon | |
| parent | eba42d30fb11377e731cfea9ab65802177b81cde (diff) | |
hwmon: (pc87427) Use permission specific SENSOR[_DEVICE]_ATTR variants
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readability, and to reduce the chance of inconsistencies.
Also replace any remaining S_<PERMS> in the driver with octal values.
The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/hwmon/.
This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
| -rw-r--r-- | drivers/hwmon/pc87427.c | 317 |
1 files changed, 146 insertions, 171 deletions
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c index dc5a9d5ada51..d1a3f2040c00 100644 --- a/drivers/hwmon/pc87427.c +++ b/drivers/hwmon/pc87427.c | |||
| @@ -384,8 +384,8 @@ done: | |||
| 384 | return data; | 384 | return data; |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | static ssize_t show_fan_input(struct device *dev, struct device_attribute | 387 | static ssize_t fan_input_show(struct device *dev, |
| 388 | *devattr, char *buf) | 388 | struct device_attribute *devattr, char *buf) |
| 389 | { | 389 | { |
| 390 | struct pc87427_data *data = pc87427_update_device(dev); | 390 | struct pc87427_data *data = pc87427_update_device(dev); |
| 391 | int nr = to_sensor_dev_attr(devattr)->index; | 391 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -393,8 +393,8 @@ static ssize_t show_fan_input(struct device *dev, struct device_attribute | |||
| 393 | return sprintf(buf, "%lu\n", fan_from_reg(data->fan[nr])); | 393 | return sprintf(buf, "%lu\n", fan_from_reg(data->fan[nr])); |
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | static ssize_t show_fan_min(struct device *dev, struct device_attribute | 396 | static ssize_t fan_min_show(struct device *dev, |
| 397 | *devattr, char *buf) | 397 | struct device_attribute *devattr, char *buf) |
| 398 | { | 398 | { |
| 399 | struct pc87427_data *data = pc87427_update_device(dev); | 399 | struct pc87427_data *data = pc87427_update_device(dev); |
| 400 | int nr = to_sensor_dev_attr(devattr)->index; | 400 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -402,8 +402,8 @@ static ssize_t show_fan_min(struct device *dev, struct device_attribute | |||
| 402 | return sprintf(buf, "%lu\n", fan_from_reg(data->fan_min[nr])); | 402 | return sprintf(buf, "%lu\n", fan_from_reg(data->fan_min[nr])); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | static ssize_t show_fan_alarm(struct device *dev, struct device_attribute | 405 | static ssize_t fan_alarm_show(struct device *dev, |
| 406 | *devattr, char *buf) | 406 | struct device_attribute *devattr, char *buf) |
| 407 | { | 407 | { |
| 408 | struct pc87427_data *data = pc87427_update_device(dev); | 408 | struct pc87427_data *data = pc87427_update_device(dev); |
| 409 | int nr = to_sensor_dev_attr(devattr)->index; | 409 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -412,8 +412,8 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute | |||
| 412 | & FAN_STATUS_LOSPD)); | 412 | & FAN_STATUS_LOSPD)); |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | static ssize_t show_fan_fault(struct device *dev, struct device_attribute | 415 | static ssize_t fan_fault_show(struct device *dev, |
| 416 | *devattr, char *buf) | 416 | struct device_attribute *devattr, char *buf) |
| 417 | { | 417 | { |
| 418 | struct pc87427_data *data = pc87427_update_device(dev); | 418 | struct pc87427_data *data = pc87427_update_device(dev); |
| 419 | int nr = to_sensor_dev_attr(devattr)->index; | 419 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -422,8 +422,9 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attribute | |||
| 422 | & FAN_STATUS_STALL)); | 422 | & FAN_STATUS_STALL)); |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | static ssize_t set_fan_min(struct device *dev, struct device_attribute | 425 | static ssize_t fan_min_store(struct device *dev, |
| 426 | *devattr, const char *buf, size_t count) | 426 | struct device_attribute *devattr, |
| 427 | const char *buf, size_t count) | ||
| 427 | { | 428 | { |
| 428 | struct pc87427_data *data = dev_get_drvdata(dev); | 429 | struct pc87427_data *data = dev_get_drvdata(dev); |
| 429 | int nr = to_sensor_dev_attr(devattr)->index; | 430 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -449,49 +450,41 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute | |||
| 449 | return count; | 450 | return count; |
| 450 | } | 451 | } |
| 451 | 452 | ||
| 452 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0); | 453 | static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0); |
| 453 | static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1); | 454 | static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1); |
| 454 | static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan_input, NULL, 2); | 455 | static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2); |
| 455 | static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan_input, NULL, 3); | 456 | static SENSOR_DEVICE_ATTR_RO(fan4_input, fan_input, 3); |
| 456 | static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan_input, NULL, 4); | 457 | static SENSOR_DEVICE_ATTR_RO(fan5_input, fan_input, 4); |
| 457 | static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan_input, NULL, 5); | 458 | static SENSOR_DEVICE_ATTR_RO(fan6_input, fan_input, 5); |
| 458 | static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan_input, NULL, 6); | 459 | static SENSOR_DEVICE_ATTR_RO(fan7_input, fan_input, 6); |
| 459 | static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan_input, NULL, 7); | 460 | static SENSOR_DEVICE_ATTR_RO(fan8_input, fan_input, 7); |
| 460 | 461 | ||
| 461 | static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, | 462 | static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0); |
| 462 | show_fan_min, set_fan_min, 0); | 463 | static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1); |
| 463 | static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, | 464 | static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2); |
| 464 | show_fan_min, set_fan_min, 1); | 465 | static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3); |
| 465 | static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, | 466 | static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4); |
| 466 | show_fan_min, set_fan_min, 2); | 467 | static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5); |
| 467 | static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, | 468 | static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6); |
| 468 | show_fan_min, set_fan_min, 3); | 469 | static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7); |
| 469 | static SENSOR_DEVICE_ATTR(fan5_min, S_IWUSR | S_IRUGO, | 470 | |
| 470 | show_fan_min, set_fan_min, 4); | 471 | static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0); |
| 471 | static SENSOR_DEVICE_ATTR(fan6_min, S_IWUSR | S_IRUGO, | 472 | static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1); |
| 472 | show_fan_min, set_fan_min, 5); | 473 | static SENSOR_DEVICE_ATTR_RO(fan3_alarm, fan_alarm, 2); |
| 473 | static SENSOR_DEVICE_ATTR(fan7_min, S_IWUSR | S_IRUGO, | 474 | static SENSOR_DEVICE_ATTR_RO(fan4_alarm, fan_alarm, 3); |
| 474 | show_fan_min, set_fan_min, 6); | 475 | static SENSOR_DEVICE_ATTR_RO(fan5_alarm, fan_alarm, 4); |
| 475 | static SENSOR_DEVICE_ATTR(fan8_min, S_IWUSR | S_IRUGO, | 476 | static SENSOR_DEVICE_ATTR_RO(fan6_alarm, fan_alarm, 5); |
| 476 | show_fan_min, set_fan_min, 7); | 477 | static SENSOR_DEVICE_ATTR_RO(fan7_alarm, fan_alarm, 6); |
| 477 | 478 | static SENSOR_DEVICE_ATTR_RO(fan8_alarm, fan_alarm, 7); | |
| 478 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0); | 479 | |
| 479 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1); | 480 | static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0); |
| 480 | static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2); | 481 | static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1); |
| 481 | static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3); | 482 | static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2); |
| 482 | static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_fan_alarm, NULL, 4); | 483 | static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3); |
| 483 | static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_fan_alarm, NULL, 5); | 484 | static SENSOR_DEVICE_ATTR_RO(fan5_fault, fan_fault, 4); |
| 484 | static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_fan_alarm, NULL, 6); | 485 | static SENSOR_DEVICE_ATTR_RO(fan6_fault, fan_fault, 5); |
| 485 | static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_fan_alarm, NULL, 7); | 486 | static SENSOR_DEVICE_ATTR_RO(fan7_fault, fan_fault, 6); |
| 486 | 487 | static SENSOR_DEVICE_ATTR_RO(fan8_fault, fan_fault, 7); | |
| 487 | static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); | ||
| 488 | static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); | ||
| 489 | static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); | ||
| 490 | static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); | ||
| 491 | static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, show_fan_fault, NULL, 4); | ||
| 492 | static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, show_fan_fault, NULL, 5); | ||
| 493 | static SENSOR_DEVICE_ATTR(fan7_fault, S_IRUGO, show_fan_fault, NULL, 6); | ||
| 494 | static SENSOR_DEVICE_ATTR(fan8_fault, S_IRUGO, show_fan_fault, NULL, 7); | ||
| 495 | 488 | ||
| 496 | static struct attribute *pc87427_attributes_fan[8][5] = { | 489 | static struct attribute *pc87427_attributes_fan[8][5] = { |
| 497 | { | 490 | { |
| @@ -568,8 +561,8 @@ static void update_pwm_enable(struct pc87427_data *data, int nr, u8 mode) | |||
| 568 | outb(data->pwm_enable[nr], iobase + PC87427_REG_PWM_ENABLE); | 561 | outb(data->pwm_enable[nr], iobase + PC87427_REG_PWM_ENABLE); |
| 569 | } | 562 | } |
| 570 | 563 | ||
| 571 | static ssize_t show_pwm_enable(struct device *dev, struct device_attribute | 564 | static ssize_t pwm_enable_show(struct device *dev, |
| 572 | *devattr, char *buf) | 565 | struct device_attribute *devattr, char *buf) |
| 573 | { | 566 | { |
| 574 | struct pc87427_data *data = pc87427_update_device(dev); | 567 | struct pc87427_data *data = pc87427_update_device(dev); |
| 575 | int nr = to_sensor_dev_attr(devattr)->index; | 568 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -581,8 +574,9 @@ static ssize_t show_pwm_enable(struct device *dev, struct device_attribute | |||
| 581 | return sprintf(buf, "%d\n", pwm_enable); | 574 | return sprintf(buf, "%d\n", pwm_enable); |
| 582 | } | 575 | } |
| 583 | 576 | ||
| 584 | static ssize_t set_pwm_enable(struct device *dev, struct device_attribute | 577 | static ssize_t pwm_enable_store(struct device *dev, |
| 585 | *devattr, const char *buf, size_t count) | 578 | struct device_attribute *devattr, |
| 579 | const char *buf, size_t count) | ||
| 586 | { | 580 | { |
| 587 | struct pc87427_data *data = dev_get_drvdata(dev); | 581 | struct pc87427_data *data = dev_get_drvdata(dev); |
| 588 | int nr = to_sensor_dev_attr(devattr)->index; | 582 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -602,8 +596,8 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute | |||
| 602 | return count; | 596 | return count; |
| 603 | } | 597 | } |
| 604 | 598 | ||
| 605 | static ssize_t show_pwm(struct device *dev, struct device_attribute | 599 | static ssize_t pwm_show(struct device *dev, struct device_attribute *devattr, |
| 606 | *devattr, char *buf) | 600 | char *buf) |
| 607 | { | 601 | { |
| 608 | struct pc87427_data *data = pc87427_update_device(dev); | 602 | struct pc87427_data *data = pc87427_update_device(dev); |
| 609 | int nr = to_sensor_dev_attr(devattr)->index; | 603 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -611,8 +605,8 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute | |||
| 611 | return sprintf(buf, "%d\n", (int)data->pwm[nr]); | 605 | return sprintf(buf, "%d\n", (int)data->pwm[nr]); |
| 612 | } | 606 | } |
| 613 | 607 | ||
| 614 | static ssize_t set_pwm(struct device *dev, struct device_attribute | 608 | static ssize_t pwm_store(struct device *dev, struct device_attribute *devattr, |
| 615 | *devattr, const char *buf, size_t count) | 609 | const char *buf, size_t count) |
| 616 | { | 610 | { |
| 617 | struct pc87427_data *data = dev_get_drvdata(dev); | 611 | struct pc87427_data *data = dev_get_drvdata(dev); |
| 618 | int nr = to_sensor_dev_attr(devattr)->index; | 612 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -657,19 +651,15 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute | |||
| 657 | return count; | 651 | return count; |
| 658 | } | 652 | } |
| 659 | 653 | ||
| 660 | static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, | 654 | static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0); |
| 661 | show_pwm_enable, set_pwm_enable, 0); | 655 | static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1); |
| 662 | static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, | 656 | static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_enable, 2); |
| 663 | show_pwm_enable, set_pwm_enable, 1); | 657 | static SENSOR_DEVICE_ATTR_RW(pwm4_enable, pwm_enable, 3); |
| 664 | static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO, | ||
| 665 | show_pwm_enable, set_pwm_enable, 2); | ||
| 666 | static SENSOR_DEVICE_ATTR(pwm4_enable, S_IWUSR | S_IRUGO, | ||
| 667 | show_pwm_enable, set_pwm_enable, 3); | ||
| 668 | 658 | ||
| 669 | static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); | 659 | static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0); |
| 670 | static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); | 660 | static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1); |
| 671 | static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); | 661 | static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2); |
| 672 | static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); | 662 | static SENSOR_DEVICE_ATTR_RW(pwm4, pwm, 3); |
| 673 | 663 | ||
| 674 | static struct attribute *pc87427_attributes_pwm[4][3] = { | 664 | static struct attribute *pc87427_attributes_pwm[4][3] = { |
| 675 | { | 665 | { |
| @@ -698,8 +688,8 @@ static const struct attribute_group pc87427_group_pwm[4] = { | |||
| 698 | { .attrs = pc87427_attributes_pwm[3] }, | 688 | { .attrs = pc87427_attributes_pwm[3] }, |
| 699 | }; | 689 | }; |
| 700 | 690 | ||
| 701 | static ssize_t show_temp_input(struct device *dev, struct device_attribute | 691 | static ssize_t temp_input_show(struct device *dev, |
| 702 | *devattr, char *buf) | 692 | struct device_attribute *devattr, char *buf) |
| 703 | { | 693 | { |
| 704 | struct pc87427_data *data = pc87427_update_device(dev); | 694 | struct pc87427_data *data = pc87427_update_device(dev); |
| 705 | int nr = to_sensor_dev_attr(devattr)->index; | 695 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -707,8 +697,8 @@ static ssize_t show_temp_input(struct device *dev, struct device_attribute | |||
| 707 | return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr])); | 697 | return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr])); |
| 708 | } | 698 | } |
| 709 | 699 | ||
| 710 | static ssize_t show_temp_min(struct device *dev, struct device_attribute | 700 | static ssize_t temp_min_show(struct device *dev, |
| 711 | *devattr, char *buf) | 701 | struct device_attribute *devattr, char *buf) |
| 712 | { | 702 | { |
| 713 | struct pc87427_data *data = pc87427_update_device(dev); | 703 | struct pc87427_data *data = pc87427_update_device(dev); |
| 714 | int nr = to_sensor_dev_attr(devattr)->index; | 704 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -716,8 +706,8 @@ static ssize_t show_temp_min(struct device *dev, struct device_attribute | |||
| 716 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_min[nr])); | 706 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_min[nr])); |
| 717 | } | 707 | } |
| 718 | 708 | ||
| 719 | static ssize_t show_temp_max(struct device *dev, struct device_attribute | 709 | static ssize_t temp_max_show(struct device *dev, |
| 720 | *devattr, char *buf) | 710 | struct device_attribute *devattr, char *buf) |
| 721 | { | 711 | { |
| 722 | struct pc87427_data *data = pc87427_update_device(dev); | 712 | struct pc87427_data *data = pc87427_update_device(dev); |
| 723 | int nr = to_sensor_dev_attr(devattr)->index; | 713 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -725,8 +715,8 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute | |||
| 725 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_max[nr])); | 715 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_max[nr])); |
| 726 | } | 716 | } |
| 727 | 717 | ||
| 728 | static ssize_t show_temp_crit(struct device *dev, struct device_attribute | 718 | static ssize_t temp_crit_show(struct device *dev, |
| 729 | *devattr, char *buf) | 719 | struct device_attribute *devattr, char *buf) |
| 730 | { | 720 | { |
| 731 | struct pc87427_data *data = pc87427_update_device(dev); | 721 | struct pc87427_data *data = pc87427_update_device(dev); |
| 732 | int nr = to_sensor_dev_attr(devattr)->index; | 722 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -734,8 +724,8 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attribute | |||
| 734 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_crit[nr])); | 724 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_crit[nr])); |
| 735 | } | 725 | } |
| 736 | 726 | ||
| 737 | static ssize_t show_temp_type(struct device *dev, struct device_attribute | 727 | static ssize_t temp_type_show(struct device *dev, |
| 738 | *devattr, char *buf) | 728 | struct device_attribute *devattr, char *buf) |
| 739 | { | 729 | { |
| 740 | struct pc87427_data *data = pc87427_update_device(dev); | 730 | struct pc87427_data *data = pc87427_update_device(dev); |
| 741 | int nr = to_sensor_dev_attr(devattr)->index; | 731 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -743,8 +733,9 @@ static ssize_t show_temp_type(struct device *dev, struct device_attribute | |||
| 743 | return sprintf(buf, "%u\n", temp_type_from_reg(data->temp_type[nr])); | 733 | return sprintf(buf, "%u\n", temp_type_from_reg(data->temp_type[nr])); |
| 744 | } | 734 | } |
| 745 | 735 | ||
| 746 | static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute | 736 | static ssize_t temp_min_alarm_show(struct device *dev, |
| 747 | *devattr, char *buf) | 737 | struct device_attribute *devattr, |
| 738 | char *buf) | ||
| 748 | { | 739 | { |
| 749 | struct pc87427_data *data = pc87427_update_device(dev); | 740 | struct pc87427_data *data = pc87427_update_device(dev); |
| 750 | int nr = to_sensor_dev_attr(devattr)->index; | 741 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -753,8 +744,9 @@ static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute | |||
| 753 | & TEMP_STATUS_LOWFLG)); | 744 | & TEMP_STATUS_LOWFLG)); |
| 754 | } | 745 | } |
| 755 | 746 | ||
| 756 | static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute | 747 | static ssize_t temp_max_alarm_show(struct device *dev, |
| 757 | *devattr, char *buf) | 748 | struct device_attribute *devattr, |
| 749 | char *buf) | ||
| 758 | { | 750 | { |
| 759 | struct pc87427_data *data = pc87427_update_device(dev); | 751 | struct pc87427_data *data = pc87427_update_device(dev); |
| 760 | int nr = to_sensor_dev_attr(devattr)->index; | 752 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -763,8 +755,9 @@ static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute | |||
| 763 | & TEMP_STATUS_HIGHFLG)); | 755 | & TEMP_STATUS_HIGHFLG)); |
| 764 | } | 756 | } |
| 765 | 757 | ||
| 766 | static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute | 758 | static ssize_t temp_crit_alarm_show(struct device *dev, |
| 767 | *devattr, char *buf) | 759 | struct device_attribute *devattr, |
| 760 | char *buf) | ||
| 768 | { | 761 | { |
| 769 | struct pc87427_data *data = pc87427_update_device(dev); | 762 | struct pc87427_data *data = pc87427_update_device(dev); |
| 770 | int nr = to_sensor_dev_attr(devattr)->index; | 763 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -773,8 +766,8 @@ static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute | |||
| 773 | & TEMP_STATUS_CRITFLG)); | 766 | & TEMP_STATUS_CRITFLG)); |
| 774 | } | 767 | } |
| 775 | 768 | ||
| 776 | static ssize_t show_temp_fault(struct device *dev, struct device_attribute | 769 | static ssize_t temp_fault_show(struct device *dev, |
| 777 | *devattr, char *buf) | 770 | struct device_attribute *devattr, char *buf) |
| 778 | { | 771 | { |
| 779 | struct pc87427_data *data = pc87427_update_device(dev); | 772 | struct pc87427_data *data = pc87427_update_device(dev); |
| 780 | int nr = to_sensor_dev_attr(devattr)->index; | 773 | int nr = to_sensor_dev_attr(devattr)->index; |
| @@ -783,86 +776,68 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute | |||
| 783 | & TEMP_STATUS_SENSERR)); | 776 | & TEMP_STATUS_SENSERR)); |
| 784 | } | 777 | } |
| 785 | 778 | ||
| 786 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); | 779 | static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0); |
| 787 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1); | 780 | static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1); |
| 788 | static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp_input, NULL, 2); | 781 | static SENSOR_DEVICE_ATTR_RO(temp3_input, temp_input, 2); |
| 789 | static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp_input, NULL, 3); | 782 | static SENSOR_DEVICE_ATTR_RO(temp4_input, temp_input, 3); |
| 790 | static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp_input, NULL, 4); | 783 | static SENSOR_DEVICE_ATTR_RO(temp5_input, temp_input, 4); |
| 791 | static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp_input, NULL, 5); | 784 | static SENSOR_DEVICE_ATTR_RO(temp6_input, temp_input, 5); |
| 792 | 785 | ||
| 793 | static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO, show_temp_min, NULL, 0); | 786 | static SENSOR_DEVICE_ATTR_RO(temp1_min, temp_min, 0); |
| 794 | static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO, show_temp_min, NULL, 1); | 787 | static SENSOR_DEVICE_ATTR_RO(temp2_min, temp_min, 1); |
| 795 | static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO, show_temp_min, NULL, 2); | 788 | static SENSOR_DEVICE_ATTR_RO(temp3_min, temp_min, 2); |
| 796 | static SENSOR_DEVICE_ATTR(temp4_min, S_IRUGO, show_temp_min, NULL, 3); | 789 | static SENSOR_DEVICE_ATTR_RO(temp4_min, temp_min, 3); |
| 797 | static SENSOR_DEVICE_ATTR(temp5_min, S_IRUGO, show_temp_min, NULL, 4); | 790 | static SENSOR_DEVICE_ATTR_RO(temp5_min, temp_min, 4); |
| 798 | static SENSOR_DEVICE_ATTR(temp6_min, S_IRUGO, show_temp_min, NULL, 5); | 791 | static SENSOR_DEVICE_ATTR_RO(temp6_min, temp_min, 5); |
| 799 | 792 | ||
| 800 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); | 793 | static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0); |
| 801 | static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); | 794 | static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1); |
| 802 | static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); | 795 | static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2); |
| 803 | static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); | 796 | static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3); |
| 804 | static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); | 797 | static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4); |
| 805 | static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); | 798 | static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5); |
| 806 | 799 | ||
| 807 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); | 800 | static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0); |
| 808 | static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); | 801 | static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1); |
| 809 | static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); | 802 | static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2); |
| 810 | static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); | 803 | static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3); |
| 811 | static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); | 804 | static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4); |
| 812 | static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); | 805 | static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5); |
| 813 | 806 | ||
| 814 | static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0); | 807 | static SENSOR_DEVICE_ATTR_RO(temp1_type, temp_type, 0); |
| 815 | static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1); | 808 | static SENSOR_DEVICE_ATTR_RO(temp2_type, temp_type, 1); |
| 816 | static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2); | 809 | static SENSOR_DEVICE_ATTR_RO(temp3_type, temp_type, 2); |
| 817 | static SENSOR_DEVICE_ATTR(temp4_type, S_IRUGO, show_temp_type, NULL, 3); | 810 | static SENSOR_DEVICE_ATTR_RO(temp4_type, temp_type, 3); |
| 818 | static SENSOR_DEVICE_ATTR(temp5_type, S_IRUGO, show_temp_type, NULL, 4); | 811 | static SENSOR_DEVICE_ATTR_RO(temp5_type, temp_type, 4); |
| 819 | static SENSOR_DEVICE_ATTR(temp6_type, S_IRUGO, show_temp_type, NULL, 5); | 812 | static SENSOR_DEVICE_ATTR_RO(temp6_type, temp_type, 5); |
| 820 | 813 | ||
| 821 | static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, | 814 | static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_min_alarm, 0); |
| 822 | show_temp_min_alarm, NULL, 0); | 815 | static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_min_alarm, 1); |
| 823 | static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, | 816 | static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, temp_min_alarm, 2); |
| 824 | show_temp_min_alarm, NULL, 1); | 817 | static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, temp_min_alarm, 3); |
| 825 | static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, | 818 | static SENSOR_DEVICE_ATTR_RO(temp5_min_alarm, temp_min_alarm, 4); |
| 826 | show_temp_min_alarm, NULL, 2); | 819 | static SENSOR_DEVICE_ATTR_RO(temp6_min_alarm, temp_min_alarm, 5); |
| 827 | static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, | 820 | |
| 828 | show_temp_min_alarm, NULL, 3); | 821 | static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_max_alarm, 0); |
| 829 | static SENSOR_DEVICE_ATTR(temp5_min_alarm, S_IRUGO, | 822 | static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_max_alarm, 1); |
| 830 | show_temp_min_alarm, NULL, 4); | 823 | static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, temp_max_alarm, 2); |
| 831 | static SENSOR_DEVICE_ATTR(temp6_min_alarm, S_IRUGO, | 824 | static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, temp_max_alarm, 3); |
| 832 | show_temp_min_alarm, NULL, 5); | 825 | static SENSOR_DEVICE_ATTR_RO(temp5_max_alarm, temp_max_alarm, 4); |
| 833 | 826 | static SENSOR_DEVICE_ATTR_RO(temp6_max_alarm, temp_max_alarm, 5); | |
| 834 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, | 827 | |
| 835 | show_temp_max_alarm, NULL, 0); | 828 | static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, temp_crit_alarm, 0); |
| 836 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, | 829 | static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, temp_crit_alarm, 1); |
| 837 | show_temp_max_alarm, NULL, 1); | 830 | static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, temp_crit_alarm, 2); |
| 838 | static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, | 831 | static SENSOR_DEVICE_ATTR_RO(temp4_crit_alarm, temp_crit_alarm, 3); |
| 839 | show_temp_max_alarm, NULL, 2); | 832 | static SENSOR_DEVICE_ATTR_RO(temp5_crit_alarm, temp_crit_alarm, 4); |
| 840 | static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, | 833 | static SENSOR_DEVICE_ATTR_RO(temp6_crit_alarm, temp_crit_alarm, 5); |
| 841 | show_temp_max_alarm, NULL, 3); | 834 | |
| 842 | static SENSOR_DEVICE_ATTR(temp5_max_alarm, S_IRUGO, | 835 | static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); |
| 843 | show_temp_max_alarm, NULL, 4); | 836 | static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); |
| 844 | static SENSOR_DEVICE_ATTR(temp6_max_alarm, S_IRUGO, | 837 | static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2); |
| 845 | show_temp_max_alarm, NULL, 5); | 838 | static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3); |
| 846 | 839 | static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4); | |
| 847 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, | 840 | static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5); |
| 848 | show_temp_crit_alarm, NULL, 0); | ||
| 849 | static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, | ||
| 850 | show_temp_crit_alarm, NULL, 1); | ||
| 851 | static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, | ||
| 852 | show_temp_crit_alarm, NULL, 2); | ||
| 853 | static SENSOR_DEVICE_ATTR(temp4_crit_alarm, S_IRUGO, | ||
| 854 | show_temp_crit_alarm, NULL, 3); | ||
| 855 | static SENSOR_DEVICE_ATTR(temp5_crit_alarm, S_IRUGO, | ||
| 856 | show_temp_crit_alarm, NULL, 4); | ||
| 857 | static SENSOR_DEVICE_ATTR(temp6_crit_alarm, S_IRUGO, | ||
| 858 | show_temp_crit_alarm, NULL, 5); | ||
| 859 | |||
| 860 | static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); | ||
| 861 | static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); | ||
| 862 | static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); | ||
| 863 | static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); | ||
| 864 | static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4); | ||
| 865 | static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5); | ||
| 866 | 841 | ||
| 867 | static struct attribute *pc87427_attributes_temp[6][10] = { | 842 | static struct attribute *pc87427_attributes_temp[6][10] = { |
| 868 | { | 843 | { |
