Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netdevsim: convert to DEFINE_SHOW_ATTRIBUTE

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Yangtao Li and committed by
David S. Miller
e6652f0f 9a58ee2f

+2 -14
+2 -14
drivers/net/netdevsim/bpf.c
··· 48 48 struct list_head l; 49 49 }; 50 50 51 - static int nsim_debugfs_bpf_string_read(struct seq_file *file, void *data) 51 + static int nsim_bpf_string_show(struct seq_file *file, void *data) 52 52 { 53 53 const char **str = file->private; 54 54 ··· 57 57 58 58 return 0; 59 59 } 60 - 61 - static int nsim_debugfs_bpf_string_open(struct inode *inode, struct file *f) 62 - { 63 - return single_open(f, nsim_debugfs_bpf_string_read, inode->i_private); 64 - } 65 - 66 - static const struct file_operations nsim_bpf_string_fops = { 67 - .owner = THIS_MODULE, 68 - .open = nsim_debugfs_bpf_string_open, 69 - .release = single_release, 70 - .read = seq_read, 71 - .llseek = seq_lseek 72 - }; 60 + DEFINE_SHOW_ATTRIBUTE(nsim_bpf_string); 73 61 74 62 static int 75 63 nsim_bpf_verify_insn(struct bpf_verifier_env *env, int insn_idx, int prev_insn)