]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: dsa: move cpu port probe to dsa_post_probe
authorTim Harvey <tharvey@gateworks.com>
Wed, 30 Nov 2022 17:42:45 +0000 (09:42 -0800)
committerTom Rini <trini@konsulko.com>
Thu, 2 Feb 2023 19:22:08 +0000 (14:22 -0500)
In order to ensure that a DSA driver probe gets called before
dsa_ops->port_probe move the port_probe of the cpu_port to
a post-probe function.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
net/dsa-uclass.c

index 5b7046432ff3980aba1098fba9ca501745723728..5759cedcbec3ccdfa7f5da76888577dc6fe85a94 100644 (file)
@@ -466,7 +466,6 @@ static int dsa_pre_probe(struct udevice *dev)
 {
        struct dsa_pdata *pdata = dev_get_uclass_plat(dev);
        struct dsa_priv *priv = dev_get_uclass_priv(dev);
-       struct dsa_ops *ops = dsa_get_ops(dev);
        int err;
 
        priv->num_ports = pdata->num_ports;
@@ -482,6 +481,15 @@ static int dsa_pre_probe(struct udevice *dev)
        if (err)
                return err;
 
+       return 0;
+}
+
+static int dsa_post_probe(struct udevice *dev)
+{
+       struct dsa_priv *priv = dev_get_uclass_priv(dev);
+       struct dsa_ops *ops = dsa_get_ops(dev);
+       int err;
+
        /* Simulate a probing event for the CPU port */
        if (ops->port_probe) {
                err = ops->port_probe(dev, priv->cpu_port,
@@ -498,6 +506,7 @@ UCLASS_DRIVER(dsa) = {
        .name = "dsa",
        .post_bind = dsa_post_bind,
        .pre_probe = dsa_pre_probe,
+       .post_probe = dsa_post_probe,
        .per_device_auto = sizeof(struct dsa_priv),
        .per_device_plat_auto = sizeof(struct dsa_pdata),
        .per_child_plat_auto = sizeof(struct dsa_port_pdata),