All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] rtc: use DEVICE_ATTR_* macro to simplify code
@ 2021-06-02  7:38 ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

DEVICE_ATTR_RO marks ReadOnly file, DEVICE_ATTR_RW marks ReadWrite file,
it's clearer than DEVICE_ATTR.

Zhen Lei (8):
  rtc: x1205: use DEVICE_ATTR_RO macro
  rtc: rx8025: use DEVICE_ATTR_RW macro
  rtc: rs5c372: use DEVICE_ATTR_RO macro
  rtc: isl1208: use DEVICE_ATTR_* macro
  rtc: ds1685: use DEVICE_ATTR_RO macro
  rtc: ds1343: use DEVICE_ATTR_* macro
  rtc: bq32k: use DEVICE_ATTR_RW macro
  rtc: ab8500: use DEVICE_ATTR_RW macro

 drivers/rtc/rtc-ab8500.c  | 14 ++++++--------
 drivers/rtc/rtc-bq32k.c   | 16 +++++++---------
 drivers/rtc/rtc-ds1343.c  | 19 +++++++++----------
 drivers/rtc/rtc-ds1685.c  | 27 ++++++++++++---------------
 drivers/rtc/rtc-isl1208.c | 29 ++++++++++++-----------------
 drivers/rtc/rtc-rs5c372.c | 12 ++++++------
 drivers/rtc/rtc-rx8025.c  | 16 +++++++---------
 drivers/rtc/rtc-x1205.c   | 12 ++++++------
 8 files changed, 65 insertions(+), 80 deletions(-)

-- 
2.26.0.106.g9fadedd



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/8] rtc: use DEVICE_ATTR_* macro to simplify code
@ 2021-06-02  7:38 ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

DEVICE_ATTR_RO marks ReadOnly file, DEVICE_ATTR_RW marks ReadWrite file,
it's clearer than DEVICE_ATTR.

Zhen Lei (8):
  rtc: x1205: use DEVICE_ATTR_RO macro
  rtc: rx8025: use DEVICE_ATTR_RW macro
  rtc: rs5c372: use DEVICE_ATTR_RO macro
  rtc: isl1208: use DEVICE_ATTR_* macro
  rtc: ds1685: use DEVICE_ATTR_RO macro
  rtc: ds1343: use DEVICE_ATTR_* macro
  rtc: bq32k: use DEVICE_ATTR_RW macro
  rtc: ab8500: use DEVICE_ATTR_RW macro

 drivers/rtc/rtc-ab8500.c  | 14 ++++++--------
 drivers/rtc/rtc-bq32k.c   | 16 +++++++---------
 drivers/rtc/rtc-ds1343.c  | 19 +++++++++----------
 drivers/rtc/rtc-ds1685.c  | 27 ++++++++++++---------------
 drivers/rtc/rtc-isl1208.c | 29 ++++++++++++-----------------
 drivers/rtc/rtc-rs5c372.c | 12 ++++++------
 drivers/rtc/rtc-rx8025.c  | 16 +++++++---------
 drivers/rtc/rtc-x1205.c   | 12 ++++++------
 8 files changed, 65 insertions(+), 80 deletions(-)

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/8] rtc: x1205: use DEVICE_ATTR_RO macro
  2021-06-02  7:38 ` Zhen Lei
@ 2021-06-02  7:38   ` Zhen Lei
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.com>
---
 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



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 1/8] rtc: x1205: use DEVICE_ATTR_RO macro
@ 2021-06-02  7:38   ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.com>
---
 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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/8] rtc: rx8025: use DEVICE_ATTR_RW macro
  2021-06-02  7:38 ` Zhen Lei
@ 2021-06-02  7:38   ` Zhen Lei
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/8] rtc: rx8025: use DEVICE_ATTR_RW macro
@ 2021-06-02  7:38   ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/8] rtc: rs5c372: use DEVICE_ATTR_RO macro
  2021-06-02  7:38 ` Zhen Lei
@ 2021-06-02  7:38   ` Zhen Lei
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.com>
---
 drivers/rtc/rtc-rs5c372.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 80980414890c703..eae0fbad64c109e 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -496,8 +496,8 @@ static const struct rtc_class_ops rs5c372_rtc_ops = {
 
 #if IS_ENABLED(CONFIG_RTC_INTF_SYSFS)
 
-static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t trim_show(struct device *dev,
+			 struct device_attribute *attr, char *buf)
 {
 	int err, trim;
 
@@ -507,10 +507,10 @@ static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
 
 	return sprintf(buf, "%d\n", trim);
 }
-static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL);
+static DEVICE_ATTR_RO(trim);
 
-static ssize_t rs5c372_sysfs_show_osc(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t osc_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
 {
 	int err, osc;
 
@@ -520,7 +520,7 @@ static ssize_t rs5c372_sysfs_show_osc(struct device *dev,
 
 	return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
 }
-static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL);
+static DEVICE_ATTR_RO(osc);
 
 static int rs5c_sysfs_register(struct device *dev)
 {
-- 
2.26.0.106.g9fadedd



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/8] rtc: rs5c372: use DEVICE_ATTR_RO macro
@ 2021-06-02  7:38   ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.com>
---
 drivers/rtc/rtc-rs5c372.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 80980414890c703..eae0fbad64c109e 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -496,8 +496,8 @@ static const struct rtc_class_ops rs5c372_rtc_ops = {
 
 #if IS_ENABLED(CONFIG_RTC_INTF_SYSFS)
 
-static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t trim_show(struct device *dev,
+			 struct device_attribute *attr, char *buf)
 {
 	int err, trim;
 
@@ -507,10 +507,10 @@ static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
 
 	return sprintf(buf, "%d\n", trim);
 }
-static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL);
+static DEVICE_ATTR_RO(trim);
 
-static ssize_t rs5c372_sysfs_show_osc(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t osc_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
 {
 	int err, osc;
 
@@ -520,7 +520,7 @@ static ssize_t rs5c372_sysfs_show_osc(struct device *dev,
 
 	return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
 }
-static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL);
+static DEVICE_ATTR_RO(osc);
 
 static int rs5c_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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/8] rtc: isl1208: use DEVICE_ATTR_* macro
  2021-06-02  7:38 ` Zhen Lei
@ 2021-06-02  7:38   ` Zhen Lei
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.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



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/8] rtc: isl1208: use DEVICE_ATTR_* macro
@ 2021-06-02  7:38   ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/8] rtc: ds1685: use DEVICE_ATTR_RO macro
  2021-06-02  7:38 ` Zhen Lei
@ 2021-06-02  7:38   ` Zhen Lei
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.com>
---
 drivers/rtc/rtc-ds1685.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 75db7ab654a5ae1..60209320c7ac9ca 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -975,14 +975,13 @@ static int ds1685_nvram_write(void *priv, unsigned int pos, void *val,
 /* SysFS interface */
 
 /**
- * ds1685_rtc_sysfs_battery_show - sysfs file for main battery status.
+ * battery_show - sysfs file for main battery status.
  * @dev: pointer to device structure.
  * @attr: pointer to device_attribute structure.
  * @buf: pointer to char array to hold the output.
  */
-static ssize_t
-ds1685_rtc_sysfs_battery_show(struct device *dev,
-			      struct device_attribute *attr, char *buf)
+static ssize_t battery_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
 	u8 ctrld;
@@ -992,17 +991,16 @@ ds1685_rtc_sysfs_battery_show(struct device *dev,
 	return sprintf(buf, "%s\n",
 			(ctrld & RTC_CTRL_D_VRT) ? "ok" : "not ok or N/A");
 }
-static DEVICE_ATTR(battery, S_IRUGO, ds1685_rtc_sysfs_battery_show, NULL);
+static DEVICE_ATTR_RO(battery);
 
 /**
- * ds1685_rtc_sysfs_auxbatt_show - sysfs file for aux battery status.
+ * auxbatt_show - sysfs file for aux battery status.
  * @dev: pointer to device structure.
  * @attr: pointer to device_attribute structure.
  * @buf: pointer to char array to hold the output.
  */
-static ssize_t
-ds1685_rtc_sysfs_auxbatt_show(struct device *dev,
-			      struct device_attribute *attr, char *buf)
+static ssize_t auxbatt_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
 	u8 ctrl4a;
@@ -1014,17 +1012,16 @@ ds1685_rtc_sysfs_auxbatt_show(struct device *dev,
 	return sprintf(buf, "%s\n",
 			(ctrl4a & RTC_CTRL_4A_VRT2) ? "ok" : "not ok or N/A");
 }
-static DEVICE_ATTR(auxbatt, S_IRUGO, ds1685_rtc_sysfs_auxbatt_show, NULL);
+static DEVICE_ATTR_RO(auxbatt);
 
 /**
- * ds1685_rtc_sysfs_serial_show - sysfs file for silicon serial number.
+ * serial_show - sysfs file for silicon serial number.
  * @dev: pointer to device structure.
  * @attr: pointer to device_attribute structure.
  * @buf: pointer to char array to hold the output.
  */
-static ssize_t
-ds1685_rtc_sysfs_serial_show(struct device *dev,
-			     struct device_attribute *attr, char *buf)
+static ssize_t serial_show(struct device *dev,
+			   struct device_attribute *attr, char *buf)
 {
 	struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
 	u8 ssn[8];
@@ -1035,7 +1032,7 @@ ds1685_rtc_sysfs_serial_show(struct device *dev,
 
 	return sprintf(buf, "%8phC\n", ssn);
 }
-static DEVICE_ATTR(serial, S_IRUGO, ds1685_rtc_sysfs_serial_show, NULL);
+static DEVICE_ATTR_RO(serial);
 
 /*
  * struct ds1685_rtc_sysfs_misc_attrs - list for misc RTC features.
-- 
2.26.0.106.g9fadedd



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/8] rtc: ds1685: use DEVICE_ATTR_RO macro
@ 2021-06-02  7:38   ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.com>
---
 drivers/rtc/rtc-ds1685.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 75db7ab654a5ae1..60209320c7ac9ca 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -975,14 +975,13 @@ static int ds1685_nvram_write(void *priv, unsigned int pos, void *val,
 /* SysFS interface */
 
 /**
- * ds1685_rtc_sysfs_battery_show - sysfs file for main battery status.
+ * battery_show - sysfs file for main battery status.
  * @dev: pointer to device structure.
  * @attr: pointer to device_attribute structure.
  * @buf: pointer to char array to hold the output.
  */
-static ssize_t
-ds1685_rtc_sysfs_battery_show(struct device *dev,
-			      struct device_attribute *attr, char *buf)
+static ssize_t battery_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
 	u8 ctrld;
@@ -992,17 +991,16 @@ ds1685_rtc_sysfs_battery_show(struct device *dev,
 	return sprintf(buf, "%s\n",
 			(ctrld & RTC_CTRL_D_VRT) ? "ok" : "not ok or N/A");
 }
-static DEVICE_ATTR(battery, S_IRUGO, ds1685_rtc_sysfs_battery_show, NULL);
+static DEVICE_ATTR_RO(battery);
 
 /**
- * ds1685_rtc_sysfs_auxbatt_show - sysfs file for aux battery status.
+ * auxbatt_show - sysfs file for aux battery status.
  * @dev: pointer to device structure.
  * @attr: pointer to device_attribute structure.
  * @buf: pointer to char array to hold the output.
  */
-static ssize_t
-ds1685_rtc_sysfs_auxbatt_show(struct device *dev,
-			      struct device_attribute *attr, char *buf)
+static ssize_t auxbatt_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
 	u8 ctrl4a;
@@ -1014,17 +1012,16 @@ ds1685_rtc_sysfs_auxbatt_show(struct device *dev,
 	return sprintf(buf, "%s\n",
 			(ctrl4a & RTC_CTRL_4A_VRT2) ? "ok" : "not ok or N/A");
 }
-static DEVICE_ATTR(auxbatt, S_IRUGO, ds1685_rtc_sysfs_auxbatt_show, NULL);
+static DEVICE_ATTR_RO(auxbatt);
 
 /**
- * ds1685_rtc_sysfs_serial_show - sysfs file for silicon serial number.
+ * serial_show - sysfs file for silicon serial number.
  * @dev: pointer to device structure.
  * @attr: pointer to device_attribute structure.
  * @buf: pointer to char array to hold the output.
  */
-static ssize_t
-ds1685_rtc_sysfs_serial_show(struct device *dev,
-			     struct device_attribute *attr, char *buf)
+static ssize_t serial_show(struct device *dev,
+			   struct device_attribute *attr, char *buf)
 {
 	struct ds1685_priv *rtc = dev_get_drvdata(dev->parent);
 	u8 ssn[8];
@@ -1035,7 +1032,7 @@ ds1685_rtc_sysfs_serial_show(struct device *dev,
 
 	return sprintf(buf, "%8phC\n", ssn);
 }
-static DEVICE_ATTR(serial, S_IRUGO, ds1685_rtc_sysfs_serial_show, NULL);
+static DEVICE_ATTR_RO(serial);
 
 /*
  * struct ds1685_rtc_sysfs_misc_attrs - list for misc RTC features.
-- 
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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/8] rtc: ds1343: use DEVICE_ATTR_* macro
  2021-06-02  7:38 ` Zhen Lei
@ 2021-06-02  7:38   ` Zhen Lei
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.com>
---
 drivers/rtc/rtc-ds1343.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c
index f14ed6c96437b44..ffabb8b69e6d8e6 100644
--- a/drivers/rtc/rtc-ds1343.c
+++ b/drivers/rtc/rtc-ds1343.c
@@ -80,8 +80,8 @@ struct ds1343_priv {
 	int irq;
 };
 
-static ssize_t ds1343_show_glitchfilter(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t glitch_filter_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
 {
 	struct ds1343_priv *priv = dev_get_drvdata(dev->parent);
 	int glitch_filt_status, data;
@@ -99,9 +99,9 @@ static ssize_t ds1343_show_glitchfilter(struct device *dev,
 		return sprintf(buf, "disabled\n");
 }
 
-static ssize_t ds1343_store_glitchfilter(struct device *dev,
-					struct device_attribute *attr,
-					const char *buf, size_t count)
+static ssize_t glitch_filter_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
 {
 	struct ds1343_priv *priv = dev_get_drvdata(dev->parent);
 	int data = 0;
@@ -120,8 +120,7 @@ static ssize_t ds1343_store_glitchfilter(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(glitch_filter, S_IRUGO | S_IWUSR, ds1343_show_glitchfilter,
-			ds1343_store_glitchfilter);
+static DEVICE_ATTR_RW(glitch_filter);
 
 static int ds1343_nvram_write(void *priv, unsigned int off, void *val,
 			      size_t bytes)
@@ -139,8 +138,8 @@ static int ds1343_nvram_read(void *priv, unsigned int off, void *val,
 	return regmap_bulk_read(ds1343->map, DS1343_NVRAM + off, val, bytes);
 }
 
-static ssize_t ds1343_show_tricklecharger(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t trickle_charger_show(struct device *dev,
+				    struct device_attribute *attr, char *buf)
 {
 	struct ds1343_priv *priv = dev_get_drvdata(dev->parent);
 	int res, data;
@@ -183,7 +182,7 @@ static ssize_t ds1343_show_tricklecharger(struct device *dev,
 	return sprintf(buf, "%s %s\n", diodes, resistors);
 }
 
-static DEVICE_ATTR(trickle_charger, S_IRUGO, ds1343_show_tricklecharger, NULL);
+static DEVICE_ATTR_RO(trickle_charger);
 
 static struct attribute *ds1343_attrs[] = {
 	&dev_attr_glitch_filter.attr,
-- 
2.26.0.106.g9fadedd



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/8] rtc: ds1343: use DEVICE_ATTR_* macro
@ 2021-06-02  7:38   ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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@huawei.com>
---
 drivers/rtc/rtc-ds1343.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c
index f14ed6c96437b44..ffabb8b69e6d8e6 100644
--- a/drivers/rtc/rtc-ds1343.c
+++ b/drivers/rtc/rtc-ds1343.c
@@ -80,8 +80,8 @@ struct ds1343_priv {
 	int irq;
 };
 
-static ssize_t ds1343_show_glitchfilter(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t glitch_filter_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
 {
 	struct ds1343_priv *priv = dev_get_drvdata(dev->parent);
 	int glitch_filt_status, data;
@@ -99,9 +99,9 @@ static ssize_t ds1343_show_glitchfilter(struct device *dev,
 		return sprintf(buf, "disabled\n");
 }
 
-static ssize_t ds1343_store_glitchfilter(struct device *dev,
-					struct device_attribute *attr,
-					const char *buf, size_t count)
+static ssize_t glitch_filter_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
 {
 	struct ds1343_priv *priv = dev_get_drvdata(dev->parent);
 	int data = 0;
@@ -120,8 +120,7 @@ static ssize_t ds1343_store_glitchfilter(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(glitch_filter, S_IRUGO | S_IWUSR, ds1343_show_glitchfilter,
-			ds1343_store_glitchfilter);
+static DEVICE_ATTR_RW(glitch_filter);
 
 static int ds1343_nvram_write(void *priv, unsigned int off, void *val,
 			      size_t bytes)
@@ -139,8 +138,8 @@ static int ds1343_nvram_read(void *priv, unsigned int off, void *val,
 	return regmap_bulk_read(ds1343->map, DS1343_NVRAM + off, val, bytes);
 }
 
-static ssize_t ds1343_show_tricklecharger(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t trickle_charger_show(struct device *dev,
+				    struct device_attribute *attr, char *buf)
 {
 	struct ds1343_priv *priv = dev_get_drvdata(dev->parent);
 	int res, data;
@@ -183,7 +182,7 @@ static ssize_t ds1343_show_tricklecharger(struct device *dev,
 	return sprintf(buf, "%s %s\n", diodes, resistors);
 }
 
-static DEVICE_ATTR(trickle_charger, S_IRUGO, ds1343_show_tricklecharger, NULL);
+static DEVICE_ATTR_RO(trickle_charger);
 
 static struct attribute *ds1343_attrs[] = {
 	&dev_attr_glitch_filter.attr,
-- 
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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 7/8] rtc: bq32k: use DEVICE_ATTR_RW macro
  2021-06-02  7:38 ` Zhen Lei
@ 2021-06-02  7:38   ` Zhen Lei
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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-bq32k.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c
index 2235c968842db76..83c799f59331bff 100644
--- a/drivers/rtc/rtc-bq32k.c
+++ b/drivers/rtc/rtc-bq32k.c
@@ -190,9 +190,9 @@ static int trickle_charger_of_init(struct device *dev, struct device_node *node)
 	return 0;
 }
 
-static ssize_t bq32k_sysfs_show_tricklecharge_bypass(struct device *dev,
-					       struct device_attribute *attr,
-					       char *buf)
+static ssize_t trickle_charge_bypass_show(struct device *dev,
+					  struct device_attribute *attr,
+					  char *buf)
 {
 	int reg, error;
 
@@ -203,9 +203,9 @@ static ssize_t bq32k_sysfs_show_tricklecharge_bypass(struct device *dev,
 	return sprintf(buf, "%d\n", (reg & BQ32K_TCFE) ? 1 : 0);
 }
 
-static ssize_t bq32k_sysfs_store_tricklecharge_bypass(struct device *dev,
-						struct device_attribute *attr,
-						const char *buf, size_t count)
+static ssize_t trickle_charge_bypass_store(struct device *dev,
+					   struct device_attribute *attr,
+					   const char *buf, size_t count)
 {
 	int reg, enable, error;
 
@@ -235,9 +235,7 @@ static ssize_t bq32k_sysfs_store_tricklecharge_bypass(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(trickle_charge_bypass, 0644,
-		   bq32k_sysfs_show_tricklecharge_bypass,
-		   bq32k_sysfs_store_tricklecharge_bypass);
+static DEVICE_ATTR_RW(trickle_charge_bypass);
 
 static int bq32k_sysfs_register(struct device *dev)
 {
-- 
2.26.0.106.g9fadedd



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 7/8] rtc: bq32k: use DEVICE_ATTR_RW macro
@ 2021-06-02  7:38   ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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-bq32k.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c
index 2235c968842db76..83c799f59331bff 100644
--- a/drivers/rtc/rtc-bq32k.c
+++ b/drivers/rtc/rtc-bq32k.c
@@ -190,9 +190,9 @@ static int trickle_charger_of_init(struct device *dev, struct device_node *node)
 	return 0;
 }
 
-static ssize_t bq32k_sysfs_show_tricklecharge_bypass(struct device *dev,
-					       struct device_attribute *attr,
-					       char *buf)
+static ssize_t trickle_charge_bypass_show(struct device *dev,
+					  struct device_attribute *attr,
+					  char *buf)
 {
 	int reg, error;
 
@@ -203,9 +203,9 @@ static ssize_t bq32k_sysfs_show_tricklecharge_bypass(struct device *dev,
 	return sprintf(buf, "%d\n", (reg & BQ32K_TCFE) ? 1 : 0);
 }
 
-static ssize_t bq32k_sysfs_store_tricklecharge_bypass(struct device *dev,
-						struct device_attribute *attr,
-						const char *buf, size_t count)
+static ssize_t trickle_charge_bypass_store(struct device *dev,
+					   struct device_attribute *attr,
+					   const char *buf, size_t count)
 {
 	int reg, enable, error;
 
@@ -235,9 +235,7 @@ static ssize_t bq32k_sysfs_store_tricklecharge_bypass(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(trickle_charge_bypass, 0644,
-		   bq32k_sysfs_show_tricklecharge_bypass,
-		   bq32k_sysfs_store_tricklecharge_bypass);
+static DEVICE_ATTR_RW(trickle_charge_bypass);
 
 static int bq32k_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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 8/8] rtc: ab8500: use DEVICE_ATTR_RW macro
  2021-06-02  7:38 ` Zhen Lei
@ 2021-06-02  7:38   ` Zhen Lei
  -1 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 8/8] rtc: ab8500: use DEVICE_ATTR_RW macro
@ 2021-06-02  7:38   ` Zhen Lei
  0 siblings, 0 replies; 20+ messages in thread
From: Zhen Lei @ 2021-06-02  7:38 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	Linus Walleij, linux-arm-kernel, linux-rtc, linux-kernel
  Cc: Zhen Lei

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



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 8/8] rtc: ab8500: use DEVICE_ATTR_RW macro
  2021-06-02  7:38   ` Zhen Lei
@ 2021-06-04  7:46     ` Linus Walleij
  -1 siblings, 0 replies; 20+ messages in thread
From: Linus Walleij @ 2021-06-04  7:46 UTC (permalink / raw)
  To: Zhen Lei
  Cc: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	linux-arm-kernel, linux-rtc, linux-kernel

On Wed, Jun 2, 2021 at 9:38 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:

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

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 8/8] rtc: ab8500: use DEVICE_ATTR_RW macro
@ 2021-06-04  7:46     ` Linus Walleij
  0 siblings, 0 replies; 20+ messages in thread
From: Linus Walleij @ 2021-06-04  7:46 UTC (permalink / raw)
  To: Zhen Lei
  Cc: Alessandro Zummo, Alexandre Belloni, Joshua Kinard,
	linux-arm-kernel, linux-rtc, linux-kernel

On Wed, Jun 2, 2021 at 9:38 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:

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

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-06-04  7:48 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  7:38 [PATCH 0/8] rtc: use DEVICE_ATTR_* macro to simplify code Zhen Lei
2021-06-02  7:38 ` Zhen Lei
2021-06-02  7:38 ` [PATCH 1/8] rtc: x1205: use DEVICE_ATTR_RO macro Zhen Lei
2021-06-02  7:38   ` Zhen Lei
2021-06-02  7:38 ` [PATCH 2/8] rtc: rx8025: use DEVICE_ATTR_RW macro Zhen Lei
2021-06-02  7:38   ` Zhen Lei
2021-06-02  7:38 ` [PATCH 3/8] rtc: rs5c372: use DEVICE_ATTR_RO macro Zhen Lei
2021-06-02  7:38   ` Zhen Lei
2021-06-02  7:38 ` [PATCH 4/8] rtc: isl1208: use DEVICE_ATTR_* macro Zhen Lei
2021-06-02  7:38   ` Zhen Lei
2021-06-02  7:38 ` [PATCH 5/8] rtc: ds1685: use DEVICE_ATTR_RO macro Zhen Lei
2021-06-02  7:38   ` Zhen Lei
2021-06-02  7:38 ` [PATCH 6/8] rtc: ds1343: use DEVICE_ATTR_* macro Zhen Lei
2021-06-02  7:38   ` Zhen Lei
2021-06-02  7:38 ` [PATCH 7/8] rtc: bq32k: use DEVICE_ATTR_RW macro Zhen Lei
2021-06-02  7:38   ` Zhen Lei
2021-06-02  7:38 ` [PATCH 8/8] rtc: ab8500: " Zhen Lei
2021-06-02  7:38   ` Zhen Lei
2021-06-04  7:46   ` Linus Walleij
2021-06-04  7:46     ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.