diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-12-22 13:05:00 +0100 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2017-01-02 10:19:45 -0800 |
commit | 5c2f0dd5705a33b4a3256934dae83727c120fd50 (patch) | |
tree | a207d1e3fdbb79569c776f304e28fbec437ff46f | |
parent | 918b405699d7f121be6e963de7655fd1416ba2d2 (diff) | |
download | linux-5c2f0dd5705a33b4a3256934dae83727c120fd50.tar.bz2 |
hwmon: (mcp3021) 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>
-rw-r--r-- | drivers/hwmon/mcp3021.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwmon/mcp3021.c b/drivers/hwmon/mcp3021.c index 1929734c3b1d..de886f82101b 100644 --- a/drivers/hwmon/mcp3021.c +++ b/drivers/hwmon/mcp3021.c @@ -86,8 +86,8 @@ static inline u16 volts_from_reg(struct mcp3021_data *data, u16 val) return DIV_ROUND_CLOSEST(data->vdd * val, 1 << data->output_res); } -static ssize_t show_in_input(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t in0_input_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); struct mcp3021_data *data = i2c_get_clientdata(client); @@ -102,7 +102,7 @@ static ssize_t show_in_input(struct device *dev, struct device_attribute *attr, return sprintf(buf, "%d\n", in_input); } -static DEVICE_ATTR(in0_input, 0444, show_in_input, NULL); +static DEVICE_ATTR_RO(in0_input); static int mcp3021_probe(struct i2c_client *client, const struct i2c_device_id *id) |