diff options
author | Florian Fainelli <florian@openwrt.org> | 2009-11-28 08:57:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-30 02:50:32 -0500 |
commit | 3c91c7ae84966f992429e1e128c4936f22b89064 (patch) | |
tree | c13ec087971bd55235e1dfff1ae009d63d76db46 /drivers/net/arm/ep93xx_eth.c | |
parent | d5ccd67bb77ced5249067d05171992a7d5020393 (diff) |
ep93xx-eth: check for zero MAC address on probe, not on device open
If we happen to have registered the driver without passing
a MAC address, we will print a zero MAC address and register
the interface with this invalid address, this is confusin. This
patch moves the checking of a valid ethernet address and the
generation of a random one down from the open function to
the probe function.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/arm/ep93xx_eth.c')
-rw-r--r-- | drivers/net/arm/ep93xx_eth.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index 2be49c817995..b25467ac895c 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
@@ -628,15 +628,6 @@ static int ep93xx_open(struct net_device *dev) | |||
628 | if (ep93xx_alloc_buffers(ep)) | 628 | if (ep93xx_alloc_buffers(ep)) |
629 | return -ENOMEM; | 629 | return -ENOMEM; |
630 | 630 | ||
631 | if (is_zero_ether_addr(dev->dev_addr)) { | ||
632 | random_ether_addr(dev->dev_addr); | ||
633 | printk(KERN_INFO "%s: generated random MAC address " | ||
634 | "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", dev->name, | ||
635 | dev->dev_addr[0], dev->dev_addr[1], | ||
636 | dev->dev_addr[2], dev->dev_addr[3], | ||
637 | dev->dev_addr[4], dev->dev_addr[5]); | ||
638 | } | ||
639 | |||
640 | napi_enable(&ep->napi); | 631 | napi_enable(&ep->napi); |
641 | 632 | ||
642 | if (ep93xx_start_hw(dev)) { | 633 | if (ep93xx_start_hw(dev)) { |
@@ -877,6 +868,9 @@ static int ep93xx_eth_probe(struct platform_device *pdev) | |||
877 | ep->mii.mdio_write = ep93xx_mdio_write; | 868 | ep->mii.mdio_write = ep93xx_mdio_write; |
878 | ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ | 869 | ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ |
879 | 870 | ||
871 | if (is_zero_ether_addr(dev->dev_addr)) | ||
872 | random_ether_addr(dev->dev_addr); | ||
873 | |||
880 | err = register_netdev(dev); | 874 | err = register_netdev(dev); |
881 | if (err) { | 875 | if (err) { |
882 | dev_err(&pdev->dev, "Failed to register netdev\n"); | 876 | dev_err(&pdev->dev, "Failed to register netdev\n"); |