Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Qinglang Miao <[email protected]>
---
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