aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/atm
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2013-09-03 08:13:43 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-04 14:41:55 -0400
commit8390f81482e3bbf756dce3a5121f164140fd0412 (patch)
tree52919d1889dd3a9ba9a495e04bbed40a35cd082f /drivers/atm
parent0cf915809ce775cba3f08de5df1fb89bdbd95a28 (diff)
atm: nicstar: re-use native mac_pton() helper
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm')
-rw-r--r--drivers/atm/nicstar.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 6587dc295eb0..409502a78e7e 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);
153static void which_list(ns_dev * card, struct sk_buff *skb); 153static void which_list(ns_dev * card, struct sk_buff *skb);
154#endif 154#endif
155static void ns_poll(unsigned long arg); 155static void ns_poll(unsigned long arg);
156static int ns_parse_mac(char *mac, unsigned char *esi);
157static void ns_phy_put(struct atm_dev *dev, unsigned char value, 156static void ns_phy_put(struct atm_dev *dev, unsigned char value,
158 unsigned long addr); 157 unsigned long addr);
159static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr); 158static 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)
779 return error; 778 return error;
780 } 779 }
781 780
782 if (ns_parse_mac(mac[i], card->atmdev->esi)) { 781 if (mac[i] == NULL || mac_pton(mac[i], card->atmdev->esi)) {
783 nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET, 782 nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET,
784 card->atmdev->esi, 6); 783 card->atmdev->esi, 6);
785 if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) == 784 if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) ==
@@ -2802,29 +2801,6 @@ static void ns_poll(unsigned long arg)
2802 PRINTK("nicstar: Leaving ns_poll().\n"); 2801 PRINTK("nicstar: Leaving ns_poll().\n");
2803} 2802}
2804 2803
2805static int ns_parse_mac(char *mac, unsigned char *esi)
2806{
2807 int i, j;
2808 short byte1, byte0;
2809
2810 if (mac == NULL || esi == NULL)
2811 return -1;
2812 j = 0;
2813 for (i = 0; i < 6; i++) {
2814 if ((byte1 = hex_to_bin(mac[j++])) < 0)
2815 return -1;
2816 if ((byte0 = hex_to_bin(mac[j++])) < 0)
2817 return -1;
2818 esi[i] = (unsigned char)(byte1 * 16 + byte0);
2819 if (i < 5) {
2820 if (mac[j++] != ':')
2821 return -1;
2822 }
2823 }
2824 return 0;
2825}
2826
2827
2828static void ns_phy_put(struct atm_dev *dev, unsigned char value, 2804static void ns_phy_put(struct atm_dev *dev, unsigned char value,
2829 unsigned long addr) 2805 unsigned long addr)
2830{ 2806{