From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wlnem-0006Q3-QT for qemu-devel@nongnu.org; Sat, 17 May 2014 19:04:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wlned-000437-3h for qemu-devel@nongnu.org; Sat, 17 May 2014 19:04:44 -0400 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:48527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wlnec-00042x-Te for qemu-devel@nongnu.org; Sat, 17 May 2014 19:04:35 -0400 Received: by mail-we0-f174.google.com with SMTP id k48so3990545wev.19 for ; Sat, 17 May 2014 16:04:34 -0700 (PDT) From: =?UTF-8?q?Marc=20Mar=C3=AD?= Date: Sun, 18 May 2014 01:03:32 +0200 Message-Id: <1400367823-32610-6-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 05/16] highbank: 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. Remove header and __func__ in debug printfs, to avoid duplicated messages. Signed-off-by: Marc MarĂ­ --- hw/net/xgmac.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c index aeffcb5..4db93d1 100644 --- a/hw/net/xgmac.c +++ b/hw/net/xgmac.c @@ -30,14 +30,17 @@ #include "net/net.h" #include "net/checksum.h" +//#define DEBUG_XGMAC + #ifdef DEBUG_XGMAC -#define DEBUGF_BRK(message, args...) do { \ - fprintf(stderr, (message), ## args); \ - } while (0) +#define DEBUG_XGMAC_ENABLED 1 #else -#define DEBUGF_BRK(message, args...) do { } while (0) +#define DEBUG_XGMAC_ENABLED 0 #endif +#define DEBUGF_BRK(message, args...) \ + QEMU_DPRINTF(DEBUG_XGMAC_ENABLED, "xgmag", message, ## args) + #define XGMAC_CONTROL 0x00000000 /* MAC Configuration */ #define XGMAC_FRAME_FILTER 0x00000001 /* MAC Frame Filter */ #define XGMAC_FLOW_CTRL 0x00000006 /* MAC Flow Control */ @@ -218,20 +221,20 @@ static void xgmac_enet_send(XgmacState *s) len = (bd.buffer1_size & 0xfff) + (bd.buffer2_size & 0xfff); if ((bd.buffer1_size & 0xfff) > 2048) { - DEBUGF_BRK("qemu:%s:ERROR...ERROR...ERROR... -- " + DEBUGF_BRK("ERROR...ERROR...ERROR... -- " "xgmac buffer 1 len on send > 2048 (0x%x)\n", - __func__, bd.buffer1_size & 0xfff); + bd.buffer1_size & 0xfff); } if ((bd.buffer2_size & 0xfff) != 0) { - DEBUGF_BRK("qemu:%s:ERROR...ERROR...ERROR... -- " + DEBUGF_BRK("ERROR...ERROR...ERROR... -- " "xgmac buffer 2 len on send != 0 (0x%x)\n", - __func__, bd.buffer2_size & 0xfff); + bd.buffer2_size & 0xfff); } if (len >= sizeof(frame)) { - DEBUGF_BRK("qemu:%s: buffer overflow %d read into %zu " - "buffer\n" , __func__, len, sizeof(frame)); - DEBUGF_BRK("qemu:%s: buffer1.size=%d; buffer2.size=%d\n", - __func__, bd.buffer1_size, bd.buffer2_size); + DEBUGF_BRK("buffer overflow %d read into %zu " + "buffer\n" , len, sizeof(frame)); + DEBUGF_BRK("buffer1.size=%d; buffer2.size=%d\n", + bd.buffer1_size, bd.buffer2_size); } cpu_physical_memory_read(bd.buffer1_addr, ptr, len); -- 1.7.10.4