netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	intel-wired-lan@lists.osuosl.org,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v1] ice: devlink: use %*phD to print small buffer
Date: Thu, 30 Jul 2020 14:20:46 -0700	[thread overview]
Message-ID: <77247fbc-152a-517f-2500-ce761b7afa6a@intel.com> (raw)
In-Reply-To: <20200730160451.40810-1-andriy.shevchenko@linux.intel.com>



On 7/30/2020 9:04 AM, Andy Shevchenko wrote:
> Use %*phD format to print small buffer as hex string.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Ah nice. I swear I looked for a printk format to do this and didn't find
one. But it's been there since 2012.. so I guess I just missed it.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

I also tested this on my system to make sure it gives the same output
for the serial value, so I guess also:

Tested-by: Jacob Keller <jacob.e.keller@intel.com>

Thanks!

> ---
>  drivers/net/ethernet/intel/ice/ice_devlink.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
> index dbbd8b6f9d1a..a9105ad5b983 100644
> --- a/drivers/net/ethernet/intel/ice/ice_devlink.c
> +++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
> @@ -13,9 +13,7 @@ static int ice_info_get_dsn(struct ice_pf *pf, char *buf, size_t len)
>  	/* Copy the DSN into an array in Big Endian format */
>  	put_unaligned_be64(pci_get_dsn(pf->pdev), dsn);
>  
> -	snprintf(buf, len, "%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x",
> -		 dsn[0], dsn[1], dsn[2], dsn[3],
> -		 dsn[4], dsn[5], dsn[6], dsn[7]);
> +	snprintf(buf, len, "%8phD", dsn);
>  
>  	return 0;
>  }
> 

  reply	other threads:[~2020-07-30 21:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 16:04 [PATCH v1] ice: devlink: use %*phD to print small buffer Andy Shevchenko
2020-07-30 21:20 ` Jacob Keller [this message]
2020-07-31  7:49   ` Andy Shevchenko
2020-07-31 23:49 ` David Miller
2020-08-01  0:07   ` [Intel-wired-lan] " Nguyen, Anthony L

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=77247fbc-152a-517f-2500-ce761b7afa6a@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).