.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * adm1026.c - Part of lm_sensors, Linux kernel modules for hardware |
---|
3 | 4 | * monitoring |
---|
.. | .. |
---|
6 | 7 | * |
---|
7 | 8 | * Chip details at: |
---|
8 | 9 | * |
---|
9 | | - * <http://www.onsemi.com/PowerSolutions/product.do?id=ADM1026> |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or modify |
---|
12 | | - * it under the terms of the GNU General Public License as published by |
---|
13 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
14 | | - * (at your option) any later version. |
---|
15 | | - * |
---|
16 | | - * This program is distributed in the hope that it will be useful, |
---|
17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | | - * GNU General Public License for more details. |
---|
20 | | - * |
---|
21 | | - * You should have received a copy of the GNU General Public License |
---|
22 | | - * along with this program; if not, write to the Free Software |
---|
23 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 10 | + * <https://www.onsemi.com/PowerSolutions/product.do?id=ADM1026> |
---|
24 | 11 | */ |
---|
25 | 12 | |
---|
26 | 13 | #include <linux/module.h> |
---|
.. | .. |
---|
477 | 464 | return data; |
---|
478 | 465 | } |
---|
479 | 466 | |
---|
480 | | -static ssize_t show_in(struct device *dev, struct device_attribute *attr, |
---|
481 | | - char *buf) |
---|
| 467 | +static ssize_t in_show(struct device *dev, struct device_attribute *attr, |
---|
| 468 | + char *buf) |
---|
482 | 469 | { |
---|
483 | 470 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
484 | 471 | int nr = sensor_attr->index; |
---|
485 | 472 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
486 | 473 | return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in[nr])); |
---|
487 | 474 | } |
---|
488 | | -static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, |
---|
489 | | - char *buf) |
---|
| 475 | +static ssize_t in_min_show(struct device *dev, struct device_attribute *attr, |
---|
| 476 | + char *buf) |
---|
490 | 477 | { |
---|
491 | 478 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
492 | 479 | int nr = sensor_attr->index; |
---|
493 | 480 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
494 | 481 | return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in_min[nr])); |
---|
495 | 482 | } |
---|
496 | | -static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, |
---|
497 | | - const char *buf, size_t count) |
---|
| 483 | +static ssize_t in_min_store(struct device *dev, struct device_attribute *attr, |
---|
| 484 | + const char *buf, size_t count) |
---|
498 | 485 | { |
---|
499 | 486 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
500 | 487 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
513 | 500 | mutex_unlock(&data->update_lock); |
---|
514 | 501 | return count; |
---|
515 | 502 | } |
---|
516 | | -static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, |
---|
517 | | - char *buf) |
---|
| 503 | +static ssize_t in_max_show(struct device *dev, struct device_attribute *attr, |
---|
| 504 | + char *buf) |
---|
518 | 505 | { |
---|
519 | 506 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
520 | 507 | int nr = sensor_attr->index; |
---|
521 | 508 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
522 | 509 | return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in_max[nr])); |
---|
523 | 510 | } |
---|
524 | | -static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, |
---|
525 | | - const char *buf, size_t count) |
---|
| 511 | +static ssize_t in_max_store(struct device *dev, struct device_attribute *attr, |
---|
| 512 | + const char *buf, size_t count) |
---|
526 | 513 | { |
---|
527 | 514 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
528 | 515 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
542 | 529 | return count; |
---|
543 | 530 | } |
---|
544 | 531 | |
---|
545 | | -#define in_reg(offset) \ |
---|
546 | | -static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in, \ |
---|
547 | | - NULL, offset); \ |
---|
548 | | -static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ |
---|
549 | | - show_in_min, set_in_min, offset); \ |
---|
550 | | -static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ |
---|
551 | | - show_in_max, set_in_max, offset); |
---|
| 532 | +static SENSOR_DEVICE_ATTR_RO(in0_input, in, 0); |
---|
| 533 | +static SENSOR_DEVICE_ATTR_RW(in0_min, in_min, 0); |
---|
| 534 | +static SENSOR_DEVICE_ATTR_RW(in0_max, in_max, 0); |
---|
| 535 | +static SENSOR_DEVICE_ATTR_RO(in1_input, in, 1); |
---|
| 536 | +static SENSOR_DEVICE_ATTR_RW(in1_min, in_min, 1); |
---|
| 537 | +static SENSOR_DEVICE_ATTR_RW(in1_max, in_max, 1); |
---|
| 538 | +static SENSOR_DEVICE_ATTR_RO(in2_input, in, 2); |
---|
| 539 | +static SENSOR_DEVICE_ATTR_RW(in2_min, in_min, 2); |
---|
| 540 | +static SENSOR_DEVICE_ATTR_RW(in2_max, in_max, 2); |
---|
| 541 | +static SENSOR_DEVICE_ATTR_RO(in3_input, in, 3); |
---|
| 542 | +static SENSOR_DEVICE_ATTR_RW(in3_min, in_min, 3); |
---|
| 543 | +static SENSOR_DEVICE_ATTR_RW(in3_max, in_max, 3); |
---|
| 544 | +static SENSOR_DEVICE_ATTR_RO(in4_input, in, 4); |
---|
| 545 | +static SENSOR_DEVICE_ATTR_RW(in4_min, in_min, 4); |
---|
| 546 | +static SENSOR_DEVICE_ATTR_RW(in4_max, in_max, 4); |
---|
| 547 | +static SENSOR_DEVICE_ATTR_RO(in5_input, in, 5); |
---|
| 548 | +static SENSOR_DEVICE_ATTR_RW(in5_min, in_min, 5); |
---|
| 549 | +static SENSOR_DEVICE_ATTR_RW(in5_max, in_max, 5); |
---|
| 550 | +static SENSOR_DEVICE_ATTR_RO(in6_input, in, 6); |
---|
| 551 | +static SENSOR_DEVICE_ATTR_RW(in6_min, in_min, 6); |
---|
| 552 | +static SENSOR_DEVICE_ATTR_RW(in6_max, in_max, 6); |
---|
| 553 | +static SENSOR_DEVICE_ATTR_RO(in7_input, in, 7); |
---|
| 554 | +static SENSOR_DEVICE_ATTR_RW(in7_min, in_min, 7); |
---|
| 555 | +static SENSOR_DEVICE_ATTR_RW(in7_max, in_max, 7); |
---|
| 556 | +static SENSOR_DEVICE_ATTR_RO(in8_input, in, 8); |
---|
| 557 | +static SENSOR_DEVICE_ATTR_RW(in8_min, in_min, 8); |
---|
| 558 | +static SENSOR_DEVICE_ATTR_RW(in8_max, in_max, 8); |
---|
| 559 | +static SENSOR_DEVICE_ATTR_RO(in9_input, in, 9); |
---|
| 560 | +static SENSOR_DEVICE_ATTR_RW(in9_min, in_min, 9); |
---|
| 561 | +static SENSOR_DEVICE_ATTR_RW(in9_max, in_max, 9); |
---|
| 562 | +static SENSOR_DEVICE_ATTR_RO(in10_input, in, 10); |
---|
| 563 | +static SENSOR_DEVICE_ATTR_RW(in10_min, in_min, 10); |
---|
| 564 | +static SENSOR_DEVICE_ATTR_RW(in10_max, in_max, 10); |
---|
| 565 | +static SENSOR_DEVICE_ATTR_RO(in11_input, in, 11); |
---|
| 566 | +static SENSOR_DEVICE_ATTR_RW(in11_min, in_min, 11); |
---|
| 567 | +static SENSOR_DEVICE_ATTR_RW(in11_max, in_max, 11); |
---|
| 568 | +static SENSOR_DEVICE_ATTR_RO(in12_input, in, 12); |
---|
| 569 | +static SENSOR_DEVICE_ATTR_RW(in12_min, in_min, 12); |
---|
| 570 | +static SENSOR_DEVICE_ATTR_RW(in12_max, in_max, 12); |
---|
| 571 | +static SENSOR_DEVICE_ATTR_RO(in13_input, in, 13); |
---|
| 572 | +static SENSOR_DEVICE_ATTR_RW(in13_min, in_min, 13); |
---|
| 573 | +static SENSOR_DEVICE_ATTR_RW(in13_max, in_max, 13); |
---|
| 574 | +static SENSOR_DEVICE_ATTR_RO(in14_input, in, 14); |
---|
| 575 | +static SENSOR_DEVICE_ATTR_RW(in14_min, in_min, 14); |
---|
| 576 | +static SENSOR_DEVICE_ATTR_RW(in14_max, in_max, 14); |
---|
| 577 | +static SENSOR_DEVICE_ATTR_RO(in15_input, in, 15); |
---|
| 578 | +static SENSOR_DEVICE_ATTR_RW(in15_min, in_min, 15); |
---|
| 579 | +static SENSOR_DEVICE_ATTR_RW(in15_max, in_max, 15); |
---|
552 | 580 | |
---|
553 | | - |
---|
554 | | -in_reg(0); |
---|
555 | | -in_reg(1); |
---|
556 | | -in_reg(2); |
---|
557 | | -in_reg(3); |
---|
558 | | -in_reg(4); |
---|
559 | | -in_reg(5); |
---|
560 | | -in_reg(6); |
---|
561 | | -in_reg(7); |
---|
562 | | -in_reg(8); |
---|
563 | | -in_reg(9); |
---|
564 | | -in_reg(10); |
---|
565 | | -in_reg(11); |
---|
566 | | -in_reg(12); |
---|
567 | | -in_reg(13); |
---|
568 | | -in_reg(14); |
---|
569 | | -in_reg(15); |
---|
570 | | - |
---|
571 | | -static ssize_t show_in16(struct device *dev, struct device_attribute *attr, |
---|
| 581 | +static ssize_t in16_show(struct device *dev, struct device_attribute *attr, |
---|
572 | 582 | char *buf) |
---|
573 | 583 | { |
---|
574 | 584 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
575 | 585 | return sprintf(buf, "%d\n", INS_FROM_REG(16, data->in[16]) - |
---|
576 | 586 | NEG12_OFFSET); |
---|
577 | 587 | } |
---|
578 | | -static ssize_t show_in16_min(struct device *dev, struct device_attribute *attr, |
---|
579 | | - char *buf) |
---|
| 588 | +static ssize_t in16_min_show(struct device *dev, |
---|
| 589 | + struct device_attribute *attr, char *buf) |
---|
580 | 590 | { |
---|
581 | 591 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
582 | 592 | return sprintf(buf, "%d\n", INS_FROM_REG(16, data->in_min[16]) |
---|
583 | 593 | - NEG12_OFFSET); |
---|
584 | 594 | } |
---|
585 | | -static ssize_t set_in16_min(struct device *dev, struct device_attribute *attr, |
---|
586 | | - const char *buf, size_t count) |
---|
| 595 | +static ssize_t in16_min_store(struct device *dev, |
---|
| 596 | + struct device_attribute *attr, const char *buf, |
---|
| 597 | + size_t count) |
---|
587 | 598 | { |
---|
588 | 599 | struct adm1026_data *data = dev_get_drvdata(dev); |
---|
589 | 600 | struct i2c_client *client = data->client; |
---|
.. | .. |
---|
603 | 614 | mutex_unlock(&data->update_lock); |
---|
604 | 615 | return count; |
---|
605 | 616 | } |
---|
606 | | -static ssize_t show_in16_max(struct device *dev, struct device_attribute *attr, |
---|
607 | | - char *buf) |
---|
| 617 | +static ssize_t in16_max_show(struct device *dev, |
---|
| 618 | + struct device_attribute *attr, char *buf) |
---|
608 | 619 | { |
---|
609 | 620 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
610 | 621 | return sprintf(buf, "%d\n", INS_FROM_REG(16, data->in_max[16]) |
---|
611 | 622 | - NEG12_OFFSET); |
---|
612 | 623 | } |
---|
613 | | -static ssize_t set_in16_max(struct device *dev, struct device_attribute *attr, |
---|
614 | | - const char *buf, size_t count) |
---|
| 624 | +static ssize_t in16_max_store(struct device *dev, |
---|
| 625 | + struct device_attribute *attr, const char *buf, |
---|
| 626 | + size_t count) |
---|
615 | 627 | { |
---|
616 | 628 | struct adm1026_data *data = dev_get_drvdata(dev); |
---|
617 | 629 | struct i2c_client *client = data->client; |
---|
.. | .. |
---|
632 | 644 | return count; |
---|
633 | 645 | } |
---|
634 | 646 | |
---|
635 | | -static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL, 16); |
---|
636 | | -static SENSOR_DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, |
---|
637 | | - set_in16_min, 16); |
---|
638 | | -static SENSOR_DEVICE_ATTR(in16_max, S_IRUGO | S_IWUSR, show_in16_max, |
---|
639 | | - set_in16_max, 16); |
---|
640 | | - |
---|
| 647 | +static SENSOR_DEVICE_ATTR_RO(in16_input, in16, 16); |
---|
| 648 | +static SENSOR_DEVICE_ATTR_RW(in16_min, in16_min, 16); |
---|
| 649 | +static SENSOR_DEVICE_ATTR_RW(in16_max, in16_max, 16); |
---|
641 | 650 | |
---|
642 | 651 | /* Now add fan read/write functions */ |
---|
643 | 652 | |
---|
644 | | -static ssize_t show_fan(struct device *dev, struct device_attribute *attr, |
---|
645 | | - char *buf) |
---|
| 653 | +static ssize_t fan_show(struct device *dev, struct device_attribute *attr, |
---|
| 654 | + char *buf) |
---|
646 | 655 | { |
---|
647 | 656 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
648 | 657 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
650 | 659 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr], |
---|
651 | 660 | data->fan_div[nr])); |
---|
652 | 661 | } |
---|
653 | | -static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, |
---|
654 | | - char *buf) |
---|
| 662 | +static ssize_t fan_min_show(struct device *dev, struct device_attribute *attr, |
---|
| 663 | + char *buf) |
---|
655 | 664 | { |
---|
656 | 665 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
657 | 666 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
659 | 668 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr], |
---|
660 | 669 | data->fan_div[nr])); |
---|
661 | 670 | } |
---|
662 | | -static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, |
---|
663 | | - const char *buf, size_t count) |
---|
| 671 | +static ssize_t fan_min_store(struct device *dev, |
---|
| 672 | + struct device_attribute *attr, const char *buf, |
---|
| 673 | + size_t count) |
---|
664 | 674 | { |
---|
665 | 675 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
666 | 676 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
681 | 691 | return count; |
---|
682 | 692 | } |
---|
683 | 693 | |
---|
684 | | -#define fan_offset(offset) \ |
---|
685 | | -static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan, NULL, \ |
---|
686 | | - offset - 1); \ |
---|
687 | | -static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ |
---|
688 | | - show_fan_min, set_fan_min, offset - 1); |
---|
689 | | - |
---|
690 | | -fan_offset(1); |
---|
691 | | -fan_offset(2); |
---|
692 | | -fan_offset(3); |
---|
693 | | -fan_offset(4); |
---|
694 | | -fan_offset(5); |
---|
695 | | -fan_offset(6); |
---|
696 | | -fan_offset(7); |
---|
697 | | -fan_offset(8); |
---|
| 694 | +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0); |
---|
| 695 | +static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0); |
---|
| 696 | +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1); |
---|
| 697 | +static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1); |
---|
| 698 | +static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2); |
---|
| 699 | +static SENSOR_DEVICE_ATTR_RW(fan3_min, fan_min, 2); |
---|
| 700 | +static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3); |
---|
| 701 | +static SENSOR_DEVICE_ATTR_RW(fan4_min, fan_min, 3); |
---|
| 702 | +static SENSOR_DEVICE_ATTR_RO(fan5_input, fan, 4); |
---|
| 703 | +static SENSOR_DEVICE_ATTR_RW(fan5_min, fan_min, 4); |
---|
| 704 | +static SENSOR_DEVICE_ATTR_RO(fan6_input, fan, 5); |
---|
| 705 | +static SENSOR_DEVICE_ATTR_RW(fan6_min, fan_min, 5); |
---|
| 706 | +static SENSOR_DEVICE_ATTR_RO(fan7_input, fan, 6); |
---|
| 707 | +static SENSOR_DEVICE_ATTR_RW(fan7_min, fan_min, 6); |
---|
| 708 | +static SENSOR_DEVICE_ATTR_RO(fan8_input, fan, 7); |
---|
| 709 | +static SENSOR_DEVICE_ATTR_RW(fan8_min, fan_min, 7); |
---|
698 | 710 | |
---|
699 | 711 | /* Adjust fan_min to account for new fan divisor */ |
---|
700 | 712 | static void fixup_fan_min(struct device *dev, int fan, int old_div) |
---|
.. | .. |
---|
715 | 727 | } |
---|
716 | 728 | |
---|
717 | 729 | /* Now add fan_div read/write functions */ |
---|
718 | | -static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, |
---|
719 | | - char *buf) |
---|
| 730 | +static ssize_t fan_div_show(struct device *dev, struct device_attribute *attr, |
---|
| 731 | + char *buf) |
---|
720 | 732 | { |
---|
721 | 733 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
722 | 734 | int nr = sensor_attr->index; |
---|
723 | 735 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
724 | 736 | return sprintf(buf, "%d\n", data->fan_div[nr]); |
---|
725 | 737 | } |
---|
726 | | -static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, |
---|
727 | | - const char *buf, size_t count) |
---|
| 738 | +static ssize_t fan_div_store(struct device *dev, |
---|
| 739 | + struct device_attribute *attr, const char *buf, |
---|
| 740 | + size_t count) |
---|
728 | 741 | { |
---|
729 | 742 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
730 | 743 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
765 | 778 | return count; |
---|
766 | 779 | } |
---|
767 | 780 | |
---|
768 | | -#define fan_offset_div(offset) \ |
---|
769 | | -static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ |
---|
770 | | - show_fan_div, set_fan_div, offset - 1); |
---|
771 | | - |
---|
772 | | -fan_offset_div(1); |
---|
773 | | -fan_offset_div(2); |
---|
774 | | -fan_offset_div(3); |
---|
775 | | -fan_offset_div(4); |
---|
776 | | -fan_offset_div(5); |
---|
777 | | -fan_offset_div(6); |
---|
778 | | -fan_offset_div(7); |
---|
779 | | -fan_offset_div(8); |
---|
| 781 | +static SENSOR_DEVICE_ATTR_RW(fan1_div, fan_div, 0); |
---|
| 782 | +static SENSOR_DEVICE_ATTR_RW(fan2_div, fan_div, 1); |
---|
| 783 | +static SENSOR_DEVICE_ATTR_RW(fan3_div, fan_div, 2); |
---|
| 784 | +static SENSOR_DEVICE_ATTR_RW(fan4_div, fan_div, 3); |
---|
| 785 | +static SENSOR_DEVICE_ATTR_RW(fan5_div, fan_div, 4); |
---|
| 786 | +static SENSOR_DEVICE_ATTR_RW(fan6_div, fan_div, 5); |
---|
| 787 | +static SENSOR_DEVICE_ATTR_RW(fan7_div, fan_div, 6); |
---|
| 788 | +static SENSOR_DEVICE_ATTR_RW(fan8_div, fan_div, 7); |
---|
780 | 789 | |
---|
781 | 790 | /* Temps */ |
---|
782 | | -static ssize_t show_temp(struct device *dev, struct device_attribute *attr, |
---|
783 | | - char *buf) |
---|
| 791 | +static ssize_t temp_show(struct device *dev, struct device_attribute *attr, |
---|
| 792 | + char *buf) |
---|
784 | 793 | { |
---|
785 | 794 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
786 | 795 | int nr = sensor_attr->index; |
---|
787 | 796 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
788 | 797 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr])); |
---|
789 | 798 | } |
---|
790 | | -static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, |
---|
791 | | - char *buf) |
---|
| 799 | +static ssize_t temp_min_show(struct device *dev, |
---|
| 800 | + struct device_attribute *attr, char *buf) |
---|
792 | 801 | { |
---|
793 | 802 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
794 | 803 | int nr = sensor_attr->index; |
---|
795 | 804 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
796 | 805 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[nr])); |
---|
797 | 806 | } |
---|
798 | | -static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, |
---|
799 | | - const char *buf, size_t count) |
---|
| 807 | +static ssize_t temp_min_store(struct device *dev, |
---|
| 808 | + struct device_attribute *attr, const char *buf, |
---|
| 809 | + size_t count) |
---|
800 | 810 | { |
---|
801 | 811 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
802 | 812 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
816 | 826 | mutex_unlock(&data->update_lock); |
---|
817 | 827 | return count; |
---|
818 | 828 | } |
---|
819 | | -static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, |
---|
820 | | - char *buf) |
---|
| 829 | +static ssize_t temp_max_show(struct device *dev, |
---|
| 830 | + struct device_attribute *attr, char *buf) |
---|
821 | 831 | { |
---|
822 | 832 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
823 | 833 | int nr = sensor_attr->index; |
---|
824 | 834 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
825 | 835 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[nr])); |
---|
826 | 836 | } |
---|
827 | | -static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, |
---|
828 | | - const char *buf, size_t count) |
---|
| 837 | +static ssize_t temp_max_store(struct device *dev, |
---|
| 838 | + struct device_attribute *attr, const char *buf, |
---|
| 839 | + size_t count) |
---|
829 | 840 | { |
---|
830 | 841 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
831 | 842 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
846 | 857 | return count; |
---|
847 | 858 | } |
---|
848 | 859 | |
---|
849 | | -#define temp_reg(offset) \ |
---|
850 | | -static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \ |
---|
851 | | - NULL, offset - 1); \ |
---|
852 | | -static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ |
---|
853 | | - show_temp_min, set_temp_min, offset - 1); \ |
---|
854 | | -static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ |
---|
855 | | - show_temp_max, set_temp_max, offset - 1); |
---|
| 860 | +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0); |
---|
| 861 | +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp_min, 0); |
---|
| 862 | +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0); |
---|
| 863 | +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1); |
---|
| 864 | +static SENSOR_DEVICE_ATTR_RW(temp2_min, temp_min, 1); |
---|
| 865 | +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1); |
---|
| 866 | +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2); |
---|
| 867 | +static SENSOR_DEVICE_ATTR_RW(temp3_min, temp_min, 2); |
---|
| 868 | +static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_max, 2); |
---|
856 | 869 | |
---|
857 | | - |
---|
858 | | -temp_reg(1); |
---|
859 | | -temp_reg(2); |
---|
860 | | -temp_reg(3); |
---|
861 | | - |
---|
862 | | -static ssize_t show_temp_offset(struct device *dev, |
---|
863 | | - struct device_attribute *attr, char *buf) |
---|
| 870 | +static ssize_t temp_offset_show(struct device *dev, |
---|
| 871 | + struct device_attribute *attr, char *buf) |
---|
864 | 872 | { |
---|
865 | 873 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
866 | 874 | int nr = sensor_attr->index; |
---|
867 | 875 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
868 | 876 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_offset[nr])); |
---|
869 | 877 | } |
---|
870 | | -static ssize_t set_temp_offset(struct device *dev, |
---|
871 | | - struct device_attribute *attr, const char *buf, |
---|
872 | | - size_t count) |
---|
| 878 | +static ssize_t temp_offset_store(struct device *dev, |
---|
| 879 | + struct device_attribute *attr, |
---|
| 880 | + const char *buf, size_t count) |
---|
873 | 881 | { |
---|
874 | 882 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
875 | 883 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
890 | 898 | return count; |
---|
891 | 899 | } |
---|
892 | 900 | |
---|
893 | | -#define temp_offset_reg(offset) \ |
---|
894 | | -static SENSOR_DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \ |
---|
895 | | - show_temp_offset, set_temp_offset, offset - 1); |
---|
| 901 | +static SENSOR_DEVICE_ATTR_RW(temp1_offset, temp_offset, 0); |
---|
| 902 | +static SENSOR_DEVICE_ATTR_RW(temp2_offset, temp_offset, 1); |
---|
| 903 | +static SENSOR_DEVICE_ATTR_RW(temp3_offset, temp_offset, 2); |
---|
896 | 904 | |
---|
897 | | -temp_offset_reg(1); |
---|
898 | | -temp_offset_reg(2); |
---|
899 | | -temp_offset_reg(3); |
---|
900 | | - |
---|
901 | | -static ssize_t show_temp_auto_point1_temp_hyst(struct device *dev, |
---|
902 | | - struct device_attribute *attr, char *buf) |
---|
| 905 | +static ssize_t temp_auto_point1_temp_hyst_show(struct device *dev, |
---|
| 906 | + struct device_attribute *attr, |
---|
| 907 | + char *buf) |
---|
903 | 908 | { |
---|
904 | 909 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
905 | 910 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
907 | 912 | return sprintf(buf, "%d\n", TEMP_FROM_REG( |
---|
908 | 913 | ADM1026_FAN_ACTIVATION_TEMP_HYST + data->temp_tmin[nr])); |
---|
909 | 914 | } |
---|
910 | | -static ssize_t show_temp_auto_point2_temp(struct device *dev, |
---|
911 | | - struct device_attribute *attr, char *buf) |
---|
| 915 | +static ssize_t temp_auto_point2_temp_show(struct device *dev, |
---|
| 916 | + struct device_attribute *attr, |
---|
| 917 | + char *buf) |
---|
912 | 918 | { |
---|
913 | 919 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
914 | 920 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
916 | 922 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_tmin[nr] + |
---|
917 | 923 | ADM1026_FAN_CONTROL_TEMP_RANGE)); |
---|
918 | 924 | } |
---|
919 | | -static ssize_t show_temp_auto_point1_temp(struct device *dev, |
---|
920 | | - struct device_attribute *attr, char *buf) |
---|
| 925 | +static ssize_t temp_auto_point1_temp_show(struct device *dev, |
---|
| 926 | + struct device_attribute *attr, |
---|
| 927 | + char *buf) |
---|
921 | 928 | { |
---|
922 | 929 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
923 | 930 | int nr = sensor_attr->index; |
---|
924 | 931 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
925 | 932 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_tmin[nr])); |
---|
926 | 933 | } |
---|
927 | | -static ssize_t set_temp_auto_point1_temp(struct device *dev, |
---|
928 | | - struct device_attribute *attr, const char *buf, size_t count) |
---|
| 934 | +static ssize_t temp_auto_point1_temp_store(struct device *dev, |
---|
| 935 | + struct device_attribute *attr, |
---|
| 936 | + const char *buf, size_t count) |
---|
929 | 937 | { |
---|
930 | 938 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
931 | 939 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
946 | 954 | return count; |
---|
947 | 955 | } |
---|
948 | 956 | |
---|
949 | | -#define temp_auto_point(offset) \ |
---|
950 | | -static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp, \ |
---|
951 | | - S_IRUGO | S_IWUSR, show_temp_auto_point1_temp, \ |
---|
952 | | - set_temp_auto_point1_temp, offset - 1); \ |
---|
953 | | -static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO,\ |
---|
954 | | - show_temp_auto_point1_temp_hyst, NULL, offset - 1); \ |
---|
955 | | -static SENSOR_DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \ |
---|
956 | | - show_temp_auto_point2_temp, NULL, offset - 1); |
---|
957 | | - |
---|
958 | | -temp_auto_point(1); |
---|
959 | | -temp_auto_point(2); |
---|
960 | | -temp_auto_point(3); |
---|
| 957 | +static SENSOR_DEVICE_ATTR_RW(temp1_auto_point1_temp, temp_auto_point1_temp, 0); |
---|
| 958 | +static SENSOR_DEVICE_ATTR_RO(temp1_auto_point1_temp_hyst, |
---|
| 959 | + temp_auto_point1_temp_hyst, 0); |
---|
| 960 | +static SENSOR_DEVICE_ATTR_RO(temp1_auto_point2_temp, temp_auto_point2_temp, 0); |
---|
| 961 | +static SENSOR_DEVICE_ATTR_RW(temp2_auto_point1_temp, temp_auto_point1_temp, 1); |
---|
| 962 | +static SENSOR_DEVICE_ATTR_RO(temp2_auto_point1_temp_hyst, |
---|
| 963 | + temp_auto_point1_temp_hyst, 1); |
---|
| 964 | +static SENSOR_DEVICE_ATTR_RO(temp2_auto_point2_temp, temp_auto_point2_temp, 1); |
---|
| 965 | +static SENSOR_DEVICE_ATTR_RW(temp3_auto_point1_temp, temp_auto_point1_temp, 2); |
---|
| 966 | +static SENSOR_DEVICE_ATTR_RO(temp3_auto_point1_temp_hyst, |
---|
| 967 | + temp_auto_point1_temp_hyst, 2); |
---|
| 968 | +static SENSOR_DEVICE_ATTR_RO(temp3_auto_point2_temp, temp_auto_point2_temp, 2); |
---|
961 | 969 | |
---|
962 | 970 | static ssize_t show_temp_crit_enable(struct device *dev, |
---|
963 | 971 | struct device_attribute *attr, char *buf) |
---|
.. | .. |
---|
988 | 996 | return count; |
---|
989 | 997 | } |
---|
990 | 998 | |
---|
991 | | -#define temp_crit_enable(offset) \ |
---|
992 | | -static DEVICE_ATTR(temp##offset##_crit_enable, S_IRUGO | S_IWUSR, \ |
---|
993 | | - show_temp_crit_enable, set_temp_crit_enable); |
---|
| 999 | +static DEVICE_ATTR(temp1_crit_enable, 0644, show_temp_crit_enable, |
---|
| 1000 | + set_temp_crit_enable); |
---|
| 1001 | +static DEVICE_ATTR(temp2_crit_enable, 0644, show_temp_crit_enable, |
---|
| 1002 | + set_temp_crit_enable); |
---|
| 1003 | +static DEVICE_ATTR(temp3_crit_enable, 0644, show_temp_crit_enable, |
---|
| 1004 | + set_temp_crit_enable); |
---|
994 | 1005 | |
---|
995 | | -temp_crit_enable(1); |
---|
996 | | -temp_crit_enable(2); |
---|
997 | | -temp_crit_enable(3); |
---|
998 | | - |
---|
999 | | -static ssize_t show_temp_crit(struct device *dev, |
---|
1000 | | - struct device_attribute *attr, char *buf) |
---|
| 1006 | +static ssize_t temp_crit_show(struct device *dev, |
---|
| 1007 | + struct device_attribute *attr, char *buf) |
---|
1001 | 1008 | { |
---|
1002 | 1009 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
1003 | 1010 | int nr = sensor_attr->index; |
---|
1004 | 1011 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
1005 | 1012 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[nr])); |
---|
1006 | 1013 | } |
---|
1007 | | -static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, |
---|
1008 | | - const char *buf, size_t count) |
---|
| 1014 | +static ssize_t temp_crit_store(struct device *dev, |
---|
| 1015 | + struct device_attribute *attr, const char *buf, |
---|
| 1016 | + size_t count) |
---|
1009 | 1017 | { |
---|
1010 | 1018 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
---|
1011 | 1019 | int nr = sensor_attr->index; |
---|
.. | .. |
---|
1026 | 1034 | return count; |
---|
1027 | 1035 | } |
---|
1028 | 1036 | |
---|
1029 | | -#define temp_crit_reg(offset) \ |
---|
1030 | | -static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \ |
---|
1031 | | - show_temp_crit, set_temp_crit, offset - 1); |
---|
1032 | | - |
---|
1033 | | -temp_crit_reg(1); |
---|
1034 | | -temp_crit_reg(2); |
---|
1035 | | -temp_crit_reg(3); |
---|
| 1037 | +static SENSOR_DEVICE_ATTR_RW(temp1_crit, temp_crit, 0); |
---|
| 1038 | +static SENSOR_DEVICE_ATTR_RW(temp2_crit, temp_crit, 1); |
---|
| 1039 | +static SENSOR_DEVICE_ATTR_RW(temp3_crit, temp_crit, 2); |
---|
1036 | 1040 | |
---|
1037 | 1041 | static ssize_t analog_out_show(struct device *dev, |
---|
1038 | 1042 | struct device_attribute *attr, char *buf) |
---|
.. | .. |
---|
1110 | 1114 | |
---|
1111 | 1115 | static DEVICE_ATTR_RO(alarms); |
---|
1112 | 1116 | |
---|
1113 | | -static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, |
---|
| 1117 | +static ssize_t alarm_show(struct device *dev, struct device_attribute *attr, |
---|
1114 | 1118 | char *buf) |
---|
1115 | 1119 | { |
---|
1116 | 1120 | struct adm1026_data *data = adm1026_update_device(dev); |
---|
.. | .. |
---|
1118 | 1122 | return sprintf(buf, "%ld\n", (data->alarms >> bitnr) & 1); |
---|
1119 | 1123 | } |
---|
1120 | 1124 | |
---|
1121 | | -static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 0); |
---|
1122 | | -static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 1); |
---|
1123 | | -static SENSOR_DEVICE_ATTR(in9_alarm, S_IRUGO, show_alarm, NULL, 1); |
---|
1124 | | -static SENSOR_DEVICE_ATTR(in11_alarm, S_IRUGO, show_alarm, NULL, 2); |
---|
1125 | | -static SENSOR_DEVICE_ATTR(in12_alarm, S_IRUGO, show_alarm, NULL, 3); |
---|
1126 | | -static SENSOR_DEVICE_ATTR(in13_alarm, S_IRUGO, show_alarm, NULL, 4); |
---|
1127 | | -static SENSOR_DEVICE_ATTR(in14_alarm, S_IRUGO, show_alarm, NULL, 5); |
---|
1128 | | -static SENSOR_DEVICE_ATTR(in15_alarm, S_IRUGO, show_alarm, NULL, 6); |
---|
1129 | | -static SENSOR_DEVICE_ATTR(in16_alarm, S_IRUGO, show_alarm, NULL, 7); |
---|
1130 | | -static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8); |
---|
1131 | | -static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9); |
---|
1132 | | -static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10); |
---|
1133 | | -static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 11); |
---|
1134 | | -static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 12); |
---|
1135 | | -static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 13); |
---|
1136 | | -static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 14); |
---|
1137 | | -static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 15); |
---|
1138 | | -static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 16); |
---|
1139 | | -static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 17); |
---|
1140 | | -static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 18); |
---|
1141 | | -static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 19); |
---|
1142 | | -static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 20); |
---|
1143 | | -static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_alarm, NULL, 21); |
---|
1144 | | -static SENSOR_DEVICE_ATTR(fan7_alarm, S_IRUGO, show_alarm, NULL, 22); |
---|
1145 | | -static SENSOR_DEVICE_ATTR(fan8_alarm, S_IRUGO, show_alarm, NULL, 23); |
---|
1146 | | -static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 24); |
---|
1147 | | -static SENSOR_DEVICE_ATTR(in10_alarm, S_IRUGO, show_alarm, NULL, 25); |
---|
1148 | | -static SENSOR_DEVICE_ATTR(in8_alarm, S_IRUGO, show_alarm, NULL, 26); |
---|
| 1125 | +static SENSOR_DEVICE_ATTR_RO(temp2_alarm, alarm, 0); |
---|
| 1126 | +static SENSOR_DEVICE_ATTR_RO(temp3_alarm, alarm, 1); |
---|
| 1127 | +static SENSOR_DEVICE_ATTR_RO(in9_alarm, alarm, 1); |
---|
| 1128 | +static SENSOR_DEVICE_ATTR_RO(in11_alarm, alarm, 2); |
---|
| 1129 | +static SENSOR_DEVICE_ATTR_RO(in12_alarm, alarm, 3); |
---|
| 1130 | +static SENSOR_DEVICE_ATTR_RO(in13_alarm, alarm, 4); |
---|
| 1131 | +static SENSOR_DEVICE_ATTR_RO(in14_alarm, alarm, 5); |
---|
| 1132 | +static SENSOR_DEVICE_ATTR_RO(in15_alarm, alarm, 6); |
---|
| 1133 | +static SENSOR_DEVICE_ATTR_RO(in16_alarm, alarm, 7); |
---|
| 1134 | +static SENSOR_DEVICE_ATTR_RO(in0_alarm, alarm, 8); |
---|
| 1135 | +static SENSOR_DEVICE_ATTR_RO(in1_alarm, alarm, 9); |
---|
| 1136 | +static SENSOR_DEVICE_ATTR_RO(in2_alarm, alarm, 10); |
---|
| 1137 | +static SENSOR_DEVICE_ATTR_RO(in3_alarm, alarm, 11); |
---|
| 1138 | +static SENSOR_DEVICE_ATTR_RO(in4_alarm, alarm, 12); |
---|
| 1139 | +static SENSOR_DEVICE_ATTR_RO(in5_alarm, alarm, 13); |
---|
| 1140 | +static SENSOR_DEVICE_ATTR_RO(in6_alarm, alarm, 14); |
---|
| 1141 | +static SENSOR_DEVICE_ATTR_RO(in7_alarm, alarm, 15); |
---|
| 1142 | +static SENSOR_DEVICE_ATTR_RO(fan1_alarm, alarm, 16); |
---|
| 1143 | +static SENSOR_DEVICE_ATTR_RO(fan2_alarm, alarm, 17); |
---|
| 1144 | +static SENSOR_DEVICE_ATTR_RO(fan3_alarm, alarm, 18); |
---|
| 1145 | +static SENSOR_DEVICE_ATTR_RO(fan4_alarm, alarm, 19); |
---|
| 1146 | +static SENSOR_DEVICE_ATTR_RO(fan5_alarm, alarm, 20); |
---|
| 1147 | +static SENSOR_DEVICE_ATTR_RO(fan6_alarm, alarm, 21); |
---|
| 1148 | +static SENSOR_DEVICE_ATTR_RO(fan7_alarm, alarm, 22); |
---|
| 1149 | +static SENSOR_DEVICE_ATTR_RO(fan8_alarm, alarm, 23); |
---|
| 1150 | +static SENSOR_DEVICE_ATTR_RO(temp1_alarm, alarm, 24); |
---|
| 1151 | +static SENSOR_DEVICE_ATTR_RO(in10_alarm, alarm, 25); |
---|
| 1152 | +static SENSOR_DEVICE_ATTR_RO(in8_alarm, alarm, 26); |
---|
1149 | 1153 | |
---|
1150 | 1154 | static ssize_t alarm_mask_show(struct device *dev, |
---|
1151 | 1155 | struct device_attribute *attr, char *buf) |
---|
.. | .. |
---|
1187 | 1191 | } |
---|
1188 | 1192 | |
---|
1189 | 1193 | static DEVICE_ATTR_RW(alarm_mask); |
---|
1190 | | - |
---|
1191 | 1194 | |
---|
1192 | 1195 | static ssize_t gpio_show(struct device *dev, struct device_attribute *attr, |
---|
1193 | 1196 | char *buf) |
---|
.. | .. |
---|
1371 | 1374 | |
---|
1372 | 1375 | /* enable PWM fan control */ |
---|
1373 | 1376 | static DEVICE_ATTR_RW(pwm1); |
---|
1374 | | -static DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, pwm1_show, pwm1_store); |
---|
1375 | | -static DEVICE_ATTR(pwm3, S_IRUGO | S_IWUSR, pwm1_show, pwm1_store); |
---|
| 1377 | +static DEVICE_ATTR(pwm2, 0644, pwm1_show, pwm1_store); |
---|
| 1378 | +static DEVICE_ATTR(pwm3, 0644, pwm1_show, pwm1_store); |
---|
1376 | 1379 | static DEVICE_ATTR_RW(pwm1_enable); |
---|
1377 | | -static DEVICE_ATTR(pwm2_enable, S_IRUGO | S_IWUSR, pwm1_enable_show, |
---|
| 1380 | +static DEVICE_ATTR(pwm2_enable, 0644, pwm1_enable_show, |
---|
1378 | 1381 | pwm1_enable_store); |
---|
1379 | | -static DEVICE_ATTR(pwm3_enable, S_IRUGO | S_IWUSR, pwm1_enable_show, |
---|
| 1382 | +static DEVICE_ATTR(pwm3_enable, 0644, pwm1_enable_show, |
---|
1380 | 1383 | pwm1_enable_store); |
---|
1381 | 1384 | static DEVICE_ATTR_RW(temp1_auto_point1_pwm); |
---|
1382 | | -static DEVICE_ATTR(temp2_auto_point1_pwm, S_IRUGO | S_IWUSR, |
---|
1383 | | - temp1_auto_point1_pwm_show, temp1_auto_point1_pwm_store); |
---|
1384 | | -static DEVICE_ATTR(temp3_auto_point1_pwm, S_IRUGO | S_IWUSR, |
---|
1385 | | - temp1_auto_point1_pwm_show, temp1_auto_point1_pwm_store); |
---|
| 1385 | +static DEVICE_ATTR(temp2_auto_point1_pwm, 0644, |
---|
| 1386 | + temp1_auto_point1_pwm_show, temp1_auto_point1_pwm_store); |
---|
| 1387 | +static DEVICE_ATTR(temp3_auto_point1_pwm, 0644, |
---|
| 1388 | + temp1_auto_point1_pwm_show, temp1_auto_point1_pwm_store); |
---|
1386 | 1389 | |
---|
1387 | 1390 | static DEVICE_ATTR_RO(temp1_auto_point2_pwm); |
---|
1388 | | -static DEVICE_ATTR(temp2_auto_point2_pwm, S_IRUGO, temp1_auto_point2_pwm_show, |
---|
| 1391 | +static DEVICE_ATTR(temp2_auto_point2_pwm, 0444, temp1_auto_point2_pwm_show, |
---|
1389 | 1392 | NULL); |
---|
1390 | | -static DEVICE_ATTR(temp3_auto_point2_pwm, S_IRUGO, temp1_auto_point2_pwm_show, |
---|
| 1393 | +static DEVICE_ATTR(temp3_auto_point2_pwm, 0444, temp1_auto_point2_pwm_show, |
---|
1391 | 1394 | NULL); |
---|
1392 | 1395 | |
---|
1393 | 1396 | static struct attribute *adm1026_attributes[] = { |
---|
.. | .. |
---|
1813 | 1816 | } |
---|
1814 | 1817 | } |
---|
1815 | 1818 | |
---|
1816 | | -static int adm1026_probe(struct i2c_client *client, |
---|
1817 | | - const struct i2c_device_id *id) |
---|
| 1819 | +static int adm1026_probe(struct i2c_client *client) |
---|
1818 | 1820 | { |
---|
1819 | 1821 | struct device *dev = &client->dev; |
---|
1820 | 1822 | struct device *hwmon_dev; |
---|
.. | .. |
---|
1857 | 1859 | .driver = { |
---|
1858 | 1860 | .name = "adm1026", |
---|
1859 | 1861 | }, |
---|
1860 | | - .probe = adm1026_probe, |
---|
| 1862 | + .probe_new = adm1026_probe, |
---|
1861 | 1863 | .id_table = adm1026_id, |
---|
1862 | 1864 | .detect = adm1026_detect, |
---|
1863 | 1865 | .address_list = normal_i2c, |
---|