2022-08-03 13:56:28 +00:00
|
|
|
From dd07dd394d8bfdb5d527fab18ca54f20815ec4e4 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Will Moss <willormos@gmail.com>
|
|
|
|
Date: Wed, 3 Aug 2022 13:48:55 +0000
|
|
|
|
Subject: [PATCH] of_net: do mac-address-increment only once
|
|
|
|
|
|
|
|
Remove mac-address-increment and mac-address-increment-byte
|
|
|
|
DT property after incrementing process to make sure MAC address
|
|
|
|
would not get incremented more if this function is stared again.
|
|
|
|
It could happen if device initialization is deferred after
|
|
|
|
unsuccessful attempt.
|
|
|
|
|
|
|
|
Signed-off-by: Will Moss <willormos@gmail.com>
|
|
|
|
---
|
|
|
|
drivers/of/of_net.c | 6 ++++++
|
|
|
|
1 file changed, 6 insertions(+)
|
|
|
|
|
|
|
|
--- a/net/core/of_net.c
|
|
|
|
+++ b/net/core/of_net.c
|
2023-11-15 08:04:47 +00:00
|
|
|
@@ -184,6 +184,11 @@ found:
|
2022-08-03 13:56:28 +00:00
|
|
|
addr[3] = (mac_val >> 16) & 0xff;
|
|
|
|
addr[4] = (mac_val >> 8) & 0xff;
|
|
|
|
addr[5] = (mac_val >> 0) & 0xff;
|
|
|
|
+
|
2023-11-15 08:04:47 +00:00
|
|
|
+ /* Remove mac-address-increment DT property to make sure MAC
|
|
|
|
+ * address would not get incremented more if this function is
|
|
|
|
+ * stared again. */
|
2022-08-03 13:56:28 +00:00
|
|
|
+ of_remove_property(np, of_find_property(np, "mac-address-increment", NULL));
|
|
|
|
}
|
|
|
|
|
|
|
|
of_add_mac_address(np, addr);
|