diff options
author | 2020-06-16 14:35:12 +0000 | |
---|---|---|
committer | 2020-06-16 14:35:12 +0000 | |
commit | 5cf16f9f28d6fe6b5339014fb438916efb9d5df7 (patch) | |
tree | ec443cc83ec76ee7c6b3dabceacc59ab3fcb08df | |
parent | remove a dead store (diff) | |
download | wireguard-openbsd-5cf16f9f28d6fe6b5339014fb438916efb9d5df7.tar.xz wireguard-openbsd-5cf16f9f28d6fe6b5339014fb438916efb9d5df7.zip |
implement atomic_inc_not_zero() by way of atomic_add_unless()
-rw-r--r-- | sys/dev/pci/drm/include/linux/atomic.h | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/dev/pci/drm/include/linux/atomic.h b/sys/dev/pci/drm/include/linux/atomic.h index 1dce7bb185c..4e4ae819029 100644 --- a/sys/dev/pci/drm/include/linux/atomic.h +++ b/sys/dev/pci/drm/include/linux/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.7 2020/06/16 14:04:50 jsg Exp $ */ +/* $OpenBSD: atomic.h,v 1.8 2020/06/16 14:35:12 jsg Exp $ */ /** * \file drm_atomic.h * Atomic operations used in the DRM which may or may not be provided by the OS. @@ -98,6 +98,8 @@ atomic_add_unless(volatile int *v, int n, int u) return 1; } +#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) + static inline int atomic_dec_if_positive(volatile int *v) { @@ -223,16 +225,6 @@ typedef int32_t atomic_long_t; #define atomic_long_cmpxchg(p, o, n) atomic_cmpxchg(p, o, n) #endif -static inline int -atomic_inc_not_zero(atomic_t *p) -{ - if (*p == 0) - return (0); - - *(p) += 1; - return (*p); -} - /* FIXME */ #define atomic_set_int(p, bits) atomic_setbits_int(p,bits) #define atomic_set_mask(bits, p) atomic_setbits_int(p,bits) |