proc: introduce proc_create_seq{,_data}
Variants of proc_create{,_data} that directly take a struct seq_operations argument 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:
@@ -95,19 +95,6 @@ static const struct seq_operations misc_seq_ops = {
|
||||
.stop = misc_seq_stop,
|
||||
.show = misc_seq_show,
|
||||
};
|
||||
|
||||
static int misc_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &misc_seq_ops);
|
||||
}
|
||||
|
||||
static const struct file_operations misc_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = misc_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
static int misc_open(struct inode *inode, struct file *file)
|
||||
@@ -282,7 +269,7 @@ static int __init misc_init(void)
|
||||
int err;
|
||||
struct proc_dir_entry *ret;
|
||||
|
||||
ret = proc_create("misc", 0, NULL, &misc_proc_fops);
|
||||
ret = proc_create_seq("misc", 0, NULL, &misc_seq_ops);
|
||||
misc_class = class_create(THIS_MODULE, "misc");
|
||||
err = PTR_ERR(misc_class);
|
||||
if (IS_ERR(misc_class))
|
||||
|
Reference in New Issue
Block a user