qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 6/8] i.MX: Standardize i.MX FEC debug


From: Jean-Christophe Dubois
Subject: [Qemu-devel] [PATCH 6/8] i.MX: Standardize i.MX FEC debug
Date: Tue, 20 Oct 2015 23:20:05 +0200

The goal is to have debug code always compiled during build.

Signed-off-by: Jean-Christophe Dubois <address@hidden>
---
 hw/net/imx_fec.c | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index 725f3fa..b39fc8d 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -27,31 +27,29 @@
 /* For crc32 */
 #include <zlib.h>
 
-#ifndef IMX_FEC_DEBUG
-#define IMX_FEC_DEBUG          0
+#ifndef DEBUG_IMX_FEC
+#define DEBUG_IMX_FEC 0
 #endif
 
-#ifndef IMX_PHY_DEBUG
-#define IMX_PHY_DEBUG          0
-#endif
+#define FEC_PRINTF(fmt, args...) \
+          do { \
+              if (DEBUG_IMX_FEC) { \
+                  fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_FEC, \
+                                                   __func__, ##args); \
+              } \
+          } while (0)
 
-#if IMX_FEC_DEBUG
-#define FEC_PRINTF(fmt, ...) \
-    do { fprintf(stderr, "%s[%s]: " fmt , TYPE_IMX_FEC, __func__, \
-                 ## __VA_ARGS__); \
-    } while (0)
-#else
-#define FEC_PRINTF(fmt, ...) do {} while (0)
+#ifndef DEBUG_IMX_PHY
+#define DEBUG_IMX_PHY 0
 #endif
 
-#if IMX_PHY_DEBUG
-#define PHY_PRINTF(fmt, ...) \
-    do { fprintf(stderr, "%s.phy[%s]: " fmt , TYPE_IMX_FEC, __func__, \
-                 ## __VA_ARGS__); \
-    } while (0)
-#else
-#define PHY_PRINTF(fmt, ...) do {} while (0)
-#endif
+#define PHY_PRINTF(fmt, args...) \
+          do { \
+              if (DEBUG_IMX_PHY) { \
+                  fprintf(stderr, "[%s.phy]%s: " fmt , TYPE_IMX_FEC, \
+                                                       __func__, ##args); \
+              } \
+          } while (0)
 
 static const VMStateDescription vmstate_imx_fec = {
     .name = TYPE_IMX_FEC,
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]