summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorStefan Riedmueller <s.riedmueller@phytec.de>2021-03-29 15:10:48 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-03-30 07:38:16 +0200
commit5e7499310e334eae50ab72bdd858f58598113903 (patch)
tree6e70840216e01dcc94b77e83e14a93e93b5836fd /net
parent1b09e7a392f342dc4999f1e9574e07449646b058 (diff)
downloadbarebox-5e7499310e334eae50ab72bdd858f58598113903.tar.gz
net: eth: of_fixup_node: Use reproducible node name for fixup
To be able to fixup older devicetrees, prior to v4.15 where leading zeros of the unit addresses were removed, use the reproducible name to find the corresponding nodes. Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r--net/eth.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/eth.c b/net/eth.c
index 626b35d5cc..84f99d3aa8 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -304,7 +304,8 @@ static void eth_of_fixup_node(struct device_node *root,
const char *node_path, int ethid,
const u8 ethaddr[ETH_ALEN])
{
- struct device_node *node;
+ struct device_node *bb_node, *fixup_node;
+ char *name;
int ret;
if (!is_valid_ether_addr(ethaddr)) {
@@ -314,22 +315,25 @@ static void eth_of_fixup_node(struct device_node *root,
}
if (node_path) {
- node = of_find_node_by_path_from(root, node_path);
+ bb_node = of_find_node_by_path_from(0, node_path);
+ name = of_get_reproducible_name(bb_node);
+ fixup_node = of_find_node_by_reproducible_name(root, name);
+ free(name);
} else {
char eth[12];
sprintf(eth, "ethernet%d", ethid);
- node = of_find_node_by_alias(root, eth);
+ fixup_node = of_find_node_by_alias(root, eth);
}
- if (!node) {
+ if (!fixup_node) {
pr_debug("%s: no node to fixup\n", __func__);
return;
}
- ret = of_set_property(node, "mac-address", ethaddr, ETH_ALEN, 1);
+ ret = of_set_property(fixup_node, "mac-address", ethaddr, ETH_ALEN, 1);
if (ret)
pr_err("Setting mac-address property of %s failed with: %s\n",
- node->full_name, strerror(-ret));
+ fixup_node->full_name, strerror(-ret));
}
static int eth_of_fixup(struct device_node *root, void *unused)