qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc Marí" <marc.mari.barcelo@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Marc Marí" <marc.mari.barcelo@gmail.com>,
	"Stefan Hajnoczi" <stefanha@gmail.com>,
	"Peter Crosthwaite" <peter.crosthwaite@xilinx.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH v3 15/16] pci-host: Convert debug printfs to QEMU_DPRINTF
Date: Sun, 18 May 2014 01:03:42 +0200	[thread overview]
Message-ID: <1400367823-32610-16-git-send-email-marc.mari.barcelo@gmail.com> (raw)
In-Reply-To: <1400367823-32610-1-git-send-email-marc.mari.barcelo@gmail.com>

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

As the debug printf is always put in code, some formats had to be changed to
avoid warnings treated as errors at compile time.

As QEMU_DPRINTF already puts the function name as the header, __func__ was
removed from debug printfs.

Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com>
---
 hw/pci-host/bonito.c  |   13 +++++++++----
 hw/pci-host/ppce500.c |   21 +++++++++++++--------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 56292ad..814b6d8 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -50,11 +50,14 @@
 //#define DEBUG_BONITO
 
 #ifdef DEBUG_BONITO
-#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__)
+#define DEBUG_BONITO_ENABLED 1
 #else
-#define DPRINTF(fmt, ...)
+#define DEBUG_BONITO_ENABLED 0
 #endif
 
+#define DPRINTF(fmt, ...) \
+    QEMU_DPRINTF(DEBUG_BONITO_ENABLED, "bonito", fmt, ## __VA_ARGS__)
+
 /* from linux soure code. include/asm-mips/mips-boards/bonito64.h*/
 #define BONITO_BOOT_BASE        0x1fc00000
 #define BONITO_BOOT_SIZE        0x00100000
@@ -235,7 +238,8 @@ static void bonito_writel(void *opaque, hwaddr addr,
 
     saddr = (addr - BONITO_REGBASE) >> 2;
 
-    DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n", addr, val, saddr);
+    DPRINTF("bonito_writel "TARGET_FMT_plx" val %" PRIx64 " saddr %x\n",
+            addr, val, saddr);
     switch (saddr) {
     case BONITO_BONPONCFG:
     case BONITO_IODEVCFG:
@@ -322,7 +326,8 @@ static void bonito_pciconf_writel(void *opaque, hwaddr addr,
     PCIBonitoState *s = opaque;
     PCIDevice *d = PCI_DEVICE(s);
 
-    DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val);
+    DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %" PRIx64 "\n",
+            addr, val);
     d->config_write(d, addr, val, 4);
 }
 
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index c80b7cb..ff250ce 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -21,12 +21,17 @@
 #include "qemu/bswap.h"
 #include "hw/pci-host/ppce500.h"
 
+//#define DEBUG_PCI
+
 #ifdef DEBUG_PCI
-#define pci_debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
+#define DEBUG_PCI_ENABLED 1
 #else
-#define pci_debug(fmt, ...)
+#define DEBUG_PCI_ENABLED 0
 #endif
 
+#define pci_debug(fmt, ...) \
+    QEMU_DPRINTF(DEBUG_PCI_ENABLED, "ppce500", fmt, ## __VA_ARGS__)
+
 #define PCIE500_CFGADDR       0x0
 #define PCIE500_CFGDATA       0x4
 #define PCIE500_REG_BASE      0xC00
@@ -174,7 +179,7 @@ static uint64_t pci_reg_read4(void *opaque, hwaddr addr,
         break;
     }
 
-    pci_debug("%s: win:%lx(addr:" TARGET_FMT_plx ") -> value:%x\n", __func__,
+    pci_debug("win:%lx(addr:" TARGET_FMT_plx ") -> value:%x\n", 
               win, addr, value);
     return value;
 }
@@ -188,8 +193,8 @@ static void pci_reg_write4(void *opaque, hwaddr addr,
 
     win = addr & 0xfe0;
 
-    pci_debug("%s: value:%x -> win:%lx(addr:" TARGET_FMT_plx ")\n",
-              __func__, (unsigned)value, win, addr);
+    pci_debug("value:%" PRIx64 " -> win:%lx(addr:" TARGET_FMT_plx ")\n",
+              value, win, addr);
 
     switch (win) {
     case PPCE500_PCI_OW1:
@@ -259,8 +264,8 @@ static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int irq_num)
 
     ret = ppce500_pci_map_irq_slot(devno, irq_num);
 
-    pci_debug("%s: devfn %x irq %d -> %d  devno:%x\n", __func__,
-           pci_dev->devfn, irq_num, ret, devno);
+    pci_debug("devfn %x irq %d -> %d  devno:%x\n",
+                pci_dev->devfn, irq_num, ret, devno);
 
     return ret;
 }
@@ -269,7 +274,7 @@ static void mpc85xx_pci_set_irq(void *opaque, int irq_num, int level)
 {
     qemu_irq *pic = opaque;
 
-    pci_debug("%s: PCI irq %d, level:%d\n", __func__, irq_num, level);
+    pci_debug("PCI irq %d, level:%d\n", irq_num, level);
 
     qemu_set_irq(pic[irq_num], level);
 }
-- 
1.7.10.4

  parent reply	other threads:[~2014-05-17 23:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-17 23:03 [Qemu-devel] [PATCH v3 00/16] Convert debug printfs to QEMU_DPRINTF Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 01/16] include/qemu-common.h: Add QEMU_DPRINTF macro Marc Marí
2014-05-19 15:28   ` Eric Blake
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 02/16] x86: Convert debug printfs to QEMU_DPRINTF Marc Marí
2014-05-19 15:48   ` Eric Blake
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 03/16] s390: " Marc Marí
2014-05-18  9:37   ` Peter Crosthwaite
2014-05-19 11:50     ` Alexander Graf
2014-05-19 16:45     ` Marc Marí
2014-05-19 16:50       ` Richard Henderson
2014-05-19 20:33         ` Peter Crosthwaite
2014-05-19 20:34           ` Alexander Graf
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 04/16] scsi: " Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 05/16] highbank: " Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 06/16] xilinx: " Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 07/16] spapr: " Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 08/16] stellaris: " Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 09/16] i82374: " Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 10/16] i8257: " Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 11/16] rc4030: " Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 12/16] sd: " Marc Marí
2014-05-19 21:05   ` Eric Blake
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 13/16] isa: " Marc Marí
2014-05-19 21:07   ` Eric Blake
2014-05-20  6:39     ` Marc Marí
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 14/16] lan9118: " Marc Marí
2014-05-17 23:03 ` Marc Marí [this message]
2014-05-17 23:03 ` [Qemu-devel] [PATCH v3 16/16] common: " Marc Marí

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400367823-32610-16-git-send-email-marc.mari.barcelo@gmail.com \
    --to=marc.mari.barcelo@gmail.com \
    --cc=afaerber@suse.de \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).