[PATCH] net: make eth_register_ethaddr work on registered network devices

Sascha Hauer s.hauer at pengutronix.de
Mon Jul 27 23:01:09 PDT 2015


When eth_register_ethaddr is called after the device has been registered
it should work aswell.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 net/eth.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/eth.c b/net/eth.c
index a090961..c381ebd 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -100,9 +100,17 @@ static void eth_drop_ethaddr(int ethid)
 void eth_register_ethaddr(int ethid, const char *ethaddr)
 {
 	struct eth_ethaddr *addr;
+	struct eth_device *edev;
 
 	eth_drop_ethaddr(ethid);
 
+	list_for_each_entry(edev, &netdev_list, list) {
+		if (edev->dev.id == ethid) {
+			register_preset_mac_address(edev, ethaddr);
+			return;
+		}
+	}
+
 	addr = xzalloc(sizeof(*addr));
 	addr->ethid = ethid;
 	memcpy(addr->ethaddr, ethaddr, 6);
-- 
2.1.4




More information about the barebox mailing list