netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ep93xx-eth: check for zero MAC address on probe, not on device open
@ 2009-11-28 23:57 Florian Fainelli
  2009-11-29 12:11 ` Lennert Buytenhek
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2009-11-28 23:57 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, buytenh

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>
---
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) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ep93xx-eth: check for zero MAC address on probe, not on device open
  2009-11-28 23:57 [PATCH v2] ep93xx-eth: check for zero MAC address on probe, not on device open Florian Fainelli
@ 2009-11-29 12:11 ` Lennert Buytenhek
  2009-11-30  7:50   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Lennert Buytenhek @ 2009-11-29 12:11 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, David Miller

On Sun, Nov 29, 2009 at 12:57:00AM +0100, Florian Fainelli wrote:

> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ep93xx-eth: check for zero MAC address on probe, not on device open
  2009-11-29 12:11 ` Lennert Buytenhek
@ 2009-11-30  7:50   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-11-30  7:50 UTC (permalink / raw)
  To: buytenh; +Cc: florian, netdev

From: Lennert Buytenhek <buytenh@wantstofly.org>
Date: Sun, 29 Nov 2009 13:11:58 +0100

> On Sun, Nov 29, 2009 at 12:57:00AM +0100, Florian Fainelli wrote:
> 
>> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-30  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-28 23:57 [PATCH v2] ep93xx-eth: check for zero MAC address on probe, not on device open Florian Fainelli
2009-11-29 12:11 ` Lennert Buytenhek
2009-11-30  7:50   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).