--- src/driver.c.orig 2008-01-30 01:53:11.000000000 +0100 +++ src/driver.c 2008-01-30 01:54:06.000000000 +0100 @@ -92,8 +92,12 @@ static DECLARE_WAIT_QUEUE_HEAD(capi_wait); static DECLARE_WAIT_QUEUE_HEAD(tx_wait); static DECLARE_WAIT_QUEUE_HEAD(rx_wait); +static DECLARE_COMPLETION(hotplug); /* New DECLARE, */ +static DECLARE_COMPLETION(notify); /* New DECLARE, */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) static DECLARE_MUTEX_LOCKED(hotplug); static DECLARE_MUTEX_LOCKED(notify); +#endif #define SCHED_WAKEUP_CAPI { atomic_set (&thread_capi_flag, 1); wake_up_interruptible (&capi_wait); } #define SCHED_WAKEUP { atomic_set (&got_kicked, 1); wake_up_interruptible (&wait); } @@ -787,7 +791,7 @@ close_func = func; close_data = data; - INIT_WORK (&closing_work, closing_worker); + INIT_WORK (&closing_work, (work_func_t)closing_worker); schedule_work (&closing_work); LOG("Worker scheduled.\n"); } /* start_closing_worker */ @@ -1211,7 +1215,10 @@ } } LOG("Scheduler thread stopped.\n"); + complete(&hotplug); /* Complete Thread Sync here */ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) up (&hotplug); + #endif return 0; } /* scheduler */ @@ -1246,7 +1253,10 @@ SCHED_WAKEUP; } LOG("Scheduler thread signalled, waiting...\n"); + wait_for_completion(&hotplug); /* Wait for complete Thread Sync */ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) down (&hotplug); + #endif LOG("Scheduler thread[%d] terminated.\n", thread_pid); } thread_pid = -1;