aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-05-14 16:29:21 +0900
committerBlue Swirl <blauwirbel@gmail.com>2010-05-15 16:39:53 +0000
commitb246eebb0acca216648c75e4f925ac0939a968c0 (patch)
tree078ea237da76e7adade5e946147bed9ef97ffbdb
parentac4040955b1669f0aac5937f623d6587d5210679 (diff)
pm_smbus: remove #ifdef DEBUG.
remove #ifdef DEBUG by using macro. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--hw/pm_smbus.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/hw/pm_smbus.c b/hw/pm_smbus.c
index 6ef6b9ed58..9929d721eb 100644
--- a/hw/pm_smbus.c
+++ b/hw/pm_smbus.c
@@ -37,6 +37,15 @@
#define SMBHSTDAT1 0x06
#define SMBBLKDAT 0x07
+//#define DEBUG
+
+#ifdef DEBUG
+# define SMBUS_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
+#else
+# define SMBUS_DPRINTF(format, ...) do { } while (0)
+#endif
+
+
static void smb_transaction(PMSMBus *s)
{
uint8_t prot = (s->smb_ctl >> 2) & 0x07;
@@ -45,9 +54,7 @@ static void smb_transaction(PMSMBus *s)
uint8_t addr = s->smb_addr >> 1;
i2c_bus *bus = s->smbus;
-#ifdef DEBUG
- printf("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
-#endif
+ SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
switch(prot) {
case 0x0:
smbus_quick_command(bus, addr, read);
@@ -96,9 +103,7 @@ void smb_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
{
PMSMBus *s = opaque;
addr &= 0x3f;
-#ifdef DEBUG
- printf("SMB writeb port=0x%04x val=0x%02x\n", addr, val);
-#endif
+ SMBUS_DPRINTF("SMB writeb port=0x%04x val=0x%02x\n", addr, val);
switch(addr) {
case SMBHSTSTS:
s->smb_stat = 0;
@@ -166,9 +171,7 @@ uint32_t smb_ioport_readb(void *opaque, uint32_t addr)
val = 0;
break;
}
-#ifdef DEBUG
- printf("SMB readb port=0x%04x val=0x%02x\n", addr, val);
-#endif
+ SMBUS_DPRINTF("SMB readb port=0x%04x val=0x%02x\n", addr, val);
return val;
}