[PATCH 2/8] Add conditionalized debug() print macro.

Josh Boyer jwboyer at linux.vnet.ibm.com
Thu Sep 25 22:42:44 EST 2008


On Tue, 23 Sep 2008 14:04:06 -0500
Jon Loeliger <jdl at jdl.com> wrote:

> From: Jon Loeliger <jdl at freescale.com>
> 
> Signed-off-by: Jon Loeliger <jdl at freescale.com>
> ---
>  dtc.h |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/dtc.h b/dtc.h
> index 08d54c8..ec636f8 100644
> --- a/dtc.h
> +++ b/dtc.h
> @@ -34,7 +34,15 @@
>  #include <libfdt_env.h>
>  #include <fdt.h>
> 
> +#ifdef DEBUG
> +#define debug(fmt,args...)	printf(fmt, ##args)
> +#else
> +#define debug(fmt,args...)
> +#endif
> +
> +

So, not to be nitpicky, but this requires a rebuild of dtc with -DDEBUG
(or similar) to get the debug output.

Would it be better to have it just take a --debug option on the command
line and conditionalize on a global variable?  dtc isn't exactly a
performance crazy application, so the if checks shouldn't matter too
much.

josh



More information about the devicetree-discuss mailing list