--- vloopback.orig/webcamstudio.c 2010-11-04 21:59:27.000000000 +0200 +++ vloopback/webcamstudio.c 2011-02-05 23:52:30.134289481 +0200 @@ -241,7 +241,24 @@ #include #include #endif + +/* kernels <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +# include +#else +# include +#endif +#if (defined CONFIG_PREEMPT_RT && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) + #ifndef DECLARE_MUTEX + #define DECLARE_MUTEX(_m) DEFINE_SEMAPHORE(_m) + #endif + #ifndef init_MUTEX + #define init_MUTEX(_m) sema_init(_m,1) + #endif +#endif + + #define VIDIOCSINVALID _IO('v',BASE_VIDIOCPRIVATE+1) #define verbose(format, arg...) if (printk_ratelimit()) \ @@ -1326,15 +1343,8 @@ loops[nr]->vloopin->minor = minor_in; init_waitqueue_head(&loops[nr]->wait); -#ifdef CONFIG_PREEMPT_RT - /* for RT kernels */ -#warning "******************************" -#warning "* Using patch for RT Kernels *" -#warning "******************************" - semaphore_init(&loops[nr]->lock); -#else + init_MUTEX(&loops[nr]->lock); -#endif ret = video_register_device(loops[nr]->vloopin, VFL_TYPE_GRABBER, minor_in);