--- /var/tmp/portage/app-misc/lirc-0.8.3_pre1/work/lirc-0.8.3pre1/drivers/lirc_dev/lirc_dev.c 2007-09-27 15:47:20.000000000 -0400 +++ lirc-0.8.3pre1/drivers/lirc_dev/lirc_dev.c 2007-11-27 11:06:41.000000000 -0500 @@ -41,6 +41,7 @@ #include #include #include +#include #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) #include #include @@ -86,8 +87,8 @@ struct lirc_buffer *buf; int tpid; - struct semaphore *t_notify; - struct semaphore *t_notify2; + struct completion *t_notify; + struct completion *t_notify2; int shutdown; long jiffies_to_wait; @@ -193,7 +194,7 @@ daemonize("lirc_dev"); if (ir->t_notify != NULL) - up(ir->t_notify); + complete(ir->t_notify); dprintk(LOGHEAD "poll thread started\n", ir->p.name, ir->p.minor); @@ -218,11 +219,11 @@ } while (!ir->shutdown); if (ir->t_notify2 != NULL) - down(ir->t_notify2); + wait_for_completion(ir->t_notify2); ir->tpid = -1; if (ir->t_notify != NULL) - up(ir->t_notify); + complete(ir->t_notify); dprintk(LOGHEAD "poll thread ended\n", ir->p.name, ir->p.minor); @@ -238,7 +239,7 @@ #ifdef LIRC_HAVE_DEVFS_24 char name[16]; #endif - DECLARE_MUTEX_LOCKED(tn); + DECLARE_COMPLETION(tn); if (!p) { printk(KERN_ERR "lirc_dev: lirc_register_plugin: " @@ -389,7 +390,7 @@ err = -ECHILD; goto out_sysfs; } - down(&tn); + wait_for_completion(&tn); ir->t_notify = NULL; } ir->attached = 1; @@ -425,8 +426,8 @@ int lirc_unregister_plugin(int minor) { struct irctl *ir; - DECLARE_MUTEX_LOCKED(tn); - DECLARE_MUTEX_LOCKED(tn2); + DECLARE_COMPLETION(tn); + DECLARE_COMPLETION(tn2); if (minor < 0 || minor >= MAX_IRCTL_DEVICES) { printk(KERN_ERR "lirc_dev: lirc_unregister_plugin: " @@ -462,8 +463,8 @@ /* 2.2.x does not export wake_up_process() */ wake_up_interruptible(ir->p.get_queue(ir->p.data)); #endif - up(&tn2); - down(&tn); + complete(&tn2); + wait_for_completion(&tn); ir->t_notify = NULL; ir->t_notify2 = NULL; }