All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	netdev@vger.kernel.org,
	Kweh Hock Leong <hock.leong.kweh@intel.com>,
	"David S . Miller" <davem@davemloft.net>,
	Vince Bridgers <vbridgers2013@gmail.com>
Subject: Re: [PATCH] stmmac: remove custom implementation of print_hex_dump()
Date: Mon, 03 Nov 2014 09:39:15 -0800	[thread overview]
Message-ID: <1415036355.17743.22.camel@perches.com> (raw)
In-Reply-To: <1415035734-24163-2-git-send-email-andriy.shevchenko@linux.intel.com>

On Mon, 2014-11-03 at 19:28 +0200, Andy Shevchenko wrote:
> There is a kernel helper to dump buffers in a hexdecimal format. This patch
> substitutes the open coded function by calling that helper.
[]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
[]
> @@ -191,14 +191,8 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>  
>  static void print_pkt(unsigned char *buf, int len)
>  {
> -	int j;
> -	pr_debug("len = %d byte, buf addr: 0x%p", len, buf);
> -	for (j = 0; j < len; j++) {
> -		if ((j % 16) == 0)
> -			pr_debug("\n %03x:", j);
> -		pr_debug(" %02x", buf[j]);
> -	}
> -	pr_debug("\n");
> +	pr_debug("len = %d byte, buf addr: 0x%p\n", len, buf);
> +	print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET, 16, 1, buf, len, 0);

Prefix should be ""
Please use true/false for the last argument

Another (better?) option would be to use:

	print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);

so that it can be dynamically controlled like
the pr_debug statements.

  reply	other threads:[~2014-11-03 17:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03 17:28 [PATCH] stmmac: fix sparse warnings Andy Shevchenko
2014-11-03 17:28 ` [PATCH] stmmac: remove custom implementation of print_hex_dump() Andy Shevchenko
2014-11-03 17:39   ` Joe Perches [this message]
2014-11-03 17:53     ` Andy Shevchenko
2014-11-03 18:11       ` Joe Perches
2014-11-04 16:35 ` [PATCH] stmmac: fix sparse warnings Giuseppe CAVALLARO
2014-11-04 21:59   ` David Miller
2014-11-05  9:03   ` Andy Shevchenko
2014-11-05  9:27     ` Giuseppe CAVALLARO

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=1415036355.17743.22.camel@perches.com \
    --to=joe@perches.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=hock.leong.kweh@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=vbridgers2013@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.