Index: kernel/generic/include/synch/spinlock.h
===================================================================
--- kernel/generic/include/synch/spinlock.h	(revision d7da428424c0f1c2c3f084c6836535553e191008)
+++ kernel/generic/include/synch/spinlock.h	(revision ffe4a87f6f04e3b1afccf14bda789427236053b1)
@@ -115,4 +115,6 @@
 extern void spinlock_lock_debug(spinlock_t *);
 extern void spinlock_unlock_debug(spinlock_t *);
+extern bool spinlock_locked(spinlock_t *);
+extern bool spinlock_unlocked(spinlock_t *);
 
 /** Unlock spinlock
@@ -177,4 +179,6 @@
 #define spinlock_trylock(lock)  (preemption_disable(), 1)
 #define spinlock_unlock(lock)   preemption_enable()
+#define spinlock_locked(lock)	1
+#define spinlock_unlocked(lock)	1
 
 #define DEADLOCK_PROBE_INIT(pname)
@@ -283,4 +287,6 @@
 extern void irq_spinlock_pass(irq_spinlock_t *, irq_spinlock_t *);
 extern void irq_spinlock_exchange(irq_spinlock_t *, irq_spinlock_t *);
+extern bool irq_spinlock_locked(irq_spinlock_t *);
+extern bool irq_spinlock_unlocked(irq_spinlock_t *);
 
 #endif
Index: kernel/generic/src/synch/spinlock.c
===================================================================
--- kernel/generic/src/synch/spinlock.c	(revision d7da428424c0f1c2c3f084c6836535553e191008)
+++ kernel/generic/src/synch/spinlock.c	(revision ffe4a87f6f04e3b1afccf14bda789427236053b1)
@@ -128,5 +128,5 @@
 void spinlock_unlock_debug(spinlock_t *lock)
 {
-	ASSERT_SPINLOCK(atomic_get(&lock->val) != 0, lock);
+	ASSERT_SPINLOCK(spinlock_locked(lock), lock);
 	
 	/*
@@ -165,4 +165,24 @@
 	
 	return rc;
+}
+
+/** Find out whether the spinlock is currently locked.
+ *
+ * @param lock		Spinlock.
+ * @return		True if the spinlock is locked, false otherwise.
+ */
+bool spinlock_locked(spinlock_t *lock)
+{
+	return atomic_get(&lock->val) != 0;
+}
+
+/** Find out whether the spinlock is currently unlocked.
+ *
+ * @param lock		Spinlock.
+ * @return		True if the spinlock is not locked, false otherwise.
+ */
+bool spinlock_unlocked(spinlock_t *lock)
+{
+	return atomic_get(&lock->val) == 0;
 }
 
@@ -314,4 +334,24 @@
 }
 
+/** Find out whether the IRQ spinlock is currently locked.
+ *
+ * @param lock		IRQ spinlock.
+ * @return		True if the IRQ spinlock is locked, false otherwise.
+ */
+bool irq_spinlock_locked(irq_spinlock_t *ilock)
+{
+	return spinlock_locked(&ilock->lock);
+}
+
+/** Find out whether the IRQ spinlock is currently unlocked.
+ *
+ * @param lock		IRQ spinlock.
+ * @return		True if the IRQ spinlock is not locked, false otherwise.
+ */
+bool irq_spinlock_unlocked(irq_spinlock_t *ilock)
+{
+	return spinlock_unlocked(&ilock->lock);
+}
+
 /** @}
  */
