Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4055978rdb; Thu, 14 Sep 2023 10:21:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFElaVa8Fi935iCgu1m4jqQrcyXCW20QLuEowdZD5wr97LBZBDlTvfdxlx4LLZhxuuedpQ1 X-Received: by 2002:a17:902:8697:b0:1b7:fd82:973c with SMTP id g23-20020a170902869700b001b7fd82973cmr5878550plo.39.1694712067159; Thu, 14 Sep 2023 10:21:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694712067; cv=none; d=google.com; s=arc-20160816; b=LBSmgQX11OhHVeQgwUCx6vG3WPrbzwGU20SJUPmhL/ADaOAwFr95Z+hv1DGzX1mO58 tT0g/tZaunyX3lF3RzefIra14XRyL+4yElpCpiBW5RzlrlVt1QguQTo8/xZ8IRLhNUx1 dd1vvfsB06OIJrvup4lgBkcX7Kh6A5gHVCbzE33L7b4OM1+beVW7qtZ3rCkgFtSso8iH ohCMlauqvSvAecjPOwogTf+fVwZhlxPi5kRRC6am0p2ulbhVi8ID2Tdsm/F0ixe4y+Jc SdxoyoYSZ8GsQFlAjqDg3mLBDh0a+K77mW05J2TJyGN1Gs8Qaumo/c597EPhRs+qfmiq ztBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+xymJo11SyIRwVkFuT6UCmx9kUiXb6mQKCgK/FBxhF0=; fh=0hV00+QRilmU6v9WI3tqiSPa4nkmj3HoLV5CGrqRm4U=; b=NiqPqOYkf+Y9al2N2T+aDczn+vBn8rxwDGtG7P28MDsuYNpsO5fyQi3ipXrcYJn76g 9BdT0zACZ53uFRkqdWFxGEknM1g9n2Ita2e0LAaQ6Wa/CiFZqg08go3xOBUZ9QscAoZV jEz2UzpgyUX/2s6+FsKFChNWtuqvcBFvMkJB2hGtMlYDbf4JgMpfeaHzI9RIziky8e6Q CkIaRroeAwzHRv/nnlPQsgcMrp/JyRyKhxEHMOPDm2r9I2Buu04XFPHmCI3boEm2bABM Y9KZPmgUTuyyr0thflTjw+BuAL/XcqjV9Y9xoPLTLBV/90ayCvHRNftYDJzh9QLT6bH6 OxdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dgOuqOec; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id s4-20020a170902ea0400b001bc650255b6si2081349plg.390.2023.09.14.10.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:21:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dgOuqOec; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 90773831EDAE; Thu, 14 Sep 2023 10:07:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238859AbjINRHx (ORCPT + 99 others); Thu, 14 Sep 2023 13:07:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbjINRHv (ORCPT ); Thu, 14 Sep 2023 13:07:51 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 009E11FE1; Thu, 14 Sep 2023 10:07:46 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91BAEC433C9; Thu, 14 Sep 2023 17:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694711266; bh=1r0+Zdvf3wZUhOn2z8iQ20YUkXarqeZelKafGh0Vb5A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dgOuqOeceJAGBoDw1c6Co4XoM8soxD7wU2eq/W6C+XZJf8V9pPkWgPUrUlgMqdE3b 7xYGmNx7ifAr7G46/C+o5KAoAvIJ4MI02+388TPgweqM9yyb2nb7yh5f5l2NV928nf HzKsuBT45z22NndhQwRtqYlkQRwcL59p4AL6dcWrniocC5KhzYaAYr5W+KWH5R4SjY /XWnkWCC05FLEdCJ0xRIQIj/qbAcnkutGUaP4kvMC4UGWSzao6GMj9aQAUiHnnBESq vVnlhnJJave+UwMBOmYSqUrX9799zP1LRPBuB+sZtdYGRRK0lnWt4FYN4xQA72hY7A LNgnq+suizjiQ== Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-1c4c5375329so654198fac.2; Thu, 14 Sep 2023 10:07:46 -0700 (PDT) X-Gm-Message-State: AOJu0YzkINIjBLZakX2ZPYndHH1n3qGrsnqeB5lQxKBZEUn3fQ1z6wd/ BWdZKwzTf2JIFR7KCi2Mp6TEW3dpnTKzTGXVnFQ= X-Received: by 2002:a05:6871:60e:b0:1d5:a905:5681 with SMTP id w14-20020a056871060e00b001d5a9055681mr6469325oan.26.1694711265804; Thu, 14 Sep 2023 10:07:45 -0700 (PDT) MIME-Version: 1.0 References: <20230913113801.1901152-1-arnd@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Fri, 15 Sep 2023 02:07:09 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Documentation: kbuild: explain handling optional dependencies To: Nicolas Schier Cc: Arnd Bergmann , Arnd Bergmann , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 10:07:53 -0700 (PDT) On Thu, Sep 14, 2023 at 5:34=E2=80=AFAM Nicolas Schier = wrote: > > 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(+) > > >> > > >> diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentati= on/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 > > >> > > >> +Optional dependencies > > >> +~~~~~~~~~~~~~~~~~~~~~ > > >> + > > >> +Some drivers are able to optionally use a feature from another modu= le > > >> +or build cleanly with that module disabled, but cause a link failur= e > > >> +when trying to use that loadable module from a built-in driver. > > >> + > > >> +The most common way to express this optional dependency in Kconfig = logic > > >> +uses the slighly counterintuitive > > > > > > slighly -> slightly > > > > Fixed, thanks > > > > > For better RST compliance: could you explicitly start the code block = e.g. by > > > appending '::' as in "... counterintuitive::"? > > > > Ok, done. > > > > >> + > > >> + config FOO > > >> + bool "Support for foo hardware" > > >> + depends on BAR || !BAR > > > > > > are you sure that this is enough? While testing, I needed to explici= tly use > > > =3Dy|=3Dn: > > > > > > depends on BAR=3Dy || BAR=3Dn > > > > > > to prevent FOO to be selectable iff BAR=3Dm. > > > > 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: > > > > --- a/Documentation/kbuild/kconfig-language.rst > > +++ b/Documentation/kbuild/kconfig-language.rst > > @@ -581,19 +581,19 @@ or build cleanly with that module disabled, but c= ause 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 log= ic > > -uses the slighly counterintuitive > > +uses the slightly counterintuitive:: > > > > 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. Both FOO and BAR MUST be tristate to make this documentation sensible. If FOO is bool type, "depends on BAR || !BAR" becomes a no-op. As you notice, FOO and BAR become independent of each other. You may wonder why. Here, another unclear rule applies: 'depends on m' for a bool option is promoted to 'depends on y'. https://github.com/torvalds/linux/blob/v6.5/scripts/kconfig/symbol.c#L214 --=20 Best Regards Masahiro Yamada