[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210602073820.11011-3-thunder.leizhen@huawei.com>
Date: Wed, 2 Jun 2021 15:38:14 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Alessandro Zummo <a.zummo@...ertech.it>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Joshua Kinard <kumba@...too.org>,
"Linus Walleij" <linus.walleij@...aro.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
linux-rtc <linux-rtc@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH 2/8] rtc: rx8025: use DEVICE_ATTR_RW macro
Use DEVICE_ATTR_RW macro helper instead of plain DEVICE_ATTR, which makes
the code a bit shorter and easier to read.
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
drivers/rtc/rtc-rx8025.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index c914091819ba7da..73973886db4441d 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -458,9 +458,9 @@ static int rx8025_set_clock_adjust(struct device *dev, int adj)
return 0;
}
-static ssize_t rx8025_sysfs_show_clock_adjust(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t clock_adjust_ppb_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
int err, adj;
@@ -471,9 +471,9 @@ static ssize_t rx8025_sysfs_show_clock_adjust(struct device *dev,
return sprintf(buf, "%d\n", adj);
}
-static ssize_t rx8025_sysfs_store_clock_adjust(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t clock_adjust_ppb_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
int adj, err;
@@ -485,9 +485,7 @@ static ssize_t rx8025_sysfs_store_clock_adjust(struct device *dev,
return err ? err : count;
}
-static DEVICE_ATTR(clock_adjust_ppb, S_IRUGO | S_IWUSR,
- rx8025_sysfs_show_clock_adjust,
- rx8025_sysfs_store_clock_adjust);
+static DEVICE_ATTR_RW(clock_adjust_ppb);
static int rx8025_sysfs_register(struct device *dev)
{
--
2.26.0.106.g9fadedd
Powered by blists - more mailing lists