Commit 66dc92ed authored by Danny Kukawka's avatar Danny Kukawka Committed by David S. Miller

cirrus/mac89x0: print MAC via printk format specifier

Print MAC/dev_addr via printk extended format specifier %pM instead
of custom code.

Use memcpy to set the address to dev->dev_addr in set_mac_address,
instead of mxing it up in a for loop with printing a debug msg.

Check also if the given address is valid.
Signed-off-by: default avatarDanny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f27fd499
...@@ -592,10 +592,14 @@ static void set_multicast_list(struct net_device *dev) ...@@ -592,10 +592,14 @@ static void set_multicast_list(struct net_device *dev)
static int set_mac_address(struct net_device *dev, void *addr) static int set_mac_address(struct net_device *dev, void *addr)
{ {
int i; int i;
printk("%s: Setting MAC address to ", dev->name); struct sockaddr *saddr = addr;
for (i = 0; i < 6; i++)
printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]); if (!is_valid_ether_addr(addr->sa_data))
printk(".\n"); return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
printk("%s: Setting MAC address to %pM\n", dev->name, dev->dev_addr);
/* set the Ethernet address */ /* set the Ethernet address */
for (i=0; i < ETH_ALEN/2; i++) for (i=0; i < ETH_ALEN/2; i++)
writereg(dev, PP_IA+i*2, dev->dev_addr[i*2] | (dev->dev_addr[i*2+1] << 8)); writereg(dev, PP_IA+i*2, dev->dev_addr[i*2] | (dev->dev_addr[i*2+1] << 8));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment