]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: eth: reorganize control structure setup
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Mon, 18 May 2026 16:15:18 +0000 (18:15 +0200)
committerRobert Marko <robimarko@gmail.com>
Thu, 21 May 2026 10:19:47 +0000 (12:19 +0200)
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>
target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c

index 2beaefb08df97c0f26a5d4b64207bbc24e3428e9..ab55701285ed662858a146b563a9c57cb9f9afd9 100644 (file)
@@ -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;