Re: [PATCH] provide arch_test_bit_acquire for architectures that define test_bit
From: Linus Torvalds
Date: Fri Aug 26 2022 - 16:07:49 EST
[ Crossed emails ]
On Fri, Aug 26, 2022 at 1:03 PM Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote:
>
> +static __always_inline bool
> +arch_test_bit_acquire(unsigned long nr, const volatile unsigned long *addr)
> +{
> + unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
> + return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1)));
> +}
> +
I'd suggest you just do
#define arch_test_bit_acquire generic_test_bit_acquire
in each of these files, instead of duplicating that function over and
over again..
Because the generic version always exists, since it comes from
generic-non-atomic.h, which is included directly from
<linux/bitops.h>.
Linus