[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200919021833.191196-1-miaoqinglang@huawei.com>
Date: Sat, 19 Sep 2020 10:18:33 +0800
From: Qinglang Miao <miaoqinglang@...wei.com>
To: Lee Jones <lee.jones@...aro.org>
CC: <linux-kernel@...r.kernel.org>,
Qinglang Miao <miaoqinglang@...wei.com>
Subject: [PATCH -next v2] mfd: tps65010: 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/tps65010.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 7e7dbee58..f6d6b6c18 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -179,7 +179,7 @@ static inline void show_chgconfig(int por, const char *label, u8 chgconfig) { }
#ifdef CONFIG_DEBUG_FS
-static int dbg_show(struct seq_file *s, void *_)
+static int debug_show(struct seq_file *s, void *_)
{
struct tps65010 *tps = s->private;
u8 value, v2;
@@ -283,17 +283,7 @@ static int dbg_show(struct seq_file *s, void *_)
return 0;
}
-static int dbg_tps_open(struct inode *inode, struct file *file)
-{
- return single_open(file, dbg_show, inode->i_private);
-}
-
-static const struct file_operations debug_fops = {
- .open = dbg_tps_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(debug);
#define DEBUG_FOPS &debug_fops
--
2.23.0
Powered by blists - more mailing lists