[openfabrics-ewg] [PATCH] ehca backport linux_spinlock_to_2_6_9.patch

Hoang-Nam Nguyen hnguyen at de.ibm.com
Mon Sep 18 09:47:00 PDT 2006


Hi,
below is backport of spinlock.h for kernel 2.6.9. It defines spin_trylock_irqsave(),
which is required by ipoib.
I did commit it into contrib/ibm/gen2/backport/2.6.9
Thanks!
Nam Nguyen


Signed-off-by: Hoang-Nam Nguyen <hnguyen at de.ibm.com>
---


 spinlock.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+)


diff -Nurp linux-2.6.9_orig/drivers/infiniband/include/linux/spinlock.h linux-2.6.9_work/drivers/infiniband/include/linux/spinlock.h
--- linux-2.6.9_orig/drivers/infiniband/include/linux/spinlock.h 1969-12-31 16:00:00.000000000 -0800
+++ linux-2.6.9_work/drivers/infiniband/include/linux/spinlock.h 2006-09-18 04:43:45.875983280 -0700
@@ -0,0 +1,16 @@
+#ifndef BACKPORT_LINUX_SPINLOCK_H
+#define BACKPORT_LINUX_SPINLOCK_H
+
+#include_next <linux/spinlock.h>
+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
+
+#define spin_lock_nested(lock, subclass) spin_lock(lock)
+
+#define spin_trylock_irqsave(lock, flags) \
+({ \
+         local_irq_save(flags); \
+         _spin_trylock(lock) ? \
+         1 : ({local_irq_restore(flags); 0;}); \
+})
+
+#endif




More information about the ewg mailing list