[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/riscv: allow write_atomic() to work with non-scalar types
commit f9e69c266ee0b5d386126d3625b79326c8cab3b3 Author: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> AuthorDate: Mon Sep 30 10:06:44 2024 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Sep 30 10:06:44 2024 +0200 xen/riscv: allow write_atomic() to work with non-scalar types Update the defintion of write_atomic() to support non-scalar types, bringing it closer to the behavior of read_atomic(). Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/riscv/include/asm/atomic.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h index 95910ebfeb..9669a3286d 100644 --- a/xen/arch/riscv/include/asm/atomic.h +++ b/xen/arch/riscv/include/asm/atomic.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ + /* SPDX-License-Identifier: GPL-2.0-only */ /* * Taken and modified from Linux. * @@ -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 ul; } x_ = { .ul = 0UL }; \ + x_.v = (x); \ + _write_atomic(p, x_.ul, sizeof(*(p))); \ }) static always_inline void _add_sized(volatile void *p, -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |