diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /net/irda/irlan/irlan_common.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'net/irda/irlan/irlan_common.c')
-rw-r--r-- | net/irda/irlan/irlan_common.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 315ead3cb926..a788f9e9427d 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/gfp.h> | ||
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
31 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
32 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
@@ -1128,34 +1129,14 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) | |||
1128 | */ | 1129 | */ |
1129 | static void *irlan_seq_start(struct seq_file *seq, loff_t *pos) | 1130 | static void *irlan_seq_start(struct seq_file *seq, loff_t *pos) |
1130 | { | 1131 | { |
1131 | int i = 1; | ||
1132 | struct irlan_cb *self; | ||
1133 | |||
1134 | rcu_read_lock(); | 1132 | rcu_read_lock(); |
1135 | if (*pos == 0) | 1133 | return seq_list_start_head(&irlans, *pos); |
1136 | return SEQ_START_TOKEN; | ||
1137 | |||
1138 | list_for_each_entry(self, &irlans, dev_list) { | ||
1139 | if (*pos == i) | ||
1140 | return self; | ||
1141 | ++i; | ||
1142 | } | ||
1143 | return NULL; | ||
1144 | } | 1134 | } |
1145 | 1135 | ||
1146 | /* Return entry after v, and increment pos */ | 1136 | /* Return entry after v, and increment pos */ |
1147 | static void *irlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 1137 | static void *irlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
1148 | { | 1138 | { |
1149 | struct list_head *nxt; | 1139 | return seq_list_next(v, &irlans, pos); |
1150 | |||
1151 | ++*pos; | ||
1152 | if (v == SEQ_START_TOKEN) | ||
1153 | nxt = irlans.next; | ||
1154 | else | ||
1155 | nxt = ((struct irlan_cb *)v)->dev_list.next; | ||
1156 | |||
1157 | return (nxt == &irlans) ? NULL | ||
1158 | : list_entry(nxt, struct irlan_cb, dev_list); | ||
1159 | } | 1140 | } |
1160 | 1141 | ||
1161 | /* End of reading /proc file */ | 1142 | /* End of reading /proc file */ |
@@ -1170,10 +1151,10 @@ static void irlan_seq_stop(struct seq_file *seq, void *v) | |||
1170 | */ | 1151 | */ |
1171 | static int irlan_seq_show(struct seq_file *seq, void *v) | 1152 | static int irlan_seq_show(struct seq_file *seq, void *v) |
1172 | { | 1153 | { |
1173 | if (v == SEQ_START_TOKEN) | 1154 | if (v == &irlans) |
1174 | seq_puts(seq, "IrLAN instances:\n"); | 1155 | seq_puts(seq, "IrLAN instances:\n"); |
1175 | else { | 1156 | else { |
1176 | struct irlan_cb *self = v; | 1157 | struct irlan_cb *self = list_entry(v, struct irlan_cb, dev_list); |
1177 | 1158 | ||
1178 | IRDA_ASSERT(self != NULL, return -1;); | 1159 | IRDA_ASSERT(self != NULL, return -1;); |
1179 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); | 1160 | IRDA_ASSERT(self->magic == IRLAN_MAGIC, return -1;); |