diff options
Diffstat (limited to 'net/8021q/vlanproc.c')
-rw-r--r-- | net/8021q/vlanproc.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index 5e24f72602a1..d216a64421cd 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c | |||
@@ -237,13 +237,9 @@ int vlan_proc_rem_dev(struct net_device *vlandev) | |||
237 | * The following few functions build the content of /proc/net/vlan/config | 237 | * The following few functions build the content of /proc/net/vlan/config |
238 | */ | 238 | */ |
239 | 239 | ||
240 | /* starting at dev, find a VLAN device */ | 240 | static inline int is_vlan_dev(struct net_device *dev) |
241 | static struct net_device *vlan_skip(struct net_device *dev) | ||
242 | { | 241 | { |
243 | while (dev && !(dev->priv_flags & IFF_802_1Q_VLAN)) | 242 | return dev->priv_flags & IFF_802_1Q_VLAN; |
244 | dev = dev->next; | ||
245 | |||
246 | return dev; | ||
247 | } | 243 | } |
248 | 244 | ||
249 | /* start read of /proc/net/vlan/config */ | 245 | /* start read of /proc/net/vlan/config */ |
@@ -257,19 +253,35 @@ static void *vlan_seq_start(struct seq_file *seq, loff_t *pos) | |||
257 | if (*pos == 0) | 253 | if (*pos == 0) |
258 | return SEQ_START_TOKEN; | 254 | return SEQ_START_TOKEN; |
259 | 255 | ||
260 | for (dev = vlan_skip(dev_base); dev && i < *pos; | 256 | for_each_netdev(dev) { |
261 | dev = vlan_skip(dev->next), ++i); | 257 | if (!is_vlan_dev(dev)) |
258 | continue; | ||
259 | |||
260 | if (i++ == *pos) | ||
261 | return dev; | ||
262 | } | ||
262 | 263 | ||
263 | return (i == *pos) ? dev : NULL; | 264 | return NULL; |
264 | } | 265 | } |
265 | 266 | ||
266 | static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 267 | static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
267 | { | 268 | { |
269 | struct net_device *dev; | ||
270 | |||
268 | ++*pos; | 271 | ++*pos; |
269 | 272 | ||
270 | return vlan_skip((v == SEQ_START_TOKEN) | 273 | dev = (struct net_device *)v; |
271 | ? dev_base | 274 | if (v == SEQ_START_TOKEN) |
272 | : ((struct net_device *)v)->next); | 275 | dev = net_device_entry(&dev_base_head); |
276 | |||
277 | for_each_netdev_continue(dev) { | ||
278 | if (!is_vlan_dev(dev)) | ||
279 | continue; | ||
280 | |||
281 | return dev; | ||
282 | } | ||
283 | |||
284 | return NULL; | ||
273 | } | 285 | } |
274 | 286 | ||
275 | static void vlan_seq_stop(struct seq_file *seq, void *v) | 287 | static void vlan_seq_stop(struct seq_file *seq, void *v) |