summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDanny Kukawka <danny.kukawka@bisect.de>2012-02-24 03:45:54 +0000
committerDavid S. Miller <davem@davemloft.net>2012-02-24 15:40:59 -0500
commit66dc92eddf610d6f4572367f42902e62e19db7cb (patch)
tree5d56d48daea804b8d8099b913118c4f096b8c255 /drivers
parentf27fd49962dc0f608e5547fc7ae98a8243570610 (diff)
downloadlwn-66dc92eddf610d6f4572367f42902e62e19db7cb.tar.gz
lwn-66dc92eddf610d6f4572367f42902e62e19db7cb.zip
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: Danny Kukawka <danny.kukawka@bisect.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/cirrus/mac89x0.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c
index 83781f316d1f..419825ceab3b 100644
--- a/drivers/net/ethernet/cirrus/mac89x0.c
+++ b/drivers/net/ethernet/cirrus/mac89x0.c
@@ -592,10 +592,14 @@ static void set_multicast_list(struct net_device *dev)
static int set_mac_address(struct net_device *dev, void *addr)
{
int i;
- printk("%s: Setting MAC address to ", dev->name);
- for (i = 0; i < 6; i++)
- printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]);
- printk(".\n");
+ struct sockaddr *saddr = addr;
+
+ if (!is_valid_ether_addr(addr->sa_data))
+ 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 */
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));