diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2018-12-10 17:02:17 -0500 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2019-02-18 17:23:29 -0500 |
| commit | 6d190949821b837ab309c2ef4ed6de6b1768fad6 (patch) | |
| tree | eb0d1de24fdd3d3be2396974b27f8bab03f2a040 /drivers/hwmon | |
| parent | 0f50b2e8508399de88c2e935fe810a28659129fb (diff) | |
hwmon: (mc13783-adc) 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/mc13783-adc.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/hwmon/mc13783-adc.c b/drivers/hwmon/mc13783-adc.c index 825b922a3f92..ff147e5e1b8c 100644 --- a/drivers/hwmon/mc13783-adc.c +++ b/drivers/hwmon/mc13783-adc.c | |||
| @@ -63,8 +63,9 @@ static int mc13783_adc_read(struct device *dev, | |||
| 63 | return 0; | 63 | return 0; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | static ssize_t mc13783_adc_read_bp(struct device *dev, | 66 | static ssize_t mc13783_adc_bp_show(struct device *dev, |
| 67 | struct device_attribute *devattr, char *buf) | 67 | struct device_attribute *devattr, |
| 68 | char *buf) | ||
| 68 | { | 69 | { |
| 69 | unsigned val; | 70 | unsigned val; |
| 70 | struct platform_device *pdev = to_platform_device(dev); | 71 | struct platform_device *pdev = to_platform_device(dev); |
| @@ -86,8 +87,9 @@ static ssize_t mc13783_adc_read_bp(struct device *dev, | |||
| 86 | return sprintf(buf, "%u\n", val); | 87 | return sprintf(buf, "%u\n", val); |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | static ssize_t mc13783_adc_read_gp(struct device *dev, | 90 | static ssize_t mc13783_adc_gp_show(struct device *dev, |
| 90 | struct device_attribute *devattr, char *buf) | 91 | struct device_attribute *devattr, |
| 92 | char *buf) | ||
| 91 | { | 93 | { |
| 92 | unsigned val; | 94 | unsigned val; |
| 93 | int ret = mc13783_adc_read(dev, devattr, &val); | 95 | int ret = mc13783_adc_read(dev, devattr, &val); |
| @@ -104,8 +106,9 @@ static ssize_t mc13783_adc_read_gp(struct device *dev, | |||
| 104 | return sprintf(buf, "%u\n", val); | 106 | return sprintf(buf, "%u\n", val); |
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | static ssize_t mc13783_adc_read_uid(struct device *dev, | 109 | static ssize_t mc13783_adc_uid_show(struct device *dev, |
| 108 | struct device_attribute *devattr, char *buf) | 110 | struct device_attribute *devattr, |
| 111 | char *buf) | ||
| 109 | { | 112 | { |
| 110 | unsigned int val; | 113 | unsigned int val; |
| 111 | struct platform_device *pdev = to_platform_device(dev); | 114 | struct platform_device *pdev = to_platform_device(dev); |
| @@ -125,8 +128,9 @@ static ssize_t mc13783_adc_read_uid(struct device *dev, | |||
| 125 | return sprintf(buf, "%u\n", val); | 128 | return sprintf(buf, "%u\n", val); |
| 126 | } | 129 | } |
| 127 | 130 | ||
| 128 | static ssize_t mc13783_adc_read_temp(struct device *dev, | 131 | static ssize_t mc13783_adc_temp_show(struct device *dev, |
| 129 | struct device_attribute *devattr, char *buf) | 132 | struct device_attribute *devattr, |
| 133 | char *buf) | ||
| 130 | { | 134 | { |
| 131 | unsigned int val; | 135 | unsigned int val; |
| 132 | struct platform_device *pdev = to_platform_device(dev); | 136 | struct platform_device *pdev = to_platform_device(dev); |
| @@ -156,21 +160,20 @@ static ssize_t mc13783_adc_read_temp(struct device *dev, | |||
| 156 | } | 160 | } |
| 157 | 161 | ||
| 158 | static DEVICE_ATTR_RO(name); | 162 | static DEVICE_ATTR_RO(name); |
| 159 | static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, mc13783_adc_read_bp, NULL, 2); | 163 | static SENSOR_DEVICE_ATTR_RO(in2_input, mc13783_adc_bp, 2); |
| 160 | static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, mc13783_adc_read_gp, NULL, 5); | 164 | static SENSOR_DEVICE_ATTR_RO(in5_input, mc13783_adc_gp, 5); |
| 161 | static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, mc13783_adc_read_gp, NULL, 6); | 165 | static SENSOR_DEVICE_ATTR_RO(in6_input, mc13783_adc_gp, 6); |
| 162 | static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, mc13783_adc_read_gp, NULL, 7); | 166 | static SENSOR_DEVICE_ATTR_RO(in7_input, mc13783_adc_gp, 7); |
| 163 | static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, mc13783_adc_read_gp, NULL, 8); | 167 | static SENSOR_DEVICE_ATTR_RO(in8_input, mc13783_adc_gp, 8); |
| 164 | static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, mc13783_adc_read_gp, NULL, 9); | 168 | static SENSOR_DEVICE_ATTR_RO(in9_input, mc13783_adc_gp, 9); |
| 165 | static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, mc13783_adc_read_gp, NULL, 10); | 169 | static SENSOR_DEVICE_ATTR_RO(in10_input, mc13783_adc_gp, 10); |
| 166 | static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, mc13783_adc_read_gp, NULL, 11); | 170 | static SENSOR_DEVICE_ATTR_RO(in11_input, mc13783_adc_gp, 11); |
| 167 | static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, mc13783_adc_read_gp, NULL, 12); | 171 | static SENSOR_DEVICE_ATTR_RO(in12_input, mc13783_adc_gp, 12); |
| 168 | static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, mc13783_adc_read_gp, NULL, 13); | 172 | static SENSOR_DEVICE_ATTR_RO(in13_input, mc13783_adc_gp, 13); |
| 169 | static SENSOR_DEVICE_ATTR(in14_input, S_IRUGO, mc13783_adc_read_gp, NULL, 14); | 173 | static SENSOR_DEVICE_ATTR_RO(in14_input, mc13783_adc_gp, 14); |
| 170 | static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, mc13783_adc_read_gp, NULL, 15); | 174 | static SENSOR_DEVICE_ATTR_RO(in15_input, mc13783_adc_gp, 15); |
| 171 | static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, mc13783_adc_read_uid, NULL, 16); | 175 | static SENSOR_DEVICE_ATTR_RO(in16_input, mc13783_adc_uid, 16); |
| 172 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, | 176 | static SENSOR_DEVICE_ATTR_RO(temp1_input, mc13783_adc_temp, 17); |
| 173 | mc13783_adc_read_temp, NULL, 17); | ||
| 174 | 177 | ||
| 175 | static struct attribute *mc13783_attr_base[] = { | 178 | static struct attribute *mc13783_attr_base[] = { |
| 176 | &dev_attr_name.attr, | 179 | &dev_attr_name.attr, |
