diff options
Diffstat (limited to 'target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch')
-rw-r--r-- | target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch b/target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch index cabfba8b96..377f16e7c9 100644 --- a/target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch +++ b/target/linux/generic/pending-5.4/683-of_net-add-mac-address-to-of-tree.patch @@ -1,19 +1,16 @@ --- a/drivers/of/of_net.c +++ b/drivers/of/of_net.c -@@ -126,6 +126,33 @@ static void *of_get_mac_address_mtd(stru - return NULL; +@@ -132,6 +132,30 @@ static void *of_get_mac_address_mtd(stru + return -EINVAL; } +static int of_add_mac_address(struct device_node *np, u8* addr) +{ + struct property *prop; -+ u8 *np_addr; + -+ np_addr = of_get_mac_addr(np, "mac-address"); -+ if (np_addr) { -+ memcpy(np_addr, addr, ETH_ALEN); -+ return 0; -+ } ++ prop = of_find_property(np, "mac-address", NULL); ++ if (prop) ++ kfree(prop); + + prop = kzalloc(sizeof(*prop), GFP_KERNEL); + if (!prop) @@ -34,11 +31,11 @@ /** * Search the device tree for the best MAC address to use. 'mac-address' is -@@ -199,6 +226,7 @@ found: +@@ -205,6 +232,7 @@ found: if (!of_property_read_u32(np, "mac-address-increment", &mac_inc)) addr[inc_idx] += mac_inc; + of_add_mac_address(np, addr); - return addr; + return ret; } EXPORT_SYMBOL(of_get_mac_address); |