From 3f3942aca6da351a12543aa776467791b63b3a78 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 15 May 2018 15:57:23 +0200 Subject: proc: introduce proc_create_single{,_data} Variants of proc_create{,_data} that directly take a seq_file show callback and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by: Christoph Hellwig --- net/sched/sch_api.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'net/sched/sch_api.c') diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 106dae7e4818..54eca685420f 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -2092,23 +2092,11 @@ static int psched_show(struct seq_file *seq, void *v) return 0; } -static int psched_open(struct inode *inode, struct file *file) -{ - return single_open(file, psched_show, NULL); -} - -static const struct file_operations psched_fops = { - .open = psched_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - static int __net_init psched_net_init(struct net *net) { struct proc_dir_entry *e; - e = proc_create("psched", 0, net->proc_net, &psched_fops); + e = proc_create_single("psched", 0, net->proc_net, psched_show); if (e == NULL) return -ENOMEM; -- cgit 1.4.1