[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200919021832.191137-1-miaoqinglang@huawei.com>
Date: Sat, 19 Sep 2020 10:18:32 +0800
From: Qinglang Miao <miaoqinglang@...wei.com>
To: Linus Walleij <linus.walleij@...aro.org>,
Lee Jones <lee.jones@...aro.org>
CC: <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
Qinglang Miao <miaoqinglang@...wei.com>
Subject: [PATCH -next v2] mfd: ab3100-otp: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Qinglang Miao <miaoqinglang@...wei.com>
---
v2: based on linux-next(20200917), and can be applied to
mainline cleanly now.
drivers/mfd/ab3100-otp.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c
index c393102e3..e5d294805 100644
--- a/drivers/mfd/ab3100-otp.c
+++ b/drivers/mfd/ab3100-otp.c
@@ -96,7 +96,7 @@ static int __init ab3100_otp_read(struct ab3100_otp *otp)
* the contents of the OTP.
*/
#ifdef CONFIG_DEBUG_FS
-static int ab3100_show_otp(struct seq_file *s, void *v)
+static int ab3100_otp_show(struct seq_file *s, void *v)
{
struct ab3100_otp *otp = s->private;
@@ -110,23 +110,13 @@ static int ab3100_show_otp(struct seq_file *s, void *v)
return 0;
}
-static int ab3100_otp_open(struct inode *inode, struct file *file)
-{
- return single_open(file, ab3100_show_otp, inode->i_private);
-}
-
-static const struct file_operations ab3100_otp_operations = {
- .open = ab3100_otp_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(ab3100_otp);
static void __init ab3100_otp_init_debugfs(struct device *dev,
struct ab3100_otp *otp)
{
otp->debugfs = debugfs_create_file("ab3100_otp", S_IFREG | S_IRUGO,
- NULL, otp, &ab3100_otp_operations);
+ NULL, otp, &ab3100_otp_fops);
}
static void __exit ab3100_otp_exit_debugfs(struct ab3100_otp *otp)
--
2.23.0
Powered by blists - more mailing lists