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>
This commit is contained in:
parent
4c47867bc7
commit
a48acad789
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user