diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-06-01 03:16:17 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-06-01 03:16:17 +0000 |
commit | d8d9b8f76f22b7a16a83e261e64f89ee611f49df (patch) | |
tree | 3067bc130b80d52808e6390c9fc7fc087ec1e33c /include/asm-sparc/semaphore.h | |
parent | 19c9bba94152148523ba0f7ef7cffe3d45656b11 (diff) |
Initial revision
Diffstat (limited to 'include/asm-sparc/semaphore.h')
-rw-r--r-- | include/asm-sparc/semaphore.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h index 48da860e4..eac2160e7 100644 --- a/include/asm-sparc/semaphore.h +++ b/include/asm-sparc/semaphore.h @@ -28,20 +28,18 @@ extern void __up(struct semaphore * sem); * XXX spinlock can allow this to be done without grabbing the IRQ * XXX global lock. */ -static inline int waking_non_zero(struct semaphore *sem) -{ - unsigned long flags; - int ret = 0; - - save_flags(flags); - cli(); - if (atomic_read(&sem->waking) > 0) { - atomic_dec(&sem->waking); - ret = 1; - } - restore_flags(flags); - return ret; -} +#define waking_non_zero(sem) \ +({ unsigned long flags; \ + int ret = 0; \ + save_flags(flags); \ + cli(); \ + if (atomic_read(&sem->waking) > 0) { \ + atomic_dec(&sem->waking); \ + ret = 1; \ + } \ + restore_flags(flags); \ + ret; \ +}) /* This isn't quite as clever as the x86 side, I'll be fixing this * soon enough. |