Re: [PATCH] Documentation: kbuild: explain handling optional dependencies

From: Arnd Bergmann
Date: Fri Sep 15 2023 - 01:27:31 EST


On Thu, Sep 14, 2023, at 19:23, Masahiro Yamada wrote:
> On Thu, Sep 14, 2023 at 11:57 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>> On Thu, Sep 14, 2023, at 15:42, Jani Nikula wrote:
>
> It is unclear why WIREGUARD must be entirely disabled
> just because of the optional feature being modular.

I don't think anyone is asking for that, and the current
"depends on IPV6 || !IPV6" seems fine here, and is consistent
with dozens of other symbols.

> My preference is to use IS_REACHABLE(CONFIG_IPV6)
> instead of IS_ENABLED(CONFIG_IPV6)
> under drivers/net/wireguard, then
> get rid of "depends on IPV6 || !IPV6)

My feeling is that this would be significantly worse from a
usability point of view even if it made it a little easier
for maintainers:

When a user selects both IPV6 and WIREGUARD, they expect
to be able to use them together, and a normal user setting
WIREGUARD=y would have a hard time figuring out why that
leads it becoming IPv4-only.

> If you want to make it clearer on the Kconfig level,
> perhaps the following is also possible.
>
>
> config WIREGUARD
> tristate "WireGuard"
>
> config WIREGUARD_IPV6
> def_bool y
> depends on WIREGUARD
> depends on IPV6 >= WIREGUARD
>
> config IPV6
> tristate "IPV6"

That has the same downside, with the added problem
of also confusing kernel developers with the '>='
Kconfig syntax, which IMHO makes no sense unless one
knows way too much about Kconfig internals.

Arnd