diff options
author | Richard Braun <rbraun@sceen.net> | 2013-04-06 18:37:39 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-04-06 18:37:39 +0200 |
commit | 42a7fb217e8ae686e5e4009ba4368cc507fdeae8 (patch) | |
tree | ff418d8671b1279274acb7d355b9e7f205db8106 | |
parent | e8dfbc47c11df34d6157dfa067b58cc3d691bf5d (diff) |
kern/spinlock: rewrite spinlock_assert_locked as a macro
Using a macro makes panic display the function where the assertion actually
failed.
-rw-r--r-- | kern/spinlock.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kern/spinlock.h b/kern/spinlock.h index 8d20db4f..01329f1d 100644 --- a/kern/spinlock.h +++ b/kern/spinlock.h @@ -24,8 +24,9 @@ #define _KERN_SPINLOCK_H #include <kern/assert.h> -#include <kern/thread.h> +#include <kern/macros.h> #include <kern/spinlock_i.h> +#include <kern/thread.h> #include <machine/cpu.h> struct spinlock; @@ -38,11 +39,7 @@ spinlock_init(struct spinlock *lock) lock->locked = 0; } -static inline void -spinlock_assert_locked(struct spinlock *lock) -{ - assert(lock->locked); -} +#define spinlock_assert_locked(lock) assert((lock)->locked) /* * Return 0 on success, 1 if busy. |