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

hwmon: (max197) 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
a93c843b 23eb359d

+3 -3
+3 -3
drivers/hwmon/max197.c
··· 207 207 return ret; 208 208 } 209 209 210 - static ssize_t max197_show_name(struct device *dev, 211 - struct device_attribute *attr, char *buf) 210 + static ssize_t name_show(struct device *dev, struct device_attribute *attr, 211 + char *buf) 212 212 { 213 213 struct platform_device *pdev = to_platform_device(dev); 214 214 return sprintf(buf, "%s\n", pdev->name); ··· 231 231 &sensor_dev_attr_in##chan##_max.dev_attr.attr, \ 232 232 &sensor_dev_attr_in##chan##_min.dev_attr.attr 233 233 234 - static DEVICE_ATTR(name, S_IRUGO, max197_show_name, NULL); 234 + static DEVICE_ATTR_RO(name); 235 235 236 236 MAX197_SENSOR_DEVICE_ATTR_CH(0); 237 237 MAX197_SENSOR_DEVICE_ATTR_CH(1);