aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/atomic_common.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-02-14 23:15:41 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-02-14 23:15:41 +0000
commit082a6b2a92888cf799c7a0408a78e2d7ad9320bb (patch)
tree20de7ae1d68d9825dcd2cc5f7c89d3655bed9d88 /sys/sys/atomic_common.h
parent23f6a81e4930c69f1fdcbb90de30ce03561bb4cf (diff)
downloadsrc-082a6b2a92888cf799c7a0408a78e2d7ad9320bb.tar.gz
src-082a6b2a92888cf799c7a0408a78e2d7ad9320bb.zip
Make atomic_load_ptr type-aware
Returned value has type based on the argument, meaning consumers no longer have to cast in the commmon case. This commit keeps the kernel compilable without patching the rest.
Notes
Notes: svn path=/head/; revision=357940
Diffstat (limited to 'sys/sys/atomic_common.h')
-rw-r--r--sys/sys/atomic_common.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h
index 889d491cc1af..63311b5a3124 100644
--- a/sys/sys/atomic_common.h
+++ b/sys/sys/atomic_common.h
@@ -41,7 +41,7 @@
#define atomic_load_short(p) (*(volatile u_short *)(p))
#define atomic_load_int(p) (*(volatile u_int *)(p))
#define atomic_load_long(p) (*(volatile u_long *)(p))
-#define atomic_load_ptr(p) (*(volatile uintptr_t*)(p))
+#define atomic_load_ptr(p) (*(volatile __typeof(p))(p))
#define atomic_load_8(p) (*(volatile uint8_t *)(p))
#define atomic_load_16(p) (*(volatile uint16_t *)(p))
#define atomic_load_32(p) (*(volatile uint32_t *)(p))