linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] netdevsim: convert to DEFINE_SHOW_ATTRIBUTE
@ 2018-12-12 16:40 Yangtao Li
  2018-12-12 18:21 ` Jakub Kicinski
  2018-12-13  0:24 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Yangtao Li @ 2018-12-12 16:40 UTC (permalink / raw)
  To: jakub.kicinski, davem; +Cc: netdev, linux-kernel, Yangtao Li

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
v2:
-update subject
---
 drivers/net/netdevsim/bpf.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c
index cb3518474f0e..14b4d9774708 100644
--- a/drivers/net/netdevsim/bpf.c
+++ b/drivers/net/netdevsim/bpf.c
@@ -48,7 +48,7 @@ struct nsim_bpf_bound_map {
 	struct list_head l;
 };
 
-static int nsim_debugfs_bpf_string_read(struct seq_file *file, void *data)
+static int nsim_bpf_string_show(struct seq_file *file, void *data)
 {
 	const char **str = file->private;
 
@@ -57,19 +57,7 @@ static int nsim_debugfs_bpf_string_read(struct seq_file *file, void *data)
 
 	return 0;
 }
-
-static int nsim_debugfs_bpf_string_open(struct inode *inode, struct file *f)
-{
-	return single_open(f, nsim_debugfs_bpf_string_read, inode->i_private);
-}
-
-static const struct file_operations nsim_bpf_string_fops = {
-	.owner = THIS_MODULE,
-	.open = nsim_debugfs_bpf_string_open,
-	.release = single_release,
-	.read = seq_read,
-	.llseek = seq_lseek
-};
+DEFINE_SHOW_ATTRIBUTE(nsim_bpf_string);
 
 static int
 nsim_bpf_verify_insn(struct bpf_verifier_env *env, int insn_idx, int prev_insn)
-- 
2.17.0


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

* Re: [PATCH v2] netdevsim: convert to DEFINE_SHOW_ATTRIBUTE
  2018-12-12 16:40 [PATCH v2] netdevsim: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
@ 2018-12-12 18:21 ` Jakub Kicinski
  2018-12-13  0:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2018-12-12 18:21 UTC (permalink / raw)
  To: Yangtao Li; +Cc: davem, netdev, linux-kernel

On Wed, 12 Dec 2018 11:40:07 -0500, Yangtao Li wrote:
> Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Thank you!

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

* Re: [PATCH v2] netdevsim: convert to DEFINE_SHOW_ATTRIBUTE
  2018-12-12 16:40 [PATCH v2] netdevsim: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
  2018-12-12 18:21 ` Jakub Kicinski
@ 2018-12-13  0:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-12-13  0:24 UTC (permalink / raw)
  To: tiny.windzz; +Cc: jakub.kicinski, netdev, linux-kernel

From: Yangtao Li <tiny.windzz@gmail.com>
Date: Wed, 12 Dec 2018 11:40:07 -0500

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

Applied, thank you.

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

end of thread, other threads:[~2018-12-13  0:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-12 16:40 [PATCH v2] netdevsim: convert to DEFINE_SHOW_ATTRIBUTE Yangtao Li
2018-12-12 18:21 ` Jakub Kicinski
2018-12-13  0:24 ` 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).