From: Julia Lawall Date: Thu, 22 Dec 2016 12:05:00 +0000 (+0100) Subject: hwmon: (mcp3021) use permission-specific DEVICE_ATTR variants X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5c2f0dd5705a33b4a3256934dae83727c120fd50;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 [groeck: Updated description] Signed-off-by: Guenter Roeck --- 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)