[PATCH net-next v1] net: macb: fix use of at91_default_usrio without CONFIG_OF
From: Conor Dooley <conor@kernel.org>
Date: 2026-03-30 09:02:41
Also in:
linux-devicetree, linux-riscv, lkml
Subsystem:
atmel macb ethernet driver, networking drivers, the rest · Maintainers:
Théo Lebrun, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
From: Conor Dooley <conor.dooley@microchip.com> If CONFIG_OF is not enabled, at91_default_usrio is used undeclared in gem_default_config. Rather than move the struct around, take the opportunity to rename gem_default_config, as the only compatible it is ever used for is "cdns,macb" - not "cdns,gem" at all! With that done, remove the use of default_gem_config as a fallback in probe, as every device has a specific set of match data. It pains me a little to leave at91_default_usrio in match data used by "cdns,macb", but this is probably required to avoid regressing anyone. Reported-by: kernel test robot <redacted> Closes: https://lore.kernel.org/oe-kbuild-all/202603280028.wQjUrIvv-lkp@intel.com/ (local) Reported-by: Jiawen Wu <jiawenwu@trustnetic.com> Closes: https://lore.kernel.org/all/06a701dcc014$86def5b0$949ce110$@trustnetic.com/ (local) Fixes: a17871778ee28 ("net: macb: rename macb_default_usrio to at91_default_usrio as not all platforms have mii mode control in usrio") Signed-off-by: Conor Dooley <conor.dooley@microchip.com> --- lkp also reported this over the weekend, but against the dev copy in my tree. I had thought that CONFIG_OF was standard off on x86, but I guess it isn't, given lkp didn't catch it until randconfigs. CC: Andrew Lunn <andrew+netdev@lunn.ch> CC: David S. Miller <davem@davemloft.net> CC: Eric Dumazet <edumazet@google.com> CC: Jakub Kicinski <kuba@kernel.org> CC: Paolo Abeni <pabeni@redhat.com> CC: Nicolas Ferre <nicolas.ferre@microchip.com> CC: Claudiu Beznea <claudiu.beznea@tuxon.dev> CC: netdev@vger.kernel.org CC: devicetree@vger.kernel.org CC: linux-kernel@vger.kernel.org CC: linux-riscv@lists.infradead.org --- drivers/net/ethernet/cadence/macb_main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 12e2b2f4aaf88..4f70e4fcf4606 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c@@ -5716,9 +5716,18 @@ static const struct macb_config pic64hpsc_config = { .jumbo_max_len = 16383, }; +static const struct macb_config macb_macb_config = { + .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | + MACB_CAPS_JUMBO | + MACB_CAPS_GEM_HAS_PTP, + .dma_burst_length = 16, + .usrio = &at91_default_usrio, + .jumbo_max_len = 10240, +}; + static const struct of_device_id macb_dt_ids[] = { { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, - { .compatible = "cdns,macb" }, + { .compatible = "cdns,macb", .data = &macb_macb_config}, { .compatible = "cdns,np4-macb", .data = &np4_config }, { .compatible = "cdns,pc302-gem", .data = &pc302gem_config }, { .compatible = "cdns,gem", .data = &pc302gem_config },
@@ -5747,15 +5756,6 @@ static const struct of_device_id macb_dt_ids[] = { MODULE_DEVICE_TABLE(of, macb_dt_ids); #endif /* CONFIG_OF */ -static const struct macb_config default_gem_config = { - .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | - MACB_CAPS_JUMBO | - MACB_CAPS_GEM_HAS_PTP, - .dma_burst_length = 16, - .usrio = &at91_default_usrio, - .jumbo_max_len = 10240, -}; - static int macb_probe(struct platform_device *pdev) { struct clk *pclk, *hclk = NULL, *tx_clk = NULL, *rx_clk = NULL;
@@ -5778,7 +5778,7 @@ static int macb_probe(struct platform_device *pdev) macb_config = of_device_get_match_data(&pdev->dev); if (!macb_config) - macb_config = &default_gem_config; + return -EINVAL; err = macb_clk_init(pdev, &pclk, &hclk, &tx_clk, &rx_clk, &tsu_clk, macb_config);
--
2.53.0