Forráskód Böngészése

hwmon: (w83627ehf) 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 <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Julia Lawall 8 éve
szülő
commit
9bbacbfe0e
1 módosított fájl, 4 hozzáadás és 4 törlés
  1. 4 4
      drivers/hwmon/w83627ehf.c

+ 4 - 4
drivers/hwmon/w83627ehf.c

@@ -1687,14 +1687,14 @@ store_##reg(struct device *dev, struct device_attribute *attr, \
 
 
 fan_time_functions(fan_stop_time, FAN_STOP_TIME)
 fan_time_functions(fan_stop_time, FAN_STOP_TIME)
 
 
-static ssize_t show_name(struct device *dev, struct device_attribute *attr,
+static ssize_t name_show(struct device *dev, struct device_attribute *attr,
 			 char *buf)
 			 char *buf)
 {
 {
 	struct w83627ehf_data *data = dev_get_drvdata(dev);
 	struct w83627ehf_data *data = dev_get_drvdata(dev);
 
 
 	return sprintf(buf, "%s\n", data->name);
 	return sprintf(buf, "%s\n", data->name);
 }
 }
-static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+static DEVICE_ATTR_RO(name);
 
 
 static struct sensor_device_attribute sda_sf3_arrays_fan4[] = {
 static struct sensor_device_attribute sda_sf3_arrays_fan4[] = {
 	SENSOR_ATTR(pwm4_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time,
 	SENSOR_ATTR(pwm4_stop_time, S_IWUSR | S_IRUGO, show_fan_stop_time,
@@ -1754,12 +1754,12 @@ static struct sensor_device_attribute sda_sf3_max_step_arrays[] = {
 };
 };
 
 
 static ssize_t
 static ssize_t
-show_vid(struct device *dev, struct device_attribute *attr, char *buf)
+cpu0_vid_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 {
 	struct w83627ehf_data *data = dev_get_drvdata(dev);
 	struct w83627ehf_data *data = dev_get_drvdata(dev);
 	return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
 	return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
 }
 }
-static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
+static DEVICE_ATTR_RO(cpu0_vid);
 
 
 
 
 /* Case open detection */
 /* Case open detection */