From 1f856175e44bc2b8c5c961854abe80fb6c106229 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 22 Dec 2016 13:05:01 +0100 Subject: [PATCH] hwmon: (nct6683) 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/nct6683.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c index 559c596b24f9..8b0bc4fc06e8 100644 --- a/drivers/hwmon/nct6683.c +++ b/drivers/hwmon/nct6683.c @@ -979,7 +979,7 @@ static const struct sensor_template_group nct6683_pwm_template_group = { }; static ssize_t -show_global_beep(struct device *dev, struct device_attribute *attr, char *buf) +beep_enable_show(struct device *dev, struct device_attribute *attr, char *buf) { struct nct6683_data *data = dev_get_drvdata(dev); int ret; @@ -1004,7 +1004,7 @@ error: } static ssize_t -store_global_beep(struct device *dev, struct device_attribute *attr, +beep_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct nct6683_data *data = dev_get_drvdata(dev); @@ -1039,7 +1039,8 @@ error: /* Case open detection */ static ssize_t -show_caseopen(struct device *dev, struct device_attribute *attr, char *buf) +intrusion0_alarm_show(struct device *dev, struct device_attribute *attr, + char *buf) { struct nct6683_data *data = dev_get_drvdata(dev); int ret; @@ -1064,8 +1065,8 @@ error: } static ssize_t -clear_caseopen(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +intrusion0_alarm_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { struct nct6683_data *data = dev_get_drvdata(dev); unsigned long val; @@ -1102,10 +1103,8 @@ error: return count; } -static DEVICE_ATTR(intrusion0_alarm, S_IWUSR | S_IRUGO, show_caseopen, - clear_caseopen); -static DEVICE_ATTR(beep_enable, S_IWUSR | S_IRUGO, show_global_beep, - store_global_beep); +static DEVICE_ATTR_RW(intrusion0_alarm); +static DEVICE_ATTR_RW(beep_enable); static struct attribute *nct6683_attributes_other[] = { &dev_attr_intrusion0_alarm.attr, -- 2.20.1