linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wireless: ath6kl: re-use native helper to parse MAC
@ 2013-04-23 13:32 Andy Shevchenko
  2013-04-23 14:25 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2013-04-23 13:32 UTC (permalink / raw)
  To: linux-wireless, Kalle Valo, John W. Linville; +Cc: Andy Shevchenko

There is native mac_pton() function which helps to parse MAC.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/net/wireless/ath/ath6kl/debug.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index fe38b83..9824cb0 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -1241,19 +1241,14 @@ static ssize_t ath6kl_force_roam_write(struct file *file,
 	size_t len;
 	u8 bssid[ETH_ALEN];
 	int i;
-	int addr[ETH_ALEN];
 
 	len = min(count, sizeof(buf) - 1);
 	if (copy_from_user(buf, user_buf, len))
 		return -EFAULT;
 	buf[len] = '\0';
 
-	if (sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
-		   &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
-	    != ETH_ALEN)
+	if (!mac_pton(buf, bssid))
 		return -EINVAL;
-	for (i = 0; i < ETH_ALEN; i++)
-		bssid[i] = addr[i];
 
 	ret = ath6kl_wmi_force_roam_cmd(ar->wmi, bssid);
 	if (ret)
-- 
1.8.2.rc0.22.gb3600c3


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

* Re: [PATCH] wireless: ath6kl: re-use native helper to parse MAC
  2013-04-23 13:32 [PATCH] wireless: ath6kl: re-use native helper to parse MAC Andy Shevchenko
@ 2013-04-23 14:25 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2013-04-23 14:25 UTC (permalink / raw)
  To: linux-wireless; +Cc: Kalle Valo, John W. Linville

On Tue, 2013-04-23 at 16:32 +0300, Andy Shevchenko wrote: 
> There is native mac_pton() function which helps to parse MAC.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/net/wireless/ath/ath6kl/debug.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
> index fe38b83..9824cb0 100644
> --- a/drivers/net/wireless/ath/ath6kl/debug.c
> +++ b/drivers/net/wireless/ath/ath6kl/debug.c
> @@ -1241,19 +1241,14 @@ static ssize_t ath6kl_force_roam_write(struct file *file,
>  	size_t len;
>  	u8 bssid[ETH_ALEN];
>  	int i;

It seems i shall be removed as well.

> -	int addr[ETH_ALEN];
>  
>  	len = min(count, sizeof(buf) - 1);
>  	if (copy_from_user(buf, user_buf, len))
>  		return -EFAULT;
>  	buf[len] = '\0';
>  
> -	if (sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
> -		   &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
> -	    != ETH_ALEN)
> +	if (!mac_pton(buf, bssid))
>  		return -EINVAL;
> -	for (i = 0; i < ETH_ALEN; i++)
> -		bssid[i] = addr[i];
>  
>  	ret = ath6kl_wmi_force_roam_cmd(ar->wmi, bssid);
>  	if (ret)

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

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

end of thread, other threads:[~2013-04-23 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-23 13:32 [PATCH] wireless: ath6kl: re-use native helper to parse MAC Andy Shevchenko
2013-04-23 14:25 ` Andy Shevchenko

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).