Thread (10 messages) 10 messages, 2 authors, 2021-06-04
STALE1825d

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

From: Zhen Lei <hidden>
Date: 2021-06-02 07:39:48
Also in: linux-rtc, lkml
Subsystem: real time clock (rtc) subsystem, the rest · Maintainers: Alexandre Belloni, Linus Torvalds

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 <redacted>
---
 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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help