aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/lec.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm/lec.c')
-rw-r--r--net/atm/lec.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 3235c57615e4..653aca3573ac 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1023,7 +1023,7 @@ static void *lec_tbl_walk(struct lec_state *state, struct hlist_head *tbl,
1023 1023
1024 if (!e) 1024 if (!e)
1025 e = tbl->first; 1025 e = tbl->first;
1026 if (e == (void *)1) { 1026 if (e == SEQ_START_TOKEN) {
1027 e = tbl->first; 1027 e = tbl->first;
1028 --*l; 1028 --*l;
1029 } 1029 }
@@ -1125,9 +1125,9 @@ static void *lec_seq_start(struct seq_file *seq, loff_t *pos)
1125 state->locked = NULL; 1125 state->locked = NULL;
1126 state->arp_table = 0; 1126 state->arp_table = 0;
1127 state->misc_table = 0; 1127 state->misc_table = 0;
1128 state->node = (void *)1; 1128 state->node = SEQ_START_TOKEN;
1129 1129
1130 return *pos ? lec_get_idx(state, *pos) : (void *)1; 1130 return *pos ? lec_get_idx(state, *pos) : SEQ_START_TOKEN;
1131} 1131}
1132 1132
1133static void lec_seq_stop(struct seq_file *seq, void *v) 1133static void lec_seq_stop(struct seq_file *seq, void *v)
@@ -1156,7 +1156,7 @@ static int lec_seq_show(struct seq_file *seq, void *v)
1156 " Status Flags " 1156 " Status Flags "
1157 "VPI/VCI Recv VPI/VCI\n"; 1157 "VPI/VCI Recv VPI/VCI\n";
1158 1158
1159 if (v == (void *)1) 1159 if (v == SEQ_START_TOKEN)
1160 seq_puts(seq, lec_banner); 1160 seq_puts(seq, lec_banner);
1161 else { 1161 else {
1162 struct lec_state *state = seq->private; 1162 struct lec_state *state = seq->private;
@@ -1178,32 +1178,7 @@ static const struct seq_operations lec_seq_ops = {
1178 1178
1179static int lec_seq_open(struct inode *inode, struct file *file) 1179static int lec_seq_open(struct inode *inode, struct file *file)
1180{ 1180{
1181 struct lec_state *state; 1181 return seq_open_private(file, &lec_seq_ops, sizeof(struct lec_state));
1182 struct seq_file *seq;
1183 int rc = -EAGAIN;
1184
1185 state = kmalloc(sizeof(*state), GFP_KERNEL);
1186 if (!state) {
1187 rc = -ENOMEM;
1188 goto out;
1189 }
1190
1191 rc = seq_open(file, &lec_seq_ops);
1192 if (rc)
1193 goto out_kfree;
1194 seq = file->private_data;
1195 seq->private = state;
1196out:
1197 return rc;
1198
1199out_kfree:
1200 kfree(state);
1201 goto out;
1202}
1203
1204static int lec_seq_release(struct inode *inode, struct file *file)
1205{
1206 return seq_release_private(inode, file);
1207} 1182}
1208 1183
1209static const struct file_operations lec_seq_fops = { 1184static const struct file_operations lec_seq_fops = {
@@ -1211,7 +1186,7 @@ static const struct file_operations lec_seq_fops = {
1211 .open = lec_seq_open, 1186 .open = lec_seq_open,
1212 .read = seq_read, 1187 .read = seq_read,
1213 .llseek = seq_lseek, 1188 .llseek = seq_lseek,
1214 .release = lec_seq_release, 1189 .release = seq_release_private,
1215}; 1190};
1216#endif 1191#endif
1217 1192