Schedule delayed work when setting interface up.
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Mon, 24 May 2010 08:12:05 +0000 (04:12 -0400)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Mon, 24 May 2010 08:12:05 +0000 (04:12 -0400)
ndeth.c

diff --git a/ndeth.c b/ndeth.c
index ec6be59..c9402c4 100644 (file)
--- a/ndeth.c
+++ b/ndeth.c
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/workqueue.h>
 
 MODULE_LICENSE("GPL");
 
 
 MODULE_LICENSE("GPL");
 
+static void work_ndeth(struct work_struct *work)
+{
+       printk(KERN_DEBUG "doing ndeth work\n");
+}
+
+static DECLARE_DELAYED_WORK(ndeth_work, work_ndeth);
+
 static int ndeth_open(struct net_device *dev)
 {
        printk(KERN_DEBUG "ndeth open\n");
 static int ndeth_open(struct net_device *dev)
 {
        printk(KERN_DEBUG "ndeth open\n");
+       schedule_delayed_work(&ndeth_work, 4 * HZ);
        return 0;
 }
 
 static int ndeth_stop(struct net_device *dev)
 {
        printk(KERN_DEBUG "ndeth stop\n");
        return 0;
 }
 
 static int ndeth_stop(struct net_device *dev)
 {
        printk(KERN_DEBUG "ndeth stop\n");
+       cancel_delayed_work_sync(&ndeth_work);
        return 0;
 }
 
        return 0;
 }