From: Thadeu Lima de Souza Cascardo Date: Mon, 24 May 2010 08:12:05 +0000 (-0400) Subject: Schedule delayed work when setting interface up. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fkernel%2Fsamples%2Fnetdev%2F.git;a=commitdiff_plain;h=4582c6dc1f10642ebecbe9fdebc241a265ad4516 Schedule delayed work when setting interface up. --- diff --git a/ndeth.c b/ndeth.c index ec6be59..c9402c4 100644 --- a/ndeth.c +++ b/ndeth.c @@ -20,18 +20,28 @@ #include #include #include +#include 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"); + schedule_delayed_work(&ndeth_work, 4 * HZ); return 0; } static int ndeth_stop(struct net_device *dev) { printk(KERN_DEBUG "ndeth stop\n"); + cancel_delayed_work_sync(&ndeth_work); return 0; }