提交 ac8e35b2 编写于 作者: J Julia Lawall 提交者: Guenter Roeck

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: NJulia Lawall <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 808fc6c2
...@@ -331,9 +331,8 @@ static ssize_t adt7x10_show_alarm(struct device *dev, ...@@ -331,9 +331,8 @@ static ssize_t adt7x10_show_alarm(struct device *dev,
return sprintf(buf, "%d\n", !!(ret & attr->index)); return sprintf(buf, "%d\n", !!(ret & attr->index));
} }
static ssize_t adt7x10_show_name(struct device *dev, static ssize_t name_show(struct device *dev, struct device_attribute *da,
struct device_attribute *da, char *buf)
char *buf)
{ {
struct adt7x10_data *data = dev_get_drvdata(dev); struct adt7x10_data *data = dev_get_drvdata(dev);
...@@ -359,7 +358,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, adt7x10_show_alarm, ...@@ -359,7 +358,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, adt7x10_show_alarm,
NULL, ADT7X10_STAT_T_HIGH); NULL, ADT7X10_STAT_T_HIGH);
static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, adt7x10_show_alarm, static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, adt7x10_show_alarm,
NULL, ADT7X10_STAT_T_CRIT); NULL, ADT7X10_STAT_T_CRIT);
static DEVICE_ATTR(name, S_IRUGO, adt7x10_show_name, NULL); static DEVICE_ATTR_RO(name);
static struct attribute *adt7x10_attributes[] = { static struct attribute *adt7x10_attributes[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册