Re: [RFC][PATCH 04/24] arm64: Provide atomic_{or,xor,and}

Will Deacon
2015-07-15T16:01:20Z

On Thu, Jul 09, 2015 at 06:28:59PM +0100, Peter Zijlstra wrote:
> Implement atomic logic ops -- atomic_{or,xor,and}.
>
> These will replace the atomic_{set,clear}_mask functions that are
> available on some archs.
>
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> arch/arm64/include/asm/atomic.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> --- a/arch/arm64/include/asm/atomic.h
> +++ b/arch/arm64/include/asm/atomic.h
> @@ -84,6 +84,9 @@ static inline int atomic_##op##_return(i
>
> ATOMIC_OPS(add, add)
> ATOMIC_OPS(sub, sub)
> +ATOMIC_OP(and, and)
> +ATOMIC_OP(or, orr)

FYI, but without selecting CONFIG_ARCH_HAS_ATOMIC_OR this change leads to
build errors:

from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/arm64/kernel/asm-offsets.c:21:
include/linux/atomic.h:115:20: error: redefinition of ‘atomic_or’
static inline void atomic_or(int i, atomic_t *v)
^
In file included from include/linux/atomic.h:4:0,
from include/linux/spinlock.h:416,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/arm64/kernel/asm-offsets.c:21:
arch/arm64/include/asm/atomic.h:48:20: note: previous definition of ‘atomic_or’ was here
static inline void atomic_##op(int i, atomic_t *v) \
^
arch/arm64/include/asm/atomic.h:88:1: note: in expansion of macro ‘ATOMIC_OP’
ATOMIC_OP(or, orr)
^
make[2]: *** [arch/arm64/kernel/asm-offsets.s] Error 1

Will