From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@chromium.org>
Cc: Troy Kisky <Troy.Kisky@lairdconnect.com>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>,
"sbabic@denx.de" <sbabic@denx.de>,
"festevam@gmail.com" <festevam@gmail.com>,
"marex@denx.de" <marex@denx.de>
Subject: Re: CONFIG_IS_ENABLED vs IS_ENABLED
Date: Thu, 26 Jan 2023 12:21:34 -0500 [thread overview]
Message-ID: <Y9K2nlwZEqvTGOA0@bill-the-cat> (raw)
In-Reply-To: <CAPnjgZ2koSJc5WDGkVjp=1Cn4XgAQa+SykFd1XBdb5nzdF5e2Q@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2485 bytes --]
On Tue, Jan 24, 2023 at 06:36:00PM -0700, Simon Glass wrote:
> Hi Troy,
>
> On Tue, 24 Jan 2023 at 16:31, Troy Kisky <Troy.Kisky@lairdconnect.com> wrote:
> >
> >
> >
> > ________________________________
> > From: Troy Kisky
> > Sent: Tuesday, January 24, 2023 2:52 PM
> > To: u-boot@lists.denx.de <u-boot@lists.denx.de>; sbabic@denx.de <sbabic@denx.de>; trini@konsulko.com <trini@konsulko.com>; festevam@gmail.com <festevam@gmail.com>
> > Cc: sjg@chromium.org <sjg@chromium.org>; marex@denx.de <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->quirks & 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_{}' || git 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_{}' && git grep 'IS_ENABLED(CONFIG_{})'"
> >
> >
> > It prints uses of IS_ENABLED(CONFIG_x) where CONFIG_SPL_x exists.
>
> Thank you for that. We definitely have quite a few of these.
>
> By a great coincidence I updated moveconfig.py to do something a
> little like that:.
>
> 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.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2023-01-26 17:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 22:52 CONFIG_IS_ENABLED vs IS_ENABLED Troy Kisky
2023-01-24 23:31 ` Troy Kisky
2023-01-25 1:36 ` Simon Glass
2023-01-26 17:21 ` Tom Rini [this message]
2023-01-26 18:04 ` Simon Glass
2023-01-26 18:16 ` Tom Rini
2023-01-26 21:29 ` Simon Glass
2023-01-26 21:33 ` Tom Rini
2023-01-27 14:30 ` Simon Glass
-- strict thread matches above, loose matches on Subject: below --
2023-01-26 17:26 Troy Kisky
2023-01-26 17:34 ` Tom Rini
2023-01-28 17:25 ` Troy Kisky
2023-01-30 17:18 ` Tom Rini
2023-01-30 18:51 ` Troy Kisky
2023-01-30 19:44 ` Tom Rini
2023-01-30 22:16 ` Troy Kisky
2023-01-31 14:16 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y9K2nlwZEqvTGOA0@bill-the-cat \
--to=trini@konsulko.com \
--cc=Troy.Kisky@lairdconnect.com \
--cc=festevam@gmail.com \
--cc=marex@denx.de \
--cc=sbabic@denx.de \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox