[PATCH 2/5] arm64: add __READ_ONCE_EX()
David Laight
David.Laight at ACULAB.COM
Sat Nov 9 01:49:03 PST 2024
From: Haris Okanovic
> Sent: 05 November 2024 18:31
>
> Perform an exclusive load, which atomically loads a word and arms the
> exclusive monitor to enable wfet()/wfe() accelerated polling.
>
...
> + atomic ? (typeof(*__x))__u.__val : (*(volatile typeof(__x))__x);\
That doesn't do what you want it to do.
(It is wrong in READ_ONCE() as well.)
?: is treated like an arithmetic operator and the result will get
promoted to 'int'.
Moving the first cast outside the ?: probably works:
(typeof(*__x))(atomic ? __u.__val : (*(volatile typeof(__x))__x));
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
More information about the linux-arm-kernel
mailing list