lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210602073820.11011-9-thunder.leizhen@huawei.com>
Date:   Wed, 2 Jun 2021 15:38:20 +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 8/8] rtc: ab8500: 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-ab8500.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index b40048871295d12..540a1a5d42d0b57 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -274,9 +274,9 @@ static int ab8500_rtc_get_calibration(struct device *dev, int *calibration)
 	return retval;
 }
 
-static ssize_t ab8500_sysfs_store_rtc_calibration(struct device *dev,
-				struct device_attribute *attr,
-				const char *buf, size_t count)
+static ssize_t rtc_calibration_store(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t count)
 {
 	int retval;
 	int calibration = 0;
@@ -291,8 +291,8 @@ static ssize_t ab8500_sysfs_store_rtc_calibration(struct device *dev,
 	return retval ? retval : count;
 }
 
-static ssize_t ab8500_sysfs_show_rtc_calibration(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t rtc_calibration_show(struct device *dev,
+				    struct device_attribute *attr, char *buf)
 {
 	int  retval = 0;
 	int  calibration = 0;
@@ -307,9 +307,7 @@ static ssize_t ab8500_sysfs_show_rtc_calibration(struct device *dev,
 	return sprintf(buf, "%d\n", calibration);
 }
 
-static DEVICE_ATTR(rtc_calibration, S_IRUGO | S_IWUSR,
-		   ab8500_sysfs_show_rtc_calibration,
-		   ab8500_sysfs_store_rtc_calibration);
+static DEVICE_ATTR_RW(rtc_calibration);
 
 static struct attribute *ab8500_rtc_attrs[] = {
 	&dev_attr_rtc_calibration.attr,
-- 
2.26.0.106.g9fadedd


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ