public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yangtao Li <tiny.windzz@gmail.com>
To: rubini@gnudd.com
Cc: linux-kernel@vger.kernel.org, Yangtao Li <tiny.windzz@gmail.com>
Subject: [PATCH] drivers/fmc: Change to use DEFINE_SHOW_ATTRIBUTE macro
Date: Fri, 30 Nov 2018 21:06:24 -0500	[thread overview]
Message-ID: <20181201020624.4854-1-tiny.windzz@gmail.com> (raw)

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/fmc/fmc-debug.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/fmc/fmc-debug.c b/drivers/fmc/fmc-debug.c
index 32930722770c..c923d076c807 100644
--- a/drivers/fmc/fmc-debug.c
+++ b/drivers/fmc/fmc-debug.c
@@ -114,7 +114,7 @@ static void fmc_sdb_dump_recursive(struct fmc_device *fmc, struct seq_file *s,
 	}
 }
 
-static int fmc_sdb_dump(struct seq_file *s, void *offset)
+static int fmc_sdb_dump_show(struct seq_file *s, void *offset)
 {
 	struct fmc_device *fmc = s->private;
 
@@ -131,22 +131,7 @@ static int fmc_sdb_dump(struct seq_file *s, void *offset)
 	return 0;
 }
 
-
-static int fmc_sdb_dump_open(struct inode *inode, struct file *file)
-{
-	struct fmc_device *fmc = inode->i_private;
-
-	return single_open(file, fmc_sdb_dump, fmc);
-}
-
-
-const struct file_operations fmc_dbgfs_sdb_dump = {
-	.owner = THIS_MODULE,
-	.open  = fmc_sdb_dump_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(fmc_sdb_dump);
 
 int fmc_debug_init(struct fmc_device *fmc)
 {
@@ -158,7 +143,7 @@ int fmc_debug_init(struct fmc_device *fmc)
 
 	fmc->dbg_sdb_dump = debugfs_create_file(FMC_DBG_SDB_DUMP, 0444,
 						fmc->dbg_dir, fmc,
-						&fmc_dbgfs_sdb_dump);
+						&fmc_sdb_dump_fops);
 	if (IS_ERR_OR_NULL(fmc->dbg_sdb_dump))
 		pr_err("FMC: Cannot create debugfs file %s\n",
 		       FMC_DBG_SDB_DUMP);
-- 
2.17.0


                 reply	other threads:[~2018-12-01  2:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20181201020624.4854-1-tiny.windzz@gmail.com \
    --to=tiny.windzz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rubini@gnudd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox