[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210602073820.11011-8-thunder.leizhen@huawei.com>
Date: Wed, 2 Jun 2021 15:38:19 +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 7/8] rtc: bq32k: 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-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
Powered by blists - more mailing lists