]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hwmon: (smsc47m1) use permission-specific DEVICE_ATTR variants
authorJulia Lawall <Julia.Lawall@lip6.fr>
Thu, 22 Dec 2016 12:05:06 +0000 (13:05 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 2 Jan 2017 18:19:45 +0000 (10:19 -0800)
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>
drivers/hwmon/smsc47m1.c

index 5d323186d2c10be446db19325b410e9aa384cfd3..c7b6a425e2c0270f5b20a7b09241a0eadce94ce8 100644 (file)
@@ -264,8 +264,8 @@ static ssize_t get_pwm_en(struct device *dev, struct device_attribute
        return sprintf(buf, "%d\n", PWM_EN_FROM_REG(data->pwm[attr->index]));
 }
 
-static ssize_t get_alarms(struct device *dev, struct device_attribute
-                         *devattr, char *buf)
+static ssize_t alarms_show(struct device *dev,
+                          struct device_attribute *devattr, char *buf)
 {
        struct smsc47m1_data *data = smsc47m1_update_device(dev, 0);
        return sprintf(buf, "%d\n", data->alarms);
@@ -440,16 +440,16 @@ fan_present(1);
 fan_present(2);
 fan_present(3);
 
-static DEVICE_ATTR(alarms, S_IRUGO, get_alarms, NULL);
+static DEVICE_ATTR_RO(alarms);
 
-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 smsc47m1_data *data = dev_get_drvdata(dev);
 
        return sprintf(buf, "%s\n", data->name);
 }
-static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+static DEVICE_ATTR_RO(name);
 
 static struct attribute *smsc47m1_attributes_fan1[] = {
        &sensor_dev_attr_fan1_input.dev_attr.attr,