[PATCH 1/2] efi: payload: iomem: add commented out #define DEBUG 1

Masahiro Yamada masahiroy at kernel.org
Tue May 30 08:38:20 PDT 2023


On Tue, May 30, 2023 at 9:38 PM Sascha Hauer <sha at pengutronix.de> wrote:
>
> Picked some outdated address from Masahiro, so once again:


The macro name is misleading - perhaps, it should have
been named as __is_defined_as_1().

I do not know if __is_defined() is future-proof.
IS_BUILTIN, IS_MODULE, etc. are official,
but __is_defined() is internal.





>
> On Tue, May 23, 2023 at 11:40:34AM +0200, Ahmad Fatoum wrote:
> > The code uses __is_defined, which only works for undefined macros and
> > defined ones with a value. This is different than the debugging prints
> > that accept empty defined DEBUG, so add a commented out #define DEBUG 1
> > to alert those seeking to debug the code.
> >
> > Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> > ---
> >  common/efi/payload/iomem.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/common/efi/payload/iomem.c b/common/efi/payload/iomem.c
> > index 6b92ca993aa7..550d832668ed 100644
> > --- a/common/efi/payload/iomem.c
> > +++ b/common/efi/payload/iomem.c
> > @@ -3,6 +3,7 @@
> >
> >  #define pr_fmt(fmt) "efi-iomem: " fmt
> >
> > +// #define DEBUG 1
>
> I don't like this very much.
>
> Generally being able to do this is really appealing:
>
>         if (__is_defined(DEBUG))
>                 ...
>
> Indeed this is so appealing that others may copy this. Having to
> remember then that there's a subtle difference between __is_defined() and
> #ifdef is not so nice though.
>
> We could add
>
> #define __ARG_PLACEHOLDER_ 0,
>
> to include/linux/kconfig.h. With this __is_defined() and #ifdef should
> do the same thing. It would even better to add this to the Linux
> upstream version of this file. I am not sure though if that has any
> unwanted side effects. Masahiro, do you have an opinion about this?
>
> Another option would be to add this somewhere:
>
> #ifdef DEBUG
> #undef DEBUG
> #define DEBUG 1
> #endif
>
> Sascha
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



-- 
Best Regards
Masahiro Yamada



More information about the barebox mailing list