The other thing to watch is that you need to delete the timer before you unload
As you can safely del_timer() an initialised but already deleted timer that
isnt too onerous.
Waiting for a thread in the module unload is trickier. You cannot simply kill
the thread as it may run after cleanup_module() returns. Instead you do
static void cleanup_module(void)
{
kill_thread();
down(&thread_sem);
printk("Thread dead\n");
}
and in the thread exit path do
up_and_exit(&thread_sem, error_code);
This ensures that the thread of execution has left the module code space and
will not return.
Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/