hwmon: (lm70) 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>
This commit is contained in:
Julia Lawall 2016-12-22 13:04:50 +01:00 committed by Guenter Roeck
parent dc7a326589
commit 89cb4af87c
1 changed files with 3 additions and 3 deletions

View File

@ -54,8 +54,8 @@ struct lm70 {
}; };
/* sysfs hook function */ /* sysfs hook function */
static ssize_t lm70_sense_temp(struct device *dev, static ssize_t temp1_input_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct lm70 *p_lm70 = dev_get_drvdata(dev); struct lm70 *p_lm70 = dev_get_drvdata(dev);
struct spi_device *spi = p_lm70->spi; struct spi_device *spi = p_lm70->spi;
@ -120,7 +120,7 @@ out:
return status; return status;
} }
static DEVICE_ATTR(temp1_input, S_IRUGO, lm70_sense_temp, NULL); static DEVICE_ATTR_RO(temp1_input);
static struct attribute *lm70_attrs[] = { static struct attribute *lm70_attrs[] = {
&dev_attr_temp1_input.attr, &dev_attr_temp1_input.attr,