summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2013-08-29 19:47:52 +0000
committerjkim <jkim@FreeBSD.org>2013-08-29 19:47:52 +0000
commitd60bb760ec3e7d8592b384e51bf1e6402f0e8700 (patch)
tree55a7af20fc6622602b192443c58a202e7ad62d9b
parent8f526008d42509877a0b1f0303be142898629693 (diff)
downloadFreeBSD-src-d60bb760ec3e7d8592b384e51bf1e6402f0e8700.zip
FreeBSD-src-d60bb760ec3e7d8592b384e51bf1e6402f0e8700.tar.gz
- Remove test_and_set_bit() macro. It is unused since r255037.
- Relax atomic_read() and atomic_set() macros. Linux does not require any memory barrier. Also, these macros may be even reordered or optimized away according to the API documentation: https://www.kernel.org/doc/Documentation/atomic_ops.txt
-rw-r--r--sys/dev/drm2/drm_atomic.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/drm2/drm_atomic.h b/sys/dev/drm2/drm_atomic.h
index b901341..b4ef0fb 100644
--- a/sys/dev/drm2/drm_atomic.h
+++ b/sys/dev/drm2/drm_atomic.h
@@ -37,8 +37,8 @@ typedef uint64_t atomic64_t;
#define BITS_TO_LONGS(x) howmany(x, sizeof(long) * NBBY)
-#define atomic_set(p, v) atomic_store_rel_int(p, v)
-#define atomic_read(p) atomic_load_acq_int(p)
+#define atomic_read(p) (*(volatile u_int *)(p))
+#define atomic_set(p, v) do { *(u_int *)(p) = (v); } while (0)
#define atomic_add(v, p) atomic_add_int(p, v)
#define atomic_sub(v, p) atomic_subtract_int(p, v)
@@ -63,9 +63,7 @@ typedef uint64_t atomic64_t;
#define set_bit(b, p) \
atomic_set_int((volatile u_int *)(p) + (b) / 32, 1 << (b) % 32)
#define test_bit(b, p) \
- (atomic_load_acq_int((volatile u_int *)(p) + (b) / 32) & (1 << (b) % 32))
-#define test_and_set_bit(b, p) \
- atomic_testandset_int((volatile u_int *)(p) + (b) / 32, b)
+ ((atomic_read((volatile u_int *)(p) + (b) / 32) & (1 << (b) % 32)) != 0)
static __inline int
find_first_zero_bit(volatile void *p, int max)
OpenPOWER on IntegriCloud