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 C08EAC433F5 for ; Wed, 12 Jan 2022 21:56:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 38FC78326F; Wed, 12 Jan 2022 22:56:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com 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=konsulko.com header.i=@konsulko.com header.b="WVGmt3AI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2E29E832D8; Wed, 12 Jan 2022 22:56:42 +0100 (CET) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (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 71B0181429 for ; Wed, 12 Jan 2022 22:56:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x831.google.com with SMTP id f17so4711201qtf.8 for ; Wed, 12 Jan 2022 13:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5Efs+kOSVDcHQqgDj7JaYaFKpuskWm3lCjc40zrIjfk=; b=WVGmt3AIp++h9pweQQmydaVjIp2oiVxHw4BA/hS85t0e+xW8cXy7yWvItvmEvtrRFC P6aTepgsOExPLnUgOfscRW2rktnDPZQLeEpkvxFkeH1sp5MU4bTGkRt3x+JL5Lyk0ypX 0XKQpW+Hpr4onKkub7uEoKr+fQMBJgUpbzau8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5Efs+kOSVDcHQqgDj7JaYaFKpuskWm3lCjc40zrIjfk=; b=cAJlcI6VXBjAwCcQjzDpQlqp6wS1xQASqfypniiDpujCbd1W+MY/wHI2PMxfEMYxJo qEeIXvxerotQUyf5kDSGrCdaCQjxD/BTpWyyX8XlX6CW7MGwGUX5ImxebYZ8m/NcNl6a T9BRvx8sYMX4E+gPdUcz/5FjLYfMdzwQya4p3+6UekNZd4RoydzqMxF6aD2mLqRQy0bD 2eiigsmI6OpO7ViGotA1OEmL1kEiFG4S3pkEx04VLRzlnlN7jKl+MUVoIhyT4tcIZ4MS NPhHvpPZQ9+mzcBGAW6xvUbPof26DNqhtT2AcyAbXU3AQvVq+N0xwHY+ewlShSA8P27A O1Ng== X-Gm-Message-State: AOAM531Lah7IkZaHzw8WGrE3pun5aHo5z/WCg9Fgjlf1GX7H2yHREDQz jpG/CDkrPvoIOPI+434D1IBXjQ== X-Google-Smtp-Source: ABdhPJwnEq/V58uxC8TSg8mJ9Dkcv6Ww3NLWocjzlSOumARtoa+04LwRICReounz/ilkhpP+QqLNMg== X-Received: by 2002:a05:622a:1183:: with SMTP id m3mr1409299qtk.393.1642024598155; Wed, 12 Jan 2022 13:56:38 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-2440-966a-5ce3-c6d0.res6.spectrum.com. [2603:6081:7b01:cbda:2440:966a:5ce3:c6d0]) by smtp.gmail.com with ESMTPSA id u9sm751112qkp.116.2022.01.12.13.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 13:56:36 -0800 (PST) Date: Wed, 12 Jan 2022 16:56:35 -0500 From: Tom Rini To: Simon Glass Cc: Ilias Apalodimas , U-Boot Mailing List , Bin Meng , Bill Mills , Heinrich Schuchardt , =?iso-8859-1?Q?Fran=E7ois?= Ozog , Masahiro Yamada Subject: Re: [PATCH 02/31] kconfig: Add support for conditional values Message-ID: <20220112215635.GD9207@bill-the-cat> References: <20211101011734.1614781-1-sjg@chromium.org> <20211101011734.1614781-3-sjg@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xesSdrSSBC0PokLI" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett 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.2 at phobos.denx.de X-Virus-Status: Clean --xesSdrSSBC0PokLI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 12, 2022 at 02:28:21PM -0700, Simon Glass wrote: > Hi Ilias, >=20 > On Mon, 1 Nov 2021 at 01:05, Ilias Apalodimas > wrote: > > > > On Mon, 1 Nov 2021 at 03:19, Simon Glass wrote: > > > > > > At present if an optional Kconfig value needs to be used it must be > > > bracketed by #ifdef. For example, with this Kconfig setup: > > > > > > config WIBBLE > > > bool "Support wibbles, the world needs more wibbles" > > > > > > config WIBBLE_ADDR > > > hex "Address of the wibble" > > > depends on WIBBLE > > > > > > then the following code must be used: > > > > > > #ifdef CONFIG_WIBBLE > > > static void handle_wibble(void) > > > { > > > int val =3D CONFIG_WIBBLE_ADDR; > > > > > > ... > > > } > > > #endif > > > > > > > The example here might be a bit off and we might need this for int > > related values. Was this function handle_wibble() supposed to return > > an int or not? We could shield the linker easier here without adding > > macros. Something along the lines of > > static void handle_wibble(void) > > { > > #ifdef CONFIG_WIBBLE > > int val =3D CONFIG_WIBBLE_ADDR; > > #endif > > } > > > > In that case you don't an extra ifdef to call handle_wibble(). > > Personally I find this easier to read. >=20 > But how does that help with the problem here? I am trying to avoid > using preprocessor macros in this case. I'm not sure I see a problem here. A number of the finish-converting-X that I did recently had a guard symbol first because usage wasn't fully converted but really everyone using that area of code needed to set the value, or use the default. There might be some cases where we do still need a guard symbol because usage is in common code and maybe shouldn't be, but instead moved to other usage-specific files. I also think I've seen cases where doing: if (CONFIG_EVALUATES_TO_ZERO) { ... } takes more space in the binary than an #ifdef does. And finally for the moment, we also have many cases where zero is a valid value. That's what leads to potentially harder to read code or needing a guard, I think. --=20 Tom --xesSdrSSBC0PokLI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmHfTo8ACgkQFHw5/5Y0 tyyNwgv/VaTLj2l0zFDBJ3e0LRnhF4p1p1KQgrETrw5YX7Fj++/vtdYudBiLdMVR e5HKKdQNJMeUmcU2z7dwAYLxObFoodAGqb4/vPkxFqEL/2FFGqYM045B/h7dwWNF p12vggdF4tW9aP4UnKb6dHRCT18qvdDp9kjhU3PzUXyAoeCILzN+QQT9wXnaGym+ KQcTxbASRHj8i05B3n8fYPjIfwku/ESJZwiyINORVF10RMC+gsZCV4N9EQUL5bNb SR3HmRg+BYPfWt3jiraklQmAfqoalBH5kzxDk1ckhQ5A2Yv0dpbEbbxHIMHbXXQx oErfFxnbpbYRbbfqNRmuXCump+wog7OsG8dTIB64OLs+jccoZJfAfNr5C9AgaI+i W2Lom+PihqVZ+asu9hAGifui/xSiOua5XjFx1qAgtnYBdVVnmvr+qDkZNGNSh7Le 8bH/1P0RngZNovp9oXzvnJDr4G7IQN36AWO4Erq7IAGX1O2zFvwF4HKOC1dh+MI/ kuCDCWN7 =s0yO -----END PGP SIGNATURE----- --xesSdrSSBC0PokLI--