mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: netdev@vger.kernel.org
Cc: "Ben Hutchings" <bhutchings@solarflare.com>,
	"Szymon Janc" <szymon@janc.net.pl>,
	"Michał Mirosław" <mirqus@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 03/11] forcedeth: Use print_hex_dump
Date: Mon, 29 Nov 2010 09:41:54 -0800	[thread overview]
Message-ID: <1b70e8ee9beb0642a1a68d9f84e166dcfdfb14c8.1291051316.git.joe@perches.com> (raw)
In-Reply-To: <cover.1291051316.git.joe@perches.com>

Use the standard code to emit hex dumps.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/forcedeth.c |   54 ++++++++++++++--------------------------------
 1 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 767d1eb..1ac8b4e 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2192,15 +2192,10 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	netdev_dbg(dev, "%s: entries %d queued for transmission. tx_flags_extra: %x\n",
 		   __func__, entries, tx_flags_extra);
-	{
-		int j;
-		for (j = 0; j < 64; j++) {
-			if ((j%16) == 0)
-				dprintk("\n%03x:", j);
-			dprintk(" %02x", ((unsigned char *)skb->data)[j]);
-		}
-		dprintk("\n");
-	}
+#ifdef DEBUG
+	print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 16, 1,
+		       skb->data, 64, true);
+#endif
 
 	writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
 	return NETDEV_TX_OK;
@@ -2343,15 +2338,10 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
 
 	netdev_dbg(dev, "%s: entries %d queued for transmission. tx_flags_extra: %x\n",
 		   __func__, entries, tx_flags_extra);
-	{
-		int j;
-		for (j = 0; j < 64; j++) {
-			if ((j%16) == 0)
-				dprintk("\n%03x:", j);
-			dprintk(" %02x", ((unsigned char *)skb->data)[j]);
-		}
-		dprintk("\n");
-	}
+#ifdef DEBUG
+	print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 16, 1,
+		       skb->data, 64, true);
+#endif
 
 	writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
 	return NETDEV_TX_OK;
@@ -2666,16 +2656,11 @@ static int nv_rx_process(struct net_device *dev, int limit)
 		skb = np->get_rx_ctx->skb;
 		np->get_rx_ctx->skb = NULL;
 
-		{
-			int j;
 			netdev_dbg(dev, "Dumping packet (flags 0x%x)\n", flags);
-			for (j = 0; j < 64; j++) {
-				if ((j%16) == 0 && j)
-					dprintk("\n%03x:", j);
-				dprintk(" %02x", ((unsigned char *)skb->data)[j]);
-			}
-			dprintk("\n");
-		}
+#ifdef DEBUG
+			print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET,
+				       16, 1, skb->data, 64, true);
+#endif
 		/* look at what we actually got: */
 		if (np->desc_ver == DESC_VER_1) {
 			if (likely(flags & NV_RX_DESCRIPTORVALID)) {
@@ -2793,16 +2778,11 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
 		skb = np->get_rx_ctx->skb;
 		np->get_rx_ctx->skb = NULL;
 
-		{
-			int j;
-			netdev_dbg(dev, "Dumping packet (flags 0x%x)\n", flags);
-			for (j = 0; j < 64; j++) {
-				if ((j%16) == 0 && j)
-					dprintk("\n%03x:", j);
-				dprintk(" %02x", ((unsigned char *)skb->data)[j]);
-			}
-			dprintk("\n");
-		}
+		netdev_dbg(dev, "Dumping packet (flags 0x%x)\n", flags);
+#ifdef DEBUG
+		print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 16, 1,
+			       skb->data, 64, true);
+#endif
 		/* look at what we actually got: */
 		if (likely(flags & NV_RX2_DESCRIPTORVALID)) {
 			len = flags & LEN_MASK_V2;
-- 
1.7.3.2.245.g03276.dirty


  parent reply	other threads:[~2010-11-29 17:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29 17:41 [PATCH 00/11] forcedeth: Convert to use netdev_<level> and neatening Joe Perches
2010-11-29 17:41 ` [PATCH 01/11] forcedeth: Change reg_delay arguments and use Joe Perches
2010-11-29 17:41 ` [PATCH 02/11] forcedeth: convert dprintk(KERN_DEBUG to netdev_dbg Joe Perches
2010-11-29 17:41 ` Joe Perches [this message]
2010-11-29 17:41 ` [PATCH 04/11] forcedeth: Convert remaining dprintk " Joe Perches
2010-11-29 17:41 ` [PATCH 05/11] forcedeth: Use pr_fmt and pr_<level> Joe Perches
2010-11-29 17:41 ` [PATCH 06/11] forcedeth: Convert pr_<level> to netdev_<level> Joe Perches
2010-11-29 17:41 ` [PATCH 07/11] forcedeth: Add function init_realtek_8211b Joe Perches
2010-11-29 17:41 ` [PATCH 08/11] forcedeth: Separate vendor specific initializations into functions Joe Perches
2010-11-29 17:42 ` [PATCH 09/11] forcedeth: Convert dev_printk(<level> to dev_<level>( Joe Perches
2010-11-29 17:42 ` [PATCH 10/11] forcedeth: Remove netdev_dbg uses Joe Perches
2010-11-29 17:42 ` [PATCH 11/11] forcedeth: Use netdev_dbg for printk(KERN_DEBUG Joe Perches
2010-11-29 19:51 ` [PATCH 00/11] forcedeth: Convert to use netdev_<level> and neatening David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b70e8ee9beb0642a1a68d9f84e166dcfdfb14c8.1291051316.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=bhutchings@solarflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirqus@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=szymon@janc.net.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®