From: Marek Vasut <marex@denx.de>
Date: Wed, 13 Apr 2022 02:15:27 +0000 (+0200)
Subject: net: dm9000: Turn DM9000_DMP_PACKET() into a function
X-Git-Tag: v2025.01-rc5-pxa1908~1454^2~12
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=c7b7ee52b2818a891f5a974a4bdc4a5808a1885b;p=u-boot.git

net: dm9000: Turn DM9000_DMP_PACKET() into a function

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>
---

diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index 223df944a4..da16b64610 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -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);