diff mbox series

[7/8] rtc: bq32k: use DEVICE_ATTR_RW macro

Message ID 20210602073820.11011-8-thunder.leizhen@huawei.com (mailing list archive)
State New, archived
Headers show
Series rtc: use DEVICE_ATTR_* macro to simplify code | expand

Commit Message

Leizhen (ThunderTown) June 2, 2021, 7:38 a.m. UTC
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 mbox series

Patch

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