[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <nycvar.YSQ.7.76.2004231155060.2671@knanqh.ubzr>
Date: Thu, 23 Apr 2020 12:05:17 -0400 (EDT)
From: Nicolas Pitre <nico@...xnic.net>
To: Jani Nikula <jani.nikula@...ux.intel.com>
cc: Masahiro Yamada <masahiroy@...nel.org>,
linux-kbuild@...r.kernel.org, Randy Dunlap <rdunlap@...radead.org>,
Saeed Mahameed <saeedm@...lanox.com>,
Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kconfig: allow for conditional dependencies
On Thu, 23 Apr 2020, Jani Nikula wrote:
> On Thu, 23 Apr 2020, Nicolas Pitre <nico@...xnic.net> wrote:
> > This might appear to be a strange concept, but sometimes we want
> > a dependency to be conditionally applied. One such case is currently
> > expressed with:
> >
> > depends on FOO || !FOO
> >
> > This pattern is strange enough to give one's pause. Given that it is
> > also frequent, let's make the intent more obvious with some syntaxic
> > sugar by effectively making dependencies optionally conditional.
> >
> > This also makes the kconfig language more uniform.
>
> Thanks, I prefer this over all the previous proposals. Versatile yet
> self-explanatory.
>
> > Signed-off-by: Nicolas Pitre <nico@...xnic.net>
> >
> > diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation/kbuild/kconfig-language.rst
> > index d0111dd264..0f841e0037 100644
> > --- a/Documentation/kbuild/kconfig-language.rst
> > +++ b/Documentation/kbuild/kconfig-language.rst
> > @@ -114,7 +114,7 @@ applicable everywhere (see syntax).
> > This is a shorthand notation for a type definition plus a value.
> > Optionally dependencies for this default value can be added with "if".
> >
> > -- dependencies: "depends on" <expr>
> > +- dependencies: "depends on" <expr> ["if" <expr>]
> >
> > This defines a dependency for this menu entry. If multiple
> > dependencies are defined, they are connected with '&&'. Dependencies
> > @@ -130,6 +130,16 @@ applicable everywhere (see syntax).
> > bool "foo"
> > default y
> >
> > + The dependency definition itself may be conditional by appending "if"
> > + followed by an expression. If such expression is false (n) then this
> > + dependency is ignored. One possible use case is:
> > +
> > + config FOO
> > + tristate
> > + depends on BAZ if BAZ != n
>
> I presume this is the same as
>
> depends on BAZ if BAZ
>
> which makes me wonder if that should be the example. At least current
> usage for select is predominantly
>
> select FOO if BAR
>
> without "!= n".
Yes, it is the same thing. I prefer making the documentation a little
more explicit than necessary so the explanation is really obvious.
Nicolas
Powered by blists - more mailing lists