Messages in this thread | | | From | Arnd Bergmann <> | Date | Sat, 19 Mar 2022 12:52:09 +0100 | Subject | Re: [PATCH V2 1/5] asm-generic: ticket-lock: New generic ticket-based spinlock |
| |
On Sat, Mar 19, 2022 at 4:54 AM <guoren@kernel.org> wrote: > /* > - * You need to implement asm/spinlock.h for SMP support. The generic > - * version does not handle SMP. > + * Using ticket-spinlock.h as generic for SMP support. > */ > #ifdef CONFIG_SMP > -#error need an architecture specific asm/spinlock.h > +#include <asm-generic/ticket-lock.h> > +#ifdef CONFIG_QUEUED_RWLOCKS > +#include <asm-generic/qrwlock.h> > +#else > +#error Please select ARCH_USE_QUEUED_RWLOCKS in architecture Kconfig > +#endif > #endif
There is no need for the !CONFIG_SMP case, as asm/spinlock.h only ever gets included for SMP builds in the first place. This was already a mistake in the existing code, but your change would be the time to fix it.
I would also drop the !CONFIG_QUEUED_RWLOCKS case, just include it unconditionally. If any architecture wants the ticket spinlock in combination with a custom rwlock, they can simply include the asm-generic/ticket-lock.h from their asm/spinlock.h, but more likely any architecture that can use the ticket spinlock will also want the qrwlock anyway.
Arnd
| |