Messages in this thread | | | From | Linus Torvalds <> | Date | Fri, 26 Aug 2022 13:07:24 -0700 | Subject | Re: [PATCH] provide arch_test_bit_acquire for architectures that define test_bit |
| |
[ Crossed emails ]
On Fri, Aug 26, 2022 at 1:03 PM Mikulas Patocka <mpatocka@redhat.com> 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
| |