Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3635062rdb; Wed, 13 Sep 2023 19:42:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRZOlIUByZ8XtNy/s6I5plevzO1yeGmvpuK+FCb3HX6p50UkCYac5HVDIFkkwnBwLp1kaF X-Received: by 2002:a05:6a20:1581:b0:14d:9938:735f with SMTP id h1-20020a056a20158100b0014d9938735fmr4319581pzj.17.1694659353748; Wed, 13 Sep 2023 19:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694659353; cv=none; d=google.com; s=arc-20160816; b=IurjIEWTpWPqGq1+5dp/TetWZ3SLY4Y50gj1sRBe34PbQ+HPVqp+7EeAG0dSDSZbCJ Vyv9O9D+GQgDvdrG0cRExJrhuiWptYLhX2OTSWLEQZYRKPErbeplBEvTUyWkqx54nCy9 a9oWb1+BXyDIxjzbdREAqWXtG4o5b7SCy2BfrxySUDORP5RwmvMYjDPtuwNzLPnuTAr3 ADS+sVNaKAMcQtc9l6DA+S8tjkpkT/tbqJVzr3Uipf3Z4xH7H1W4+naixLKC07OXKd/N 3IPrJjftyDPiBQf+3BuFLoJnx21GTYG2wrviuYAhqwGJrD0aWGtUJm+dTrnY8knAu/hj lcAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CE1Mihjln5kCtrssBag1ECT2mBGHqg2H1tGb2q/ZAvE=; fh=dJgIOWgAu9rAlxoqiouJEnkL756tUO5mBvjFghlyYWE=; b=0+942RWQT79WmyWUFB8mC3KK3wPh7Lb2kJtFANN8CsNpNNXk1uhuGojLpNZpVyNmU5 zxclzUG+nYCExHByu6dhqNzPvGLXYjOFRci18NZDbiQYiGdnRwnq7sK6JYdICVRDPw52 r1LimpmIdtXCSKOg0RcsUJLXp6L40A6dnK0LLufcz5Lsx0eRyoeO8v34/FG+x8DWq89Q MgwlPGQfaEvivjl0ycq4p+YxVFnLIvdnTdeNEX7RG60FTbW5t4wxsJvU24lN18xWReWB n6TGqGkFOPfpV0vy66DA8l/1ZSU53TmjDCS5+Hhph0XrIfXIpfsqQs7ZqwhaSHHaVCMg 3zzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fjasle.eu header.s=mail header.b=LbRZAR9k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fjasle.eu Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ja19-20020a170902efd300b001bb6d711625si635600plb.279.2023.09.13.19.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 19:42:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@fjasle.eu header.s=mail header.b=LbRZAR9k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fjasle.eu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 54A1C827E58E; Wed, 13 Sep 2023 13:34:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232052AbjIMUex (ORCPT + 99 others); Wed, 13 Sep 2023 16:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230205AbjIMUew (ORCPT ); Wed, 13 Sep 2023 16:34:52 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A8C1BCC; Wed, 13 Sep 2023 13:34:47 -0700 (PDT) Received: from leknes.fjasle.eu ([46.142.99.40]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MxV4T-1reNP838Bd-00xsvc; Wed, 13 Sep 2023 22:34:03 +0200 Received: by leknes.fjasle.eu (Postfix, from userid 1000) id B10AD3E92A; Wed, 13 Sep 2023 22:34:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fjasle.eu; s=mail; t=1694637242; bh=FHAimLrZHHhF8N3CgKs14v93vknjgjW6r5VMGiBKQDI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LbRZAR9kjYJe9nfyWG3dyToRiphnpjx5s7w9vZ/whCu2VqWXtbPjgnQVa8XO4zHwv u96SLZ4CJZmy0AOg+vCjjOZEt9r+aSKhhasw0eeX7amyLVTPtuOCBE+EmHN6waH8eP LhmtkQwZTrVeyIpYKhbjsMWH8vWw5/aqyU0qBMdI= Date: Wed, 13 Sep 2023 22:34:01 +0200 From: Nicolas Schier To: Arnd Bergmann Cc: Arnd Bergmann , Masahiro Yamada , Jonathan Corbet , Sakari Ailus , Javier Martinez Canillas , Nathan Chancellor , Nick Desaulniers , linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Documentation: kbuild: explain handling optional dependencies Message-ID: References: <20230913113801.1901152-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ezqQzNRmwLErRa0+" Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:j9GB8B2tR4Q6PQoLV76ATtVYxSr2KY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gIa9XMmVhEbnJerh4MkMyQzUh1+W3BMR6fRPlBE8Vs9C0JAgrZNQMsmWsGZ sd7n28EYiPILT2A== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 13:34:57 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email --ezqQzNRmwLErRa0+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 13, 2023 at 09:55:36PM +0200 Arnd Bergmann wrote: > On Wed, Sep 13, 2023, at 21:48, Nicolas Schier wrote: > > On Wed, Sep 13, 2023 at 01:37:52PM +0200 Arnd Bergmann wrote: > > > >> Documentation/kbuild/kconfig-language.rst | 26 +++++++++++++++++++++++ > >> 1 file changed, 26 insertions(+) > >>=20 > >> diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation= /kbuild/kconfig-language.rst > >> index 858ed5d80defe..89dea587a469a 100644 > >> --- a/Documentation/kbuild/kconfig-language.rst > >> +++ b/Documentation/kbuild/kconfig-language.rst > >> @@ -573,6 +573,32 @@ above, leading to: > >> bool "Support for foo hardware" > >> depends on ARCH_FOO_VENDOR || COMPILE_TEST > >> =20 > >> +Optional dependencies > >> +~~~~~~~~~~~~~~~~~~~~~ > >> + > >> +Some drivers are able to optionally use a feature from another module > >> +or build cleanly with that module disabled, but cause a link failure > >> +when trying to use that loadable module from a built-in driver. > >> + > >> +The most common way to express this optional dependency in Kconfig lo= gic > >> +uses the slighly counterintuitive > > > > slighly -> slightly >=20 > Fixed, thanks >=20 > > For better RST compliance: could you explicitly start the code block e.= g. by > > appending '::' as in "... counterintuitive::"? >=20 > Ok, done. >=20 > >> + > >> + config FOO > >> + bool "Support for foo hardware" > >> + depends on BAR || !BAR > > > > are you sure that this is enough? While testing, I needed to explicitl= y use > > =3Dy|=3Dn: > > > > depends on BAR=3Dy || BAR=3Dn > > > > to prevent FOO to be selectable iff BAR=3Dm. >=20 > I see my problem, I made a different mistake here. Your version > is correct for a 'bool' symbol as I had here, but the intention > of this was to make it work for tristate symbols, which are the > interesting case. I've fixed it up this way now, hope it now makes > sense to you: >=20 > --- a/Documentation/kbuild/kconfig-language.rst > +++ b/Documentation/kbuild/kconfig-language.rst > @@ -581,19 +581,19 @@ or build cleanly with that module disabled, but cau= se a link failure > when trying to use that loadable module from a built-in driver. > =20 > The most common way to express this optional dependency in Kconfig logic > -uses the slighly counterintuitive > +uses the slightly counterintuitive:: > =20 > config FOO > - bool "Support for foo hardware" > + tristate "Support for foo hardware" > depends on BAR || !BAR ah, thanks, tristate kconfig symbols are really more interesting. But I am still not sure, whether this works as proposed: With the 'config FOO' above and config BAR tristate "Support for bar feature" kconfig allows me to choose between these: BAR=3Dy =3D> FOO=3D{N/m/y} BAR=3Dm =3D> FOO=3D{N/m} BAR=3Dn =3D> FOO=3D{N/m/y} But with config FOO tristate "Support for foo hardware" depends on !BAR=3Dm I can choose between: BAR=3Dy =3D> FOO=3D{N/m/y} BAR=3Dm =3D> FOO is not selectable BAR=3Dn =3D> FOO=3D{N/m/y} (Re-checked with BAR=3DIPV6 and FOO=3DWIREGUARD; CONFIG_WIREGUARD as 'depen= ds on IPV6 || !IPV6' in its kconfig definition, and both are tristate kconfig symbols.) Thus, it seems to me, that the intuitive way is the way forward (and several Kconfigs are out-of-date with regard to 'depends on !X=3Dm'. Or do I still= miss your point? Kind regards, Nicolas > This means that there is either a dependency on BAR that disallows > the combination of FOO=3Dy with BAR=3Dm, or BAR is completely disabled. > For a more formalized approach if there are multiple drivers that have > -the same dependency, a helper symbol can be used, like > +the same dependency, a helper symbol can be used, like:: > =20 > config FOO > - bool "Support for foo hardware" > + tristate "Support for foo hardware" > depends on BAR_OPTIONAL > =20 > config BAR_OPTIONAL >=20 > >> +This means that there is either a dependency on BAR that disallows > >> +the combination of FOO=3Dy with BAR=3Dm, or BAR is completely disable= d. > > > > For me, this sentence is hard to parse (but I am not a native speaker);= what > > about something like this: > > > > This means that FOO can only be enabled, iff BAR is either built-in or > > completely disabled. If BAR is built as a module, FOO cannot be enable= d. >=20 > That would describe the version you suggested, but that's a > different issue. Let me know if you still think it needs > clarification after fixing the example. >=20 > Arnd --ezqQzNRmwLErRa0+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEh0E3p4c3JKeBvsLGB1IKcBYmEmkFAmUCHLgACgkQB1IKcBYm Emm6+xAApymEDDCvENlFvxMQcBo2GI1/j6oVgzZ5TPFA81a4Xq8zOv18mvyqd4DS ywuq9vex449OaAcREnDSyQNgfBzrvax/MkcGlewGEjvDaY6wsQ7yQK4VlqwbrTRY w6gvDRhfvFtv6KXo3g9T2kEJkpfGweKTrnmKRDoz94yZqoyFvWpD1hJuD6mBcx05 b7Y1DWcekIFxF9JxrctQQ3cxE4361G9mmRcwdjVox4jypsUXwqteDj5Fs0Ubh0FR mi18xOKZ416w0nZOudwNGQV39Lgkcryr/y74PxJuKOI0pxze75ytG9S41UqauWBn Kex+MT/p6C205IBJv3SVssxhHwycfl/gwwGxaKPaEXVKVvXFNT2OiOulP2ov4AiZ j7ZuKbE1iCvU1Fh1QE19pWdDrSZrl+u/OOwtaqiytwrqLg2l4zxUEwrWQTZy9nBq o4mlU47MPYviZnj4/ottshFt52CgA/m4WIK8WlelNxHS8JQr6/R5Ibzv89GapSDC nm8Y1u+3uFJ3FxoxTqb2e92LpSPMZYBYhi/ZhqO1dZCX4VRN2a1pECU5eHlEHso7 7cY1v7NDoGbTIw5EAcUrxNpNvpCOnyiVxLVhLGKP/6aTTZJqRuObKeLHe4fcuRc7 hp7GH9P5SKt6vmWxMqcx/YeHurNeragRt8WseKJuEWybT5ncNAM= =NdDD -----END PGP SIGNATURE----- --ezqQzNRmwLErRa0+--