Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20260117-macb-v1-1-f092092d8c91@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Kevin Hao and committed by
Jakub Kicinski
1be080b7 6406fc70

+5 -9
+5 -9
drivers/net/ethernet/cadence/macb_main.c
··· 5438 5438 5439 5439 static int macb_probe(struct platform_device *pdev) 5440 5440 { 5441 - const struct macb_config *macb_config = &default_gem_config; 5442 - struct device_node *np = pdev->dev.of_node; 5443 5441 struct clk *pclk, *hclk = NULL, *tx_clk = NULL, *rx_clk = NULL; 5442 + struct device_node *np = pdev->dev.of_node; 5443 + const struct macb_config *macb_config; 5444 5444 struct clk *tsu_clk = NULL; 5445 5445 phy_interface_t interface; 5446 5446 struct net_device *dev; ··· 5456 5456 if (IS_ERR(mem)) 5457 5457 return PTR_ERR(mem); 5458 5458 5459 - if (np) { 5460 - const struct of_device_id *match; 5461 - 5462 - match = of_match_node(macb_dt_ids, np); 5463 - if (match && match->data) 5464 - macb_config = match->data; 5465 - } 5459 + macb_config = of_device_get_match_data(&pdev->dev); 5460 + if (!macb_config) 5461 + macb_config = &default_gem_config; 5466 5462 5467 5463 err = macb_config->clk_init(pdev, &pclk, &hclk, &tx_clk, &rx_clk, &tsu_clk); 5468 5464 if (err)