Index: driver/ivtv-driver.h
===================================================================
--- driver/ivtv-driver.h	(revision 3725)
+++ driver/ivtv-driver.h	(working copy)
@@ -507,7 +507,11 @@
 
 	/* control thread */
 	struct task_struct *thread;
+#if defined(CONFIG_RT_MUTEXES) && defined(__COMPAT_DECLARE_SEMAPHORE_GENERIC)
+	struct compat_semaphore startstop_sem;
+#else
 	struct semaphore startstop_sem;
+#endif /* defined(CONFIG_RT_MUTEXES) && defined(__COMPAT_DECLARE_SEMAPHORE_GENERIC) */
 	wait_queue_head_t queue;
 	int terminate;
 };
Index: driver/ivtv-kthreads.c
===================================================================
--- driver/ivtv-kthreads.c	(revision 3725)
+++ driver/ivtv-kthreads.c	(working copy)
@@ -168,7 +168,11 @@
 	struct ivtv_dualwatch *kthread = &ivtv->dualwatch;
 
 	if (!kthread->thread) {
+#if defined(CONFIG_RT_MUTEXES) && defined(__COMPAT_DECLARE_SEMAPHORE_GENERIC)
+		compat_init_MUTEX_LOCKED(&kthread->startstop_sem);
+#else
 		init_MUTEX_LOCKED(&kthread->startstop_sem);
+#endif /* defined(CONFIG_RT_MUTEXES) && defined(__COMPAT_DECLARE_SEMAPHORE_GENERIC) */
 		kernel_thread(ivtv_dualwatch_kthread, ivtv, 0);
 		down(&kthread->startstop_sem);
 	}
@@ -186,7 +190,11 @@
 	   flag and released after the down() call. */
 	lock_kernel();
 	if (kthread->thread) {	/* paranoid mode */
+#if defined(CONFIG_RT_MUTEXES) && defined(__COMPAT_DECLARE_SEMAPHORE_GENERIC)
+		compat_init_MUTEX_LOCKED(&kthread->startstop_sem);
+#else
 		init_MUTEX_LOCKED(&kthread->startstop_sem);
+#endif /* defined(CONFIG_RT_MUTEXES) && defined(__COMPAT_DECLARE_SEMAPHORE_GENERIC) */
 		/* We need to do a memory barrier here to be sure that
 		   the flags are visible on all CPUs. 
 		 */
