lkml.org 
[lkml]   [2021]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/8] rtc: rx8025: use DEVICE_ATTR_RW macro
Date
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 --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

\
 
 \ /
  Last update: 2021-06-02 09:40    [W:0.095 / U:1.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site