--- vloopback.c.orig 2011-02-06 12:26:40.945545824 +0200 +++ vloopback.c 2011-02-06 12:29:46.725820264 +0200 @@ -173,6 +173,10 @@ * * 08.09.10 (Darryl Sokoloski) * Patch for kernel version >= 2.6.34 + * + * 06.02.11 (PhobosK) + * Patch for kernel version >= 2.6.37 + * Modified patch for RT kernels. */ @@ -244,7 +248,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()) \ @@ -1329,15 +1350,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);