All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: bgmac-bcma: handle deferred probe error due to mac-address
@ 2021-09-18 17:26 Christian Lamparter
  2021-09-19  1:19 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Lamparter @ 2021-09-18 17:26 UTC (permalink / raw)
  To: netdev, bcm-kernel-feedback-list
  Cc: Jakub Kicinski, David S . Miller, Rafał Miłecki

Since the inclusion of nvmem into the helper function
of_get_mac_address() by
commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
it has been possible to receive a -EPROBE_DEFER return code during boot.
Previously, this resulted in setting a random ethernet address.

This exact issue happened on my Meraki MR32. This is because the nvmem
provider is an EEPROM (at24) which gets instantiated once the module
driver is loaded... which of course happens much later when the
filesystem becomes available.

With this patch, the probe will propagate this error code. The
driver subsystem will reschedule the probe at a later time,
once the nvmem is in place and ready to deliver the requested
mac-address.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
 drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ethernet/broadcom/bgmac-bcma.c
index 85fa0ab7201c..9513cfb5ba58 100644
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
@@ -129,6 +129,8 @@ static int bgmac_probe(struct bcma_device *core)
 	bcma_set_drvdata(core, bgmac);
 
 	err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr);
+	if (err == -EPROBE_DEFER)
+		return err;
 
 	/* If no MAC address assigned via device tree, check SPROM */
 	if (err) {
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: bgmac-bcma: handle deferred probe error due to mac-address
  2021-09-18 17:26 [PATCH] net: bgmac-bcma: handle deferred probe error due to mac-address Christian Lamparter
@ 2021-09-19  1:19 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2021-09-19  1:19 UTC (permalink / raw)
  To: Christian Lamparter
  Cc: netdev, bcm-kernel-feedback-list, Jakub Kicinski,
	David S . Miller, Rafał Miłecki

On Sat, Sep 18, 2021 at 07:26:32PM +0200, Christian Lamparter wrote:
> Since the inclusion of nvmem into the helper function
> of_get_mac_address() by
> commit d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
> it has been possible to receive a -EPROBE_DEFER return code during boot.

Please use this commit as the Fixes: tag.

Also, please base this in net, not next-next, and put net in subject,
as described in the netdev FAQ.

   Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-19  1:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18 17:26 [PATCH] net: bgmac-bcma: handle deferred probe error due to mac-address Christian Lamparter
2021-09-19  1:19 ` Andrew Lunn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.