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-5-thunder.leizhen@huawei.com>
Date:   Wed, 2 Jun 2021 15:38:16 +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 4/8] rtc: isl1208: use DEVICE_ATTR_* macro

Use DEVICE_ATTR_* 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-isl1208.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 182dfa605515572..1e0069ab9769647 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -654,9 +654,8 @@ static const struct rtc_class_ops isl1208_rtc_ops = {
 
 /* sysfs interface */
 
-static ssize_t
-isl1208_sysfs_show_atrim(struct device *dev,
-			 struct device_attribute *attr, char *buf)
+static ssize_t atrim_show(struct device *dev,
+			  struct device_attribute *attr, char *buf)
 {
 	int atr = isl1208_i2c_get_atr(to_i2c_client(dev->parent));
 	if (atr < 0)
@@ -665,11 +664,10 @@ isl1208_sysfs_show_atrim(struct device *dev,
 	return sprintf(buf, "%d.%.2d pF\n", atr >> 2, (atr & 0x3) * 25);
 }
 
-static DEVICE_ATTR(atrim, S_IRUGO, isl1208_sysfs_show_atrim, NULL);
+static DEVICE_ATTR_RO(atrim);
 
-static ssize_t
-isl1208_sysfs_show_dtrim(struct device *dev,
-			 struct device_attribute *attr, char *buf)
+static ssize_t dtrim_show(struct device *dev,
+			  struct device_attribute *attr, char *buf)
 {
 	int dtr = isl1208_i2c_get_dtr(to_i2c_client(dev->parent));
 	if (dtr < 0)
@@ -678,11 +676,10 @@ isl1208_sysfs_show_dtrim(struct device *dev,
 	return sprintf(buf, "%d ppm\n", dtr - 100);
 }
 
-static DEVICE_ATTR(dtrim, S_IRUGO, isl1208_sysfs_show_dtrim, NULL);
+static DEVICE_ATTR_RO(dtrim);
 
-static ssize_t
-isl1208_sysfs_show_usr(struct device *dev,
-		       struct device_attribute *attr, char *buf)
+static ssize_t usr_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
 {
 	int usr = isl1208_i2c_get_usr(to_i2c_client(dev->parent));
 	if (usr < 0)
@@ -691,10 +688,9 @@ isl1208_sysfs_show_usr(struct device *dev,
 	return sprintf(buf, "0x%.4x\n", usr);
 }
 
-static ssize_t
-isl1208_sysfs_store_usr(struct device *dev,
-			struct device_attribute *attr,
-			const char *buf, size_t count)
+static ssize_t usr_store(struct device *dev,
+			 struct device_attribute *attr,
+			 const char *buf, size_t count)
 {
 	int usr = -1;
 
@@ -715,8 +711,7 @@ isl1208_sysfs_store_usr(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr,
-		   isl1208_sysfs_store_usr);
+static DEVICE_ATTR_RW(usr);
 
 static struct attribute *isl1208_rtc_attrs[] = {
 	&dev_attr_atrim.attr,
-- 
2.26.0.106.g9fadedd


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ