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

hwmon: (adt7x10) use permission-specific DEVICE_ATTR variants

Use DEVICE_ATTR_RO for read only attributes and DEVICE_ATTR_RW for
read/write 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
ac8e35b2 808fc6c2

+3 -4
+3 -4
drivers/hwmon/adt7x10.c
··· 331 331 return sprintf(buf, "%d\n", !!(ret & attr->index)); 332 332 } 333 333 334 - static ssize_t adt7x10_show_name(struct device *dev, 335 - struct device_attribute *da, 336 - char *buf) 334 + static ssize_t name_show(struct device *dev, struct device_attribute *da, 335 + char *buf) 337 336 { 338 337 struct adt7x10_data *data = dev_get_drvdata(dev); 339 338 ··· 358 359 NULL, ADT7X10_STAT_T_HIGH); 359 360 static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, adt7x10_show_alarm, 360 361 NULL, ADT7X10_STAT_T_CRIT); 361 - static DEVICE_ATTR(name, S_IRUGO, adt7x10_show_name, NULL); 362 + static DEVICE_ATTR_RO(name); 362 363 363 364 static struct attribute *adt7x10_attributes[] = { 364 365 &sensor_dev_attr_temp1_input.dev_attr.attr,