Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1965154ybz; Thu, 23 Apr 2020 09:10:19 -0700 (PDT) X-Google-Smtp-Source: APiQypLMWiQUvPD2of7HhVuc1VTIN/DLSbe9uR4hjIp9GHq/QhqLir6VUB8UD1dUQ4fm3Q2knRQQ X-Received: by 2002:aa7:d28a:: with SMTP id w10mr3221348edq.206.1587658219349; Thu, 23 Apr 2020 09:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587658219; cv=none; d=google.com; s=arc-20160816; b=LGG3m6hwW0EoldTBKukE7oFf9JFBlJl2WrdXSJ70iEkf0GoLDvgrYCn8Q4Vz3rQpy1 W/wqSeqX8gvdB7BI9r8KwtXJf2m2L3P3k/4J4StWJnmKM1D9BAJbuNJMoY3VuDord0dN dVG/ay7N59+iYzhEfhfWpUPWZ+xRJONTafNlnMZTD2qGq20GcDtXmpCRxuFjsRO2Zlzr 2r5B+FcOZv7rNy+NvpoPITzWXS3ghUEJUTZjgL9dmTOaAuStLySUyLWkM4ZqYj6+vNRD n6LE8r15RssIXQPY7tPO1ANY1HuVF1c4UPqR7RVBgeS7UIrpFOZ79L7VbbCqrrntJKBa OhUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=cBRkxdh4HX0XgsZunFLrXhXJ8a9hlNoc4OOW6ApjOPo=; b=J8FGDCIKdo5J+M8qgW9XlnNDg2gT+9dFcH9dbMaEeUepzittmdfJRPNJvnrZl0pXua xwsRJc7g07Dv9qvt5opIGdfYO7SHNMk5xknK9CcHgJjak6Qao15Ukc4650g3BRCdTQDb sf2P0/3eH23BszEIDiLbTQzAU/fb9tLMBgFU0/UA9ovvUviqKakSen24GkFGZGYDQ3re /hdZhUOzbI59E3k04tV9Ns1VfBFHdVVJGil0fQbERut6NWTdhzlErAxiNrWjwGBsLEyH xlGUXe7HskJ1L2yna/8SgjgGHRUg+WfknJxdl3v6lG+IPMhKmlxlZJHklJpmaO17xByE kdOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=pdUg+udN; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=OGT7qe6q; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq24si1342616ejb.222.2020.04.23.09.09.49; Thu, 23 Apr 2020 09:10:19 -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=@pobox.com header.s=sasl header.b=pdUg+udN; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=OGT7qe6q; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729467AbgDWQFU (ORCPT + 99 others); Thu, 23 Apr 2020 12:05:20 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:65029 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729405AbgDWQFU (ORCPT ); Thu, 23 Apr 2020 12:05:20 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 8871063C52; Thu, 23 Apr 2020 12:05:19 -0400 (EDT) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=x7iIIy9VfnDBC05PB7qK8tTAn6w=; b=pdUg+u dN7SpEnmFLFGAfVoxGV9vA5dtbxzXff2THUvS/tLyx7+JyKmwrgNswqZjLaMtpIL O4U3Kb0ryWLGbbq+zoJ0cWxL0dcautz9v/cjPUivyCgEoFGVrrfNrkljZIIbkusA cbN6jBG/xZNCP3ZuhF79s4bq4Y1zbF/7Z2tgw= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 7E6CA63C51; Thu, 23 Apr 2020 12:05:19 -0400 (EDT) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=KQ9Xu37VoEpvg1eX+p+3+Sv3KMPQq2glfS0rMzNnloE=; b=OGT7qe6q3ByGjWJsEY/xNYLjegCIle/r3lrmRca+UadFYWXW6gScYrkzRXYecQwZZi8ijtDHnStUPxD5Sc1rCvxNNt2xaJBVHAHyVEaUBX+ZkUE2c32+a/J2uIMkooIIZ21TG2goiNAkQ8Yux8Mv4nohpw1nu9Imwdl3eI7BWZA= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id E719463C50; Thu, 23 Apr 2020 12:05:18 -0400 (EDT) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id E58662DA0C9B; Thu, 23 Apr 2020 12:05:17 -0400 (EDT) Date: Thu, 23 Apr 2020 12:05:17 -0400 (EDT) From: Nicolas Pitre To: Jani Nikula cc: Masahiro Yamada , linux-kbuild@vger.kernel.org, Randy Dunlap , Saeed Mahameed , Arnd Bergmann , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kconfig: allow for conditional dependencies In-Reply-To: <87imhqb3le.fsf@intel.com> Message-ID: References: <87imhqb3le.fsf@intel.com> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: 3A5A1E32-857C-11EA-90B2-D1361DBA3BAF-78420484!pb-smtp2.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Nicolas