[<prev] [next>] [day] [month] [year] [list]
Message-Id: <200806092333.m59NXvwH014708@imap1.linux-foundation.org>
Date: Mon, 09 Jun 2008 16:33:57 -0700
From: akpm@...ux-foundation.org
To: jeff@...zik.org
Cc: netdev@...r.kernel.org, akpm@...ux-foundation.org,
svens@...ckframe.org, hskinnemoen@...el.com
Subject: [patch 13/13] macb: use random mac if stored address in EEPROM is invalid
From: Sven Schnelle <svens@...ckframe.org>
We should use a random mac address if the EEPROM doesn't contain a valid
one. This makes life on Boards with unprogrammed EEPROM devices easier.
Signed-off-by: Sven Schnelle <svens@...ckframe.org>
Cc: Haavard Skinnemoen <hskinnemoen@...el.com>
Cc: Jeff Garzik <jeff@...zik.org>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---
drivers/net/macb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff -puN drivers/net/macb.c~macb-use-random-mac-if-stored-address-in-eeprom-is-invalid drivers/net/macb.c
--- a/drivers/net/macb.c~macb-use-random-mac-if-stored-address-in-eeprom-is-invalid
+++ a/drivers/net/macb.c
@@ -80,8 +80,12 @@ static void __init macb_get_hwaddr(struc
addr[4] = top & 0xff;
addr[5] = (top >> 8) & 0xff;
- if (is_valid_ether_addr(addr))
+ if (is_valid_ether_addr(addr)) {
memcpy(bp->dev->dev_addr, addr, sizeof(addr));
+ } else {
+ dev_info(&bp->pdev->dev, "invalid hw address, using random\n");
+ random_ether_addr(bp->dev->dev_addr);
+ }
}
static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
_
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists