From 9a8c09e73bf6c8b1720b1172cdcabb14fc823cf8 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 29 Feb 2008 11:37:02 -0800 Subject: [ATM]: Use seq_open/release_privade instead of manual manipulations. lec_seq_open/lec_seq_release and __vcc_seq_open/vcc_seq_release do seq_open/release_private's job. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- net/atm/lec.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) (limited to 'net/atm/lec.c') diff --git a/net/atm/lec.c b/net/atm/lec.c index 0e450d12f03..e2d800d818e 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c @@ -1169,32 +1169,7 @@ static const struct seq_operations lec_seq_ops = { static int lec_seq_open(struct inode *inode, struct file *file) { - struct lec_state *state; - struct seq_file *seq; - int rc = -EAGAIN; - - state = kmalloc(sizeof(*state), GFP_KERNEL); - if (!state) { - rc = -ENOMEM; - goto out; - } - - rc = seq_open(file, &lec_seq_ops); - if (rc) - goto out_kfree; - seq = file->private_data; - seq->private = state; -out: - return rc; - -out_kfree: - kfree(state); - goto out; -} - -static int lec_seq_release(struct inode *inode, struct file *file) -{ - return seq_release_private(inode, file); + return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state)); } static const struct file_operations lec_seq_fops = { @@ -1202,7 +1177,7 @@ static const struct file_operations lec_seq_fops = { .open = lec_seq_open, .read = seq_read, .llseek = seq_lseek, - .release = lec_seq_release, + .release = seq_release_private, }; #endif -- cgit v1.2.3