From 44414d82cfe0f68cb59d0a42f599ccd893ae0032 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 24 Apr 2018 17:05:17 +0200 Subject: proc: introduce proc_create_seq_private Variant of proc_create_data that directly take a struct seq_operations argument + a private state size and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by: Christoph Hellwig --- net/atm/lec.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'net/atm') diff --git a/net/atm/lec.c b/net/atm/lec.c index 3138a869b5c0..5a95fcf6f9b6 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c @@ -990,18 +990,6 @@ static const struct seq_operations lec_seq_ops = { .stop = lec_seq_stop, .show = lec_seq_show, }; - -static int lec_seq_open(struct inode *inode, struct file *file) -{ - return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state)); -} - -static const struct file_operations lec_seq_fops = { - .open = lec_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release_private, -}; #endif static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) @@ -1047,7 +1035,8 @@ static int __init lane_module_init(void) #ifdef CONFIG_PROC_FS struct proc_dir_entry *p; - p = proc_create("lec", 0444, atm_proc_root, &lec_seq_fops); + p = proc_create_seq_private("lec", 0444, atm_proc_root, &lec_seq_ops, + sizeof(struct lec_state), NULL); if (!p) { pr_err("Unable to initialize /proc/net/atm/lec\n"); return -ENOMEM; -- cgit v1.2.3