| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * pc87427.c - hardware monitoring driver for the |
|---|
| 3 | 4 | * National Semiconductor PC87427 Super-I/O chip |
|---|
| 4 | 5 | * Copyright (C) 2006, 2008, 2010 Jean Delvare <jdelvare@suse.de> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | 6 | * |
|---|
| 15 | 7 | * Supports the following chips: |
|---|
| 16 | 8 | * |
|---|
| .. | .. |
|---|
| 392 | 384 | return data; |
|---|
| 393 | 385 | } |
|---|
| 394 | 386 | |
|---|
| 395 | | -static ssize_t show_fan_input(struct device *dev, struct device_attribute |
|---|
| 396 | | - *devattr, char *buf) |
|---|
| 387 | +static ssize_t fan_input_show(struct device *dev, |
|---|
| 388 | + struct device_attribute *devattr, char *buf) |
|---|
| 397 | 389 | { |
|---|
| 398 | 390 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 399 | 391 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 401 | 393 | return sprintf(buf, "%lu\n", fan_from_reg(data->fan[nr])); |
|---|
| 402 | 394 | } |
|---|
| 403 | 395 | |
|---|
| 404 | | -static ssize_t show_fan_min(struct device *dev, struct device_attribute |
|---|
| 405 | | - *devattr, char *buf) |
|---|
| 396 | +static ssize_t fan_min_show(struct device *dev, |
|---|
| 397 | + struct device_attribute *devattr, char *buf) |
|---|
| 406 | 398 | { |
|---|
| 407 | 399 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 408 | 400 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 410 | 402 | return sprintf(buf, "%lu\n", fan_from_reg(data->fan_min[nr])); |
|---|
| 411 | 403 | } |
|---|
| 412 | 404 | |
|---|
| 413 | | -static ssize_t show_fan_alarm(struct device *dev, struct device_attribute |
|---|
| 414 | | - *devattr, char *buf) |
|---|
| 405 | +static ssize_t fan_alarm_show(struct device *dev, |
|---|
| 406 | + struct device_attribute *devattr, char *buf) |
|---|
| 415 | 407 | { |
|---|
| 416 | 408 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 417 | 409 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 420 | 412 | & FAN_STATUS_LOSPD)); |
|---|
| 421 | 413 | } |
|---|
| 422 | 414 | |
|---|
| 423 | | -static ssize_t show_fan_fault(struct device *dev, struct device_attribute |
|---|
| 424 | | - *devattr, char *buf) |
|---|
| 415 | +static ssize_t fan_fault_show(struct device *dev, |
|---|
| 416 | + struct device_attribute *devattr, char *buf) |
|---|
| 425 | 417 | { |
|---|
| 426 | 418 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 427 | 419 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 430 | 422 | & FAN_STATUS_STALL)); |
|---|
| 431 | 423 | } |
|---|
| 432 | 424 | |
|---|
| 433 | | -static ssize_t set_fan_min(struct device *dev, struct device_attribute |
|---|
| 434 | | - *devattr, const char *buf, size_t count) |
|---|
| 425 | +static ssize_t fan_min_store(struct device *dev, |
|---|
| 426 | + struct device_attribute *devattr, |
|---|
| 427 | + const char *buf, size_t count) |
|---|
| 435 | 428 | { |
|---|
| 436 | 429 | struct pc87427_data *data = dev_get_drvdata(dev); |
|---|
| 437 | 430 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 457 | 450 | return count; |
|---|
| 458 | 451 | } |
|---|
| 459 | 452 | |
|---|
| 460 | | -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0); |
|---|
| 461 | | -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1); |
|---|
| 462 | | -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan_input, NULL, 2); |
|---|
| 463 | | -static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan_input, NULL, 3); |
|---|
| 464 | | -static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan_input, NULL, 4); |
|---|
| 465 | | -static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan_input, NULL, 5); |
|---|
| 466 | | -static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan_input, NULL, 6); |
|---|
| 467 | | -static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan_input, NULL, 7); |
|---|
| 453 | +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0); |
|---|
| 454 | +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1); |
|---|
| 455 | +static SENSOR_DEVICE_ATTR_RO(fan3_input, fan_input, 2); |
|---|
| 456 | +static SENSOR_DEVICE_ATTR_RO(fan4_input, fan_input, 3); |
|---|
| 457 | +static SENSOR_DEVICE_ATTR_RO(fan5_input, fan_input, 4); |
|---|
| 458 | +static SENSOR_DEVICE_ATTR_RO(fan6_input, fan_input, 5); |
|---|
| 459 | +static SENSOR_DEVICE_ATTR_RO(fan7_input, fan_input, 6); |
|---|
| 460 | +static SENSOR_DEVICE_ATTR_RO(fan8_input, fan_input, 7); |
|---|
| 468 | 461 | |
|---|
| 469 | | -static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, |
|---|
| 470 | | - show_fan_min, set_fan_min, 0); |
|---|
| 471 | | -static SENSOR_DEVICE_ATTR(fan2_min, S_IWUSR | S_IRUGO, |
|---|
| 472 | | - show_fan_min, set_fan_min, 1); |
|---|
| 473 | | -static SENSOR_DEVICE_ATTR(fan3_min, S_IWUSR | S_IRUGO, |
|---|
| 474 | | - show_fan_min, set_fan_min, 2); |
|---|
| 475 | | -static SENSOR_DEVICE_ATTR(fan4_min, S_IWUSR | S_IRUGO, |
|---|
| 476 | | - show_fan_min, set_fan_min, 3); |
|---|
| 477 | | -static SENSOR_DEVICE_ATTR(fan5_min, S_IWUSR | S_IRUGO, |
|---|
| 478 | | - show_fan_min, set_fan_min, 4); |
|---|
| 479 | | -static SENSOR_DEVICE_ATTR(fan6_min, S_IWUSR | S_IRUGO, |
|---|
| 480 | | - show_fan_min, set_fan_min, 5); |
|---|
| 481 | | -static SENSOR_DEVICE_ATTR(fan7_min, S_IWUSR | S_IRUGO, |
|---|
| 482 | | - show_fan_min, set_fan_min, 6); |
|---|
| 483 | | -static SENSOR_DEVICE_ATTR(fan8_min, S_IWUSR | S_IRUGO, |
|---|
| 484 | | - show_fan_min, set_fan_min, 7); |
|---|
| 462 | +static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0); |
|---|
| 463 | +static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1); |
|---|
| 464 | +static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2); |
|---|
| 465 | +static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3); |
|---|
| 466 | +static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4); |
|---|
| 467 | +static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5); |
|---|
| 468 | +static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6); |
|---|
| 469 | +static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7); |
|---|
| 485 | 470 | |
|---|
| 486 | | -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0); |
|---|
| 487 | | -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1); |
|---|
| 488 | | -static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2); |
|---|
| 489 | | -static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3); |
|---|
| 490 | | -static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_fan_alarm, NULL, 4); |
|---|
| 491 | | -static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_fan_alarm, NULL, 5); |
|---|
| 492 | | -static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_fan_alarm, NULL, 6); |
|---|
| 493 | | -static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_fan_alarm, NULL, 7); |
|---|
| 471 | +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0); |
|---|
| 472 | +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1); |
|---|
| 473 | +static SENSOR_DEVICE_ATTR_RO(fan3_alarm, fan_alarm, 2); |
|---|
| 474 | +static SENSOR_DEVICE_ATTR_RO(fan4_alarm, fan_alarm, 3); |
|---|
| 475 | +static SENSOR_DEVICE_ATTR_RO(fan5_alarm, fan_alarm, 4); |
|---|
| 476 | +static SENSOR_DEVICE_ATTR_RO(fan6_alarm, fan_alarm, 5); |
|---|
| 477 | +static SENSOR_DEVICE_ATTR_RO(fan7_alarm, fan_alarm, 6); |
|---|
| 478 | +static SENSOR_DEVICE_ATTR_RO(fan8_alarm, fan_alarm, 7); |
|---|
| 494 | 479 | |
|---|
| 495 | | -static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); |
|---|
| 496 | | -static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); |
|---|
| 497 | | -static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); |
|---|
| 498 | | -static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); |
|---|
| 499 | | -static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, show_fan_fault, NULL, 4); |
|---|
| 500 | | -static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, show_fan_fault, NULL, 5); |
|---|
| 501 | | -static SENSOR_DEVICE_ATTR(fan7_fault, S_IRUGO, show_fan_fault, NULL, 6); |
|---|
| 502 | | -static SENSOR_DEVICE_ATTR(fan8_fault, S_IRUGO, show_fan_fault, NULL, 7); |
|---|
| 480 | +static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0); |
|---|
| 481 | +static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1); |
|---|
| 482 | +static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2); |
|---|
| 483 | +static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3); |
|---|
| 484 | +static SENSOR_DEVICE_ATTR_RO(fan5_fault, fan_fault, 4); |
|---|
| 485 | +static SENSOR_DEVICE_ATTR_RO(fan6_fault, fan_fault, 5); |
|---|
| 486 | +static SENSOR_DEVICE_ATTR_RO(fan7_fault, fan_fault, 6); |
|---|
| 487 | +static SENSOR_DEVICE_ATTR_RO(fan8_fault, fan_fault, 7); |
|---|
| 503 | 488 | |
|---|
| 504 | 489 | static struct attribute *pc87427_attributes_fan[8][5] = { |
|---|
| 505 | 490 | { |
|---|
| .. | .. |
|---|
| 576 | 561 | outb(data->pwm_enable[nr], iobase + PC87427_REG_PWM_ENABLE); |
|---|
| 577 | 562 | } |
|---|
| 578 | 563 | |
|---|
| 579 | | -static ssize_t show_pwm_enable(struct device *dev, struct device_attribute |
|---|
| 580 | | - *devattr, char *buf) |
|---|
| 564 | +static ssize_t pwm_enable_show(struct device *dev, |
|---|
| 565 | + struct device_attribute *devattr, char *buf) |
|---|
| 581 | 566 | { |
|---|
| 582 | 567 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 583 | 568 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 589 | 574 | return sprintf(buf, "%d\n", pwm_enable); |
|---|
| 590 | 575 | } |
|---|
| 591 | 576 | |
|---|
| 592 | | -static ssize_t set_pwm_enable(struct device *dev, struct device_attribute |
|---|
| 593 | | - *devattr, const char *buf, size_t count) |
|---|
| 577 | +static ssize_t pwm_enable_store(struct device *dev, |
|---|
| 578 | + struct device_attribute *devattr, |
|---|
| 579 | + const char *buf, size_t count) |
|---|
| 594 | 580 | { |
|---|
| 595 | 581 | struct pc87427_data *data = dev_get_drvdata(dev); |
|---|
| 596 | 582 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 610 | 596 | return count; |
|---|
| 611 | 597 | } |
|---|
| 612 | 598 | |
|---|
| 613 | | -static ssize_t show_pwm(struct device *dev, struct device_attribute |
|---|
| 614 | | - *devattr, char *buf) |
|---|
| 599 | +static ssize_t pwm_show(struct device *dev, struct device_attribute *devattr, |
|---|
| 600 | + char *buf) |
|---|
| 615 | 601 | { |
|---|
| 616 | 602 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 617 | 603 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 619 | 605 | return sprintf(buf, "%d\n", (int)data->pwm[nr]); |
|---|
| 620 | 606 | } |
|---|
| 621 | 607 | |
|---|
| 622 | | -static ssize_t set_pwm(struct device *dev, struct device_attribute |
|---|
| 623 | | - *devattr, const char *buf, size_t count) |
|---|
| 608 | +static ssize_t pwm_store(struct device *dev, struct device_attribute *devattr, |
|---|
| 609 | + const char *buf, size_t count) |
|---|
| 624 | 610 | { |
|---|
| 625 | 611 | struct pc87427_data *data = dev_get_drvdata(dev); |
|---|
| 626 | 612 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 665 | 651 | return count; |
|---|
| 666 | 652 | } |
|---|
| 667 | 653 | |
|---|
| 668 | | -static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, |
|---|
| 669 | | - show_pwm_enable, set_pwm_enable, 0); |
|---|
| 670 | | -static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, |
|---|
| 671 | | - show_pwm_enable, set_pwm_enable, 1); |
|---|
| 672 | | -static SENSOR_DEVICE_ATTR(pwm3_enable, S_IWUSR | S_IRUGO, |
|---|
| 673 | | - show_pwm_enable, set_pwm_enable, 2); |
|---|
| 674 | | -static SENSOR_DEVICE_ATTR(pwm4_enable, S_IWUSR | S_IRUGO, |
|---|
| 675 | | - show_pwm_enable, set_pwm_enable, 3); |
|---|
| 654 | +static SENSOR_DEVICE_ATTR_RW(pwm1_enable, pwm_enable, 0); |
|---|
| 655 | +static SENSOR_DEVICE_ATTR_RW(pwm2_enable, pwm_enable, 1); |
|---|
| 656 | +static SENSOR_DEVICE_ATTR_RW(pwm3_enable, pwm_enable, 2); |
|---|
| 657 | +static SENSOR_DEVICE_ATTR_RW(pwm4_enable, pwm_enable, 3); |
|---|
| 676 | 658 | |
|---|
| 677 | | -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); |
|---|
| 678 | | -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); |
|---|
| 679 | | -static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2); |
|---|
| 680 | | -static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3); |
|---|
| 659 | +static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0); |
|---|
| 660 | +static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1); |
|---|
| 661 | +static SENSOR_DEVICE_ATTR_RW(pwm3, pwm, 2); |
|---|
| 662 | +static SENSOR_DEVICE_ATTR_RW(pwm4, pwm, 3); |
|---|
| 681 | 663 | |
|---|
| 682 | 664 | static struct attribute *pc87427_attributes_pwm[4][3] = { |
|---|
| 683 | 665 | { |
|---|
| .. | .. |
|---|
| 706 | 688 | { .attrs = pc87427_attributes_pwm[3] }, |
|---|
| 707 | 689 | }; |
|---|
| 708 | 690 | |
|---|
| 709 | | -static ssize_t show_temp_input(struct device *dev, struct device_attribute |
|---|
| 710 | | - *devattr, char *buf) |
|---|
| 691 | +static ssize_t temp_input_show(struct device *dev, |
|---|
| 692 | + struct device_attribute *devattr, char *buf) |
|---|
| 711 | 693 | { |
|---|
| 712 | 694 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 713 | 695 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 715 | 697 | return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr])); |
|---|
| 716 | 698 | } |
|---|
| 717 | 699 | |
|---|
| 718 | | -static ssize_t show_temp_min(struct device *dev, struct device_attribute |
|---|
| 719 | | - *devattr, char *buf) |
|---|
| 700 | +static ssize_t temp_min_show(struct device *dev, |
|---|
| 701 | + struct device_attribute *devattr, char *buf) |
|---|
| 720 | 702 | { |
|---|
| 721 | 703 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 722 | 704 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 724 | 706 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_min[nr])); |
|---|
| 725 | 707 | } |
|---|
| 726 | 708 | |
|---|
| 727 | | -static ssize_t show_temp_max(struct device *dev, struct device_attribute |
|---|
| 728 | | - *devattr, char *buf) |
|---|
| 709 | +static ssize_t temp_max_show(struct device *dev, |
|---|
| 710 | + struct device_attribute *devattr, char *buf) |
|---|
| 729 | 711 | { |
|---|
| 730 | 712 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 731 | 713 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 733 | 715 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_max[nr])); |
|---|
| 734 | 716 | } |
|---|
| 735 | 717 | |
|---|
| 736 | | -static ssize_t show_temp_crit(struct device *dev, struct device_attribute |
|---|
| 737 | | - *devattr, char *buf) |
|---|
| 718 | +static ssize_t temp_crit_show(struct device *dev, |
|---|
| 719 | + struct device_attribute *devattr, char *buf) |
|---|
| 738 | 720 | { |
|---|
| 739 | 721 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 740 | 722 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 742 | 724 | return sprintf(buf, "%ld\n", temp_from_reg8(data->temp_crit[nr])); |
|---|
| 743 | 725 | } |
|---|
| 744 | 726 | |
|---|
| 745 | | -static ssize_t show_temp_type(struct device *dev, struct device_attribute |
|---|
| 746 | | - *devattr, char *buf) |
|---|
| 727 | +static ssize_t temp_type_show(struct device *dev, |
|---|
| 728 | + struct device_attribute *devattr, char *buf) |
|---|
| 747 | 729 | { |
|---|
| 748 | 730 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 749 | 731 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 751 | 733 | return sprintf(buf, "%u\n", temp_type_from_reg(data->temp_type[nr])); |
|---|
| 752 | 734 | } |
|---|
| 753 | 735 | |
|---|
| 754 | | -static ssize_t show_temp_min_alarm(struct device *dev, struct device_attribute |
|---|
| 755 | | - *devattr, char *buf) |
|---|
| 736 | +static ssize_t temp_min_alarm_show(struct device *dev, |
|---|
| 737 | + struct device_attribute *devattr, |
|---|
| 738 | + char *buf) |
|---|
| 756 | 739 | { |
|---|
| 757 | 740 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 758 | 741 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 761 | 744 | & TEMP_STATUS_LOWFLG)); |
|---|
| 762 | 745 | } |
|---|
| 763 | 746 | |
|---|
| 764 | | -static ssize_t show_temp_max_alarm(struct device *dev, struct device_attribute |
|---|
| 765 | | - *devattr, char *buf) |
|---|
| 747 | +static ssize_t temp_max_alarm_show(struct device *dev, |
|---|
| 748 | + struct device_attribute *devattr, |
|---|
| 749 | + char *buf) |
|---|
| 766 | 750 | { |
|---|
| 767 | 751 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 768 | 752 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 771 | 755 | & TEMP_STATUS_HIGHFLG)); |
|---|
| 772 | 756 | } |
|---|
| 773 | 757 | |
|---|
| 774 | | -static ssize_t show_temp_crit_alarm(struct device *dev, struct device_attribute |
|---|
| 775 | | - *devattr, char *buf) |
|---|
| 758 | +static ssize_t temp_crit_alarm_show(struct device *dev, |
|---|
| 759 | + struct device_attribute *devattr, |
|---|
| 760 | + char *buf) |
|---|
| 776 | 761 | { |
|---|
| 777 | 762 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 778 | 763 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 781 | 766 | & TEMP_STATUS_CRITFLG)); |
|---|
| 782 | 767 | } |
|---|
| 783 | 768 | |
|---|
| 784 | | -static ssize_t show_temp_fault(struct device *dev, struct device_attribute |
|---|
| 785 | | - *devattr, char *buf) |
|---|
| 769 | +static ssize_t temp_fault_show(struct device *dev, |
|---|
| 770 | + struct device_attribute *devattr, char *buf) |
|---|
| 786 | 771 | { |
|---|
| 787 | 772 | struct pc87427_data *data = pc87427_update_device(dev); |
|---|
| 788 | 773 | int nr = to_sensor_dev_attr(devattr)->index; |
|---|
| .. | .. |
|---|
| 791 | 776 | & TEMP_STATUS_SENSERR)); |
|---|
| 792 | 777 | } |
|---|
| 793 | 778 | |
|---|
| 794 | | -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); |
|---|
| 795 | | -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1); |
|---|
| 796 | | -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp_input, NULL, 2); |
|---|
| 797 | | -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp_input, NULL, 3); |
|---|
| 798 | | -static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp_input, NULL, 4); |
|---|
| 799 | | -static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp_input, NULL, 5); |
|---|
| 779 | +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0); |
|---|
| 780 | +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1); |
|---|
| 781 | +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp_input, 2); |
|---|
| 782 | +static SENSOR_DEVICE_ATTR_RO(temp4_input, temp_input, 3); |
|---|
| 783 | +static SENSOR_DEVICE_ATTR_RO(temp5_input, temp_input, 4); |
|---|
| 784 | +static SENSOR_DEVICE_ATTR_RO(temp6_input, temp_input, 5); |
|---|
| 800 | 785 | |
|---|
| 801 | | -static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO, show_temp_min, NULL, 0); |
|---|
| 802 | | -static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO, show_temp_min, NULL, 1); |
|---|
| 803 | | -static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO, show_temp_min, NULL, 2); |
|---|
| 804 | | -static SENSOR_DEVICE_ATTR(temp4_min, S_IRUGO, show_temp_min, NULL, 3); |
|---|
| 805 | | -static SENSOR_DEVICE_ATTR(temp5_min, S_IRUGO, show_temp_min, NULL, 4); |
|---|
| 806 | | -static SENSOR_DEVICE_ATTR(temp6_min, S_IRUGO, show_temp_min, NULL, 5); |
|---|
| 786 | +static SENSOR_DEVICE_ATTR_RO(temp1_min, temp_min, 0); |
|---|
| 787 | +static SENSOR_DEVICE_ATTR_RO(temp2_min, temp_min, 1); |
|---|
| 788 | +static SENSOR_DEVICE_ATTR_RO(temp3_min, temp_min, 2); |
|---|
| 789 | +static SENSOR_DEVICE_ATTR_RO(temp4_min, temp_min, 3); |
|---|
| 790 | +static SENSOR_DEVICE_ATTR_RO(temp5_min, temp_min, 4); |
|---|
| 791 | +static SENSOR_DEVICE_ATTR_RO(temp6_min, temp_min, 5); |
|---|
| 807 | 792 | |
|---|
| 808 | | -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); |
|---|
| 809 | | -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); |
|---|
| 810 | | -static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); |
|---|
| 811 | | -static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); |
|---|
| 812 | | -static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); |
|---|
| 813 | | -static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); |
|---|
| 793 | +static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0); |
|---|
| 794 | +static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1); |
|---|
| 795 | +static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2); |
|---|
| 796 | +static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3); |
|---|
| 797 | +static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4); |
|---|
| 798 | +static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5); |
|---|
| 814 | 799 | |
|---|
| 815 | | -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); |
|---|
| 816 | | -static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); |
|---|
| 817 | | -static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); |
|---|
| 818 | | -static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); |
|---|
| 819 | | -static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); |
|---|
| 820 | | -static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); |
|---|
| 800 | +static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0); |
|---|
| 801 | +static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1); |
|---|
| 802 | +static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2); |
|---|
| 803 | +static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3); |
|---|
| 804 | +static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4); |
|---|
| 805 | +static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5); |
|---|
| 821 | 806 | |
|---|
| 822 | | -static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0); |
|---|
| 823 | | -static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1); |
|---|
| 824 | | -static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2); |
|---|
| 825 | | -static SENSOR_DEVICE_ATTR(temp4_type, S_IRUGO, show_temp_type, NULL, 3); |
|---|
| 826 | | -static SENSOR_DEVICE_ATTR(temp5_type, S_IRUGO, show_temp_type, NULL, 4); |
|---|
| 827 | | -static SENSOR_DEVICE_ATTR(temp6_type, S_IRUGO, show_temp_type, NULL, 5); |
|---|
| 807 | +static SENSOR_DEVICE_ATTR_RO(temp1_type, temp_type, 0); |
|---|
| 808 | +static SENSOR_DEVICE_ATTR_RO(temp2_type, temp_type, 1); |
|---|
| 809 | +static SENSOR_DEVICE_ATTR_RO(temp3_type, temp_type, 2); |
|---|
| 810 | +static SENSOR_DEVICE_ATTR_RO(temp4_type, temp_type, 3); |
|---|
| 811 | +static SENSOR_DEVICE_ATTR_RO(temp5_type, temp_type, 4); |
|---|
| 812 | +static SENSOR_DEVICE_ATTR_RO(temp6_type, temp_type, 5); |
|---|
| 828 | 813 | |
|---|
| 829 | | -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, |
|---|
| 830 | | - show_temp_min_alarm, NULL, 0); |
|---|
| 831 | | -static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, |
|---|
| 832 | | - show_temp_min_alarm, NULL, 1); |
|---|
| 833 | | -static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, |
|---|
| 834 | | - show_temp_min_alarm, NULL, 2); |
|---|
| 835 | | -static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, |
|---|
| 836 | | - show_temp_min_alarm, NULL, 3); |
|---|
| 837 | | -static SENSOR_DEVICE_ATTR(temp5_min_alarm, S_IRUGO, |
|---|
| 838 | | - show_temp_min_alarm, NULL, 4); |
|---|
| 839 | | -static SENSOR_DEVICE_ATTR(temp6_min_alarm, S_IRUGO, |
|---|
| 840 | | - show_temp_min_alarm, NULL, 5); |
|---|
| 814 | +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_min_alarm, 0); |
|---|
| 815 | +static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_min_alarm, 1); |
|---|
| 816 | +static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, temp_min_alarm, 2); |
|---|
| 817 | +static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, temp_min_alarm, 3); |
|---|
| 818 | +static SENSOR_DEVICE_ATTR_RO(temp5_min_alarm, temp_min_alarm, 4); |
|---|
| 819 | +static SENSOR_DEVICE_ATTR_RO(temp6_min_alarm, temp_min_alarm, 5); |
|---|
| 841 | 820 | |
|---|
| 842 | | -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, |
|---|
| 843 | | - show_temp_max_alarm, NULL, 0); |
|---|
| 844 | | -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, |
|---|
| 845 | | - show_temp_max_alarm, NULL, 1); |
|---|
| 846 | | -static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, |
|---|
| 847 | | - show_temp_max_alarm, NULL, 2); |
|---|
| 848 | | -static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, |
|---|
| 849 | | - show_temp_max_alarm, NULL, 3); |
|---|
| 850 | | -static SENSOR_DEVICE_ATTR(temp5_max_alarm, S_IRUGO, |
|---|
| 851 | | - show_temp_max_alarm, NULL, 4); |
|---|
| 852 | | -static SENSOR_DEVICE_ATTR(temp6_max_alarm, S_IRUGO, |
|---|
| 853 | | - show_temp_max_alarm, NULL, 5); |
|---|
| 821 | +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_max_alarm, 0); |
|---|
| 822 | +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_max_alarm, 1); |
|---|
| 823 | +static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, temp_max_alarm, 2); |
|---|
| 824 | +static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, temp_max_alarm, 3); |
|---|
| 825 | +static SENSOR_DEVICE_ATTR_RO(temp5_max_alarm, temp_max_alarm, 4); |
|---|
| 826 | +static SENSOR_DEVICE_ATTR_RO(temp6_max_alarm, temp_max_alarm, 5); |
|---|
| 854 | 827 | |
|---|
| 855 | | -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, |
|---|
| 856 | | - show_temp_crit_alarm, NULL, 0); |
|---|
| 857 | | -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, |
|---|
| 858 | | - show_temp_crit_alarm, NULL, 1); |
|---|
| 859 | | -static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, |
|---|
| 860 | | - show_temp_crit_alarm, NULL, 2); |
|---|
| 861 | | -static SENSOR_DEVICE_ATTR(temp4_crit_alarm, S_IRUGO, |
|---|
| 862 | | - show_temp_crit_alarm, NULL, 3); |
|---|
| 863 | | -static SENSOR_DEVICE_ATTR(temp5_crit_alarm, S_IRUGO, |
|---|
| 864 | | - show_temp_crit_alarm, NULL, 4); |
|---|
| 865 | | -static SENSOR_DEVICE_ATTR(temp6_crit_alarm, S_IRUGO, |
|---|
| 866 | | - show_temp_crit_alarm, NULL, 5); |
|---|
| 828 | +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, temp_crit_alarm, 0); |
|---|
| 829 | +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, temp_crit_alarm, 1); |
|---|
| 830 | +static SENSOR_DEVICE_ATTR_RO(temp3_crit_alarm, temp_crit_alarm, 2); |
|---|
| 831 | +static SENSOR_DEVICE_ATTR_RO(temp4_crit_alarm, temp_crit_alarm, 3); |
|---|
| 832 | +static SENSOR_DEVICE_ATTR_RO(temp5_crit_alarm, temp_crit_alarm, 4); |
|---|
| 833 | +static SENSOR_DEVICE_ATTR_RO(temp6_crit_alarm, temp_crit_alarm, 5); |
|---|
| 867 | 834 | |
|---|
| 868 | | -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); |
|---|
| 869 | | -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); |
|---|
| 870 | | -static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); |
|---|
| 871 | | -static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); |
|---|
| 872 | | -static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4); |
|---|
| 873 | | -static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5); |
|---|
| 835 | +static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); |
|---|
| 836 | +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); |
|---|
| 837 | +static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2); |
|---|
| 838 | +static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3); |
|---|
| 839 | +static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4); |
|---|
| 840 | +static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5); |
|---|
| 874 | 841 | |
|---|
| 875 | 842 | static struct attribute *pc87427_attributes_temp[6][10] = { |
|---|
| 876 | 843 | { |
|---|