Re: [PATCH 2/3] net: dsa: tag_ocelot_8021q: fix driver dependency

From: Arnd Bergmann
Date: Thu Feb 25 2021 - 10:45:43 EST


On Thu, Feb 25, 2021 at 4:07 PM Vladimir Oltean <olteanv@xxxxxxxxx> wrote:
> On Thu, Feb 25, 2021 at 03:49:08PM +0100, Arnd Bergmann wrote:
> > On Thu, Feb 25, 2021 at 3:47 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> > > On Thu, Feb 25, 2021 at 3:43 PM Vladimir Oltean <olteanv@xxxxxxxxx> wrote:
> > > > On Thu, Feb 25, 2021 at 03:38:32PM +0100, Arnd Bergmann wrote:
> > > > > From: Arnd Bergmann <arnd@xxxxxxxx>
> > > > >
> > > > > When the ocelot driver code is in a library, the dsa tag
> >
> > I see the problem now, I should have written 'loadable module', not 'library'.
> > Let me know if I should resend with a fixed changelog text.
>
> Ah, ok, things clicked into place now that you said 'module'.
> So basically, your patch is the standard Kconfig incantation for 'if the
> ocelot switch lib is built as module, build the tagger as module too',
> plus some extra handling to allow NET_DSA_TAG_OCELOT_8021Q to still be y
> or m when COMPILE_TEST is enabled, but it will be compiled in a
> reduced-functionality mode, without MSCC_OCELOT_SWITCH_LIB, therefore
> without PTP.
>
> Do I get things right? Sorry, Kconfig is a very strange language.

Yes, that's basically correct. I tried to express it in Kconfig the way
I would explain it in English, which means it there are two options:

a) If MSCC_OCELOT_SWITCH_LIB is enabled (y or m) there is
a direct dependency, so NET_DSA_TAG_OCELOT_8021Q cannot
be built-in if MSCC_OCELOT_SWITCH_LIB=m
b) When compile-testing *and* MSCC_OCELOT_SWITCH_LIB is fully
disabled, NET_DSA_TAG_OCELOT_8021Q can be anything (y/m/n)

As a side-effect, this also means that if we are not compile-testing
and MSCC_OCELOT_SWITCH_LIB is disabled, the option is
hdden.

Arnd.