Patchwork [V10,27/27] mc146818rtc: remove #ifdef DEBUG_CMOS.

login
register
mail settings
Submitter Isaku Yamahata
Date Dec. 24, 2009, 8:09 a.m.
Message ID <1261642160-22754-28-git-send-email-yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/41745/
State New
Headers show

Comments

Isaku Yamahata - Dec. 24, 2009, 8:09 a.m.
remove #ifdef DEBUG_CMOS by using macro.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/mc146818rtc.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

Patch

diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 1eb991c..0e1dc07 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -31,6 +31,12 @@ 
 
 //#define DEBUG_CMOS
 
+#ifdef DEBUG_CMOS
+# define CMOS_DPRINTF(format, ...)      printf(format, ## __VA_ARGS__)
+#else
+# define CMOS_DPRINTF(format, ...)      do { } while (0)
+#endif
+
 #define RTC_REINJECT_ON_ACK_COUNT 1000
 
 #define RTC_SECONDS             0
@@ -210,10 +216,8 @@  static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data)
     if ((addr & 1) == 0) {
         s->cmos_index = data & 0x7f;
     } else {
-#ifdef DEBUG_CMOS
-        printf("cmos: write index=0x%02x val=0x%02x\n",
-               s->cmos_index, data);
-#endif
+        CMOS_DPRINTF("cmos: write index=0x%02x val=0x%02x\n",
+                     s->cmos_index, data);
         switch(s->cmos_index) {
         case RTC_SECONDS_ALARM:
         case RTC_MINUTES_ALARM:
@@ -482,10 +486,8 @@  static uint32_t cmos_ioport_read(void *opaque, uint32_t addr)
             ret = s->cmos_data[s->cmos_index];
             break;
         }
-#ifdef DEBUG_CMOS
-        printf("cmos: read index=0x%02x val=0x%02x\n",
-               s->cmos_index, ret);
-#endif
+        CMOS_DPRINTF("cmos: read index=0x%02x val=0x%02x\n",
+                     s->cmos_index, ret);
         return ret;
     }
 }