Message ID | 20230917192009.254979-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2269373vqi; Sun, 17 Sep 2023 12:21:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaikZuqja3zJCvikaZfKqSHPJvYo4Y+9JGAd0Gy3RmbgwC44qZLDMTKZC3iK7CoB/JHt/l X-Received: by 2002:a05:6a21:3b48:b0:154:3f13:1bd5 with SMTP id zy8-20020a056a213b4800b001543f131bd5mr9379666pzb.34.1694978493691; Sun, 17 Sep 2023 12:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694978493; cv=none; d=google.com; s=arc-20160816; b=O0/iX2cJmZmsBmcHDQsp1rGS3w0aaVSo7dtSN7fmMoKnsiIPSPM94PcWSeQi+2b+3s WZ8VFnC4P/rtPvCthWS57/jsSp+irN6ZICIIpgSRaUyJbaHWmwJ+uu/swDGYcXa29/d5 BA9dzkVcvbaQ671Ke7ad9CBSSN4GNV3V2QXChRtiZWEzEHxZ9tiOAudcsn54Gu3BkbD8 MoLZ3rJ0htcLlxt+TZrQP9kHOHb5jTszV/4SX6e7CXnsp+3zmSqKL/2BquJxdHhyr9zL nQUc/ykeGuHLivvGJxqwVVVEFsmG50EhvMQNxxhxnpRyFbwrhAcmXLYXs1xQ25iypqoj AphA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=V6lKJaMJNy5UqS5OhiaH7K6+jWIbr0XWlcS+N2sg0Io=; fh=k5ekymPMm4m3LGPNeauBlQT++u+abAC+KV5nd8f/plA=; b=oS+DAPnBfIRNLEDwBpqWuJ0x2DVoySiKShsKd7oHXWnUwalYql1mstkfSLelSIzfx4 JzmBtScxENsgRoTCPpRlJ/nSZRd6JxkRTldt0AxpspMKkzontSs31CjyKByytHfVFHEh X5L5Kf5EERsDAfQej6eBUbbabI2WtNkSGInuW+bglBNIvywqc4PBaBgSIW4BJog1RaBE YS0Jau5cZVs7Q1Ljbwolh7AfKjd82lDnyO2+pDJ3kTGDkhJGUlZyM/xPuVg5pbhJE3L2 zSeZQTF+ggwBjc12ClupcGud8g0VFYDHSbe+EMwPwwGS28EAoD/p5BQFFzKFWnKy8ieu Jb2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oIzJcm+y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id t17-20020a63d251000000b005777b0c8f59si6651433pgi.478.2023.09.17.12.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 12:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oIzJcm+y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 43F6881F3460; Sun, 17 Sep 2023 12:21:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238428AbjIQTUb (ORCPT <rfc822;kernel.ruili@gmail.com> + 28 others); Sun, 17 Sep 2023 15:20:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231801AbjIQTUW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 17 Sep 2023 15:20:22 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 201A8115; Sun, 17 Sep 2023 12:20:17 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66821C433C9; Sun, 17 Sep 2023 19:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694978416; bh=zlezv61pkEtIb39QJV+KksqxpQMU0fbcIUj51bSEwrY=; h=From:To:Cc:Subject:Date:From; b=oIzJcm+yqSjU0N+/nDHU6W2dBiG4y1dTlpVyxYVZl0TvEkebI5Rsm40kS+rbblFIW J9xYHqsfQSEGE/hrzWSnkCdsJc14eqkd2Z6cYnhuD2DqR3KVwaVBv1ceygvjxD7mp0 uSsZ9ztBuXxelRCElu1PTfkmN1VXpCVK1alE09zCaD6Ea3nwiJToHlkkSga0AmfxZF kJgY8RZB3FIxnaemnt6Qai0L4mOWctRk2BrqAUoNF6zQgCQJGZ894J/ExJ4LauKIxE 23CBrwm9tnAbGXXh1B2eSPvGstmkbum93JCxt3rbGQriU32RhBdOPt18egKTEpabXP kIIlN/4gJDHQQ== From: Arnd Bergmann <arnd@kernel.org> To: Masahiro Yamada <masahiroy@kernel.org>, Jonathan Corbet <corbet@lwn.net> Cc: Arnd Bergmann <arnd@arndb.de>, Javier Martinez Canillas <javierm@redhat.com>, Sakari Ailus <sakari.ailus@linux.intel.com>, Nicolas Schier <nicolas@fjasle.eu>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] Documentation: kbuild: explain handling optional dependencies Date: Sun, 17 Sep 2023 21:19:59 +0200 Message-Id: <20230917192009.254979-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 17 Sep 2023 12:21:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777313769003104498 X-GMAIL-MSGID: 1777313769003104498 |
Series |
[v2] Documentation: kbuild: explain handling optional dependencies
|
|
Commit Message
Arnd Bergmann
Sept. 17, 2023, 7:19 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de> This problem frequently comes up in randconfig testing, with drivers failing to link because of a dependency on an optional feature. The Kconfig language for this is very confusing, so try to document it in "Kconfig hints" section. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- v2: fix typos pointed out by Nicolas Schier --- Documentation/kbuild/kconfig-language.rst | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)
Comments
On Mon, Sep 18, 2023 at 4:20 AM Arnd Bergmann <arnd@kernel.org> wrote: > > From: Arnd Bergmann <arnd@arndb.de> > > This problem frequently comes up in randconfig testing, with > drivers failing to link because of a dependency on an optional > feature. > > The Kconfig language for this is very confusing, so try to > document it in "Kconfig hints" section. > > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > v2: fix typos pointed out by Nicolas Schier Applied to linux-kbuild. Thanks.
On Mon 25 Sep 2023 16:06:41 GMT, Masahiro Yamada wrote: > On Mon, Sep 18, 2023 at 4:20 AM Arnd Bergmann <arnd@kernel.org> > wrote: > > > > From: Arnd Bergmann <arnd@arndb.de> > > > > This problem frequently comes up in randconfig testing, with > > drivers failing to link because of a dependency on an optional > > feature. > > > > The Kconfig language for this is very confusing, so try to > > document it in "Kconfig hints" section. > > > > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> > > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > --- > > v2: fix typos pointed out by Nicolas Schier > > > Applied to linux-kbuild. Thanks. Hi Masahiro, this patch seems to got lost, or did you intentionally removed it again? Kind regards, Nicolas
On Thu, Feb 15, 2024 at 9:39 PM Nicolas Schier <nicolas@fjasle.eu> wrote: > > On Mon 25 Sep 2023 16:06:41 GMT, Masahiro Yamada wrote: > > On Mon, Sep 18, 2023 at 4:20 AM Arnd Bergmann <arnd@kernel.org> > > wrote: > > > > > > From: Arnd Bergmann <arnd@arndb.de> > > > > > > This problem frequently comes up in randconfig testing, with > > > drivers failing to link because of a dependency on an optional > > > feature. > > > > > > The Kconfig language for this is very confusing, so try to > > > document it in "Kconfig hints" section. > > > > > > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> > > > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > > --- > > > v2: fix typos pointed out by Nicolas Schier > > > > > > Applied to linux-kbuild. Thanks. > > Hi Masahiro, > > this patch seems to got lost, or did you intentionally removed it > again? > > Kind regards, > Nicolas Oh? I can see it in the mainline. commit 28d49e171676afb7df7f47798391364af9abed7f Author: Arnd Bergmann <arnd@arndb.de> AuthorDate: Sun Sep 17 21:19:59 2023 +0200 Commit: Masahiro Yamada <masahiroy@kernel.org> CommitDate: Mon Sep 25 16:01:05 2023 +0900 Documentation: kbuild: explain handling optional dependencies
On Thu 15 Feb 2024 22:40:46 GMT, Masahiro Yamada wrote: > On Thu, Feb 15, 2024 at 9:39 PM Nicolas Schier <nicolas@fjasle.eu> > wrote: > > > > On Mon 25 Sep 2023 16:06:41 GMT, Masahiro Yamada wrote: > > > On Mon, Sep 18, 2023 at 4:20 AM Arnd Bergmann <arnd@kernel.org> > > > wrote: > > > > > > > > From: Arnd Bergmann <arnd@arndb.de> > > > > > > > > This problem frequently comes up in randconfig testing, with > > > > drivers failing to link because of a dependency on an optional > > > > feature. > > > > > > > > The Kconfig language for this is very confusing, so try to > > > > document it in "Kconfig hints" section. > > > > > > > > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> > > > > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > > > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> > > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > > > --- > > > > v2: fix typos pointed out by Nicolas Schier > > > > > > > > > Applied to linux-kbuild. Thanks. > > > > Hi Masahiro, > > > > this patch seems to got lost, or did you intentionally removed it > > again? > > > > Kind regards, > > Nicolas > > > > Oh? > > I can see it in the mainline. ups, I'm sorry for the noise. You are right, I had an heavily out-dated tree at hand and wasn't aware of it ... Kind regards, Nicolas
diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation/kbuild/kconfig-language.rst index 858ed5d80defe..0135905c0aa35 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 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 logic +uses the slightly counterintuitive:: + + config FOO + tristate "Support for foo hardware" + depends on BAR || !BAR + +This means that there is either a dependency on BAR that disallows +the combination of FOO=y with BAR=m, 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:: + + config FOO + tristate "Support for foo hardware" + depends on BAR_OPTIONAL + + config BAR_OPTIONAL + def_tristate BAR || !BAR + Kconfig recursive dependency limitations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~