Skip to contentSkip to conversation

net: macb: Replace open-coded device config retrieval with of_device_get_match_data()

PATCH Applied Kevin Hao 3 participants 3 messages Jan 17 – Jan 21

Subsystems (3)
lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

PATCH 1/1 net: macb: Replace open-coded device config retrieval with of_device_get_match_data()

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.

---
Cc: Nicolas Ferre <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>

---
 drivers/net/ethernet/cadence/macb_main.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +5 -9
index 2d5f3eb0953038dfcbb28db591227cbe5f6e80f0..5cfd859f3b293de3abfb827fcdfb2198f6304ae2 100644
@@ -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,

Signature · 1 line
Kevin Hao <[email protected]>
#2 lore raw
In reply to Kevin Hao
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · 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.

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html