From 329beb71fd666017c057b2682aeab7fc04c01a63 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 22 Dec 2016 13:05:17 +0100 Subject: [PATCH] hwmon: (w83793) 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: Julia Lawall [groeck: Updated description] Signed-off-by: Guenter Roeck --- drivers/hwmon/w83793.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 816aa6caf5d5..dab5c515d5a3 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c @@ -324,7 +324,7 @@ static struct i2c_driver w83793_driver = { }; static ssize_t -show_vrm(struct device *dev, struct device_attribute *attr, char *buf) +vrm_show(struct device *dev, struct device_attribute *attr, char *buf) { struct w83793_data *data = dev_get_drvdata(dev); return sprintf(buf, "%d\n", data->vrm); @@ -342,7 +342,7 @@ show_vid(struct device *dev, struct device_attribute *attr, char *buf) } static ssize_t -store_vrm(struct device *dev, struct device_attribute *attr, +vrm_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct w83793_data *data = dev_get_drvdata(dev); @@ -1169,7 +1169,7 @@ static struct sensor_device_attribute_2 w83793_vid[] = { SENSOR_ATTR_2(cpu0_vid, S_IRUGO, show_vid, NULL, NOT_USED, 0), SENSOR_ATTR_2(cpu1_vid, S_IRUGO, show_vid, NULL, NOT_USED, 1), }; -static DEVICE_ATTR(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm); +static DEVICE_ATTR_RW(vrm); static struct sensor_device_attribute_2 sda_single_files[] = { SENSOR_ATTR_2(intrusion0_alarm, S_IWUSR | S_IRUGO, show_alarm_beep, -- 2.45.2