Skip to contentSkip to conversation

mfd: ab3100-core: Convert to DEFINE_SHOW_ATTRIBUTE

PATCH Superseded Qinglang Miao 2 participants 2 messages Sep 19, 2020 – Sep 29, 2020 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mfd: ab3100-core: 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/ab3100-core.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/mfd/ab3100-core.c +2 -13
index ee71ae04b..4a347d059 100644
@@ -451,7 +451,7 @@ static irqreturn_t ab3100_irq_handler(int irq, void *data)
 /*
  * Some debugfs entries only exposed if we're using debug
  */
-static int ab3100_registers_print(struct seq_file *s, void *p)
+static int ab3100_registers_show(struct seq_file *s, void *p)
 {
 	struct ab3100 *ab3100 = s->private;
 	u8 value;
@@ -466,18 +466,7 @@ static int ab3100_registers_print(struct seq_file *s, void *p)
 	return 0;
 }
 
-static int ab3100_registers_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, ab3100_registers_print, inode->i_private);
-}
-
-static const struct file_operations ab3100_registers_fops = {
-	.open = ab3100_registers_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-	.owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(ab3100_registers);
 
 struct ab3100_get_set_reg_priv {
 	struct ab3100 *ab3100;
Signature · 1 line
2.23.0