Skip to contentSkip to conversation

wireless: ath6kl: re-use native helper to parse MAC

PATCH Applied Andy Shevchenko 2 participants 4 messages Apr 25, 2013 – Jun 1, 2013 Atheros ATH6KL wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wireless: ath6kl: re-use native helper to parse MAC

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

---
 drivers/net/wireless/ath/ath6kl/debug.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/wireless/ath/ath6kl/debug.c +1 -7
index fe38b83..dbfd17d 100644
@@ -1240,20 +1240,14 @@ static ssize_t ath6kl_force_roam_write(struct file *file,
 	char buf[20];
 	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)
Signature · 1 line
1.8.2.rc0.22.gb3600c3
#1 lore raw
Quoted 23 lines · Andy Shevchenko

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

---
 drivers/net/wireless/ath/ath6kl/debug.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/wireless/ath/ath6kl/debug.c +0 -2
index fe38b83..dbfd17d 100644
@@ -1240,20 +1240,14 @@ static ssize_t ath6kl_force_roam_write(struct file *file,
 	char buf[20];
 	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';
 

drivers/net/wireless/ath/ath6kl/debug.c static ssize_t ath6kl_force_roam_write(struct file *file, · line 1253

Quoted 10 lines
drivers/net/wireless/ath/ath6kl/debug.c +1 -5
-	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)

John, do you have any comment on this one?

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#2 lore raw
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

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

[...]

Quoted 2 lines

John, do you have any comment on this one?

ath6kl patches go through my tree. Sorry for not being able to look at your patch yet as I have been very busy with something else, will do that soon.

Signature · 1 line
Kalle Valo