mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org,
	Masahiro Yamada <yamada.masahiro@socionext.com>
Subject: Re: [PATCH 1/2] efi: payload: iomem: add commented out #define DEBUG 1
Date: Tue, 30 May 2023 14:31:45 +0200	[thread overview]
Message-ID: <20230530123145.GD17518@pengutronix.de> (raw)
In-Reply-To: <20230523094035.3452447-1-a.fatoum@pengutronix.de>

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 |



  parent reply	other threads:[~2023-05-30 12:33 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 ` Sascha Hauer [this message]
2023-05-30 12:38 ` [PATCH 1/2] efi: payload: iomem: " Sascha Hauer
2023-05-30 15:38   ` Masahiro Yamada
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=20230530123145.GD17518@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=yamada.masahiro@socionext.com \
    /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