Re: [PATCH] ARM: fix unmet dependency on BITREVERSE for HAVE_ARCH_BITREVERSE

From: Russell King (Oracle)
Date: Fri Oct 29 2021 - 18:21:31 EST


On Sat, Oct 30, 2021 at 12:05:28AM +0200, Arnd Bergmann wrote:
> On Fri, Oct 29, 2021 at 10:31 PM Julian Braha <julianbraha@xxxxxxxxx> wrote:
> >
> > When ARM is enabled, and BITREVERSE is disabled,
> > Kbuild gives the following warning:
> >
> > WARNING: unmet direct dependencies detected for HAVE_ARCH_BITREVERSE
> > Depends on [n]: BITREVERSE [=n]
> > Selected by [y]:
> > - ARM [=y] && (CPU_32v7M [=n] || CPU_32v7 [=y]) && !CPU_32v6 [=n]
> >
> > This is because ARM selects HAVE_ARCH_BITREVERSE
> > without selecting BITREVERSE, despite
> > HAVE_ARCH_BITREVERSE depending on BITREVERSE.
> >
> > This unmet dependency bug was found by Kismet,
> > a static analysis tool for Kconfig. Please advise if this
> > is not the appropriate solution.
> >
> > Signed-off-by: Julian Braha <julianbraha@xxxxxxxxx>
>
> This works, but I think it would be better handled differently:
>
> The other 'select BITREVERSE' instances are for drivers that use
> bitrever(), not those that provide it.
>
> We can probably just remove the dependency. Alternatively we could
> change arch/arm/ to
>
> select HAVE_ARCH_BITREVERSE if BITREVERSE && ((CPU_32v7M ||
> CPU_32v7) && !CPU_32v6)
>
> Regardless of what we do here, note that
>
> a) the 'select' lines in CONFIG_ARM are sorted alphabetically, and
> should be kept that way
>
> b) the same probably exists on arch/mips and arch/arm64, whatever we
> do here should be the same as on the other architectures.

I think HAVE_ARCH_BITREVERSE shouldn't depend on BITREVERSE.
BITREVERSE is set when something wants the bitreverse support.
HAVE_ARCH_BITREVERSE means that the architecture has support for
the bitreverse instructions and the generic code should not be
compiled.

I don't see any reason for HAVE_ARCH_BITREVERSE to depend on
BITREVERSE.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!