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

hwmon: (w83793) use permission-specific DEVICE_ATTR variants

Use 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
329beb71 8258e490

+3 -3
+3 -3
drivers/hwmon/w83793.c
··· 324 324 }; 325 325 326 326 static ssize_t 327 - show_vrm(struct device *dev, struct device_attribute *attr, char *buf) 327 + vrm_show(struct device *dev, struct device_attribute *attr, char *buf) 328 328 { 329 329 struct w83793_data *data = dev_get_drvdata(dev); 330 330 return sprintf(buf, "%d\n", data->vrm); ··· 342 342 } 343 343 344 344 static ssize_t 345 - store_vrm(struct device *dev, struct device_attribute *attr, 345 + vrm_store(struct device *dev, struct device_attribute *attr, 346 346 const char *buf, size_t count) 347 347 { 348 348 struct w83793_data *data = dev_get_drvdata(dev); ··· 1169 1169 SENSOR_ATTR_2(cpu0_vid, S_IRUGO, show_vid, NULL, NOT_USED, 0), 1170 1170 SENSOR_ATTR_2(cpu1_vid, S_IRUGO, show_vid, NULL, NOT_USED, 1), 1171 1171 }; 1172 - static DEVICE_ATTR(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm); 1172 + static DEVICE_ATTR_RW(vrm); 1173 1173 1174 1174 static struct sensor_device_attribute_2 sda_single_files[] = { 1175 1175 SENSOR_ATTR_2(intrusion0_alarm, S_IWUSR | S_IRUGO, show_alarm_beep,