From: Robert Marko Date: Wed, 19 Jun 2024 09:26:47 +0000 (+0200) Subject: ath79: ag71xx: support probe defferal for getting MAC address X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=150d0ceab7380538798df76a5d7d3c12a3632050;p=openwrt%2Fstaging%2Fnbd.git ath79: ag71xx: support probe defferal for getting MAC address Currently, of_get_ethdev_address() return is checked for any return error code which means that trying to get the MAC from NVMEM cells that is backed by MTD will fail if it was not probed before ag71xx. So, lets check the return error code for EPROBE_DEFER and defer the ag71xx probe in that case until the underlying NVMEM device is live. Link: https://github.com/openwrt/openwrt/pull/15752 Signed-off-by: Robert Marko --- diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 8f2a9c7723..f63e93f978 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -1668,7 +1668,11 @@ static int ag71xx_probe(struct platform_device *pdev) ag->stop_desc->ctrl = 0; ag->stop_desc->next = (u32) ag->stop_desc_dma; - if (of_get_ethdev_address(np, dev)) { + err = of_get_ethdev_address(np, dev); + if (err) { + if (err == -EPROBE_DEFER) + return err; + dev_err(&pdev->dev, "invalid MAC address, using random address\n"); eth_hw_addr_random(dev); }