[svn-commits] sruffell: linux/trunk r9938 - /linux/trunk/include/dahdi/kernel.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 2 15:01:28 CDT 2011


Author: sruffell
Date: Thu Jun  2 15:01:24 2011
New Revision: 9938

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9938
Log:
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 <sruffell at digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Modified:
    linux/trunk/include/dahdi/kernel.h

Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=9938&r1=9937&r2=9938
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Thu Jun  2 15:01:24 2011
@@ -1381,9 +1381,16 @@
 #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




More information about the svn-commits mailing list