diff mbox series

[v5,2/8] net: dsa: move cpu port probe to dsa_post_probe

Message ID 20221004164918.2251714-3-tharvey@gateworks.com
State Superseded
Delegated to: Ramon Fried
Headers show
Series Add MV88E6xxx DSA driver and use on gwventana | expand

Commit Message

Tim Harvey Oct. 4, 2022, 4:49 p.m. UTC
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>
---
v5:
 - added Fabio's rb tag
v4:
 - no changes
v3:
 - added Vladimir's rb tag
v2:
 - added Ramon's rb tag
---
 net/dsa-uclass.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Vladimir Oltean Oct. 4, 2022, 10:29 p.m. UTC | #1
On Tue, Oct 04, 2022 at 09:49:12AM -0700, Tim Harvey wrote:
> diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c
> index 5b7046432ff3..a37e76e25a8f 100644
> --- a/net/dsa-uclass.c
> +++ b/net/dsa-uclass.c
> @@ -466,7 +466,6 @@ static int dsa_pre_probe(struct udevice *dev)
> +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,
> @@ -491,13 +499,14 @@ static int dsa_pre_probe(struct udevice *dev)
>  	}
>  
>  	return 0;
> -}
> +};

Semicolons aren't needed at the end of functions.
diff mbox series

Patch

diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c
index 5b7046432ff3..a37e76e25a8f 100644
--- a/net/dsa-uclass.c
+++ b/net/dsa-uclass.c
@@ -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,
@@ -491,13 +499,14 @@  static int dsa_pre_probe(struct udevice *dev)
 	}
 
 	return 0;
-}
+};
 
 UCLASS_DRIVER(dsa) = {
 	.id = UCLASS_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),