]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ethernet: mtk_eth_soc: handle probe deferral
authorDaniel Golle <daniel@makrotopia.org>
Thu, 13 Jul 2023 02:42:29 +0000 (03:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2023 06:47:00 +0000 (08:47 +0200)
commit5ed16ecae5bfb367b731c2205684742570e6f806
tree5a01f1662f1c95e1afe51fb1cdecc504b2b87adf
parent39479093a47218e328244af328d382b628799b7a
net: ethernet: mtk_eth_soc: handle probe deferral

[ Upstream commit 1d6d537dc55d1f42d16290f00157ac387985b95b ]

Move the call to of_get_ethdev_address to mtk_add_mac which is part of
the probe function and can hence itself return -EPROBE_DEFER should
of_get_ethdev_address return -EPROBE_DEFER. This allows us to entirely
get rid of the mtk_init function.

The problem of of_get_ethdev_address returning -EPROBE_DEFER surfaced
in situations in which the NVMEM provider holding the MAC address has
not yet be loaded at the time mtk_eth_soc is initially probed. In this
case probing of mtk_eth_soc should be deferred instead of falling back
to use a random MAC address, so once the NVMEM provider becomes
available probing can be repeated.

Fixes: 656e705243fd ("net-next: mediatek: add support for MT7623 ethernet")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mediatek/mtk_eth_soc.c