Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f856175 authored by Julia Lawall's avatar Julia Lawall Committed by Guenter Roeck
Browse files

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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
[groeck: Updated description]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 5c2f0dd5
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -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 @@ show_global_beep(struct device *dev, struct device_attribute *attr, char *buf)
}

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 @@ store_global_beep(struct device *dev, struct device_attribute *attr,
/* 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,7 +1065,7 @@ show_caseopen(struct device *dev, struct device_attribute *attr, char *buf)
}

static ssize_t
clear_caseopen(struct device *dev, struct device_attribute *attr,
intrusion0_alarm_store(struct device *dev, struct device_attribute *attr,
		       const char *buf, size_t count)
{
	struct nct6683_data *data = dev_get_drvdata(dev);
@@ -1102,10 +1103,8 @@ clear_caseopen(struct device *dev, struct device_attribute *attr,
	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,