linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: xenbus: convert to DEFINE_SHOW_ATTRIBUTE
@ 2018-12-10 15:53 Yangtao Li
  2018-12-10 16:00 ` Wei Liu
  2018-12-10 20:05 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Yangtao Li @ 2018-12-10 15:53 UTC (permalink / raw)
  To: wei.liu2, paul.durrant, davem; +Cc: xen-devel, netdev, linux-kernel, Yangtao Li

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/net/xen-netback/xenbus.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index fe1d52247bbe..2625740bdc4a 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -186,7 +186,7 @@ static const struct file_operations xenvif_dbg_io_ring_ops_fops = {
 	.write = xenvif_write_io_ring,
 };
 
-static int xenvif_read_ctrl(struct seq_file *m, void *v)
+static int xenvif_ctrl_show(struct seq_file *m, void *v)
 {
 	struct xenvif *vif = m->private;
 
@@ -194,19 +194,7 @@ static int xenvif_read_ctrl(struct seq_file *m, void *v)
 
 	return 0;
 }
-
-static int xenvif_ctrl_open(struct inode *inode, struct file *filp)
-{
-	return single_open(filp, xenvif_read_ctrl, inode->i_private);
-}
-
-static const struct file_operations xenvif_dbg_ctrl_ops_fops = {
-	.owner = THIS_MODULE,
-	.open = xenvif_ctrl_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(xenvif_ctrl);
 
 static void xenvif_debugfs_addif(struct xenvif *vif)
 {
@@ -238,7 +226,7 @@ static void xenvif_debugfs_addif(struct xenvif *vif)
 						    0400,
 						    vif->xenvif_dbg_root,
 						    vif,
-						    &xenvif_dbg_ctrl_ops_fops);
+						    &xenvif_ctrl_fops);
 			if (IS_ERR_OR_NULL(pfile))
 				pr_warn("Creation of ctrl file returned %ld!\n",
 					PTR_ERR(pfile));
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: xenbus: convert to DEFINE_SHOW_ATTRIBUTE
  2018-12-10 15:53 [PATCH] net: xenbus: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
@ 2018-12-10 16:00 ` Wei Liu
  2018-12-10 20:05 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Wei Liu @ 2018-12-10 16:00 UTC (permalink / raw)
  To: Yangtao Li; +Cc: wei.liu2, paul.durrant, davem, xen-devel, netdev, linux-kernel

On Mon, Dec 10, 2018 at 10:53:29AM -0500, Yangtao Li wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

Thanks for the patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: xenbus: convert to DEFINE_SHOW_ATTRIBUTE
  2018-12-10 15:53 [PATCH] net: xenbus: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
  2018-12-10 16:00 ` Wei Liu
@ 2018-12-10 20:05 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-12-10 20:05 UTC (permalink / raw)
  To: tiny.windzz; +Cc: wei.liu2, paul.durrant, xen-devel, netdev, linux-kernel

From: Yangtao Li <tiny.windzz@gmail.com>
Date: Mon, 10 Dec 2018 10:53:29 -0500

> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-10 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-10 15:53 [PATCH] net: xenbus: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
2018-12-10 16:00 ` Wei Liu
2018-12-10 20:05 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).