diff options
author | Guenter Roeck <linux@roeck-us.net> | 2018-12-10 23:02:06 +0100 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2018-12-17 00:13:44 +0100 |
commit | 94bf70da8ac3f815411a24a6ca42e7327c4a4bbb (patch) | |
tree | fb7e1e2e9d1c33796665c48f3a70f2a8add3e569 /drivers/hwmon/emc2103.c | |
parent | hwmon: (emc1403) Use permission specific SENSOR[_DEVICE]_ATTR variants (diff) | |
download | linux-94bf70da8ac3f815411a24a6ca42e7327c4a4bbb.tar.xz linux-94bf70da8ac3f815411a24a6ca42e7327c4a4bbb.zip |
hwmon: (emc2103) 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.
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/emc2103.c')
-rw-r--r-- | drivers/hwmon/emc2103.c | 92 |
1 files changed, 39 insertions, 53 deletions
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c index 1ed9a7aa953d..4b7748a0a833 100644 --- a/drivers/hwmon/emc2103.c +++ b/drivers/hwmon/emc2103.c @@ -185,7 +185,7 @@ static struct emc2103_data *emc2103_update_device(struct device *dev) } static ssize_t -show_temp(struct device *dev, struct device_attribute *da, char *buf) +temp_show(struct device *dev, struct device_attribute *da, char *buf) { int nr = to_sensor_dev_attr(da)->index; struct emc2103_data *data = emc2103_update_device(dev); @@ -195,7 +195,7 @@ show_temp(struct device *dev, struct device_attribute *da, char *buf) } static ssize_t -show_temp_min(struct device *dev, struct device_attribute *da, char *buf) +temp_min_show(struct device *dev, struct device_attribute *da, char *buf) { int nr = to_sensor_dev_attr(da)->index; struct emc2103_data *data = emc2103_update_device(dev); @@ -204,7 +204,7 @@ show_temp_min(struct device *dev, struct device_attribute *da, char *buf) } static ssize_t -show_temp_max(struct device *dev, struct device_attribute *da, char *buf) +temp_max_show(struct device *dev, struct device_attribute *da, char *buf) { int nr = to_sensor_dev_attr(da)->index; struct emc2103_data *data = emc2103_update_device(dev); @@ -213,7 +213,7 @@ show_temp_max(struct device *dev, struct device_attribute *da, char *buf) } static ssize_t -show_temp_fault(struct device *dev, struct device_attribute *da, char *buf) +temp_fault_show(struct device *dev, struct device_attribute *da, char *buf) { int nr = to_sensor_dev_attr(da)->index; struct emc2103_data *data = emc2103_update_device(dev); @@ -222,7 +222,8 @@ show_temp_fault(struct device *dev, struct device_attribute *da, char *buf) } static ssize_t -show_temp_min_alarm(struct device *dev, struct device_attribute *da, char *buf) +temp_min_alarm_show(struct device *dev, struct device_attribute *da, + char *buf) { int nr = to_sensor_dev_attr(da)->index; struct emc2103_data *data = emc2103_update_device(dev); @@ -231,7 +232,8 @@ show_temp_min_alarm(struct device *dev, struct device_attribute *da, char *buf) } static ssize_t -show_temp_max_alarm(struct device *dev, struct device_attribute *da, char *buf) +temp_max_alarm_show(struct device *dev, struct device_attribute *da, + char *buf) { int nr = to_sensor_dev_attr(da)->index; struct emc2103_data *data = emc2103_update_device(dev); @@ -239,8 +241,8 @@ show_temp_max_alarm(struct device *dev, struct device_attribute *da, char *buf) return sprintf(buf, "%d\n", alarm ? 1 : 0); } -static ssize_t set_temp_min(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) +static ssize_t temp_min_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) { int nr = to_sensor_dev_attr(da)->index; struct emc2103_data *data = dev_get_drvdata(dev); @@ -261,8 +263,8 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da, return count; } -static ssize_t set_temp_max(struct device *dev, struct device_attribute *da, - const char *buf, size_t count) +static ssize_t temp_max_store(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) { int nr = to_sensor_dev_attr(da)->index; struct emc2103_data *data = dev_get_drvdata(dev); @@ -470,49 +472,33 @@ err: return count; } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, show_temp_min, - set_temp_min, 0); -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp_max, - set_temp_max, 0); -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_temp_min_alarm, - NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_temp_max_alarm, - NULL, 0); - -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); -static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, show_temp_min, - set_temp_min, 1); -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO | S_IWUSR, show_temp_max, - set_temp_max, 1); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_temp_min_alarm, - NULL, 1); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_temp_max_alarm, - NULL, 1); - -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); -static SENSOR_DEVICE_ATTR(temp3_min, S_IRUGO | S_IWUSR, show_temp_min, - set_temp_min, 2); -static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO | S_IWUSR, show_temp_max, - set_temp_max, 2); -static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, show_temp_min_alarm, - NULL, 2); -static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, show_temp_max_alarm, - NULL, 2); - -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3); -static SENSOR_DEVICE_ATTR(temp4_min, S_IRUGO | S_IWUSR, show_temp_min, - set_temp_min, 3); -static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO | S_IWUSR, show_temp_max, - set_temp_max, 3); -static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, show_temp_min_alarm, - NULL, 3); -static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_temp_max_alarm, - NULL, 3); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0); +static SENSOR_DEVICE_ATTR_RW(temp1_min, temp_min, 0); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, temp_min_alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, temp_max_alarm, 0); + +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1); +static SENSOR_DEVICE_ATTR_RW(temp2_min, temp_min, 1); +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); +static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, temp_min_alarm, 1); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, temp_max_alarm, 1); + +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2); +static SENSOR_DEVICE_ATTR_RW(temp3_min, temp_min, 2); +static SENSOR_DEVICE_ATTR_RW(temp3_max, temp_max, 2); +static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2); +static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, temp_min_alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, temp_max_alarm, 2); + +static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3); +static SENSOR_DEVICE_ATTR_RW(temp4_min, temp_min, 3); +static SENSOR_DEVICE_ATTR_RW(temp4_max, temp_max, 3); +static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3); +static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, temp_min_alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, temp_max_alarm, 3); static DEVICE_ATTR_RO(fan1_input); static DEVICE_ATTR_RW(fan1_div); |