mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Sascha Hauer <sha@pengutronix.de>
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] efi: payload: iomem: add commented out #define DEBUG 1
Date: Wed, 31 May 2023 00:38:20 +0900	[thread overview]
Message-ID: <CAK7LNAQ1jB-r+gKtL-=+dKZ=7jz3yB0BD4vuS4YWOcya=NDw7g@mail.gmail.com> (raw)
In-Reply-To: <20230530123845.GA15436@pengutronix.de>

On Tue, May 30, 2023 at 9:38 PM Sascha Hauer <sha@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@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



  reply	other threads:[~2023-05-30 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23  9:40 Ahmad Fatoum
2023-05-23  9:40 ` [PATCH 2/2] block: efi: " Ahmad Fatoum
2023-05-30 12:31 ` [PATCH 1/2] efi: payload: iomem: " Sascha Hauer
2023-05-30 12:38 ` Sascha Hauer
2023-05-30 15:38   ` Masahiro Yamada [this message]
2023-05-31  7:27     ` Sascha Hauer

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='CAK7LNAQ1jB-r+gKtL-=+dKZ=7jz3yB0BD4vuS4YWOcya=NDw7g@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.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