From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32C7FC433EF for ; Mon, 27 Sep 2021 16:11:33 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D59360F9B for ; Mon, 27 Sep 2021 16:11:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9D59360F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 50F5081761; Mon, 27 Sep 2021 18:11:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lmMFQyWS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E83E80C94; Mon, 27 Sep 2021 18:11:28 +0200 (CEST) Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B6BDA81BC8 for ; Mon, 27 Sep 2021 18:11:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-ot1-x32d.google.com with SMTP id 5-20020a9d0685000000b0054706d7b8e5so25126553otx.3 for ; Mon, 27 Sep 2021 09:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uHPs83J9xQzMRZFFUfwlwlOnT+uQhGp9HuQrmsx6vEU=; b=lmMFQyWSxp5kZxZbXA72huaibrp2QJhZluMvGI295XP1uhgj2QVrE/9438JbvSbx/y NurzFDRSPwxE92d+wVsrHodTeSn7B95EJ/GmPghY5q/42/JXtEtgeOk9u+N8g/s2DPcl a7U905dnOXdLps0T/Zgl4Rw7/ToNjj0YLBceBag7kiQwPKntRaADxBkH0zgL+6YYex+R uMX11PAgWLz9G+ST+W3ITt43dSL0vPXjnrcXpbYcJIg0cZ25W+s8CSbwivkOxZ2VBTkM bG5carViKNrBpBV8oeo37vwPdyJOgyezS36/KLNXAF+Sr8EBAcRa2S5dInVXbK1THqUd 8FRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uHPs83J9xQzMRZFFUfwlwlOnT+uQhGp9HuQrmsx6vEU=; b=Y+pjBQq5Qn8qDHfMha4X5k896/Elv7RfsgDnUauuh5ugLnVOQncjLm94q/73Yf7DwE YuiVOfS2zl8gn7aTiVHn0HjklxkE+KgedMNLjZOt9s8jmfpEKsujTKT32+XYRiAfLfBH 8h6RshY0AcgkHKImCO/dQf6MaEFBu2K9gFJRVccVf+HMHgSQIvrKHzGK+5DeIsvHNziA lUKxW8AaoPB5Fp8ivjire+kOomAgMg2Dcabulp+VgFjgCmznYWrXGf57RjW869Z/aspe HKRTRNmdZ8E3dHZ9fDZUJ4Z9/28JVc5LWq5LL02H8PEXhgs7rgrALavb/715Q9lJMEQw +jnw== X-Gm-Message-State: AOAM531n8gNbJfhKQlNyfKFbgJD8ZlosZ1O5lW4+bwnzRXzXceMfBNuC fErxZ1O9nUwIUjvgJ3yaRYM= X-Google-Smtp-Source: ABdhPJwnAPBxw0sv4t9N0c8uibJEmBVJbHj569d5iuJKAmYocrX1ESEdr1RjDgmEH3ZQ2PvzRNvjYA== X-Received: by 2002:a05:6830:1e10:: with SMTP id s16mr768768otr.214.1632759082361; Mon, 27 Sep 2021 09:11:22 -0700 (PDT) Received: from nuclearis3.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id x34sm3105925ott.52.2021.09.27.09.11.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 09:11:21 -0700 (PDT) Subject: Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED() To: Simon Glass , U-Boot Mailing List Cc: Andre Przywara , Rasmus Villemoes , Robert Marko , Masahiro Yamada , Tom Rini , Masahiro Yamada References: <20210926014342.127913-1-sjg@chromium.org> <20210926014342.127913-3-sjg@chromium.org> From: "Alex G." Message-ID: Date: Mon, 27 Sep 2021 11:11:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210926014342.127913-3-sjg@chromium.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 9/25/21 8:43 PM, Simon Glass wrote: > At present we must separately test for the host build for many options, > since we force them to be enabled. For example, CONFIG_FIT is always > enabled in the host tools, even if CONFIG_FIT is not enabled by the > board itself. > > It would be more convenient if we could use, for example, > CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for the > host. Add support for this. > > With this and the tools_build() function, we should be able to remove all > the #ifdefs currently needed in code that is build by tools and targets. > > This will be even nicer when we move to using CONFIG(xxx) everywhere, > since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will go away. > > Signed-off-by: Simon Glass > Suggested-by: Rasmus Villemoes # b4f73886 > --- In my vision, the host tools are target-agostic. They always support the same feature set: all features. From that point of view, it doesn't make sense to have options which enable or disable tools features. I understand the motivation is to use CONFIG_IS_ENABLED(), which has the appearance of making the code cleaner. We have to continue using #if CONFIG_IS_ENABLED() -- is that an improvement over old-school #ifdefs? So I question whether this new direction makes sense for the long term, as opposed to taking a deeper look at the underlying code. The polite thing from me would be to propose alternatives, which I don't have the bandwidth these days. I won't be adding opposition to this series other than these final thoughts. We can fix the code later, and then remove the HOST configs. Alex > > Changes in v5: > - Update commit message > - Use TOOLS_ instead of HOST_ > > Changes in v2: > - Correct comment about USE_HOSTCC being undefined in CONFIG_VAL() > - Fix up comment to put an underscore after every CONFIG > > include/linux/kconfig.h | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h > index d109ed3119e..a1d1a298426 100644 > --- a/include/linux/kconfig.h > +++ b/include/linux/kconfig.h > @@ -31,11 +31,14 @@ > (config_enabled(option)) > > /* > - * U-Boot add-on: Helper macros to reference to different macros > - * (CONFIG_ or CONFIG_SPL_ prefixed), depending on the build context. > + * U-Boot add-on: Helper macros to reference to different macros (prefixed by > + * CONFIG_, CONFIG_SPL_, CONFIG_TPL_ or CONFIG_TOOLS_), depending on the build > + * context. > */ > > -#if defined(CONFIG_TPL_BUILD) > +#ifdef USE_HOSTCC > +#define _CONFIG_PREFIX TOOLS_ > +#elif defined(CONFIG_TPL_BUILD) > #define _CONFIG_PREFIX TPL_ > #elif defined(CONFIG_SPL_BUILD) > #define _CONFIG_PREFIX SPL_ > @@ -49,6 +52,7 @@ > > /* > * CONFIG_VAL(FOO) evaluates to the value of > + * CONFIG_TOOLS_FOO if USE_HOSTCC is defined, > * CONFIG_FOO if CONFIG_SPL_BUILD is undefined, > * CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined. > * CONFIG_TPL_FOO if CONFIG_TPL_BUILD is defined. > @@ -76,18 +80,21 @@ > > /* > * CONFIG_IS_ENABLED(FOO) expands to > + * 1 if USE_HOSTCC is defined and CONFIG_TOOLS_FOO is set to 'y', > * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', > * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', > * 1 if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', > * 0 otherwise. > * > * CONFIG_IS_ENABLED(FOO, (abc)) expands to > + * abc if USE_HOSTCC is defined and CONFIG_TOOLS_FOO is set to 'y', > * abc if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', > * abc if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', > * abc if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', > * nothing otherwise. > * > * CONFIG_IS_ENABLED(FOO, (abc), (def)) expands to > + * abc if USE_HOSTCC is defined and CONFIG_TOOLS_FOO is set to 'y', > * abc if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', > * abc if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', > * abc if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', >