From: Zhen Lei <thunder.leizhen@huawei.com>
To: Lee Jones <lee.jones@linaro.org>,
patches <patches@opensource.cirrus.com>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH 8/9] mfd: intel_soc_pmic_bxtwc: use DEVICE_ATTR_ADMIN_RW macro
Date: Wed, 2 Jun 2021 19:43:38 +0800 [thread overview]
Message-ID: <20210602114339.11223-9-thunder.leizhen@huawei.com> (raw)
In-Reply-To: <20210602114339.11223-1-thunder.leizhen@huawei.com>
Use DEVICE_ATTR_ADMIN_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/mfd/intel_soc_pmic_bxtwc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
index 47d0d3a69a58a37..bc069c4daa60393 100644
--- a/drivers/mfd/intel_soc_pmic_bxtwc.c
+++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
@@ -330,14 +330,14 @@ static int regmap_ipc_byte_reg_write(void *context, unsigned int reg,
/* sysfs interfaces to r/w PMIC registers, required by initial script */
static unsigned long bxtwc_reg_addr;
-static ssize_t bxtwc_reg_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t addr_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
return sprintf(buf, "0x%lx\n", bxtwc_reg_addr);
}
-static ssize_t bxtwc_reg_store(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t addr_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
{
if (kstrtoul(buf, 0, &bxtwc_reg_addr)) {
dev_err(dev, "Invalid register address\n");
@@ -346,8 +346,8 @@ static ssize_t bxtwc_reg_store(struct device *dev,
return (ssize_t)count;
}
-static ssize_t bxtwc_val_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t val_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
int ret;
unsigned int val;
@@ -362,8 +362,8 @@ static ssize_t bxtwc_val_show(struct device *dev,
return sprintf(buf, "0x%02x\n", val);
}
-static ssize_t bxtwc_val_store(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t val_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
{
int ret;
unsigned int val;
@@ -382,8 +382,8 @@ static ssize_t bxtwc_val_store(struct device *dev,
return count;
}
-static DEVICE_ATTR(addr, S_IWUSR | S_IRUSR, bxtwc_reg_show, bxtwc_reg_store);
-static DEVICE_ATTR(val, S_IWUSR | S_IRUSR, bxtwc_val_show, bxtwc_val_store);
+static DEVICE_ATTR_ADMIN_RW(addr);
+static DEVICE_ATTR_ADMIN_RW(val);
static struct attribute *bxtwc_attrs[] = {
&dev_attr_addr.attr,
&dev_attr_val.attr,
--
2.26.0.106.g9fadedd
next prev parent reply other threads:[~2021-06-02 11:44 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 11:43 [PATCH 0/9] mfd: use DEVICE_ATTR_* macro to simplify code Zhen Lei
2021-06-02 11:43 ` [PATCH 1/9] mfd: wm831x: use DEVICE_ATTR_RO macro Zhen Lei
2021-06-02 12:39 ` Charles Keepax
2021-06-15 11:50 ` Lee Jones
2021-06-02 11:43 ` [PATCH 2/9] mfd: ucb1x00-assabet: " Zhen Lei
2021-06-15 11:51 ` Lee Jones
2021-06-02 11:43 ` [PATCH 3/9] mfd: timberdale: " Zhen Lei
2021-06-15 11:51 ` Lee Jones
2021-06-02 11:43 ` [PATCH 4/9] mfd: sm501: " Zhen Lei
2021-06-15 12:03 ` Lee Jones
2021-06-02 11:43 ` [PATCH 5/9] mfd: pcf50633: use DEVICE_ATTR_ADMIN_RO macro Zhen Lei
2021-06-15 12:03 ` Lee Jones
2021-06-02 11:43 ` [PATCH 6/9] mfd: kempld-core: use DEVICE_ATTR_RO macro Zhen Lei
2021-06-15 12:14 ` Lee Jones
2021-06-02 11:43 ` [PATCH 7/9] mfd: janz-cmodio: " Zhen Lei
2021-06-15 12:14 ` Lee Jones
2021-06-02 11:43 ` Zhen Lei [this message]
2021-06-15 12:14 ` [PATCH 8/9] mfd: intel_soc_pmic_bxtwc: use DEVICE_ATTR_ADMIN_RW macro Lee Jones
2021-06-02 11:43 ` [PATCH 9/9] mfd: ab8500-core: use DEVICE_ATTR_RO/RW macro Zhen Lei
2021-06-15 12:15 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210602114339.11223-9-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®