]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: dm9000: Turn DM9000_DMP_PACKET() into a function
authorMarek Vasut <marex@denx.de>
Wed, 13 Apr 2022 02:15:27 +0000 (04:15 +0200)
committerRamon Fried <ramon@neureality.ai>
Wed, 13 Apr 2022 12:13:54 +0000 (15:13 +0300)
Rework DM9000_DMP_PACKET() into dm9000_dump_packet() function,
this brings better type checking. No functional change.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
drivers/net/dm9000x.c

index 223df944a4812d6023fb890a2748a2cbeea91601..da16b64610b888ecfc0d87129daeac307c773f22 100644 (file)
@@ -58,25 +58,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_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_DMP_PACKET(func,packet,length)
-#endif
-
 /* Structure/enum declaration ------------------------------- */
 typedef struct board_info {
        u32 runt_length_counter;        /* counter: RX length < 64byte */
@@ -122,6 +103,25 @@ static void dm9000_iow(int reg, u8 value);
 #define dm9000_inl(r) __raw_readl(r)
 #endif
 
+#ifdef DEBUG
+static void dm9000_dump_packet(const char *func, u8 *packet, int length)
+{
+       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 ", packet[i]);
+       }
+
+       printf("\n");
+}
+#else
+static void dm9000_dump_packet(const char *func, u8 *packet, int length) {}
+#endif
+
 static void dm9000_outblk_8bit(volatile void *data_ptr, int count)
 {
        int i;
@@ -387,7 +387,7 @@ static int dm9000_send(struct eth_device *netdev, void *packet, int length)
        int tmo;
        struct board_info *db = &dm9000_info;
 
-       DM9000_DMP_PACKET(__func__ , packet, length);
+       dm9000_dump_packet(__func__ , packet, length);
 
        dm9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */
 
@@ -498,7 +498,7 @@ static int dm9000_rx(struct eth_device *netdev)
                                dm9000_reset();
                        }
                } else {
-                       DM9000_DMP_PACKET(__func__ , rdptr, rxlen);
+                       dm9000_dump_packet(__func__ , rdptr, rxlen);
 
                        debug("passing packet to upper layer\n");
                        net_process_received_packet(net_rx_packets[0], rxlen);