realtek: eth: reorganize control structure setup

Early assign pdev and netdev to the control structure during probing.
This way it can be used at any time later.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23420
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Markus Stockhausen
2026-05-18 18:15:18 +02:00
committed by Robert Marko
parent 76e47b4421
commit a1a4b09076
@@ -1516,8 +1516,12 @@ static int rteth_probe(struct platform_device *pdev)
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, &pdev->dev);
ctrl = netdev_priv(dev);
ctrl->pdev = pdev;
ctrl->netdev = dev;
ctrl->r = cfg;
ctrl->map = syscon_node_to_regmap(dn->parent);
if (IS_ERR(ctrl->map))
return PTR_ERR(ctrl->map);
@@ -1601,9 +1605,6 @@ static int rteth_probe(struct platform_device *pdev)
pr_info("Using MAC %pM\n", dev->dev_addr);
strscpy(dev->name, "eth%d", sizeof(dev->name));
ctrl->pdev = pdev;
ctrl->netdev = dev;
for (int i = 0; i < RTETH_RX_RINGS; i++) {
ctrl->rx_qs[i].id = i;
ctrl->rx_qs[i].ctrl = ctrl;