diff mbox series

[net-next] net: ag71xx: support probe defferal for getting MAC address

Message ID 20240824200249.137209-1-rosenp@gmail.com (mailing list archive)
State Accepted
Commit be04024a24a93f761a7b2c5f2de46db0f3acdc74
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ag71xx: support probe defferal for getting MAC address | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: chris.snook@gmail.com
netdev/build_clang success Errors and warnings before: 7 this patch: 7
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-25--21-00 (tests: 714)

Commit Message

Rosen Penev Aug. 24, 2024, 8:02 p.m. UTC
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(+)

Comments

Oleksij Rempel Aug. 25, 2024, 7:25 a.m. UTC | #1
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!
Andrew Lunn Aug. 26, 2024, 1:54 a.m. UTC | #2
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
patchwork-bot+netdevbpf@kernel.org Aug. 27, 2024, 9:30 p.m. UTC | #3
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!
diff mbox series

Patch

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);