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

hwmon: (nct6775) 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
93d72ac3 e57959a6

+2 -2
+2 -2
drivers/hwmon/nct6775.c
··· 3127 3127 }; 3128 3128 3129 3129 static ssize_t 3130 - show_vid(struct device *dev, struct device_attribute *attr, char *buf) 3130 + cpu0_vid_show(struct device *dev, struct device_attribute *attr, char *buf) 3131 3131 { 3132 3132 struct nct6775_data *data = dev_get_drvdata(dev); 3133 3133 3134 3134 return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); 3135 3135 } 3136 3136 3137 - static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 3137 + static DEVICE_ATTR_RO(cpu0_vid); 3138 3138 3139 3139 /* Case open detection */ 3140 3140