CONFIG_IS_ENABLED vs IS_ENABLED

Troy Kisky Troy.Kisky at lairdconnect.com
Wed Jan 25 00:31:20 CET 2023



________________________________
From: Troy Kisky
Sent: Tuesday, January 24, 2023 2:52 PM
To: u-boot at lists.denx.de <u-boot at lists.denx.de>; sbabic at denx.de <sbabic at denx.de>; trini at konsulko.com <trini at konsulko.com>; festevam at gmail.com <festevam at gmail.com>
Cc: sjg at chromium.org <sjg at chromium.org>; marex at denx.de <marex at 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.


BR
Troy



THIS MESSAGE, ANY ATTACHMENT(S), AND THE INFORMATION CONTAINED HEREIN MAY BE PROPRIETARY TO LAIRD CONNECTIVITY, LLC., BOUNDARY DEVICES, LLC. AND/OR ANOTHER PARTY, AND MAY FURTHER BE INTENDED TO BE KEPT CONFIDENTIAL. IF YOU ARE NOT THE INTENDED RECIPIENT, PLEASE DELETE THE EMAIL AND ANY ATTACHMENTS, AND IMMEDIATELY NOTIFY THE SENDER BY RETURN EMAIL. THIS MESSAGE AND ITS CONTENTS ARE THE PROPERTY OF LAIRD CONNECTIVITY, LLC. AND BOUNDARY DEVICES, LLC. AND MAY NOT BE REPRODUCED OR USED WITHOUT THE EXPRESS WRITTEN CONSENT OF LAIRD CONNECTIVITY, LLC. AND BOUNDARY DEVICES, LLC.


More information about the U-Boot mailing list