Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (nct6775) Convert S_I* permissions macros to octal

Checkpatch has been warning about these for a while; the octal
versions are both more comprehensible and more concise.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Link: https://lore.kernel.org/r/20220427010154.29749-6-zev@bewilderbeest.net
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Zev Weiss and committed by
Guenter Roeck
ae0d7227 bd2e82bd

+64 -95
+64 -95
drivers/hwmon/nct6775.c
··· 2380 2380 return nct6775_attr_mode(data, attr); 2381 2381 } 2382 2382 2383 - SENSOR_TEMPLATE_2(in_input, "in%d_input", S_IRUGO, show_in_reg, NULL, 0, 0); 2384 - SENSOR_TEMPLATE(in_alarm, "in%d_alarm", S_IRUGO, show_alarm, NULL, 0); 2385 - SENSOR_TEMPLATE(in_beep, "in%d_beep", S_IWUSR | S_IRUGO, show_beep, store_beep, 2386 - 0); 2387 - SENSOR_TEMPLATE_2(in_min, "in%d_min", S_IWUSR | S_IRUGO, show_in_reg, 2388 - store_in_reg, 0, 1); 2389 - SENSOR_TEMPLATE_2(in_max, "in%d_max", S_IWUSR | S_IRUGO, show_in_reg, 2390 - store_in_reg, 0, 2); 2383 + SENSOR_TEMPLATE_2(in_input, "in%d_input", 0444, show_in_reg, NULL, 0, 0); 2384 + SENSOR_TEMPLATE(in_alarm, "in%d_alarm", 0444, show_alarm, NULL, 0); 2385 + SENSOR_TEMPLATE(in_beep, "in%d_beep", 0644, show_beep, store_beep, 0); 2386 + SENSOR_TEMPLATE_2(in_min, "in%d_min", 0644, show_in_reg, store_in_reg, 0, 1); 2387 + SENSOR_TEMPLATE_2(in_max, "in%d_max", 0644, show_in_reg, store_in_reg, 0, 2); 2391 2388 2392 2389 /* 2393 2390 * nct6775_in_is_visible uses the index into the following array ··· 2613 2616 return nct6775_attr_mode(data, attr); 2614 2617 } 2615 2618 2616 - SENSOR_TEMPLATE(fan_input, "fan%d_input", S_IRUGO, show_fan, NULL, 0); 2617 - SENSOR_TEMPLATE(fan_alarm, "fan%d_alarm", S_IRUGO, show_alarm, NULL, 2618 - FAN_ALARM_BASE); 2619 - SENSOR_TEMPLATE(fan_beep, "fan%d_beep", S_IWUSR | S_IRUGO, show_beep, 2620 - store_beep, FAN_ALARM_BASE); 2621 - SENSOR_TEMPLATE(fan_pulses, "fan%d_pulses", S_IWUSR | S_IRUGO, show_fan_pulses, 2622 - store_fan_pulses, 0); 2623 - SENSOR_TEMPLATE(fan_min, "fan%d_min", S_IWUSR | S_IRUGO, show_fan_min, 2624 - store_fan_min, 0); 2625 - SENSOR_TEMPLATE(fan_div, "fan%d_div", S_IRUGO, show_fan_div, NULL, 0); 2619 + SENSOR_TEMPLATE(fan_input, "fan%d_input", 0444, show_fan, NULL, 0); 2620 + SENSOR_TEMPLATE(fan_alarm, "fan%d_alarm", 0444, show_alarm, NULL, FAN_ALARM_BASE); 2621 + SENSOR_TEMPLATE(fan_beep, "fan%d_beep", 0644, show_beep, store_beep, FAN_ALARM_BASE); 2622 + SENSOR_TEMPLATE(fan_pulses, "fan%d_pulses", 0644, show_fan_pulses, store_fan_pulses, 0); 2623 + SENSOR_TEMPLATE(fan_min, "fan%d_min", 0644, show_fan_min, store_fan_min, 0); 2624 + SENSOR_TEMPLATE(fan_div, "fan%d_div", 0444, show_fan_div, NULL, 0); 2626 2625 2627 2626 /* 2628 2627 * nct6775_fan_is_visible uses the index into the following array ··· 2836 2843 return nct6775_attr_mode(data, attr); 2837 2844 } 2838 2845 2839 - SENSOR_TEMPLATE_2(temp_input, "temp%d_input", S_IRUGO, show_temp, NULL, 0, 0); 2840 - SENSOR_TEMPLATE(temp_label, "temp%d_label", S_IRUGO, show_temp_label, NULL, 0); 2841 - SENSOR_TEMPLATE_2(temp_max, "temp%d_max", S_IRUGO | S_IWUSR, show_temp, 2842 - store_temp, 0, 1); 2843 - SENSOR_TEMPLATE_2(temp_max_hyst, "temp%d_max_hyst", S_IRUGO | S_IWUSR, 2844 - show_temp, store_temp, 0, 2); 2845 - SENSOR_TEMPLATE_2(temp_crit, "temp%d_crit", S_IRUGO | S_IWUSR, show_temp, 2846 - store_temp, 0, 3); 2847 - SENSOR_TEMPLATE_2(temp_lcrit, "temp%d_lcrit", S_IRUGO | S_IWUSR, show_temp, 2848 - store_temp, 0, 4); 2849 - SENSOR_TEMPLATE(temp_offset, "temp%d_offset", S_IRUGO | S_IWUSR, 2850 - show_temp_offset, store_temp_offset, 0); 2851 - SENSOR_TEMPLATE(temp_type, "temp%d_type", S_IRUGO | S_IWUSR, show_temp_type, 2852 - store_temp_type, 0); 2853 - SENSOR_TEMPLATE(temp_alarm, "temp%d_alarm", S_IRUGO, show_temp_alarm, NULL, 0); 2854 - SENSOR_TEMPLATE(temp_beep, "temp%d_beep", S_IRUGO | S_IWUSR, show_temp_beep, 2855 - store_temp_beep, 0); 2846 + SENSOR_TEMPLATE_2(temp_input, "temp%d_input", 0444, show_temp, NULL, 0, 0); 2847 + SENSOR_TEMPLATE(temp_label, "temp%d_label", 0444, show_temp_label, NULL, 0); 2848 + SENSOR_TEMPLATE_2(temp_max, "temp%d_max", 0644, show_temp, store_temp, 0, 1); 2849 + SENSOR_TEMPLATE_2(temp_max_hyst, "temp%d_max_hyst", 0644, show_temp, store_temp, 0, 2); 2850 + SENSOR_TEMPLATE_2(temp_crit, "temp%d_crit", 0644, show_temp, store_temp, 0, 3); 2851 + SENSOR_TEMPLATE_2(temp_lcrit, "temp%d_lcrit", 0644, show_temp, store_temp, 0, 4); 2852 + SENSOR_TEMPLATE(temp_offset, "temp%d_offset", 0644, show_temp_offset, store_temp_offset, 0); 2853 + SENSOR_TEMPLATE(temp_type, "temp%d_type", 0644, show_temp_type, store_temp_type, 0); 2854 + SENSOR_TEMPLATE(temp_alarm, "temp%d_alarm", 0444, show_temp_alarm, NULL, 0); 2855 + SENSOR_TEMPLATE(temp_beep, "temp%d_beep", 0644, show_temp_beep, store_temp_beep, 0); 2856 2856 2857 2857 /* 2858 2858 * nct6775_temp_is_visible uses the index into the following array ··· 3492 3506 return err ? : count; 3493 3507 } 3494 3508 3495 - SENSOR_TEMPLATE_2(pwm, "pwm%d", S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0, 0); 3496 - SENSOR_TEMPLATE(pwm_mode, "pwm%d_mode", S_IWUSR | S_IRUGO, show_pwm_mode, 3497 - store_pwm_mode, 0); 3498 - SENSOR_TEMPLATE(pwm_enable, "pwm%d_enable", S_IWUSR | S_IRUGO, show_pwm_enable, 3499 - store_pwm_enable, 0); 3500 - SENSOR_TEMPLATE(pwm_temp_sel, "pwm%d_temp_sel", S_IWUSR | S_IRUGO, 3501 - show_pwm_temp_sel, store_pwm_temp_sel, 0); 3502 - SENSOR_TEMPLATE(pwm_target_temp, "pwm%d_target_temp", S_IWUSR | S_IRUGO, 3503 - show_target_temp, store_target_temp, 0); 3504 - SENSOR_TEMPLATE(fan_target, "fan%d_target", S_IWUSR | S_IRUGO, 3505 - show_target_speed, store_target_speed, 0); 3506 - SENSOR_TEMPLATE(fan_tolerance, "fan%d_tolerance", S_IWUSR | S_IRUGO, 3507 - show_speed_tolerance, store_speed_tolerance, 0); 3509 + SENSOR_TEMPLATE_2(pwm, "pwm%d", 0644, show_pwm, store_pwm, 0, 0); 3510 + SENSOR_TEMPLATE(pwm_mode, "pwm%d_mode", 0644, show_pwm_mode, store_pwm_mode, 0); 3511 + SENSOR_TEMPLATE(pwm_enable, "pwm%d_enable", 0644, show_pwm_enable, store_pwm_enable, 0); 3512 + SENSOR_TEMPLATE(pwm_temp_sel, "pwm%d_temp_sel", 0644, show_pwm_temp_sel, store_pwm_temp_sel, 0); 3513 + SENSOR_TEMPLATE(pwm_target_temp, "pwm%d_target_temp", 0644, show_target_temp, store_target_temp, 0); 3514 + SENSOR_TEMPLATE(fan_target, "fan%d_target", 0644, show_target_speed, store_target_speed, 0); 3515 + SENSOR_TEMPLATE(fan_tolerance, "fan%d_tolerance", 0644, show_speed_tolerance, 3516 + store_speed_tolerance, 0); 3508 3517 3509 3518 /* Smart Fan registers */ 3510 3519 ··· 3541 3560 return err ? : count; 3542 3561 } 3543 3562 3544 - SENSOR_TEMPLATE(pwm_weight_temp_sel, "pwm%d_weight_temp_sel", S_IWUSR | S_IRUGO, 3545 - show_pwm_weight_temp_sel, store_pwm_weight_temp_sel, 0); 3563 + SENSOR_TEMPLATE(pwm_weight_temp_sel, "pwm%d_weight_temp_sel", 0644, 3564 + show_pwm_weight_temp_sel, store_pwm_weight_temp_sel, 0); 3546 3565 SENSOR_TEMPLATE_2(pwm_weight_temp_step, "pwm%d_weight_temp_step", 3547 - S_IWUSR | S_IRUGO, show_weight_temp, store_weight_temp, 0, 0); 3566 + 0644, show_weight_temp, store_weight_temp, 0, 0); 3548 3567 SENSOR_TEMPLATE_2(pwm_weight_temp_step_tol, "pwm%d_weight_temp_step_tol", 3549 - S_IWUSR | S_IRUGO, show_weight_temp, store_weight_temp, 0, 1); 3568 + 0644, show_weight_temp, store_weight_temp, 0, 1); 3550 3569 SENSOR_TEMPLATE_2(pwm_weight_temp_step_base, "pwm%d_weight_temp_step_base", 3551 - S_IWUSR | S_IRUGO, show_weight_temp, store_weight_temp, 0, 2); 3552 - SENSOR_TEMPLATE_2(pwm_weight_duty_step, "pwm%d_weight_duty_step", 3553 - S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0, 5); 3554 - SENSOR_TEMPLATE_2(pwm_weight_duty_base, "pwm%d_weight_duty_base", 3555 - S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0, 6); 3570 + 0644, show_weight_temp, store_weight_temp, 0, 2); 3571 + SENSOR_TEMPLATE_2(pwm_weight_duty_step, "pwm%d_weight_duty_step", 0644, show_pwm, store_pwm, 0, 5); 3572 + SENSOR_TEMPLATE_2(pwm_weight_duty_base, "pwm%d_weight_duty_base", 0644, show_pwm, store_pwm, 0, 6); 3556 3573 3557 3574 static ssize_t 3558 3575 show_fan_time(struct device *dev, struct device_attribute *attr, char *buf) ··· 3754 3775 return nct6775_attr_mode(data, attr); 3755 3776 } 3756 3777 3757 - SENSOR_TEMPLATE_2(pwm_stop_time, "pwm%d_stop_time", S_IWUSR | S_IRUGO, 3758 - show_fan_time, store_fan_time, 0, 0); 3759 - SENSOR_TEMPLATE_2(pwm_step_up_time, "pwm%d_step_up_time", S_IWUSR | S_IRUGO, 3778 + SENSOR_TEMPLATE_2(pwm_stop_time, "pwm%d_stop_time", 0644, show_fan_time, store_fan_time, 0, 0); 3779 + SENSOR_TEMPLATE_2(pwm_step_up_time, "pwm%d_step_up_time", 0644, 3760 3780 show_fan_time, store_fan_time, 0, 1); 3761 - SENSOR_TEMPLATE_2(pwm_step_down_time, "pwm%d_step_down_time", S_IWUSR | S_IRUGO, 3781 + SENSOR_TEMPLATE_2(pwm_step_down_time, "pwm%d_step_down_time", 0644, 3762 3782 show_fan_time, store_fan_time, 0, 2); 3763 - SENSOR_TEMPLATE_2(pwm_start, "pwm%d_start", S_IWUSR | S_IRUGO, show_pwm, 3764 - store_pwm, 0, 1); 3765 - SENSOR_TEMPLATE_2(pwm_floor, "pwm%d_floor", S_IWUSR | S_IRUGO, show_pwm, 3766 - store_pwm, 0, 2); 3767 - SENSOR_TEMPLATE_2(pwm_temp_tolerance, "pwm%d_temp_tolerance", S_IWUSR | S_IRUGO, 3783 + SENSOR_TEMPLATE_2(pwm_start, "pwm%d_start", 0644, show_pwm, store_pwm, 0, 1); 3784 + SENSOR_TEMPLATE_2(pwm_floor, "pwm%d_floor", 0644, show_pwm, store_pwm, 0, 2); 3785 + SENSOR_TEMPLATE_2(pwm_temp_tolerance, "pwm%d_temp_tolerance", 0644, 3768 3786 show_temp_tolerance, store_temp_tolerance, 0, 0); 3769 3787 SENSOR_TEMPLATE_2(pwm_crit_temp_tolerance, "pwm%d_crit_temp_tolerance", 3770 - S_IWUSR | S_IRUGO, show_temp_tolerance, store_temp_tolerance, 3771 - 0, 1); 3788 + 0644, show_temp_tolerance, store_temp_tolerance, 0, 1); 3772 3789 3773 - SENSOR_TEMPLATE_2(pwm_max, "pwm%d_max", S_IWUSR | S_IRUGO, show_pwm, store_pwm, 3774 - 0, 3); 3790 + SENSOR_TEMPLATE_2(pwm_max, "pwm%d_max", 0644, show_pwm, store_pwm, 0, 3); 3775 3791 3776 - SENSOR_TEMPLATE_2(pwm_step, "pwm%d_step", S_IWUSR | S_IRUGO, show_pwm, 3777 - store_pwm, 0, 4); 3792 + SENSOR_TEMPLATE_2(pwm_step, "pwm%d_step", 0644, show_pwm, store_pwm, 0, 4); 3778 3793 3779 3794 SENSOR_TEMPLATE_2(pwm_auto_point1_pwm, "pwm%d_auto_point1_pwm", 3780 - S_IWUSR | S_IRUGO, show_auto_pwm, store_auto_pwm, 0, 0); 3795 + 0644, show_auto_pwm, store_auto_pwm, 0, 0); 3781 3796 SENSOR_TEMPLATE_2(pwm_auto_point1_temp, "pwm%d_auto_point1_temp", 3782 - S_IWUSR | S_IRUGO, show_auto_temp, store_auto_temp, 0, 0); 3797 + 0644, show_auto_temp, store_auto_temp, 0, 0); 3783 3798 3784 3799 SENSOR_TEMPLATE_2(pwm_auto_point2_pwm, "pwm%d_auto_point2_pwm", 3785 - S_IWUSR | S_IRUGO, show_auto_pwm, store_auto_pwm, 0, 1); 3800 + 0644, show_auto_pwm, store_auto_pwm, 0, 1); 3786 3801 SENSOR_TEMPLATE_2(pwm_auto_point2_temp, "pwm%d_auto_point2_temp", 3787 - S_IWUSR | S_IRUGO, show_auto_temp, store_auto_temp, 0, 1); 3802 + 0644, show_auto_temp, store_auto_temp, 0, 1); 3788 3803 3789 3804 SENSOR_TEMPLATE_2(pwm_auto_point3_pwm, "pwm%d_auto_point3_pwm", 3790 - S_IWUSR | S_IRUGO, show_auto_pwm, store_auto_pwm, 0, 2); 3805 + 0644, show_auto_pwm, store_auto_pwm, 0, 2); 3791 3806 SENSOR_TEMPLATE_2(pwm_auto_point3_temp, "pwm%d_auto_point3_temp", 3792 - S_IWUSR | S_IRUGO, show_auto_temp, store_auto_temp, 0, 2); 3807 + 0644, show_auto_temp, store_auto_temp, 0, 2); 3793 3808 3794 3809 SENSOR_TEMPLATE_2(pwm_auto_point4_pwm, "pwm%d_auto_point4_pwm", 3795 - S_IWUSR | S_IRUGO, show_auto_pwm, store_auto_pwm, 0, 3); 3810 + 0644, show_auto_pwm, store_auto_pwm, 0, 3); 3796 3811 SENSOR_TEMPLATE_2(pwm_auto_point4_temp, "pwm%d_auto_point4_temp", 3797 - S_IWUSR | S_IRUGO, show_auto_temp, store_auto_temp, 0, 3); 3812 + 0644, show_auto_temp, store_auto_temp, 0, 3); 3798 3813 3799 3814 SENSOR_TEMPLATE_2(pwm_auto_point5_pwm, "pwm%d_auto_point5_pwm", 3800 - S_IWUSR | S_IRUGO, show_auto_pwm, store_auto_pwm, 0, 4); 3815 + 0644, show_auto_pwm, store_auto_pwm, 0, 4); 3801 3816 SENSOR_TEMPLATE_2(pwm_auto_point5_temp, "pwm%d_auto_point5_temp", 3802 - S_IWUSR | S_IRUGO, show_auto_temp, store_auto_temp, 0, 4); 3817 + 0644, show_auto_temp, store_auto_temp, 0, 4); 3803 3818 3804 3819 SENSOR_TEMPLATE_2(pwm_auto_point6_pwm, "pwm%d_auto_point6_pwm", 3805 - S_IWUSR | S_IRUGO, show_auto_pwm, store_auto_pwm, 0, 5); 3820 + 0644, show_auto_pwm, store_auto_pwm, 0, 5); 3806 3821 SENSOR_TEMPLATE_2(pwm_auto_point6_temp, "pwm%d_auto_point6_temp", 3807 - S_IWUSR | S_IRUGO, show_auto_temp, store_auto_temp, 0, 5); 3822 + 0644, show_auto_temp, store_auto_temp, 0, 5); 3808 3823 3809 3824 SENSOR_TEMPLATE_2(pwm_auto_point7_pwm, "pwm%d_auto_point7_pwm", 3810 - S_IWUSR | S_IRUGO, show_auto_pwm, store_auto_pwm, 0, 6); 3825 + 0644, show_auto_pwm, store_auto_pwm, 0, 6); 3811 3826 SENSOR_TEMPLATE_2(pwm_auto_point7_temp, "pwm%d_auto_point7_temp", 3812 - S_IWUSR | S_IRUGO, show_auto_temp, store_auto_temp, 0, 6); 3827 + 0644, show_auto_temp, store_auto_temp, 0, 6); 3813 3828 3814 3829 /* 3815 3830 * nct6775_pwm_is_visible uses the index into the following array ··· 3910 3937 return count; 3911 3938 } 3912 3939 3913 - static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IWUSR | S_IRUGO, show_alarm, 3914 - clear_caseopen, INTRUSION_ALARM_BASE); 3915 - static SENSOR_DEVICE_ATTR(intrusion1_alarm, S_IWUSR | S_IRUGO, show_alarm, 3940 + static SENSOR_DEVICE_ATTR(intrusion0_alarm, 0644, show_alarm, clear_caseopen, INTRUSION_ALARM_BASE); 3941 + static SENSOR_DEVICE_ATTR(intrusion1_alarm, 0644, show_alarm, 3916 3942 clear_caseopen, INTRUSION_ALARM_BASE + 1); 3917 - static SENSOR_DEVICE_ATTR(intrusion0_beep, S_IWUSR | S_IRUGO, show_beep, 3918 - store_beep, INTRUSION_ALARM_BASE); 3919 - static SENSOR_DEVICE_ATTR(intrusion1_beep, S_IWUSR | S_IRUGO, show_beep, 3920 - store_beep, INTRUSION_ALARM_BASE + 1); 3921 - static SENSOR_DEVICE_ATTR(beep_enable, S_IWUSR | S_IRUGO, show_beep, 3922 - store_beep, BEEP_ENABLE_BASE); 3943 + static SENSOR_DEVICE_ATTR(intrusion0_beep, 0644, show_beep, store_beep, INTRUSION_ALARM_BASE); 3944 + static SENSOR_DEVICE_ATTR(intrusion1_beep, 0644, show_beep, store_beep, INTRUSION_ALARM_BASE + 1); 3945 + static SENSOR_DEVICE_ATTR(beep_enable, 0644, show_beep, store_beep, BEEP_ENABLE_BASE); 3923 3946 3924 3947 static umode_t nct6775_other_is_visible(struct kobject *kobj, 3925 3948 struct attribute *attr, int index)