1 #include <linux/version.h>
2 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
4 #include <linux/netdevice.h>
5 #include <linux/rtnetlink.h>
8 struct list_head unreg_list;
9 struct net_device *dev;
13 * unregister_netdevice_queue - remove device from the kernel
17 * This function shuts down a device interface and removes it
18 * from the kernel tables.
19 * If head not NULL, device is queued to be unregistered later.
21 * Callers must hold the rtnl semaphore. You may want
22 * unregister_netdev() instead of this.
25 void unregister_netdevice_queue(struct net_device *dev, struct list_head *head)
30 struct netdev_list *list_item = kmalloc(sizeof *list_item,
32 /* If we can't queue it, probably better to try to destroy it
33 * now. Either could potentially be bad but this is probably
34 * less likely to cause problems. */
36 unregister_netdevice(dev);
41 list_add_tail(&list_item->unreg_list, head);
43 unregister_netdevice(dev);
47 * unregister_netdevice_many - unregister many devices
48 * @head: list of devices
51 void unregister_netdevice_many(struct list_head *head)
53 if (!list_empty(head)) {
54 struct netdev_list *list_item, *next;
56 list_for_each_entry_safe(list_item, next, head, unreg_list) {
57 unregister_netdevice(list_item->dev);
63 #endif /* kernel < 2.6.33 */