public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: ag71xx: support probe defferal for getting MAC address
@ 2024-08-24 20:02 Rosen Penev
  2024-08-25  7:25 ` Oleksij Rempel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rosen Penev @ 2024-08-24 20:02 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, linux, linux-kernel, o.rempel,
	p.zabel

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.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/ethernet/atheros/ag71xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
index d81aa0ccd572..5ef76f3d3f1a 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
@@ -1897,6 +1897,8 @@ static int ag71xx_probe(struct platform_device *pdev)
 	ag->stop_desc->next = (u32)ag->stop_desc_dma;
 
 	err = of_get_ethdev_address(np, ndev);
+	if (err == -EPROBE_DEFER)
+		return err;
 	if (err) {
 		netif_err(ag, probe, ndev, "invalid MAC address, using random address\n");
 		eth_hw_addr_random(ndev);
-- 
2.46.0


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

* Re: [PATCH net-next] net: ag71xx: support probe defferal for getting MAC address
  2024-08-24 20:02 [PATCH net-next] net: ag71xx: support probe defferal for getting MAC address Rosen Penev
@ 2024-08-25  7:25 ` Oleksij Rempel
  2024-08-26  1:54 ` Andrew Lunn
  2024-08-27 21:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Oleksij Rempel @ 2024-08-25  7:25 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, davem, edumazet, kuba, pabeni, linux, linux-kernel,
	p.zabel

On Sat, Aug 24, 2024 at 01:02:37PM -0700, Rosen Penev wrote:
> 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.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>

Thank you!
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH net-next] net: ag71xx: support probe defferal for getting MAC address
  2024-08-24 20:02 [PATCH net-next] net: ag71xx: support probe defferal for getting MAC address Rosen Penev
  2024-08-25  7:25 ` Oleksij Rempel
@ 2024-08-26  1:54 ` Andrew Lunn
  2024-08-27 21:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2024-08-26  1:54 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, davem, edumazet, kuba, pabeni, linux, linux-kernel,
	o.rempel, p.zabel

On Sat, Aug 24, 2024 at 01:02:37PM -0700, Rosen Penev wrote:
> 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.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next] net: ag71xx: support probe defferal for getting MAC address
  2024-08-24 20:02 [PATCH net-next] net: ag71xx: support probe defferal for getting MAC address Rosen Penev
  2024-08-25  7:25 ` Oleksij Rempel
  2024-08-26  1:54 ` Andrew Lunn
@ 2024-08-27 21:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-27 21:30 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, davem, edumazet, kuba, pabeni, linux, linux-kernel,
	o.rempel, p.zabel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 24 Aug 2024 13:02:37 -0700 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next] net: ag71xx: support probe defferal for getting MAC address
    https://git.kernel.org/netdev/net-next/c/be04024a24a9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-08-27 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-24 20:02 [PATCH net-next] net: ag71xx: support probe defferal for getting MAC address Rosen Penev
2024-08-25  7:25 ` Oleksij Rempel
2024-08-26  1:54 ` Andrew Lunn
2024-08-27 21:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox