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 A5B8AC52D11 for ; Thu, 26 Jan 2023 17:21:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8A453856C7; Thu, 26 Jan 2023 18:21:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (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="dv1rRarc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4E631856CE; Thu, 26 Jan 2023 18:21:42 +0100 (CET) Received: from mail-vk1-xa2a.google.com (mail-vk1-xa2a.google.com [IPv6:2607:f8b0:4864:20::a2a]) (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 83DC585463 for ; Thu, 26 Jan 2023 18:21:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-vk1-xa2a.google.com with SMTP id v81so1204057vkv.5 for ; Thu, 26 Jan 2023 09:21:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=kum7VtiERhFrpd74LJq5WPe1OGUCEC9VJ6mkLiyB4P8=; b=dv1rRarcvTO82THZeLdES4EILlBAfc2NOdKwyqOcoZTofg7dU+l6+uxim/ji6lOGDy Cfh25hs6cQWqiwP9qniq00gkJLqvyujCesQd3RwQgQ6Gj55c6zCY4s4IpaDNBeCkaajE NgdR4SciFaPuHlPHZ9lFXHZQAeT4VERXwxZGw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kum7VtiERhFrpd74LJq5WPe1OGUCEC9VJ6mkLiyB4P8=; b=kB4s9Ak5pHgAR26DEXnNei3GWkBVrS6A1g4+cda+XDPgxPL+xjyYjN5gRr/iyfHMe2 HETopqWUbi6Bvr9Dvt7mFssLKkiD+ORju6j5C0btaGIPbpHrIx6gy990/t7g1HXEiTrC 6M5QXhxfqH6p9sV/AI2P06Cvaa7Mdo7rDaIrLD5iGqyJF1xMMe5fIy6uhd/VbWNViMZX /Pg60evB3lBx6gMhfioq1sqGhb+RZ8l57klZdbWwXhg0m3+HNVZDS4EHJSBEaWVKiaMe QIik0l4wKoVUqDzFLMhCiBsAawcv3ZtSJbG/FU71Serm5C/VrpfsePCYIqwXs3iQLDXc D8yA== X-Gm-Message-State: AO0yUKVZjBJ8xdBzHg7uZ2XgsYo2ZWNYLWHDjoWfOo5VUkzH52+/d7hJ SBHOL2rcUakiyfT71/ei9fg1kw== X-Google-Smtp-Source: AK7set/8kJtVR7GUD8miGvB3paGnMv/xwQAb+D9Oq8/04fv0lYEQFGdQbow/CFLb8b8V+rg25JzuYA== X-Received: by 2002:a05:6122:2216:b0:3e5:e1d0:a007 with SMTP id bb22-20020a056122221600b003e5e1d0a007mr4784461vkb.9.1674753697186; Thu, 26 Jan 2023 09:21:37 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-3a56-04fb-7eea-5810.res6.spectrum.com. [2603:6081:7b00:6400:3a56:4fb:7eea:5810]) by smtp.gmail.com with ESMTPSA id q1-20020ae9e401000000b006fc2f74ad12sm1243284qkc.92.2023.01.26.09.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 09:21:36 -0800 (PST) Date: Thu, 26 Jan 2023 12:21:34 -0500 From: Tom Rini To: Simon Glass Cc: Troy Kisky , "u-boot@lists.denx.de" , "sbabic@denx.de" , "festevam@gmail.com" , "marex@denx.de" Subject: Re: CONFIG_IS_ENABLED vs IS_ENABLED Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Kow0BM/nnkEj5lyJ" 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.6 at phobos.denx.de X-Virus-Status: Clean --Kow0BM/nnkEj5lyJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 24, 2023 at 06:36:00PM -0700, Simon Glass wrote: > Hi Troy, >=20 > On Tue, 24 Jan 2023 at 16:31, Troy Kisky wr= ote: > > > > > > > > ________________________________ > > From: Troy Kisky > > Sent: Tuesday, January 24, 2023 2:52 PM > > To: u-boot@lists.denx.de ; sbabic@denx.de ; trini@konsulko.com ; festevam@gmail.com > > Cc: sjg@chromium.org ; marex@denx.de > > Subject: CONFIG_IS_ENABLED vs IS_ENABLED > > > > Hi Guys > > > > In a recent debugging session, I stumbled across this line > > drivers/mmc/mmc.c: if (CONFIG_IS_ENABLED(MMC_QUIRKS) && mmc->quirk= s & quirk) > > > > which prevents retries in SPL code, and was causing booting from an SD = card to fail. > > So I wrote a little script to print uses of > > CONFIG_IS_ENABLED(x) which might need to be > > IS_ENABLED(CONFIG_x) like the above one. > > > > Here it is if you want to try it out. > > > > git grep CONFIG_IS_ENABLED|sed -n -e "s/\(CONFIG_IS_ENABLED([0-9a-zA-Z_= ]*)\)/\n\1\n/gp"| \ > > sed -n -r "s/CONFIG_IS_ENABLED\(([0-9a-zA-Z_]+)\)/\1/p" |sort -u|xargs = -I {} \ > > sh -c "git grep -E 'config [ST]PL_{}' | grep -q -E -w '[ST]PL_{}' || gi= t grep 'CONFIG_IS_ENABLED({})'" > > > > It prints CONFIG_IS_ENABLED(x) uses where there is no SPL_x or TPL_x. > > > > BR > > Troy > > > > _______ > > And here is the opposite check > > > > git grep -w IS_ENABLED|sed -n -e "s/\(IS_ENABLED(CONFIG_[0-9a-zA-Z_]*)\= )/\n\1\n/gp"| \ > > sed -n -r "s/IS_ENABLED\(CONFIG_([0-9a-zA-Z_]+)\)/\1/p" |sort -u|xargs = -I {} \ > > sh -c "git grep -E 'config [ST]PL_{}' | grep -q -E -w '[ST]PL_{}' && gi= t grep 'IS_ENABLED(CONFIG_{})'" > > > > > > It prints uses of IS_ENABLED(CONFIG_x) where CONFIG_SPL_x exists. >=20 > Thank you for that. We definitely have quite a few of these. >=20 > By a great coincidence I updated moveconfig.py to do something a > little like that:. >=20 > https://patchwork.ozlabs.org/project/uboot/patch/20230123220031.3540724-2= -sjg@chromium.org/ I think this also shows that we might really want to just drop the checkpatch.pl note about IS_ENABLED / CONFIG_IS_ENABLED, it's getting used in a lot of wrong places where it's not helpful. It's not the root cause here (where a compile time check that allows for the rest of the code to be statically checked still is OK), but it's part of the problem. --=20 Tom --Kow0BM/nnkEj5lyJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmPStpcACgkQFHw5/5Y0 tyy9NAwAuWcKQ2n52E3dmX5swMA6QCDLWip2ux8VYoG8K5Kp2tRsbSmqokL9cR75 4zvL2sEZDPXs18oU0riqtiSQSctCXhHmvuOAIWbDzt3zCRQSxJKXcde3SYQ+9r6T X1QfLLcKmA6pH7PKv0X7/rsghnTvNxhKuoTfyDx5+Qi+NikZqqX8FA4C3ci6VhH/ lc8YGpiXl9EiTJORCKxVH/10kaGY0TNGkjI9mIO8g0foz3lUSeSG28FztUG+wejH +kQWyEN4ubi7rH9vz57T29y1YnHOIrmErpDf/NTTtsGfRrDBffh/B8y+cApCBTBy /PpivitgG3kxKJplnww7otLbRQHTREvfXbIZ5iBaJcyzyjjb0NXHoVNrkLvFt+q3 sspSZh6A3bY9JaMeUP2W6x1TcEUxof+zNExlaBAk/fxOsQ87jfOoS1NJXdm0NmJx yuhiHib4TVmIS18gJ4hKlwm1ApqkvWZYNuMsaNp1dzIc2KsPyZTHQ4BdxGUxZ9vY rIPiZeJ0 =oK8j -----END PGP SIGNATURE----- --Kow0BM/nnkEj5lyJ--