mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: make eth_register_ethaddr work on registered network devices
@ 2015-07-28  6:01 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2015-07-28  6:01 UTC (permalink / raw)
  To: Barebox List

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

Signed-off-by: Sascha Hauer <s.hauer@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-28  6:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28  6:01 [PATCH] net: make eth_register_ethaddr work on registered network devices Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox