From 8258e49019a59f1a24bc19bab19b4286802a9076 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 22 Dec 2016 13:05:16 +0100 Subject: [PATCH] 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: Julia Lawall [groeck: Updated description] Signed-off-by: Guenter Roeck --- drivers/hwmon/f71805f.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index facd05cda26d..73c681162653 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c @@ -946,7 +946,7 @@ static ssize_t set_temp_hyst(struct device *dev, struct device_attribute 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) { struct f71805f_data *data = f71805f_update_device(dev); @@ -954,7 +954,7 @@ static ssize_t show_alarms_in(struct device *dev, struct device_attribute 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) { struct f71805f_data *data = f71805f_update_device(dev); @@ -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); } -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) { struct f71805f_data *data = f71805f_update_device(dev); @@ -980,7 +980,7 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute 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) { struct f71805f_data *data = dev_get_drvdata(dev); @@ -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(fan2_alarm, S_IRUGO, show_alarm, NULL, 17); 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(alarms_fan, S_IRUGO, show_alarms_fan, NULL); -static DEVICE_ATTR(alarms_temp, S_IRUGO, show_alarms_temp, NULL); +static DEVICE_ATTR_RO(alarms_in); +static DEVICE_ATTR_RO(alarms_fan); +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[] = { &sensor_dev_attr_in0_input.dev_attr.attr,