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 <hch@lst.de>
This commit is contained in:
@@ -2432,22 +2432,9 @@ static int proc_udc_show(struct seq_file *s, void *_)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int proc_udc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, proc_udc_show, NULL);
|
||||
}
|
||||
|
||||
static const struct file_operations proc_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = proc_udc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static void create_proc_file(void)
|
||||
{
|
||||
proc_create(proc_filename, 0, NULL, &proc_ops);
|
||||
proc_create_single(proc_filename, 0, NULL, proc_udc_show);
|
||||
}
|
||||
|
||||
static void remove_proc_file(void)
|
||||
|
Reference in New Issue
Block a user