Commit 8258e490 authored by Julia Lawall's avatar Julia Lawall Committed by Guenter Roeck

hwmon: (f71805f) use permission-specific DEVICE_ATTR variants

Use DEVICE_ATTR_RO for read-only attributes. This simplifies the source
code, improves readbility, and reduces the chance of inconsistencies.

The conversion was done automatically using coccinelle. It was validated
by compiling both the old and the new source code and comparing its text,
data, and bss size.
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent a81b67da
...@@ -946,7 +946,7 @@ static ssize_t set_temp_hyst(struct device *dev, struct device_attribute ...@@ -946,7 +946,7 @@ static ssize_t set_temp_hyst(struct device *dev, struct device_attribute
return count; return count;
} }
static ssize_t show_alarms_in(struct device *dev, struct device_attribute static ssize_t alarms_in_show(struct device *dev, struct device_attribute
*devattr, char *buf) *devattr, char *buf)
{ {
struct f71805f_data *data = f71805f_update_device(dev); struct f71805f_data *data = f71805f_update_device(dev);
...@@ -954,7 +954,7 @@ static ssize_t show_alarms_in(struct device *dev, struct device_attribute ...@@ -954,7 +954,7 @@ static ssize_t show_alarms_in(struct device *dev, struct device_attribute
return sprintf(buf, "%lu\n", data->alarms & 0x7ff); return sprintf(buf, "%lu\n", data->alarms & 0x7ff);
} }
static ssize_t show_alarms_fan(struct device *dev, struct device_attribute static ssize_t alarms_fan_show(struct device *dev, struct device_attribute
*devattr, char *buf) *devattr, char *buf)
{ {
struct f71805f_data *data = f71805f_update_device(dev); struct f71805f_data *data = f71805f_update_device(dev);
...@@ -962,7 +962,7 @@ static ssize_t show_alarms_fan(struct device *dev, struct device_attribute ...@@ -962,7 +962,7 @@ static ssize_t show_alarms_fan(struct device *dev, struct device_attribute
return sprintf(buf, "%lu\n", (data->alarms >> 16) & 0x07); return sprintf(buf, "%lu\n", (data->alarms >> 16) & 0x07);
} }
static ssize_t show_alarms_temp(struct device *dev, struct device_attribute static ssize_t alarms_temp_show(struct device *dev, struct device_attribute
*devattr, char *buf) *devattr, char *buf)
{ {
struct f71805f_data *data = f71805f_update_device(dev); struct f71805f_data *data = f71805f_update_device(dev);
...@@ -980,7 +980,7 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute ...@@ -980,7 +980,7 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute
return sprintf(buf, "%lu\n", (data->alarms >> bitnr) & 1); return sprintf(buf, "%lu\n", (data->alarms >> bitnr) & 1);
} }
static ssize_t show_name(struct device *dev, struct device_attribute static ssize_t name_show(struct device *dev, struct device_attribute
*devattr, char *buf) *devattr, char *buf)
{ {
struct f71805f_data *data = dev_get_drvdata(dev); struct f71805f_data *data = dev_get_drvdata(dev);
...@@ -1176,11 +1176,11 @@ static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13); ...@@ -1176,11 +1176,11 @@ static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13);
static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 16); static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 16);
static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 17); static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 17);
static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 18); static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 18);
static DEVICE_ATTR(alarms_in, S_IRUGO, show_alarms_in, NULL); static DEVICE_ATTR_RO(alarms_in);
static DEVICE_ATTR(alarms_fan, S_IRUGO, show_alarms_fan, NULL); static DEVICE_ATTR_RO(alarms_fan);
static DEVICE_ATTR(alarms_temp, S_IRUGO, show_alarms_temp, NULL); static DEVICE_ATTR_RO(alarms_temp);
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static DEVICE_ATTR_RO(name);
static struct attribute *f71805f_attributes[] = { static struct attribute *f71805f_attributes[] = {
&sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in0_input.dev_attr.attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment