All of lore.kernel.org
 help / color / mirror / Atom feed
From: zuoqilin1@163.com
To: gregkh@linuxfoundation.org, rafael@kernel.org
Cc: linux-kernel@vger.kernel.org, zuoqilin <zuoqilin@yulong.com>
Subject: [PATCH] fs/debugfs: Convert to DEFINE_SHOW_ATTRIBUTE
Date: Fri,  2 Apr 2021 20:11:41 +0800	[thread overview]
Message-ID: <20210402121141.82-1-zuoqilin1@163.com> (raw)

From: zuoqilin <zuoqilin@yulong.com>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: zuoqilin <zuoqilin@yulong.com>
---
 fs/debugfs/file.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 686e0ad..d670ca3 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -1045,7 +1045,7 @@ void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
 }
 EXPORT_SYMBOL_GPL(debugfs_print_regs32);
 
-static int debugfs_show_regset32(struct seq_file *s, void *data)
+static int regset32_show(struct seq_file *s, void *data)
 {
 	struct debugfs_regset32 *regset = s->private;
 
@@ -1060,17 +1060,7 @@ static int debugfs_show_regset32(struct seq_file *s, void *data)
 	return 0;
 }
 
-static int debugfs_open_regset32(struct inode *inode, struct file *file)
-{
-	return single_open(file, debugfs_show_regset32, inode->i_private);
-}
-
-static const struct file_operations fops_regset32 = {
-	.open =		debugfs_open_regset32,
-	.read =		seq_read,
-	.llseek =	seq_lseek,
-	.release =	single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(regset32);
 
 /**
  * debugfs_create_regset32 - create a debugfs file that returns register values
@@ -1091,7 +1081,7 @@ void debugfs_create_regset32(const char *name, umode_t mode,
 			     struct dentry *parent,
 			     struct debugfs_regset32 *regset)
 {
-	debugfs_create_file(name, mode, parent, regset, &fops_regset32);
+	debugfs_create_file(name, mode, parent, regset, &regset32_fops);
 }
 EXPORT_SYMBOL_GPL(debugfs_create_regset32);
 
-- 
1.9.1


             reply	other threads:[~2021-04-02 12:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 12:11 zuoqilin1 [this message]
2021-04-02 12:22 ` [PATCH] fs/debugfs: Convert to DEFINE_SHOW_ATTRIBUTE Greg KH
2021-04-07  2:22   ` Zuo Qi Lin
2021-04-07  5:05     ` Greg KH
2021-04-14 13:25       ` Zuo Qi Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210402121141.82-1-zuoqilin1@163.com \
    --to=zuoqilin1@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=zuoqilin@yulong.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.