From 0a8db4d3e8fdf85472bfd9273154bfab2b73633c Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Thu, 17 Feb 2005 22:58:33 +0000 Subject: [PATCH] new compatibility header from Ian Abbott : Here's an asm/semaphore.h compatibility header to help build Comedi drivers for kernel versions prior to 2.2.18. It defines the following missing macros: init_MUTEX(x) init_MUTEX_LOCKED(x) DECLARE_MUTEX(name) DECLARE_MUTEX_LOCKED(name) I didn't define sema_init(sem, val) as I the implementation is arch-dependent. --- include/asm/semaphore.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/asm/semaphore.h diff --git a/include/asm/semaphore.h b/include/asm/semaphore.h new file mode 100644 index 00000000..791c2e14 --- /dev/null +++ b/include/asm/semaphore.h @@ -0,0 +1,21 @@ +/* + * asm/semaphore.h compatibility header + */ + +#ifndef __COMPAT_ASM_SEMAPHORE_H_ +#define __COMPAT_ASM_SEMAPHORE_H_ + +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) +#define init_MUTEX(x) *(x)=MUTEX +#define init_MUTEX_LOCKED(x) *(x)=MUTEX_LOCKED +#define DECLARE_MUTEX(name) struct semaphore name=MUTEX +#define DECLARE_MUTEX_LOCKED(name) struct semaphore name=MUTEX_LOCKED +/* N.B. Cannot define missing sema_init() portably, so best not use it! */ +#endif + +#include_next + +#endif // __COMPAT_ASM_SEMAPHORE_H_ + -- 2.26.2