diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-11-24 14:15:55 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2022-11-29 12:45:54 +0300 |
commit | a48acad789ff33d90e079311ed0323e5e5fc5cbd (patch) | |
tree | 458c4fc015e29e0ae33cd5a06c57c2ff547360f7 | |
parent | 4c47867bc789bdc722f3bb760355c2c246fbe9af (diff) | |
download | linux-a48acad789ff33d90e079311ed0323e5e5fc5cbd.tar.xz |
net: marvell: prestera: Avoid unnecessary DT lookups
This driver fist makes an expensive DT lookup to retrieve its DT node
(this is a PCI driver) in order to later search for the
base-mac-provider property. This property has no reality upstream and
this code should not have been accepted like this in the first
place. Instead, there is a proper nvmem interface that should be
used. Let's avoid these extra lookups and rely on the nvmem internal
logic.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r-- | drivers/net/ethernet/marvell/prestera/prestera_main.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index f8deaee84398..8343f203ff23 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -858,17 +858,10 @@ static void prestera_event_handlers_unregister(struct prestera_switch *sw) static int prestera_switch_set_base_mac_addr(struct prestera_switch *sw) { - struct device_node *base_mac_np; - int ret = 0; - - if (sw->np) { - base_mac_np = of_parse_phandle(sw->np, "base-mac-provider", 0); - if (base_mac_np) { - ret = of_get_mac_address(base_mac_np, sw->base_mac); - of_node_put(base_mac_np); - } - } + int ret; + if (sw->np) + ret = of_get_mac_address(sw->np, sw->base_mac); if (!is_valid_ether_addr(sw->base_mac) || ret) { eth_random_addr(sw->base_mac); dev_info(prestera_dev(sw), "using random base mac address\n"); @@ -1372,7 +1365,7 @@ static int prestera_switch_init(struct prestera_switch *sw) { int err; - sw->np = of_find_compatible_node(NULL, NULL, "marvell,prestera"); + sw->np = sw->dev->dev->of_node; err = prestera_hw_switch_init(sw); if (err) { |