public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pch_phub: re-use native MAC address parser
@ 2013-04-23 13:31 Andy Shevchenko
  2013-05-28  8:49 ` Andy Shevchenko
  2013-05-28 15:15 ` Arnd Bergmann
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2013-04-23 13:31 UTC (permalink / raw)
  To: linux-kernel, Arnd Bergmann; +Cc: Andy Shevchenko

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;
-- 
1.8.2.rc0.22.gb3600c3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pch_phub: re-use native MAC address parser
  2013-04-23 13:31 [PATCH] pch_phub: re-use native MAC address parser Andy Shevchenko
@ 2013-05-28  8:49 ` Andy Shevchenko
  2013-05-28 15:15 ` Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2013-05-28  8:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Arnd Bergmann, Greg Kroah-Hartman

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pch_phub: re-use native MAC address parser
  2013-04-23 13:31 [PATCH] pch_phub: re-use native MAC address parser Andy Shevchenko
  2013-05-28  8:49 ` Andy Shevchenko
@ 2013-05-28 15:15 ` Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2013-05-28 15:15 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel

On Tuesday 23 April 2013, Andy Shevchenko wrote:
> We have mac_pton() helper to parse MAC addresses.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>

Note that Greg is the one that picks up patches for drivers/misc
in general. If you want him to apply the patch, sent it again
with him on Cc and my Ack added.

	Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-28 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23 13:31 [PATCH] pch_phub: re-use native MAC address parser Andy Shevchenko
2013-05-28  8:49 ` Andy Shevchenko
2013-05-28 15:15 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox