qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v3 09/16] i82374: Convert debug printfs to QEMU_DPRI


From: Marc Marí
Subject: [Qemu-devel] [PATCH v3 09/16] i82374: Convert debug printfs to QEMU_DPRINTF
Date: Sun, 18 May 2014 01:03:36 +0200

Modify debug macros to have the same format through the codebase and use regular
ifs instead of ifdef.

As the QEMU_DPRINTF already writes the function name, remove the __func__ to
avoid writing the function name two times.

Signed-off-by: Marc Marí <address@hidden>
---
 hw/dma/i82374.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index b8ad2e6..0d9d09b 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -27,14 +27,15 @@
 //#define DEBUG_I82374
 
 #ifdef DEBUG_I82374
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "i82374: " fmt , ## __VA_ARGS__); } while (0)
+#define DEBUG_I82374_ENABLED 1
 #else
-#define DPRINTF(fmt, ...) \
-do {} while (0)
+#define DEBUG_I82374_ENABLED 0
 #endif
+
+#define DPRINTF(fmt, ...) \
+    QEMU_DPRINTF(DEBUG_I82374_ENABLED, "i82374", fmt, ## __VA_ARGS__)
 #define BADF(fmt, ...) \
-do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0)
+    QEMU_DPRINTF(1, "i82374 ERROR", fmt, ## __VA_ARGS__)
 
 typedef struct I82374State {
     uint8_t commands[8];
@@ -56,19 +57,19 @@ static uint32_t i82374_read_isr(void *opaque, uint32_t 
nport)
 {
     uint32_t val = 0;
 
-    BADF("%s: %08x\n", __func__, nport);
+    BADF("%08x\n", nport);
 
-    DPRINTF("%s: %08x=%08x\n", __func__, nport, val);
+    DPRINTF("%08x=%08x\n", nport, val);
     return val;
 }
 
 static void i82374_write_command(void *opaque, uint32_t nport, uint32_t data)
 {
-    DPRINTF("%s: %08x=%08x\n", __func__, nport, data);
+    DPRINTF("%08x=%08x\n", nport, data);
 
     if (data != 0x42) {
         /* Not Stop S/G command */
-        BADF("%s: %08x=%08x\n", __func__, nport, data);
+        BADF("%08x=%08x\n", nport, data);
     }
 }
 
@@ -76,26 +77,26 @@ static uint32_t i82374_read_status(void *opaque, uint32_t 
nport)
 {
     uint32_t val = 0;
 
-    BADF("%s: %08x\n", __func__, nport);
+    BADF("%08x\n", nport);
 
-    DPRINTF("%s: %08x=%08x\n", __func__, nport, val);
+    DPRINTF("%08x=%08x\n", nport, val);
     return val;
 }
 
 static void i82374_write_descriptor(void *opaque, uint32_t nport, uint32_t 
data)
 {
-    DPRINTF("%s: %08x=%08x\n", __func__, nport, data);
+    DPRINTF("%08x=%08x\n", nport, data);
 
-    BADF("%s: %08x=%08x\n", __func__, nport, data);
+    BADF("%08x=%08x\n", nport, data);
 }
 
 static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport)
 {
     uint32_t val = 0;
 
-    BADF("%s: %08x\n", __func__, nport);
+    BADF("%08x\n", nport);
 
-    DPRINTF("%s: %08x=%08x\n", __func__, nport, val);
+    DPRINTF("%08x=%08x\n", nport, val);
     return val;
 }
 
-- 
1.7.10.4




reply via email to

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