Re: [U-Boot] [PATCH 8/9 v2] DM9000: change some printf to use debug instead

2011-10-06 Thread Wolfgang Denk
Dear Eric Jarrige,

In message 20110828214920.11485.22198.st...@shuttle2.etheralp.ch you wrote:
 Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
 Cc: Wolfgang Denk w...@denx.de
 Cc: Detlev Zundel d...@denx.de
 
 Changes for v2:
   - Remove DM9000_ DEBUG macros and use debug() instead
 ---
  drivers/net/dm9000x.c |   97 
 +++--
  1 files changed, 46 insertions(+), 51 deletions(-)

Checkpatch says:

total: 0 errors, 1 warnings, 212 lines checked

Please clean up and resubmit.  Thanks.

Viele Grüße,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
I express preference for a chronological  sequence  of  events  which
precludes a violence.   - Terry Pratchett, _The Dark Side of the Sun_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 8/9 v2] DM9000: change some printf to use debug instead

2011-08-28 Thread Eric Jarrige
Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Wolfgang Denk w...@denx.de
Cc: Detlev Zundel d...@denx.de

Changes for v2:
- Remove DM9000_ DEBUG macros and use debug() instead
---
 drivers/net/dm9000x.c |   97 +++--
 1 files changed, 46 insertions(+), 51 deletions(-)

diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index b5c5573..7fe7e46 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -66,27 +66,6 @@ TODO: external MII is not functional, only internal at the 
moment.
 
 #include dm9000x.h
 
-/* Board/System/Debug information/definition  */
-
-/* #define CONFIG_DM9000_DEBUG */
-
-#ifdef CONFIG_DM9000_DEBUG
-#define DM9000_DBG(fmt,args...) printf(fmt, ##args)
-#define DM9000_DMP_PACKET(func,packet,length)  \
-   do { \
-   int i;  \
-   printf(%s: length: %d\n, func, length);   \
-   for (i = 0; i  length; i++) {  \
-   if (i % 8 == 0) \
-   printf(\n%s: %02x: , func, i);\
-   printf(%02x , ((unsigned char *) packet)[i]); \
-   } printf(\n); \
-   } while(0)
-#else
-#define DM9000_DBG(fmt,args...)
-#define DM9000_DMP_PACKET(func,packet,length)
-#endif
-
 /* Structure/enum declaration --- */
 typedef struct board_info {
u32 runt_length_counter;/* counter: RX length  64byte */
@@ -124,21 +103,37 @@ static void DM9000_iow(int reg, u8 value);
 #define DM9000_inw(r) readw((volatile u16 *)(r))
 #define DM9000_inl(r) readl((volatile u32 *)(r))
 
-#ifdef CONFIG_DM9000_DEBUG
+#ifdef DEBUG
 static void
 dump_regs(void)
 {
-   DM9000_DBG(\n);
-   DM9000_DBG(NCR   (0x00): %02x\n, DM9000_ior(0));
-   DM9000_DBG(NSR   (0x01): %02x\n, DM9000_ior(1));
-   DM9000_DBG(TCR   (0x02): %02x\n, DM9000_ior(2));
-   DM9000_DBG(TSRI  (0x03): %02x\n, DM9000_ior(3));
-   DM9000_DBG(TSRII (0x04): %02x\n, DM9000_ior(4));
-   DM9000_DBG(RCR   (0x05): %02x\n, DM9000_ior(5));
-   DM9000_DBG(RSR   (0x06): %02x\n, DM9000_ior(6));
-   DM9000_DBG(ISR   (0xFE): %02x\n, DM9000_ior(DM9000_ISR));
-   DM9000_DBG(\n);
+   debug(\n);
+   debug(NCR   (0x00): %02x\n, DM9000_ior(0));
+   debug(NSR   (0x01): %02x\n, DM9000_ior(1));
+   debug(TCR   (0x02): %02x\n, DM9000_ior(2));
+   debug(TSRI  (0x03): %02x\n, DM9000_ior(3));
+   debug(TSRII (0x04): %02x\n, DM9000_ior(4));
+   debug(RCR   (0x05): %02x\n, DM9000_ior(5));
+   debug(RSR   (0x06): %02x\n, DM9000_ior(6));
+   debug(ISR   (0xFE): %02x\n, DM9000_ior(DM9000_ISR));
+   debug(\n);
+}
+
+static void dm9000_dmp_packet(char *func, unsigned char *packet, int length)
+{
+   int i;
+   do {
+   printf(%s: length: %d\n, func, length);
+   for (i = 0; i  length; i++) {
+   if (i % 8 == 0)
+   printf(\n%s: %02x: , func, i);
+   printf(%02x , ((unsigned char *) packet)[i]);
+   }
+   printf(\n);
+   } while (0);
 }
+#else
+#define dm9000_dmp_packet(func, packet, length)
 #endif
 
 static void dm9000_outblk_8bit(volatile void *data_ptr, int count)
@@ -232,7 +227,7 @@ dm9000_probe(void)
id_val |= DM9000_ior(DM9000_PIDL)  16;
id_val |= DM9000_ior(DM9000_PIDH)  24;
if (id_val == DM9000_ID) {
-   printf(dm9000 i/o: 0x%x, id: 0x%x \n, CONFIG_DM9000_BASE,
+   debug(dm9000 i/o: 0x%x, id: 0x%x \n, CONFIG_DM9000_BASE,
   id_val);
return 0;
} else {
@@ -246,7 +241,7 @@ dm9000_probe(void)
 static void
 dm9000_reset(void)
 {
-   DM9000_DBG(resetting DM9000\n);
+   debug(resetting DM9000\n);
 
/* Reset DM9000,
   see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 */
@@ -259,7 +254,7 @@ dm9000_reset(void)
DM9000_iow(DM9000_NCR, (NCR_LBK_INT_MAC | NCR_RST));
 
do {
-   DM9000_DBG(resetting the DM9000, 1st reset\n);
+   debug(resetting the DM9000, 1st reset\n);
udelay(25); /* Wait at least 20 us */
} while (DM9000_ior(DM9000_NCR)  1);
 
@@ -267,7 +262,7 @@ dm9000_reset(void)
DM9000_iow(DM9000_NCR, (NCR_LBK_INT_MAC | NCR_RST)); /* Issue a second 
reset */
 
do {
-   DM9000_DBG(resetting the DM9000, 2nd reset\n);
+   debug(resetting the DM9000, 2nd reset\n);
udelay(25); /* Wait at least 20 us */
} while (DM9000_ior(DM9000_NCR)  1);
 
@@ -285,7 +280,7 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)
u8 io_mode;
struct board_info *db = dm9000_info;
 
-   DM9000_DBG(%s\n, __func__);
+   debug(%s\n, __func__);