Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (sch5627) 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>

authored by

Julia Lawall and committed by
Guenter Roeck
3776c835 eabb6f15

+2 -2
+2 -2
drivers/hwmon/sch5627.c
··· 205 205 return 5400540 / reg; 206 206 } 207 207 208 - static ssize_t show_name(struct device *dev, struct device_attribute *devattr, 208 + static ssize_t name_show(struct device *dev, struct device_attribute *devattr, 209 209 char *buf) 210 210 { 211 211 return snprintf(buf, PAGE_SIZE, "%s\n", DEVNAME); ··· 326 326 SCH5627_IN_LABELS[attr->index]); 327 327 } 328 328 329 - static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 329 + static DEVICE_ATTR_RO(name); 330 330 static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); 331 331 static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); 332 332 static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);