diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-02-29 14:37:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-29 14:37:02 -0500 |
commit | 9a8c09e73bf6c8b1720b1172cdcabb14fc823cf8 (patch) | |
tree | 00c88ccd0a1a062bec3076c1563a624d6a2c3b2a /net/atm/lec.c | |
parent | 45af1754bc09926b5e062bda24f789d7b320939f (diff) |
[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 <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/lec.c')
-rw-r--r-- | net/atm/lec.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/net/atm/lec.c b/net/atm/lec.c index 0e450d12f035..e2d800d818e3 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -1169,32 +1169,7 @@ static const struct seq_operations lec_seq_ops = { | |||
1169 | 1169 | ||
1170 | static int lec_seq_open(struct inode *inode, struct file *file) | 1170 | static int lec_seq_open(struct inode *inode, struct file *file) |
1171 | { | 1171 | { |
1172 | struct lec_state *state; | 1172 | return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state)); |
1173 | struct seq_file *seq; | ||
1174 | int rc = -EAGAIN; | ||
1175 | |||
1176 | state = kmalloc(sizeof(*state), GFP_KERNEL); | ||
1177 | if (!state) { | ||
1178 | rc = -ENOMEM; | ||
1179 | goto out; | ||
1180 | } | ||
1181 | |||
1182 | rc = seq_open(file, &lec_seq_ops); | ||
1183 | if (rc) | ||
1184 | goto out_kfree; | ||
1185 | seq = file->private_data; | ||
1186 | seq->private = state; | ||
1187 | out: | ||
1188 | return rc; | ||
1189 | |||
1190 | out_kfree: | ||
1191 | kfree(state); | ||
1192 | goto out; | ||
1193 | } | ||
1194 | |||
1195 | static int lec_seq_release(struct inode *inode, struct file *file) | ||
1196 | { | ||
1197 | return seq_release_private(inode, file); | ||
1198 | } | 1173 | } |
1199 | 1174 | ||
1200 | static const struct file_operations lec_seq_fops = { | 1175 | static const struct file_operations lec_seq_fops = { |
@@ -1202,7 +1177,7 @@ static const struct file_operations lec_seq_fops = { | |||
1202 | .open = lec_seq_open, | 1177 | .open = lec_seq_open, |
1203 | .read = seq_read, | 1178 | .read = seq_read, |
1204 | .llseek = seq_lseek, | 1179 | .llseek = seq_lseek, |
1205 | .release = lec_seq_release, | 1180 | .release = seq_release_private, |
1206 | }; | 1181 | }; |
1207 | #endif | 1182 | #endif |
1208 | 1183 | ||