From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: [PATCH v2] ep93xx-eth: check for zero MAC address on probe, not on device open Date: Sun, 29 Nov 2009 00:57:00 +0100 Message-ID: <200911290057.02109.florian@openwrt.org> Reply-To: Florian Fainelli Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: David Miller , buytenh@wantstofly.org To: netdev@vger.kernel.org Return-path: Received: from mail-ew0-f215.google.com ([209.85.219.215]:52573 "EHLO mail-ew0-f215.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753101AbZK1X47 (ORCPT ); Sat, 28 Nov 2009 18:56:59 -0500 Received: by ewy7 with SMTP id 7so3083459ewy.28 for ; Sat, 28 Nov 2009 15:57:04 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: 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 --- diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index 2be49c8..87601ca 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) if (ep93xx_alloc_buffers(ep)) return -ENOMEM; - if (is_zero_ether_addr(dev->dev_addr)) { - random_ether_addr(dev->dev_addr); - printk(KERN_INFO "%s: generated random MAC address " - "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", dev->name, - dev->dev_addr[0], dev->dev_addr[1], - dev->dev_addr[2], dev->dev_addr[3], - dev->dev_addr[4], dev->dev_addr[5]); - } - napi_enable(&ep->napi); if (ep93xx_start_hw(dev)) { @@ -876,6 +867,9 @@ static int ep93xx_eth_probe(struct platform_device *pdev) ep->mii.mdio_read = ep93xx_mdio_read; ep->mii.mdio_write = ep93xx_mdio_write; ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ + + if (is_zero_ether_addr(dev->dev_addr)) + random_ether_addr(dev->dev_addr); err = register_netdev(dev); if (err) {