[PATCH v4 04/13] net: add DSA framework to support basic switch functionality

Sascha Hauer sha at pengutronix.de
Tue Apr 12 01:02:50 PDT 2022


On Fri, Apr 08, 2022 at 10:29:41AM +0200, Oleksij Rempel wrote:
> diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
> new file mode 100644
> index 0000000000..5be38d32b0
> --- /dev/null
> +++ b/drivers/net/dsa.c

> +static int dsa_switch_register_master(struct dsa_switch *ds,
> +				      struct device_node *np,
> +				      struct device_node *master, int port)
> +{
> +	struct device_node *phy_node;
> +	struct phy_device *phydev;
> +	struct dsa_port *dp;
> +	int ret;
> +
> +	of_device_ensure_probed(master);

I think this can be dropped as it's also done by
of_find_eth_device_by_node() called below.

Sascha

> +
> +	if (ds->edev_master) {
> +		dev_err(ds->dev, "master was already registered!\n");
> +		return -EINVAL;
> +	}
> +
> +	ds->edev_master = of_find_eth_device_by_node(master);
> +	if (!ds->edev_master) {
> +		dev_err(ds->dev, "can't find ethernet master device\n");
> +		return -ENODEV;
> +	}
> +

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list