Commit e57959a6 authored by Julia Lawall's avatar Julia Lawall Committed by Guenter Roeck

hwmon: (lm90) 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 ddc64ae8
...@@ -830,7 +830,7 @@ static u16 temp_to_u16_adt7461(struct lm90_data *data, long val) ...@@ -830,7 +830,7 @@ static u16 temp_to_u16_adt7461(struct lm90_data *data, long val)
} }
/* pec used for ADM1032 only */ /* pec used for ADM1032 only */
static ssize_t show_pec(struct device *dev, struct device_attribute *dummy, static ssize_t pec_show(struct device *dev, struct device_attribute *dummy,
char *buf) char *buf)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
...@@ -838,8 +838,8 @@ static ssize_t show_pec(struct device *dev, struct device_attribute *dummy, ...@@ -838,8 +838,8 @@ static ssize_t show_pec(struct device *dev, struct device_attribute *dummy,
return sprintf(buf, "%d\n", !!(client->flags & I2C_CLIENT_PEC)); return sprintf(buf, "%d\n", !!(client->flags & I2C_CLIENT_PEC));
} }
static ssize_t set_pec(struct device *dev, struct device_attribute *dummy, static ssize_t pec_store(struct device *dev, struct device_attribute *dummy,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
long val; long val;
...@@ -863,7 +863,7 @@ static ssize_t set_pec(struct device *dev, struct device_attribute *dummy, ...@@ -863,7 +863,7 @@ static ssize_t set_pec(struct device *dev, struct device_attribute *dummy,
return count; return count;
} }
static DEVICE_ATTR(pec, S_IWUSR | S_IRUGO, show_pec, set_pec); static DEVICE_ATTR_RW(pec);
static int lm90_get_temp11(struct lm90_data *data, int index) static int lm90_get_temp11(struct lm90_data *data, int index)
{ {
......
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