diff options
author | Guenter Roeck <linux@roeck-us.net> | 2018-12-10 14:02:19 -0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-02-18 14:23:29 -0800 |
commit | 290dbb8ee4aa47794b41b9aec05c8d7b5e9cc429 (patch) | |
tree | 70a50bde85b8144ff0c3e0691d185b7a1299f380 /drivers/hwmon/sch5627.c | |
parent | e3a0ee1a8f3d5b404056cb969af9ba5b7ceccf95 (diff) |
hwmon: (sch5627) 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.
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/sch5627.c')
-rw-r--r-- | drivers/hwmon/sch5627.c | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 91544f2312e6..63cfbc5a86ed 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c @@ -211,8 +211,8 @@ static ssize_t name_show(struct device *dev, struct device_attribute *devattr, return snprintf(buf, PAGE_SIZE, "%s\n", DEVNAME); } -static ssize_t show_temp(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_show(struct device *dev, struct device_attribute *devattr, + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sch5627_data *data = sch5627_update_device(dev); @@ -225,8 +225,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute return snprintf(buf, PAGE_SIZE, "%d\n", val); } -static ssize_t show_temp_fault(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_fault_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sch5627_data *data = sch5627_update_device(dev); @@ -237,8 +237,8 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute return snprintf(buf, PAGE_SIZE, "%d\n", data->temp[attr->index] == 0); } -static ssize_t show_temp_max(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_max_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sch5627_data *data = dev_get_drvdata(dev); @@ -248,8 +248,8 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute return snprintf(buf, PAGE_SIZE, "%d\n", val); } -static ssize_t show_temp_crit(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t temp_crit_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sch5627_data *data = dev_get_drvdata(dev); @@ -259,8 +259,8 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attribute return snprintf(buf, PAGE_SIZE, "%d\n", val); } -static ssize_t show_fan(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t fan_show(struct device *dev, struct device_attribute *devattr, + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sch5627_data *data = sch5627_update_device(dev); @@ -276,8 +276,8 @@ static ssize_t show_fan(struct device *dev, struct device_attribute return snprintf(buf, PAGE_SIZE, "%d\n", val); } -static ssize_t show_fan_fault(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t fan_fault_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sch5627_data *data = sch5627_update_device(dev); @@ -289,8 +289,8 @@ static ssize_t show_fan_fault(struct device *dev, struct device_attribute data->fan[attr->index] == 0xffff); } -static ssize_t show_fan_min(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t fan_min_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sch5627_data *data = dev_get_drvdata(dev); @@ -301,8 +301,8 @@ static ssize_t show_fan_min(struct device *dev, struct device_attribute return snprintf(buf, PAGE_SIZE, "%d\n", val); } -static ssize_t show_in(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t in_show(struct device *dev, struct device_attribute *devattr, + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sch5627_data *data = sch5627_update_device(dev); @@ -317,8 +317,8 @@ static ssize_t show_in(struct device *dev, struct device_attribute return snprintf(buf, PAGE_SIZE, "%d\n", val); } -static ssize_t show_in_label(struct device *dev, struct device_attribute - *devattr, char *buf) +static ssize_t in_label_show(struct device *dev, + struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); @@ -327,61 +327,61 @@ static ssize_t show_in_label(struct device *dev, struct device_attribute } static DEVICE_ATTR_RO(name); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp, NULL, 5); -static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, show_temp, NULL, 6); -static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_temp, NULL, 7); -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5); -static SENSOR_DEVICE_ATTR(temp7_fault, S_IRUGO, show_temp_fault, NULL, 6); -static SENSOR_DEVICE_ATTR(temp8_fault, S_IRUGO, show_temp_fault, NULL, 7); -static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5); -static SENSOR_DEVICE_ATTR(temp7_max, S_IRUGO, show_temp_max, NULL, 6); -static SENSOR_DEVICE_ATTR(temp8_max, S_IRUGO, show_temp_max, NULL, 7); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1); -static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2); -static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3); -static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4); -static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5); -static SENSOR_DEVICE_ATTR(temp7_crit, S_IRUGO, show_temp_crit, NULL, 6); -static SENSOR_DEVICE_ATTR(temp8_crit, S_IRUGO, show_temp_crit, NULL, 7); - -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3); -static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3); -static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO, show_fan_min, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO, show_fan_min, NULL, 1); -static SENSOR_DEVICE_ATTR(fan3_min, S_IRUGO, show_fan_min, NULL, 2); -static SENSOR_DEVICE_ATTR(fan4_min, S_IRUGO, show_fan_min, NULL, 3); - -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_in, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_in, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_in, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_in, NULL, 3); -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_in, NULL, 4); -static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_in_label, NULL, 0); -static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_in_label, NULL, 1); -static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_in_label, NULL, 2); -static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_in_label, NULL, 3); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_input, temp, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_input, temp, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_input, temp, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_input, temp, 5); +static SENSOR_DEVICE_ATTR_RO(temp7_input, temp, 6); +static SENSOR_DEVICE_ATTR_RO(temp8_input, temp, 7); +static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_fault, temp_fault, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_fault, temp_fault, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_fault, temp_fault, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_fault, temp_fault, 5); +static SENSOR_DEVICE_ATTR_RO(temp7_fault, temp_fault, 6); +static SENSOR_DEVICE_ATTR_RO(temp8_fault, temp_fault, 7); +static SENSOR_DEVICE_ATTR_RO(temp1_max, temp_max, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_max, temp_max, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_max, temp_max, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_max, temp_max, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_max, temp_max, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_max, temp_max, 5); +static SENSOR_DEVICE_ATTR_RO(temp7_max, temp_max, 6); +static SENSOR_DEVICE_ATTR_RO(temp8_max, temp_max, 7); +static SENSOR_DEVICE_ATTR_RO(temp1_crit, temp_crit, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_crit, temp_crit, 1); +static SENSOR_DEVICE_ATTR_RO(temp3_crit, temp_crit, 2); +static SENSOR_DEVICE_ATTR_RO(temp4_crit, temp_crit, 3); +static SENSOR_DEVICE_ATTR_RO(temp5_crit, temp_crit, 4); +static SENSOR_DEVICE_ATTR_RO(temp6_crit, temp_crit, 5); +static SENSOR_DEVICE_ATTR_RO(temp7_crit, temp_crit, 6); +static SENSOR_DEVICE_ATTR_RO(temp8_crit, temp_crit, 7); + +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_input, fan, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_input, fan, 3); +static SENSOR_DEVICE_ATTR_RO(fan1_fault, fan_fault, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_fault, fan_fault, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_fault, fan_fault, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_fault, fan_fault, 3); +static SENSOR_DEVICE_ATTR_RO(fan1_min, fan_min, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_min, fan_min, 1); +static SENSOR_DEVICE_ATTR_RO(fan3_min, fan_min, 2); +static SENSOR_DEVICE_ATTR_RO(fan4_min, fan_min, 3); + +static SENSOR_DEVICE_ATTR_RO(in0_input, in, 0); +static SENSOR_DEVICE_ATTR_RO(in1_input, in, 1); +static SENSOR_DEVICE_ATTR_RO(in2_input, in, 2); +static SENSOR_DEVICE_ATTR_RO(in3_input, in, 3); +static SENSOR_DEVICE_ATTR_RO(in4_input, in, 4); +static SENSOR_DEVICE_ATTR_RO(in0_label, in_label, 0); +static SENSOR_DEVICE_ATTR_RO(in1_label, in_label, 1); +static SENSOR_DEVICE_ATTR_RO(in2_label, in_label, 2); +static SENSOR_DEVICE_ATTR_RO(in3_label, in_label, 3); static struct attribute *sch5627_attributes[] = { &dev_attr_name.attr, |