|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v7 2/8] xen/riscv: allow write_atomic() to work with non-scalar types
Update the defintion of write_atomic() to support non-scalar types,
aligning it with the behavior of read_atomic().
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
Changes in V7:
- use union in definition of write_atomic() to add support of non-scalar
types.
---
Changes in v6:
- new patch.
---
xen/arch/riscv/include/asm/atomic.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/xen/arch/riscv/include/asm/atomic.h
b/xen/arch/riscv/include/asm/atomic.h
index 95910ebfeb..e2dbb391f0 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -69,10 +69,11 @@ static always_inline void _write_atomic(volatile void *p,
}
}
-#define write_atomic(p, x) \
-({ \
- typeof(*(p)) x_ = (x); \
- _write_atomic(p, x_, sizeof(*(p))); \
+#define write_atomic(p, x) \
+({ \
+ union { typeof(*(p)) v; unsigned long v_ul; } x_ = { .v_ul = 0UL }; \
+ x_.v = (x); \
+ _write_atomic(p, x_.v_ul, sizeof(*(p))); \
})
static always_inline void _add_sized(volatile void *p,
--
2.46.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |