public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] pch_phub: re-use native MAC address parser
Date: Tue, 28 May 2013 11:49:02 +0300	[thread overview]
Message-ID: <1369730942.29283.223.camel@smile> (raw)
In-Reply-To: <1366723890-23838-1-git-send-email-andriy.shevchenko@linux.intel.com>

On Tue, 2013-04-23 at 16:31 +0300, Andy Shevchenko wrote: 
> We have mac_pton() helper to parse MAC addresses.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/misc/pch_phub.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
> index 931e635..8b4d4fb 100644
> --- a/drivers/misc/pch_phub.c
> +++ b/drivers/misc/pch_phub.c
> @@ -633,17 +633,13 @@ static ssize_t show_pch_mac(struct device *dev, struct device_attribute *attr,
>  static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr,
>  			     const char *buf, size_t count)
>  {
> -	u8 mac[6];
> +	u8 mac[ETH_ALEN];
>  	ssize_t rom_size;
>  	struct pch_phub_reg *chip = dev_get_drvdata(dev);
>  
> -	if (count != 18)
> +	if (!mac_pton(buf, mac))
>  		return -EINVAL;
>  
> -	sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
> -		(u32 *)&mac[0], (u32 *)&mac[1], (u32 *)&mac[2], (u32 *)&mac[3],
> -		(u32 *)&mac[4], (u32 *)&mac[5]);
> -
>  	chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size);
>  	if (!chip->pch_phub_extrom_base_address)
>  		return -ENOMEM;

Arnd, do you have any comment on this one?

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2013-05-28  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 13:31 [PATCH] pch_phub: re-use native MAC address parser Andy Shevchenko
2013-05-28  8:49 ` Andy Shevchenko [this message]
2013-05-28 15:15 ` Arnd Bergmann

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=1369730942.29283.223.camel@smile \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@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