Skip to contentSkip to conversation

mfd: tps65010: Convert to DEFINE_SHOW_ATTRIBUTE

PATCH New Qinglang Miao 1 participant 1 message Sep 19, 2020 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mfd: tps65010: Convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
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(-)
drivers/mfd/tps65010.c +2 -12
index 7e7dbee58..f6d6b6c18 100644
@@ -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
 
Signature · 1 line
2.23.0