linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] hsr: Convert to DEFINE_SHOW_ATTRIBUTE
@ 2020-07-16  8:47 Qinglang Miao
  2020-07-17 19:46 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Qinglang Miao @ 2020-07-16  8:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman, David S. Miller, Jakub Kicinski; +Cc: netdev, linux-kernel

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 net/hsr/hsr_debugfs.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/net/hsr/hsr_debugfs.c b/net/hsr/hsr_debugfs.c
index d994c83b0..ed7f53475 100644
--- a/net/hsr/hsr_debugfs.c
+++ b/net/hsr/hsr_debugfs.c
@@ -54,16 +54,7 @@ hsr_node_table_show(struct seq_file *sfp, void *data)
 	return 0;
 }
 
-/* hsr_node_table_open - Open the node_table file
- *
- * Description:
- * This routine opens a debugfs file node_table of specific hsr device
- */
-static int
-hsr_node_table_open(struct inode *inode, struct file *filp)
-{
-	return single_open(filp, hsr_node_table_show, inode->i_private);
-}
+DEFINE_SHOW_ATTRIBUTE(hsr_node_table);
 
 void hsr_debugfs_rename(struct net_device *dev)
 {
@@ -78,13 +69,6 @@ void hsr_debugfs_rename(struct net_device *dev)
 		priv->node_tbl_root = d;
 }
 
-static const struct file_operations hsr_fops = {
-	.open	= hsr_node_table_open,
-	.read_iter	= seq_read_iter,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
-
 /* hsr_debugfs_init - create hsr node_table file for dumping
  * the node table
  *
@@ -106,7 +90,7 @@ void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev)
 
 	de = debugfs_create_file("node_table", S_IFREG | 0444,
 				 priv->node_tbl_root, priv,
-				 &hsr_fops);
+				 &hsr_node_table_fops);
 	if (IS_ERR(de)) {
 		pr_err("Cannot create hsr node_table file\n");
 		debugfs_remove(priv->node_tbl_root);
-- 
2.17.1


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

* Re: [PATCH -next] hsr: Convert to DEFINE_SHOW_ATTRIBUTE
  2020-07-16  8:47 [PATCH -next] hsr: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
@ 2020-07-17 19:46 ` David Miller
  2020-07-20  1:06   ` miaoqinglang
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2020-07-17 19:46 UTC (permalink / raw)
  To: miaoqinglang; +Cc: gregkh, kuba, netdev, linux-kernel

From: Qinglang Miao <miaoqinglang@huawei.com>
Date: Thu, 16 Jul 2020 16:47:28 +0800

> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>

This does not apply to the net-next tree.

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

* Re: [PATCH -next] hsr: Convert to DEFINE_SHOW_ATTRIBUTE
  2020-07-17 19:46 ` David Miller
@ 2020-07-20  1:06   ` miaoqinglang
  0 siblings, 0 replies; 3+ messages in thread
From: miaoqinglang @ 2020-07-20  1:06 UTC (permalink / raw)
  To: David Miller; +Cc: gregkh, kuba, netdev, linux-kernel



在 2020/7/18 3:46, David Miller 写道:
> From: Qinglang Miao <miaoqinglang@huawei.com>
> Date: Thu, 16 Jul 2020 16:47:28 +0800
> 
>> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
>>
>> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> 
> This does not apply to the net-next tree.
> .
> 
Hi David,

I'm sorry but​ this patch is based on linux-next rather than net-next.

​There's a little diffrence because commit <4d4901c6d7>  in Linux-next 
has switched over direct seq_read method calls to seq_read_iter should 
applied.(linkage listed as below).

https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next/+/4d4901c6d748efab8aab6e7d2405dadaed0bea50

​I will send a new patch based on net-next tree if you don't mind.

Thanks.

Qinglang

.


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

end of thread, other threads:[~2020-07-20  1:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  8:47 [PATCH -next] hsr: Convert to DEFINE_SHOW_ATTRIBUTE Qinglang Miao
2020-07-17 19:46 ` David Miller
2020-07-20  1:06   ` miaoqinglang

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).