aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-02-29 14:37:02 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-29 14:37:02 -0500
commit9a8c09e73bf6c8b1720b1172cdcabb14fc823cf8 (patch)
tree00c88ccd0a1a062bec3076c1563a624d6a2c3b2a
parent45af1754bc09926b5e062bda24f789d7b320939f (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>
-rw-r--r--net/atm/lec.c29
-rw-r--r--net/atm/proc.c32
2 files changed, 9 insertions, 52 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
1170static int lec_seq_open(struct inode *inode, struct file *file) 1170static 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;
1187out:
1188 return rc;
1189
1190out_kfree:
1191 kfree(state);
1192 goto out;
1193}
1194
1195static int lec_seq_release(struct inode *inode, struct file *file)
1196{
1197 return seq_release_private(inode, file);
1198} 1173}
1199 1174
1200static const struct file_operations lec_seq_fops = { 1175static 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
diff --git a/net/atm/proc.c b/net/atm/proc.c
index e9693aed7ef8..b995b66b5585 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -114,31 +114,13 @@ static int __vcc_seq_open(struct inode *inode, struct file *file,
114 int family, const struct seq_operations *ops) 114 int family, const struct seq_operations *ops)
115{ 115{
116 struct vcc_state *state; 116 struct vcc_state *state;
117 struct seq_file *seq;
118 int rc = -ENOMEM;
119 117
120 state = kmalloc(sizeof(*state), GFP_KERNEL); 118 state = __seq_open_private(file, ops, sizeof(*state));
121 if (!state) 119 if (state == NULL)
122 goto out; 120 return -ENOMEM;
123
124 rc = seq_open(file, ops);
125 if (rc)
126 goto out_kfree;
127 121
128 state->family = family; 122 state->family = family;
129 123 return 0;
130 seq = file->private_data;
131 seq->private = state;
132out:
133 return rc;
134out_kfree:
135 kfree(state);
136 goto out;
137}
138
139static int vcc_seq_release(struct inode *inode, struct file *file)
140{
141 return seq_release_private(inode, file);
142} 124}
143 125
144static void *vcc_seq_start(struct seq_file *seq, loff_t *pos) 126static void *vcc_seq_start(struct seq_file *seq, loff_t *pos)
@@ -314,7 +296,7 @@ static const struct file_operations pvc_seq_fops = {
314 .open = pvc_seq_open, 296 .open = pvc_seq_open,
315 .read = seq_read, 297 .read = seq_read,
316 .llseek = seq_lseek, 298 .llseek = seq_lseek,
317 .release = vcc_seq_release, 299 .release = seq_release_private,
318}; 300};
319 301
320static int vcc_seq_show(struct seq_file *seq, void *v) 302static int vcc_seq_show(struct seq_file *seq, void *v)
@@ -348,7 +330,7 @@ static const struct file_operations vcc_seq_fops = {
348 .open = vcc_seq_open, 330 .open = vcc_seq_open,
349 .read = seq_read, 331 .read = seq_read,
350 .llseek = seq_lseek, 332 .llseek = seq_lseek,
351 .release = vcc_seq_release, 333 .release = seq_release_private,
352}; 334};
353 335
354static int svc_seq_show(struct seq_file *seq, void *v) 336static int svc_seq_show(struct seq_file *seq, void *v)
@@ -383,7 +365,7 @@ static const struct file_operations svc_seq_fops = {
383 .open = svc_seq_open, 365 .open = svc_seq_open,
384 .read = seq_read, 366 .read = seq_read,
385 .llseek = seq_lseek, 367 .llseek = seq_lseek,
386 .release = vcc_seq_release, 368 .release = seq_release_private,
387}; 369};
388 370
389static ssize_t proc_dev_atm_read(struct file *file, char __user *buf, 371static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,