* [PATCH net-next] net: macb: Replace open-coded device config retrieval with of_device_get_match_data()
@ 2026-01-17 1:46 Kevin Hao
2026-01-17 15:52 ` Andrew Lunn
2026-01-21 2:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Kevin Hao @ 2026-01-17 1:46 UTC (permalink / raw)
To: netdev
Cc: Kevin Hao, Nicolas Ferre, Claudiu Beznea, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Use of_device_get_match_data() to replace the open-coded method for
obtaining the device config.
Additionally, adjust the ordering of local variables to ensure
compatibility with RCS.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
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>
---
drivers/net/ethernet/cadence/macb_main.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 2d5f3eb0953038dfcbb28db591227cbe5f6e80f0..5cfd859f3b293de3abfb827fcdfb2198f6304ae2 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -5433,9 +5433,9 @@ static const struct macb_config default_gem_config = {
static int macb_probe(struct platform_device *pdev)
{
- const struct macb_config *macb_config = &default_gem_config;
- struct device_node *np = pdev->dev.of_node;
struct clk *pclk, *hclk = NULL, *tx_clk = NULL, *rx_clk = NULL;
+ struct device_node *np = pdev->dev.of_node;
+ const struct macb_config *macb_config;
struct clk *tsu_clk = NULL;
phy_interface_t interface;
struct net_device *dev;
@@ -5451,13 +5451,9 @@ static int macb_probe(struct platform_device *pdev)
if (IS_ERR(mem))
return PTR_ERR(mem);
- if (np) {
- const struct of_device_id *match;
-
- match = of_match_node(macb_dt_ids, np);
- if (match && match->data)
- macb_config = match->data;
- }
+ macb_config = of_device_get_match_data(&pdev->dev);
+ if (!macb_config)
+ macb_config = &default_gem_config;
err = macb_config->clk_init(pdev, &pclk, &hclk, &tx_clk, &rx_clk, &tsu_clk);
if (err)
---
base-commit: 46fe65a2c28ecf5df1a7475aba1f08ccf4c0ac1b
change-id: 20260117-macb-e7efd6c76bda
Best regards,
--
Kevin Hao <haokexin@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: macb: Replace open-coded device config retrieval with of_device_get_match_data()
2026-01-17 1:46 [PATCH net-next] net: macb: Replace open-coded device config retrieval with of_device_get_match_data() Kevin Hao
@ 2026-01-17 15:52 ` Andrew Lunn
2026-01-21 2:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2026-01-17 15:52 UTC (permalink / raw)
To: Kevin Hao
Cc: netdev, Nicolas Ferre, Claudiu Beznea, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Sat, Jan 17, 2026 at 09:46:18AM +0800, Kevin Hao wrote:
> Use of_device_get_match_data() to replace the open-coded method for
> obtaining the device config.
>
> Additionally, adjust the ordering of local variables to ensure
> compatibility with RCS.
>
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: macb: Replace open-coded device config retrieval with of_device_get_match_data()
2026-01-17 1:46 [PATCH net-next] net: macb: Replace open-coded device config retrieval with of_device_get_match_data() Kevin Hao
2026-01-17 15:52 ` Andrew Lunn
@ 2026-01-21 2:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-21 2:50 UTC (permalink / raw)
To: Kevin Hao
Cc: netdev, nicolas.ferre, claudiu.beznea, andrew+netdev, davem,
edumazet, kuba, pabeni
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 17 Jan 2026 09:46:18 +0800 you wrote:
> Use of_device_get_match_data() to replace the open-coded method for
> obtaining the device config.
>
> Additionally, adjust the ordering of local variables to ensure
> compatibility with RCS.
>
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
>
> [...]
Here is the summary with links:
- [net-next] net: macb: Replace open-coded device config retrieval with of_device_get_match_data()
https://git.kernel.org/netdev/net-next/c/1be080b78fd3
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] 3+ messages in thread
end of thread, other threads:[~2026-01-21 2:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-17 1:46 [PATCH net-next] net: macb: Replace open-coded device config retrieval with of_device_get_match_data() Kevin Hao
2026-01-17 15:52 ` Andrew Lunn
2026-01-21 2:50 ` 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