diff mbox series

[2/8] rtc: rx8025: use DEVICE_ATTR_RW macro

Message ID 20210602073820.11011-3-thunder.leizhen@huawei.com
State New
Headers show
Series rtc: use DEVICE_ATTR_* macro to simplify code | expand

Commit Message

Leizhen (ThunderTown) June 2, 2021, 7:38 a.m. UTC
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@huawei.com>
---
 drivers/rtc/rtc-rx8025.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
diff mbox series

Patch

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)
 {