Commit 2f2dbea6 authored by Julia Lawall's avatar Julia Lawall Committed by Guenter Roeck

hwmon: (lm95234) 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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 1fc67376
...@@ -450,8 +450,8 @@ static ssize_t set_offset(struct device *dev, struct device_attribute *attr, ...@@ -450,8 +450,8 @@ static ssize_t set_offset(struct device *dev, struct device_attribute *attr,
return count; return count;
} }
static ssize_t show_interval(struct device *dev, struct device_attribute *attr, static ssize_t update_interval_show(struct device *dev,
char *buf) struct device_attribute *attr, char *buf)
{ {
struct lm95234_data *data = dev_get_drvdata(dev); struct lm95234_data *data = dev_get_drvdata(dev);
int ret = lm95234_update_device(data); int ret = lm95234_update_device(data);
...@@ -463,8 +463,9 @@ static ssize_t show_interval(struct device *dev, struct device_attribute *attr, ...@@ -463,8 +463,9 @@ static ssize_t show_interval(struct device *dev, struct device_attribute *attr,
DIV_ROUND_CLOSEST(data->interval * 1000, HZ)); DIV_ROUND_CLOSEST(data->interval * 1000, HZ));
} }
static ssize_t set_interval(struct device *dev, struct device_attribute *attr, static ssize_t update_interval_store(struct device *dev,
const char *buf, size_t count) struct device_attribute *attr,
const char *buf, size_t count)
{ {
struct lm95234_data *data = dev_get_drvdata(dev); struct lm95234_data *data = dev_get_drvdata(dev);
int ret = lm95234_update_device(data); int ret = lm95234_update_device(data);
...@@ -566,8 +567,7 @@ static SENSOR_DEVICE_ATTR(temp4_offset, S_IWUSR | S_IRUGO, show_offset, ...@@ -566,8 +567,7 @@ static SENSOR_DEVICE_ATTR(temp4_offset, S_IWUSR | S_IRUGO, show_offset,
static SENSOR_DEVICE_ATTR(temp5_offset, S_IWUSR | S_IRUGO, show_offset, static SENSOR_DEVICE_ATTR(temp5_offset, S_IWUSR | S_IRUGO, show_offset,
set_offset, 3); set_offset, 3);
static DEVICE_ATTR(update_interval, S_IWUSR | S_IRUGO, show_interval, static DEVICE_ATTR_RW(update_interval);
set_interval);
static struct attribute *lm95234_common_attrs[] = { static struct attribute *lm95234_common_attrs[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment