public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yangtao Li <tiny.windzz@gmail.com>
To: david.kershner@unisys.com
Cc: sparmaintainer@unisys.com, linux-kernel@vger.kernel.org,
	Yangtao Li <tiny.windzz@gmail.com>
Subject: [PATCH] drivers: visorbus: convert to DEFINE_SHOW_ATTRIBUTE
Date: Sat,  1 Dec 2018 05:21:04 -0500	[thread overview]
Message-ID: <20181201102104.6561-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/visorbus/visorbus_main.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/visorbus/visorbus_main.c b/drivers/visorbus/visorbus_main.c
index 0b2434cc4ecd..8f742dc9e62c 100644
--- a/drivers/visorbus/visorbus_main.c
+++ b/drivers/visorbus/visorbus_main.c
@@ -436,7 +436,7 @@ static void vbuschannel_print_devinfo(struct visor_vbus_deviceinfo *devinfo,
 		   devinfo->infostrs);
 }
 
-static int bus_info_debugfs_show(struct seq_file *seq, void *v)
+static int bus_info_show(struct seq_file *seq, void *v)
 {
 	int i = 0;
 	unsigned long off;
@@ -471,18 +471,7 @@ static int bus_info_debugfs_show(struct seq_file *seq, void *v)
 	return 0;
 }
 
-static int bus_info_debugfs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, bus_info_debugfs_show, inode->i_private);
-}
-
-static const struct file_operations bus_info_debugfs_fops = {
-	.owner = THIS_MODULE,
-	.open = bus_info_debugfs_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(bus_info);
 
 static void dev_periodic_work(struct timer_list *t)
 {
@@ -1022,7 +1011,7 @@ int visorbus_create_instance(struct visor_device *dev)
 					      visorbus_debugfs_dir);
 	dev->debugfs_bus_info = debugfs_create_file("client_bus_info", 0440,
 						    dev->debugfs_dir, dev,
-						    &bus_info_debugfs_fops);
+						    &bus_info_fops);
 	dev_set_drvdata(&dev->device, dev);
 	err = get_vbus_header_info(dev->visorchannel, &dev->device, hdr_info);
 	if (err < 0)
-- 
2.17.0


                 reply	other threads:[~2018-12-01 10:21 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=20181201102104.6561-1-tiny.windzz@gmail.com \
    --to=tiny.windzz@gmail.com \
    --cc=david.kershner@unisys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparmaintainer@unisys.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