[PATCH 1/1] rtc: x1205: use DEVICE_ATTR_RO macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use DEVICE_ATTR_RO 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@xxxxxxxxxx>
---
 drivers/rtc/rtc-x1205.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index d1d5a44d9122ad9..351e4725a7a5439 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -566,8 +566,8 @@ static const struct rtc_class_ops x1205_rtc_ops = {
 	.set_alarm	= x1205_rtc_set_alarm,
 };
 
-static ssize_t x1205_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 err, atrim;
 
@@ -577,10 +577,10 @@ static ssize_t x1205_sysfs_show_atrim(struct device *dev,
 
 	return sprintf(buf, "%d.%02d pF\n", atrim / 1000, atrim % 1000);
 }
-static DEVICE_ATTR(atrim, S_IRUGO, x1205_sysfs_show_atrim, NULL);
+static DEVICE_ATTR_RO(atrim);
 
-static ssize_t x1205_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 err, dtrim;
 
@@ -590,7 +590,7 @@ static ssize_t x1205_sysfs_show_dtrim(struct device *dev,
 
 	return sprintf(buf, "%d ppm\n", dtrim);
 }
-static DEVICE_ATTR(dtrim, S_IRUGO, x1205_sysfs_show_dtrim, NULL);
+static DEVICE_ATTR_RO(dtrim);
 
 static int x1205_sysfs_register(struct device *dev)
 {
-- 
2.26.0.106.g9fadedd





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux