From b2b5fdd4e80044f06426c29d6167535c79881777 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 2 Jun 2011 20:01:24 +0000 Subject: dahdi: Support "struct mutex" on pre 2.6.16 kernels. 'struct mutex' was introduced in 2.6.16. While DAHDI previously allowed statically allocated mutexes, this change is required in order to allow mutexes to be embedded in dynamically allocated structures on older kernels. Signed-off-by: Shaun Ruffell Acked-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9938 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- include/dahdi/kernel.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 69f883e..33b19cd 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1381,9 +1381,16 @@ typedef u32 __bitwise pm_message_t; #endif #ifndef DEFINE_MUTEX -#define DEFINE_MUTEX DEFINE_SEMAPHORE -#define mutex_lock(_x) down(_x) -#define mutex_unlock(_x) up(_x) +struct mutex { + struct semaphore sem; +}; +#define DEFINE_MUTEX(name) \ + struct mutex name = { \ + .sem = __SEMAPHORE_INITIALIZER((name).sem, 1), \ + } +#define mutex_lock(_x) down(&(_x)->sem) +#define mutex_unlock(_x) up(&(_x)->sem) +#define mutex_init(_x) sema_init(&(_x)->sem, 1) #endif #ifndef DEFINE_PCI_DEVICE_TABLE -- cgit v1.2.3