1
0
Fork 0

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 <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
hifive-unleashed-5.1
Julia Lawall 2016-12-22 13:05:01 +01:00 committed by Guenter Roeck
parent 5c2f0dd570
commit 1f856175e4
1 changed files with 8 additions and 9 deletions

View File

@ -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,