netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] atm: nicstar: re-use native mac_pton() helper
@ 2013-09-03 12:13 Andy Shevchenko
  2013-09-03 12:13 ` [PATCH v2 2/2] atm: he: print MAC via %pM Andy Shevchenko
  2013-09-04 18:42 ` [PATCH v2 1/2] atm: nicstar: re-use native mac_pton() helper David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Andy Shevchenko @ 2013-09-03 12:13 UTC (permalink / raw)
  To: Chas Williams, linux-atm-general, inux Net Dev, David S . Miller
  Cc: Andy Shevchenko

From: Andy Shevchenko <andy.shevchenko@gmail.com>

There is a nice helper to parse MAC. Let's use it and remove custom
implementation.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/atm/nicstar.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 6587dc2..409502a 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -153,7 +153,6 @@ static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user * arg);
 static void which_list(ns_dev * card, struct sk_buff *skb);
 #endif
 static void ns_poll(unsigned long arg);
-static int ns_parse_mac(char *mac, unsigned char *esi);
 static void ns_phy_put(struct atm_dev *dev, unsigned char value,
 		       unsigned long addr);
 static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr);
@@ -779,7 +778,7 @@ static int ns_init_card(int i, struct pci_dev *pcidev)
 		return error;
 	}
 
-	if (ns_parse_mac(mac[i], card->atmdev->esi)) {
+	if (mac[i] == NULL || mac_pton(mac[i], card->atmdev->esi)) {
 		nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET,
 				   card->atmdev->esi, 6);
 		if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) ==
@@ -2802,29 +2801,6 @@ static void ns_poll(unsigned long arg)
 	PRINTK("nicstar: Leaving ns_poll().\n");
 }
 
-static int ns_parse_mac(char *mac, unsigned char *esi)
-{
-	int i, j;
-	short byte1, byte0;
-
-	if (mac == NULL || esi == NULL)
-		return -1;
-	j = 0;
-	for (i = 0; i < 6; i++) {
-		if ((byte1 = hex_to_bin(mac[j++])) < 0)
-			return -1;
-		if ((byte0 = hex_to_bin(mac[j++])) < 0)
-			return -1;
-		esi[i] = (unsigned char)(byte1 * 16 + byte0);
-		if (i < 5) {
-			if (mac[j++] != ':')
-				return -1;
-		}
-	}
-	return 0;
-}
-
-
 static void ns_phy_put(struct atm_dev *dev, unsigned char value,
 		       unsigned long addr)
 {
-- 
1.8.4.rc3

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

* [PATCH v2 2/2] atm: he: print MAC via %pM
  2013-09-03 12:13 [PATCH v2 1/2] atm: nicstar: re-use native mac_pton() helper Andy Shevchenko
@ 2013-09-03 12:13 ` Andy Shevchenko
  2013-09-03 12:17   ` [PATCH v2.1] " Andy Shevchenko
                     ` (2 more replies)
  2013-09-04 18:42 ` [PATCH v2 1/2] atm: nicstar: re-use native mac_pton() helper David Miller
  1 sibling, 3 replies; 7+ messages in thread
From: Andy Shevchenko @ 2013-09-03 12:13 UTC (permalink / raw)
  To: Chas Williams, linux-atm-general, inux Net Dev, David S . Miller
  Cc: Andy Shevchenko

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/atm/he.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 80f9743..c232dd3 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1088,15 +1088,8 @@ static int he_start(struct atm_dev *dev)
 	for (i = 0; i < 6; ++i)
 		dev->esi[i] = read_prom_byte(he_dev, MAC_ADDR + i);
 
-	hprintk("%s%s, %x:%x:%x:%x:%x:%x\n",
-				he_dev->prod_id,
-					he_dev->media & 0x40 ? "SM" : "MM",
-						dev->esi[0],
-						dev->esi[1],
-						dev->esi[2],
-						dev->esi[3],
-						dev->esi[4],
-						dev->esi[5]);
+	hprintk("%s%s, %*pM\n", he_dev->prod_id,
+		he_dev->media & 0x40 ? "SM" : "MM", dev->esi);
 	he_dev->atm_dev->link_rate = he_is622(he_dev) ?
 						ATM_OC12_PCR : ATM_OC3_PCR;
 
-- 
1.8.4.rc3

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

* [PATCH v2.1] atm: he: print MAC via %pM
  2013-09-03 12:13 ` [PATCH v2 2/2] atm: he: print MAC via %pM Andy Shevchenko
@ 2013-09-03 12:17   ` Andy Shevchenko
  2013-09-03 12:20   ` [PATCH v2 2/2] " Joe Perches
  2013-09-04 18:42   ` David Miller
  2 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2013-09-03 12:17 UTC (permalink / raw)
  To: Chas Williams, linux-atm-general, netdev, David S . Miller
  Cc: Andy Shevchenko

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/atm/he.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 80f9743..8557adc 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1088,15 +1088,8 @@ static int he_start(struct atm_dev *dev)
 	for (i = 0; i < 6; ++i)
 		dev->esi[i] = read_prom_byte(he_dev, MAC_ADDR + i);
 
-	hprintk("%s%s, %x:%x:%x:%x:%x:%x\n",
-				he_dev->prod_id,
-					he_dev->media & 0x40 ? "SM" : "MM",
-						dev->esi[0],
-						dev->esi[1],
-						dev->esi[2],
-						dev->esi[3],
-						dev->esi[4],
-						dev->esi[5]);
+	hprintk("%s%s, %pM\n", he_dev->prod_id,
+		he_dev->media & 0x40 ? "SM" : "MM", dev->esi);
 	he_dev->atm_dev->link_rate = he_is622(he_dev) ?
 						ATM_OC12_PCR : ATM_OC3_PCR;
 
-- 
1.8.4.rc3

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

* Re: [PATCH v2 2/2] atm: he: print MAC via %pM
  2013-09-03 12:13 ` [PATCH v2 2/2] atm: he: print MAC via %pM Andy Shevchenko
  2013-09-03 12:17   ` [PATCH v2.1] " Andy Shevchenko
@ 2013-09-03 12:20   ` Joe Perches
  2013-09-03 12:25     ` Andy Shevchenko
  2013-09-04 18:42   ` David Miller
  2 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2013-09-03 12:20 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Chas Williams, linux-atm-general, inux Net Dev, David S . Miller

On Tue, 2013-09-03 at 15:13 +0300, Andy Shevchenko wrote:
[]
> diff --git a/drivers/atm/he.c b/drivers/atm/he.c
[]
> @@ -1088,15 +1088,8 @@ static int he_start(struct atm_dev *dev)
>  	for (i = 0; i < 6; ++i)
>  		dev->esi[i] = read_prom_byte(he_dev, MAC_ADDR + i);
>  
> -	hprintk("%s%s, %x:%x:%x:%x:%x:%x\n",
> -				he_dev->prod_id,
> -					he_dev->media & 0x40 ? "SM" : "MM",
> -						dev->esi[0],
> -						dev->esi[1],
> -						dev->esi[2],
> -						dev->esi[3],
> -						dev->esi[4],
> -						dev->esi[5]);
> +	hprintk("%s%s, %*pM\n", he_dev->prod_id,
> +		he_dev->media & 0x40 ? "SM" : "MM", dev->esi);

%*pM?

Did this compile cleanly?

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

* Re: [PATCH v2 2/2] atm: he: print MAC via %pM
  2013-09-03 12:20   ` [PATCH v2 2/2] " Joe Perches
@ 2013-09-03 12:25     ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2013-09-03 12:25 UTC (permalink / raw)
  To: Joe Perches
  Cc: Chas Williams, linux-atm-general, inux Net Dev, David S . Miller

On Tue, 2013-09-03 at 05:20 -0700, Joe Perches wrote: 
> On Tue, 2013-09-03 at 15:13 +0300, Andy Shevchenko wrote:
> []
> > diff --git a/drivers/atm/he.c b/drivers/atm/he.c
> []
> > @@ -1088,15 +1088,8 @@ static int he_start(struct atm_dev *dev)
> >  	for (i = 0; i < 6; ++i)
> >  		dev->esi[i] = read_prom_byte(he_dev, MAC_ADDR + i);
> >  
> > -	hprintk("%s%s, %x:%x:%x:%x:%x:%x\n",
> > -				he_dev->prod_id,
> > -					he_dev->media & 0x40 ? "SM" : "MM",
> > -						dev->esi[0],
> > -						dev->esi[1],
> > -						dev->esi[2],
> > -						dev->esi[3],
> > -						dev->esi[4],
> > -						dev->esi[5]);
> > +	hprintk("%s%s, %*pM\n", he_dev->prod_id,
> > +		he_dev->media & 0x40 ? "SM" : "MM", dev->esi);
> 
> %*pM?
> 
> Did this compile cleanly?

See v2.1 of this patch, and sorry for this typo.

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

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

* Re: [PATCH v2 1/2] atm: nicstar: re-use native mac_pton() helper
  2013-09-03 12:13 [PATCH v2 1/2] atm: nicstar: re-use native mac_pton() helper Andy Shevchenko
  2013-09-03 12:13 ` [PATCH v2 2/2] atm: he: print MAC via %pM Andy Shevchenko
@ 2013-09-04 18:42 ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2013-09-04 18:42 UTC (permalink / raw)
  To: andriy.shevchenko; +Cc: chas, linux-atm-general, netdev, andy.shevchenko

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Tue,  3 Sep 2013 15:13:43 +0300

> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> There is a nice helper to parse MAC. Let's use it and remove custom
> implementation.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Applied.

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

* Re: [PATCH v2 2/2] atm: he: print MAC via %pM
  2013-09-03 12:13 ` [PATCH v2 2/2] atm: he: print MAC via %pM Andy Shevchenko
  2013-09-03 12:17   ` [PATCH v2.1] " Andy Shevchenko
  2013-09-03 12:20   ` [PATCH v2 2/2] " Joe Perches
@ 2013-09-04 18:42   ` David Miller
  2 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2013-09-04 18:42 UTC (permalink / raw)
  To: andriy.shevchenko; +Cc: chas, linux-atm-general, netdev

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: Tue,  3 Sep 2013 15:13:44 +0300

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied.

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

end of thread, other threads:[~2013-09-04 18:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-03 12:13 [PATCH v2 1/2] atm: nicstar: re-use native mac_pton() helper Andy Shevchenko
2013-09-03 12:13 ` [PATCH v2 2/2] atm: he: print MAC via %pM Andy Shevchenko
2013-09-03 12:17   ` [PATCH v2.1] " Andy Shevchenko
2013-09-03 12:20   ` [PATCH v2 2/2] " Joe Perches
2013-09-03 12:25     ` Andy Shevchenko
2013-09-04 18:42   ` David Miller
2013-09-04 18:42 ` [PATCH v2 1/2] atm: nicstar: re-use native mac_pton() helper David Miller

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