Commit f731707c authored by Zhen Lei's avatar Zhen Lei Committed by Marc Kleine-Budde
Browse files

can: janz-ican3: use DEVICE_ATTR_RO/RW() helper macro

Use DEVICE_ATTR_RO/RW() helper macro instead of plain DEVICE_ATTR(), which
makes the code a bit shorter and easier to read.

Link: https://lore.kernel.org/r/20210603111739.11983-1-thunder.leizhen@huawei.com


Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 681e4a76
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -1815,7 +1815,7 @@ static int ican3_get_berr_counter(const struct net_device *ndev,
 * Sysfs Attributes
 */

static ssize_t ican3_sysfs_show_term(struct device *dev,
static ssize_t termination_show(struct device *dev,
				struct device_attribute *attr,
				char *buf)
{
@@ -1834,7 +1834,7 @@ static ssize_t ican3_sysfs_show_term(struct device *dev,
	return snprintf(buf, PAGE_SIZE, "%u\n", mod->termination_enabled);
}

static ssize_t ican3_sysfs_set_term(struct device *dev,
static ssize_t termination_store(struct device *dev,
				 struct device_attribute *attr,
				 const char *buf, size_t count)
{
@@ -1852,7 +1852,7 @@ static ssize_t ican3_sysfs_set_term(struct device *dev,
	return count;
}

static ssize_t ican3_sysfs_show_fwinfo(struct device *dev,
static ssize_t fwinfo_show(struct device *dev,
			   struct device_attribute *attr,
			   char *buf)
{
@@ -1861,9 +1861,8 @@ static ssize_t ican3_sysfs_show_fwinfo(struct device *dev,
	return scnprintf(buf, PAGE_SIZE, "%s\n", mod->fwinfo);
}

static DEVICE_ATTR(termination, 0644, ican3_sysfs_show_term,
		   ican3_sysfs_set_term);
static DEVICE_ATTR(fwinfo, 0444, ican3_sysfs_show_fwinfo, NULL);
static DEVICE_ATTR_RW(termination);
static DEVICE_ATTR_RO(fwinfo);

static struct attribute *ican3_sysfs_attrs[] = {
	&dev_attr_termination.attr,