omap: i2c: add a timeout to the busy waiting
[safe/jmp/linux-2.6] / drivers / net / netconsole.c
index eceadf7..a361dea 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/console.h>
 #include <linux/moduleparam.h>
 #include <linux/string.h>
@@ -664,7 +665,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
        struct netconsole_target *nt;
        struct net_device *dev = ptr;
 
-       if (!(event == NETDEV_CHANGENAME))
+       if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER))
                goto done;
 
        spin_lock_irqsave(&target_list_lock, flags);
@@ -675,6 +676,15 @@ static int netconsole_netdev_event(struct notifier_block *this,
                        case NETDEV_CHANGENAME:
                                strlcpy(nt->np.dev_name, dev->name, IFNAMSIZ);
                                break;
+                       case NETDEV_UNREGISTER:
+                               if (!nt->enabled)
+                                       break;
+                               netpoll_cleanup(&nt->np);
+                               nt->enabled = 0;
+                               printk(KERN_INFO "netconsole: network logging stopped"
+                                       ", interface %s unregistered\n",
+                                       dev->name);
+                               break;
                        }
                }
                netconsole_target_put(nt);