From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wlneu-0006ah-Hm for qemu-devel@nongnu.org; Sat, 17 May 2014 19:05:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wlnel-00044e-D8 for qemu-devel@nongnu.org; Sat, 17 May 2014 19:04:52 -0400 Received: from mail-wg0-x234.google.com ([2a00:1450:400c:c00::234]:40434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wlnel-00044U-6x for qemu-devel@nongnu.org; Sat, 17 May 2014 19:04:43 -0400 Received: by mail-wg0-f52.google.com with SMTP id l18so6420295wgh.35 for ; Sat, 17 May 2014 16:04:42 -0700 (PDT) From: =?UTF-8?q?Marc=20Mar=C3=AD?= Date: Sun, 18 May 2014 01:03:36 +0200 Message-Id: <1400367823-32610-10-git-send-email-marc.mari.barcelo@gmail.com> In-Reply-To: <1400367823-32610-1-git-send-email-marc.mari.barcelo@gmail.com> References: <1400367823-32610-1-git-send-email-marc.mari.barcelo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v3 09/16] i82374: Convert debug printfs to QEMU_DPRINTF List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc=20Mar=C3=AD?= , Stefan Hajnoczi , Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= 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Ă­ --- 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