diff mbox

[RFC,1/5] dtc: Add helpers for various message levels

Message ID 1392919611-10746-2-git-send-email-t.figa@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomasz Figa Feb. 20, 2014, 6:06 p.m. UTC
This patch adds three helper macros to print errors, warnings and
informational messages using standard format.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
---
 dtc.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Gibson March 9, 2014, 11:43 a.m. UTC | #1
On Thu, Feb 20, 2014 at 07:06:47PM +0100, Tomasz Figa wrote:
> This patch adds three helper macros to print errors, warnings and
> informational messages using standard format.
> 
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> ---
>  dtc.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/dtc.h b/dtc.h
> index 20de073..e95bed7 100644
> --- a/dtc.h
> +++ b/dtc.h
> @@ -43,6 +43,9 @@
>  #define debug(fmt,args...)
>  #endif
>  
> +#define pr_err(...)	fprintf (stderr, "ERROR: " __VA_ARGS__)
> +#define pr_warn(...)	fprintf (stderr, "WARNING: " __VA_ARGS__)
> +#define pr_info(...)	fprintf (stderr, "INFO: " __VA_ARGS__)

So, there are already several message helper functions in dtc.
They're not all that consistently applied, so I can see an argument
for cleaning things up, and replacing them with ones modelled on the
kernel versions like these.

But.. this patch doesn't do that, it just adds yet another variant to
the mix.

In addition, what we want for messages in dtc is a bit different from
the kernel - the kernel's expexted to keep running, and the messages
log events of interest.  For dtc, for each warning/error you should
also be deciding whether that should terminate the program or not -
these helpers don't address that.
diff mbox

Patch

diff --git a/dtc.h b/dtc.h
index 20de073..e95bed7 100644
--- a/dtc.h
+++ b/dtc.h
@@ -43,6 +43,9 @@ 
 #define debug(fmt,args...)
 #endif
 
+#define pr_err(...)	fprintf (stderr, "ERROR: " __VA_ARGS__)
+#define pr_warn(...)	fprintf (stderr, "WARNING: " __VA_ARGS__)
+#define pr_info(...)	fprintf (stderr, "INFO: " __VA_ARGS__)
 
 #define DEFAULT_FDT_VERSION	17