summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/mc13783-adc.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-12-10 17:02:17 -0500
committerGuenter Roeck <linux@roeck-us.net>2019-02-18 17:23:29 -0500
commit6d190949821b837ab309c2ef4ed6de6b1768fad6 (patch)
treeeb0d1de24fdd3d3be2396974b27f8bab03f2a040 /drivers/hwmon/mc13783-adc.c
parent0f50b2e8508399de88c2e935fe810a28659129fb (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/mc13783-adc.c')
-rw-r--r--drivers/hwmon/mc13783-adc.c49
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
66static ssize_t mc13783_adc_read_bp(struct device *dev, 66static 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
89static ssize_t mc13783_adc_read_gp(struct device *dev, 90static 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
107static ssize_t mc13783_adc_read_uid(struct device *dev, 109static 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
128static ssize_t mc13783_adc_read_temp(struct device *dev, 131static 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
158static DEVICE_ATTR_RO(name); 162static DEVICE_ATTR_RO(name);
159static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, mc13783_adc_read_bp, NULL, 2); 163static SENSOR_DEVICE_ATTR_RO(in2_input, mc13783_adc_bp, 2);
160static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, mc13783_adc_read_gp, NULL, 5); 164static SENSOR_DEVICE_ATTR_RO(in5_input, mc13783_adc_gp, 5);
161static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, mc13783_adc_read_gp, NULL, 6); 165static SENSOR_DEVICE_ATTR_RO(in6_input, mc13783_adc_gp, 6);
162static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, mc13783_adc_read_gp, NULL, 7); 166static SENSOR_DEVICE_ATTR_RO(in7_input, mc13783_adc_gp, 7);
163static SENSOR_DEVICE_ATTR(in8_input, S_IRUGO, mc13783_adc_read_gp, NULL, 8); 167static SENSOR_DEVICE_ATTR_RO(in8_input, mc13783_adc_gp, 8);
164static SENSOR_DEVICE_ATTR(in9_input, S_IRUGO, mc13783_adc_read_gp, NULL, 9); 168static SENSOR_DEVICE_ATTR_RO(in9_input, mc13783_adc_gp, 9);
165static SENSOR_DEVICE_ATTR(in10_input, S_IRUGO, mc13783_adc_read_gp, NULL, 10); 169static SENSOR_DEVICE_ATTR_RO(in10_input, mc13783_adc_gp, 10);
166static SENSOR_DEVICE_ATTR(in11_input, S_IRUGO, mc13783_adc_read_gp, NULL, 11); 170static SENSOR_DEVICE_ATTR_RO(in11_input, mc13783_adc_gp, 11);
167static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, mc13783_adc_read_gp, NULL, 12); 171static SENSOR_DEVICE_ATTR_RO(in12_input, mc13783_adc_gp, 12);
168static SENSOR_DEVICE_ATTR(in13_input, S_IRUGO, mc13783_adc_read_gp, NULL, 13); 172static SENSOR_DEVICE_ATTR_RO(in13_input, mc13783_adc_gp, 13);
169static SENSOR_DEVICE_ATTR(in14_input, S_IRUGO, mc13783_adc_read_gp, NULL, 14); 173static SENSOR_DEVICE_ATTR_RO(in14_input, mc13783_adc_gp, 14);
170static SENSOR_DEVICE_ATTR(in15_input, S_IRUGO, mc13783_adc_read_gp, NULL, 15); 174static SENSOR_DEVICE_ATTR_RO(in15_input, mc13783_adc_gp, 15);
171static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, mc13783_adc_read_uid, NULL, 16); 175static SENSOR_DEVICE_ATTR_RO(in16_input, mc13783_adc_uid, 16);
172static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, 176static SENSOR_DEVICE_ATTR_RO(temp1_input, mc13783_adc_temp, 17);
173 mc13783_adc_read_temp, NULL, 17);
174 177
175static struct attribute *mc13783_attr_base[] = { 178static struct attribute *mc13783_attr_base[] = {
176 &dev_attr_name.attr, 179 &dev_attr_name.attr,