Re:

Alan Cox
2001-05-09T17:16:06Z

> from the interrupt back to the driver. This is not unlike what you must
> already be doing for interrupt completion.
>
> Do pay attention to getting the timer (&t->timer above) properly set up
> (see my first response or most any usage in the kernel).
>
> Have I got this right Alan?

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