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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 00242C636CC for ; Tue, 31 Jan 2023 15:36:09 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 68D4685AB6; Tue, 31 Jan 2023 16:36:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kUHt1KYv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ACE2185ADB; Tue, 31 Jan 2023 16:35:59 +0100 (CET) Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 B15AE85B03 for ; Tue, 31 Jan 2023 16:27:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x136.google.com with SMTP id k12so1587833ilv.10 for ; Tue, 31 Jan 2023 07:27:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Isni2PnU57K8yWlnp6PHTSkQXG/o4mw6zXbHgzEo0AY=; b=kUHt1KYvh6qP0xp9f+GxYqGOyDzbOl5XPTc3lSKwON5KsY6hROlSwmbTbzdCbaRHi8 hPMR+9TB1jnT8CKq1wCWj5cTHGoVwYD8nsFspkIJ4X/ko4qs3NypOOjaTx7yz4IuEFP3 4jR+Z6c1EkRD+ynOvOMdJV/9DVwib9Ty539Ok= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Isni2PnU57K8yWlnp6PHTSkQXG/o4mw6zXbHgzEo0AY=; b=G32M82fXsbg1un+b1FMS+A41+7qnJxo+NJybWllr9r6IBqYJNhlC/xAZDcBSoNpRUl T0Q0QUsrp/73muslVPIiArW7Ix3IQaFwUa5cn8b9VeoofMyFHb6yWgo5luedrO6fDj3h 3bFHgkdEbRmWiNnjHUy0h/7OUSY0h8+WWLo5vMST5AqZjApp9AklWey+zFE5uOcC+zoD rpwXpy6yIKUbQykm7L4JFJ9RtjPaPC4/bcLmTsPN2kTzR5zMKcFzyyaLlitBCrj2kFxL s457qeC0giQPfFXQweEg/b8S4vJfp+6y2Gp4/YRBCtyOfZrsk1bYZOTUHoVEwNTEIkbX b9iQ== X-Gm-Message-State: AO0yUKW8Al2/ZDA0DDCE/PwyHRxFKL/rZiWh9BNNobMa+o/VimEC4cl5 o1P9mRw4roAwJS+OvGYQ6Hn7b7MaEUhMqARU X-Google-Smtp-Source: AK7set8eaI/3uBgo+BFwXZG9Vrb+crl00aJjdlITqtOYeGzWmzVHSy8mGwrNvmUYsuATd54I2W2LqQ== X-Received: by 2002:a05:6e02:178e:b0:310:e24b:a5a6 with SMTP id y14-20020a056e02178e00b00310e24ba5a6mr9241334ilu.9.1675178877109; Tue, 31 Jan 2023 07:27:57 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id u4-20020a02cb84000000b0039db6cffcbasm5649328jap.71.2023.01.31.07.27.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 07:27:56 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Masahiro Yamada Subject: [PATCH 23/32] kconfig: Update CONFIG_IS_ENABLED() for split files Date: Tue, 31 Jan 2023 08:26:53 -0700 Message-Id: <20230131152702.249197-24-sjg@chromium.org> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog In-Reply-To: <20230131152702.249197-1-sjg@chromium.org> References: <20230131152702.249197-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Update this file to include the correct autoconf.h or autoconf_spl.h file for each phase. This allows the macros to be simplified. With this, CONFIG_IS_ENABLED() is the same as IS_ENABLED() apart from a migration detail. Signed-off-by: Simon Glass --- include/linux/kconfig.h | 74 +++++++++----------------- tools/binman/test/generated/autoconf.h | 4 +- 2 files changed, 28 insertions(+), 50 deletions(-) diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 2bc704e1104..f00686eb3e1 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -1,7 +1,17 @@ #ifndef __LINUX_KCONFIG_H #define __LINUX_KCONFIG_H +#ifdef USE_HOSTCC +#include +#elif defined(CONFIG_TPL_BUILD) +#include +#elif defined(CONFIG_VPL_BUILD) +#include +#elif defined(CONFIG_SPL_BUILD) +#include +#else #include +#endif /* * Helper macros to use CONFIG_ options in C/CPP expressions. Note that @@ -28,37 +38,9 @@ */ #define IS_ENABLED(option) config_enabled(option, 0) -/* - * 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. - */ +#define __config_val(cfg) CONFIG_ ## cfg -#ifdef USE_HOSTCC -#define _CONFIG_PREFIX TOOLS_ -#elif defined(CONFIG_TPL_BUILD) -#define _CONFIG_PREFIX TPL_ -#elif defined(CONFIG_VPL_BUILD) -#define _CONFIG_PREFIX VPL_ -#elif defined(CONFIG_SPL_BUILD) -#define _CONFIG_PREFIX SPL_ -#else -#define _CONFIG_PREFIX -#endif - -#define config_val(cfg) _config_val(_CONFIG_PREFIX, cfg) -#define _config_val(pfx, cfg) __config_val(pfx, cfg) -#define __config_val(pfx, cfg) CONFIG_ ## pfx ## cfg - -/* - * 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. - * CONFIG_VPL_FOO if CONFIG_VPL_BUILD is defined. - */ -#define CONFIG_VAL(option) config_val(option) +#define CONFIG_VAL(option) __config_val(option) /* * This uses a similar mechanism to config_enabled() above. If cfg is enabled, @@ -104,26 +86,17 @@ long invalid_use_of_IF_ENABLED_INT(void); __concat(__unwrap, config_enabled(CONFIG_VAL(option), 0)) (case1, case0) /* - * 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) returns 1 if CONFIG_FOO is enabled for the phase being + * built, else 0. Note that CONFIG_FOO corresponds to CONFIG_SPL_FOO (in + * Kconfig) for the SPL phase, CONFIG_TPL_FOO for the TPL phase, etc. * - * 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. + * The _nospl version of a CONFIG is emitted by kconfig when an option has no + * SPL equivalent. So in that case there is a CONFIG_xxx for example, but not a + * CONFIG_SPL_xxx * - * 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', - * def otherwise. + * This is needed as a transition measure while CONFIG_IS_ENABLED() is used on + * options without SPL equivalent, since in that case it should always return + * zero. Once we add SPL equivalents, this clause can be dropped. * * The optional second and third arguments must be parenthesized; that * allows one to include a trailing comma, e.g. for use in @@ -135,7 +108,7 @@ long invalid_use_of_IF_ENABLED_INT(void); * set, and nothing otherwise. */ -#define CONFIG_IS_ENABLED(option, ...) \ +#define CONFIG_IS_ENABLED(option, ...) \ __concat(__CONFIG_IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) (option, ##__VA_ARGS__) #ifndef __ASSEMBLY__ @@ -155,4 +128,7 @@ long invalid_use_of_CONFIG_IF_ENABLED_INT(void); CONFIG_IS_ENABLED(option, (CONFIG_VAL(int_option)), \ (invalid_use_of_CONFIG_IF_ENABLED_INT())) +#define CONFIG_IF_INT(option, int_option) \ + CONFIG_IF_ENABLED_INT(option, int_option) + #endif /* __LINUX_KCONFIG_H */ diff --git a/tools/binman/test/generated/autoconf.h b/tools/binman/test/generated/autoconf.h index 6a23039f469..88dc762c423 100644 --- a/tools/binman/test/generated/autoconf.h +++ b/tools/binman/test/generated/autoconf.h @@ -1,3 +1,5 @@ #define CONFIG_BINMAN 1 #define CONFIG_SPL_BUILD 1 -#define CONFIG_SPL_BINMAN_SYMBOLS 1 + +/* Don't include the SPL_ here since we are using separate autoconf files */ +#define CONFIG_BINMAN_SYMBOLS 1 -- 2.39.1.456.gfc5497dd1b-goog