summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-12-10 17:02:01 -0500
committerGuenter Roeck <linux@roeck-us.net>2018-12-16 18:13:36 -0500
commit595a86af49f0bfba8bf89a69b4b91c1aa038a373 (patch)
treedbc8f3cafa1823c06236078b7109f18a50ffd134
parent3ecd2783839c28e41baff1a7f8e9dfa6aa805616 (diff)
hwmon: (ads7871) Use permission specific SENSOR[_DEVICE]_ATTR variants
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code, to improve readbility, 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>
-rw-r--r--drivers/hwmon/ads7871.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
index 59bd7b9e1772..cd14c1501508 100644
--- a/drivers/hwmon/ads7871.c
+++ b/drivers/hwmon/ads7871.c
@@ -96,8 +96,8 @@ static int ads7871_write_reg8(struct spi_device *spi, int reg, u8 val)
96 return spi_write(spi, tmp, sizeof(tmp)); 96 return spi_write(spi, tmp, sizeof(tmp));
97} 97}
98 98
99static ssize_t show_voltage(struct device *dev, 99static ssize_t voltage_show(struct device *dev, struct device_attribute *da,
100 struct device_attribute *da, char *buf) 100 char *buf)
101{ 101{
102 struct ads7871_data *pdata = dev_get_drvdata(dev); 102 struct ads7871_data *pdata = dev_get_drvdata(dev);
103 struct spi_device *spi = pdata->spi; 103 struct spi_device *spi = pdata->spi;
@@ -138,14 +138,14 @@ static ssize_t show_voltage(struct device *dev,
138 } 138 }
139} 139}
140 140
141static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); 141static SENSOR_DEVICE_ATTR_RO(in0_input, voltage, 0);
142static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); 142static SENSOR_DEVICE_ATTR_RO(in1_input, voltage, 1);
143static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); 143static SENSOR_DEVICE_ATTR_RO(in2_input, voltage, 2);
144static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_voltage, NULL, 3); 144static SENSOR_DEVICE_ATTR_RO(in3_input, voltage, 3);
145static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_voltage, NULL, 4); 145static SENSOR_DEVICE_ATTR_RO(in4_input, voltage, 4);
146static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); 146static SENSOR_DEVICE_ATTR_RO(in5_input, voltage, 5);
147static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); 147static SENSOR_DEVICE_ATTR_RO(in6_input, voltage, 6);
148static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); 148static SENSOR_DEVICE_ATTR_RO(in7_input, voltage, 7);
149 149
150static struct attribute *ads7871_attrs[] = { 150static struct attribute *ads7871_attrs[] = {
151 &sensor_dev_attr_in0_input.dev_attr.attr, 151 &sensor_dev_attr_in0_input.dev_attr.attr,