Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp2053441ybj; Wed, 6 May 2020 09:46:21 -0700 (PDT) X-Google-Smtp-Source: APiQypKCgUhmpzP1kXM0d40VBMhrWmTCQ6dMi9QkT4RWN0WVspO0+5x1GpCv8gP+JVranHaUv0P0 X-Received: by 2002:a17:906:2b96:: with SMTP id m22mr8157986ejg.330.1588783581249; Wed, 06 May 2020 09:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588783581; cv=none; d=google.com; s=arc-20160816; b=v7J/TUCO0Qa06w7/82caI/dqjynHzAEzDz1L3O8QLFD9MjNmwoZH3bZstbOk0LNNbK zMYAdWjJERPCdFv6B3t2EiEPOgV4pc2oF4QFYmrWaZSVEGaxz8mgkGKrTAok3rt21718 U7HypdOy27rx2e1e9OWgQ1SqauD8U1Jf+9MZqrlIQHuEcpCysmkHnTeM2UH86LKMyWcR yru8fFtrahtWflfLG5NXIs2MiqYKwiJ/PqFAyzk+SuiHMonK9SaaOhwaJ6eEeVXjRj+Z 4iZi/C/5W8PcLRYDfmLvuqSlZKjENsVrTsMkZKsemvLbTOn1n64y9svGhmvieZGP1huK CBlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=utvgGRsMw8+CW4P3BXfPw8wbFM86fzbR5axYMY0vIGg=; b=wvFkuMFBnFIiajh1zedqNn2igGrvs8WQiq6Ql8QVD+JFjzhficSKiml+ScBhhZ5XUr +4dRSoHscwY6jiV3xyfPE4xTPs2v08aRAHQ4h+Sfd5gkerYxEv098AFvZB0e/QcqBiPo 6akLF9n1MLKbtbS+nV7tpqgzBwt4UO2AMhrslBcqY/XVSyyWBUau8T854iW/1letOvRe dWJ/3OhXirqUFoe6H5ruxNvPX2N/nh5xOvdh8qhWTZ32OTvunrXAZBjbd1ljgvborjKS QbwoJgb+PkQGW68usA6vkqQpq7m3j1Ln6B+unnJX7U6zBlZKtr0oalwB8UeWm175/OZP v0Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=HVH9aqAW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si1577530ejo.217.2020.05.06.09.45.58; Wed, 06 May 2020 09:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=HVH9aqAW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730125AbgEFQoZ (ORCPT + 99 others); Wed, 6 May 2020 12:44:25 -0400 Received: from conssluserg-01.nifty.com ([210.131.2.80]:39790 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730055AbgEFQoV (ORCPT ); Wed, 6 May 2020 12:44:21 -0400 Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 046GhjRm017691; Thu, 7 May 2020 01:43:46 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 046GhjRm017691 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1588783426; bh=utvgGRsMw8+CW4P3BXfPw8wbFM86fzbR5axYMY0vIGg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HVH9aqAW7dSrdCAjK6LWzWts7qi2i3l9S1k/K3/lF6QsA57Ee6mFgi8K6fwZERevF rjCXb5fR5X2r4POSS6b8fjaiRn0t2cQk1AeEGXRt9wL+uQDy4ASmfOiC+ew0tjRC+x bGLyot+eGg+hRaeaiyKW7Hr3KxZJmsW2zqxmTtyrKvmvS9W6F1rkmA2UQgk/ZWXbvy jsJIl03DzkDtOxu39qqNndEyguJO/fmWeMWTPt59h320vs1fcLIz+0RqLbE5a2jLx/ vHKsWeeOcmAuLyiiLftS7dibF6eA1SMP+X2kS9phHcrcQ25sB/uAMLcj6xUIbkWNiW JsJJogMZ5YlRw== X-Nifty-SrcIP: [209.85.222.46] Received: by mail-ua1-f46.google.com with SMTP id u12so742721uau.10; Wed, 06 May 2020 09:43:46 -0700 (PDT) X-Gm-Message-State: AGi0PuaII36n1U0693WqgVgZ0rGswZYbWwux97Wn0dOFJTlDch2l9p9u XIll8Z3it55Hgnnc4CWPYqwZk32QvPfwPPPzSTk= X-Received: by 2002:ab0:4ac9:: with SMTP id t9mr8255622uae.40.1588783425219; Wed, 06 May 2020 09:43:45 -0700 (PDT) MIME-Version: 1.0 References: <87imhqb3le.fsf@intel.com> In-Reply-To: From: Masahiro Yamada Date: Thu, 7 May 2020 01:43:08 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kconfig: allow for conditional dependencies To: Nicolas Pitre Cc: Jani Nikula , Linux Kbuild mailing list , Randy Dunlap , Saeed Mahameed , Arnd Bergmann , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 24, 2020 at 1:05 AM Nicolas Pitre wrote: > > On Thu, 23 Apr 2020, Jani Nikula wrote: > > > On Thu, 23 Apr 2020, Nicolas Pitre 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 > > > > > > 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" > > > +- dependencies: "depends on" ["if" ] > > > > > > 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. For the case of 'select', select FOO if BAR != n is NOT equivalent to: select FOO if BAR I do not think "if " in Kconfig is so easy to understand. I tend to hesitate to extend it. Sometimes, it means "the property is visible if != n". Sometimes, not. For the case of 'depends on', the 'depends on' is effective if != n because Nicolas implemented it in this way. We can do: depends on X || X = n instead of: depends on X || !X or depends on X if X I guess the source of the complaint is !X is difficult to understand when X is tristate. But, is there any confusion in 'X = n' ? I think not. -- Best Regards Masahiro Yamada