All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Masahiro Yamada <masahiroy@kernel.org>, Nicolas Pitre <nico@fluxnic.net>
Cc: Saeed Mahameed <saeedm@mellanox.com>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, Jason Gunthorpe <jgg@ziepe.ca>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Leon Romanovsky <leon@kernel.org>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	jonas@kwiboo.se, David Airlie <airlied@linux.ie>,
	jernej.skrabec@siol.net,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	linux-rdma@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] Kconfig: Introduce "uses" keyword
Date: Mon, 20 Apr 2020 11:43:13 +0300	[thread overview]
Message-ID: <87v9lu1ra6.fsf@intel.com> (raw)
In-Reply-To: <CAK7LNATmPD1R+Ranis2u3yohx8b0+dGKAvFpjg8Eo9yEHRT6zQ@mail.gmail.com>

On Sun, 19 Apr 2020, Masahiro Yamada <masahiroy@kernel.org> wrote:
> On Sun, Apr 19, 2020 at 4:11 AM Nicolas Pitre <nico@fluxnic.net> wrote:
>>
>> On Sun, 19 Apr 2020, Masahiro Yamada wrote:
>>
>> > (FOO || !FOO) is difficult to understand, but
>> > the behavior of "uses FOO" is as difficult to grasp.
>>
>> Can't this be expressed as the following instead:
>>
>>         depends on FOO if FOO
>>
>> That would be a little clearer.
>>
>>
>> Nicolas
>
>
>
> 'depends on' does not take the 'if <expr>'
>
> 'depends on A if B' is the syntax sugar of
> 'depends on (A || !B), right ?
>
> I do not know how clearer it would make things.
>
> depends on (m || FOO != m)
> is another equivalent, but we are always
> talking about a matter of expression.
>
>
> How important is it to stick to
> depends on (FOO || !FOO)
> or its equivalents?
>
>
> If a driver wants to use the feature FOO
> in most usecases, 'depends on FOO' is sensible.
>
> If FOO is just optional, you can get rid of the dependency,
> and IS_REACHABLE() will do logically correct things.

If by logically correct you mean the kernel builds, you're
right. However the proliferation of IS_REACHABLE() is making the kernel
config *harder* to understand. User enables FOO=m and expects BAR to use
it, however if BAR=y it silently gets ignored. I have and I will oppose
adding IS_REACHABLE() usage to i915 because it's just silently accepting
configurations that should be flagged and forbidden at kconfig stage.

> I do not think IS_REACHABLE() is too bad,
> but if it is confusing, we can add one more
> option to make it explicit.
>
>
>
> config DRIVER_X
>        tristate "driver x"
>
> config DRIVER_X_USES_FOO
>        bool "use FOO from driver X"
>        depends on DRIVER_X
>        depends on DRIVER_X <= FOO
>        help
>          DRIVER_X works without FOO, but
>          Using FOO will provide better usability.
>          Say Y if you want to make driver X use FOO.
>
>
>
> Of course,
>
>       if (IS_ENABLED(CONFIG_DRIVER_X_USES_FOO))
>                foo_init();
>
> works like
>
>       if (IS_REACHABLE(CONFIG_FOO))
>                 foo_init();
>
>
> At lease, it will eliminate a question like
> "I loaded the module FOO, I swear.
> But my built-in driver X still would not use FOO, why?"

Please let's not make that a more widespread problem than it already
is. I have yet to hear *one* good rationale for allowing that in the
first place. And if that pops up, you can make it work by using
IS_REACHABLE() *without* the depends, simply by checking if the module
is there.

Most use cases increasingly solved by IS_REACHABLE() should use the
"depends on FOO || FOO=n" construct, but the problem is that's not
widely understood. I'd like to have another keyword for people to
copy-paste into their Kconfigs.

In another mail I suggested

	optionally depends on FOO

might be a better alternative than "uses".


BR,
Jani.

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2020-04-20  8:43 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17  1:11 [RFC PATCH 1/2] Kconfig: Introduce "uses" keyword Saeed Mahameed
2020-04-17  1:11 ` [RFC PATCH 2/2] net/mlx5: Kconfig: Use "uses" instead of "imply" Saeed Mahameed
2020-04-17  8:08   ` Arnd Bergmann
2020-04-17  6:23 ` [RFC PATCH 1/2] Kconfig: Introduce "uses" keyword Jani Nikula
2020-04-17  6:23   ` Jani Nikula
2020-04-17 12:28   ` Jason Gunthorpe
2020-04-17 14:01     ` Jani Nikula
2020-04-17 14:07       ` Jason Gunthorpe
2020-04-17 10:24 ` Arnd Bergmann
2020-04-17 11:35   ` Saeed Mahameed
2020-04-17 11:35     ` Saeed Mahameed
2020-04-18 19:00 ` Masahiro Yamada
2020-04-18 19:11   ` Nicolas Pitre
2020-04-18 20:07     ` Masahiro Yamada
2020-04-20  8:43       ` Jani Nikula [this message]
2020-04-20 18:42         ` Jakub Kicinski
2020-04-21  4:24         ` Saeed Mahameed
2020-04-21  4:24           ` Saeed Mahameed
2020-04-21 13:58           ` Nicolas Pitre
2020-04-21 13:58             ` Nicolas Pitre
2020-04-21 16:30             ` Saeed Mahameed
2020-04-21 16:30               ` Saeed Mahameed
2020-04-21 18:23               ` Nicolas Pitre
2020-04-21 18:23                 ` Nicolas Pitre
2020-04-22  8:51                 ` Jani Nikula
2020-04-22  8:51                   ` Jani Nikula
2020-04-22 21:13                   ` Nicolas Pitre
2020-04-22 21:13                     ` Nicolas Pitre
2020-04-22 22:37                     ` Randy Dunlap
2020-04-22 22:37                       ` Randy Dunlap
2020-04-23 15:01                       ` Nicolas Pitre
2020-04-23 15:01                         ` Nicolas Pitre
2020-04-23 15:05                         ` Jason Gunthorpe
2020-04-23 15:05                           ` Jason Gunthorpe
2020-04-23 15:11                           ` Nicolas Pitre
2020-04-23 15:11                             ` Nicolas Pitre
2020-04-23 15:16                             ` Jason Gunthorpe
2020-04-23 15:16                               ` Jason Gunthorpe
2020-04-23 15:28                               ` Arnd Bergmann
2020-04-23 15:28                                 ` Arnd Bergmann
2020-04-23 15:33                               ` Nicolas Pitre
2020-04-23 15:33                                 ` Nicolas Pitre
2020-04-23 18:30                                 ` Jason Gunthorpe
2020-04-23 18:30                                   ` Jason Gunthorpe
2020-04-23 18:52                                   ` Nicolas Pitre
2020-04-23 18:52                                     ` Nicolas Pitre
2020-04-20 13:53   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9lu1ra6.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=arnd@arndb.de \
    --cc=jernej.skrabec@siol.net \
    --cc=jgg@ziepe.ca \
    --cc=jonas@kwiboo.se \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=leon@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=nico@fluxnic.net \
    --cc=saeedm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.