lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240201224516.pujapjenqtyejihg@skbuf>
Date: Fri, 2 Feb 2024 00:45:16 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Luiz Angelo Daros de Luca <luizluca@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
	Alvin Šipraga <alsi@...g-olufsen.dk>,
	Andrew Lunn <andrew@...n.ch>,
	Florian Fainelli <f.fainelli@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v5 09/11] net: dsa: realtek: migrate
 user_mii_bus setup to realtek-dsa

On Tue, Jan 30, 2024 at 08:13:28PM -0300, Luiz Angelo Daros de Luca wrote:
> +/**
> + * rtl83xx_setup_user_mdio() - register the user mii bus driver
> + * @ds: DSA switch associated with this user_mii_bus
> + *
> + * This function first gets and mdio node under the dev OF node, aborting
> + * if missing. That mdio node describing an mdio bus is used to register a
> + * new mdio bus.

The description has the overall feel of "Family Guy - Peter narrates his life"
(https://www.youtube.com/watch?v=zw8zUMjEW0I).

You could be a bit more succinct and say something like "Registers the
MDIO bus for built-in Ethernet PHYs, and associates it with the
mandatory 'mdio' child OF node of the switch".

> + *
> + * Context: Can sleep.
> + * Return: 0 on success, negative value for failure.
> + */
> +int rtl83xx_setup_user_mdio(struct dsa_switch *ds)
> +{
> +	struct realtek_priv *priv = ds->priv;
> +	struct device_node *mdio_np;
> +	struct mii_bus *bus;
> +	int ret = 0;
> +
> +	mdio_np = of_get_child_by_name(priv->dev->of_node, "mdio");
> +	if (!mdio_np) {
> +		dev_err(priv->dev, "no MDIO bus node\n");
> +		return -ENODEV;
> +	}
> +
> +	bus = devm_mdiobus_alloc(priv->dev);
> +	if (!bus) {
> +		ret = -ENOMEM;
> +		goto err_put_node;
> +	}
> +
> +	bus->priv = priv;
> +	bus->name = "Realtek user MII";
> +	bus->read = rtl83xx_user_mdio_read;
> +	bus->write = rtl83xx_user_mdio_write;
> +	snprintf(bus->id, MII_BUS_ID_SIZE, "%s:user_mii", dev_name(priv->dev));
> +	bus->parent = priv->dev;
> +
> +	ret = devm_of_mdiobus_register(priv->dev, bus, mdio_np);
> +	if (ret) {
> +		dev_err(priv->dev, "unable to register MDIO bus %s\n",
> +			bus->id);
> +		goto err_put_node;
> +	}
> +
> +	priv->user_mii_bus = bus;
> +
> +err_put_node:
> +	of_node_put(mdio_np);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_NS_GPL(rtl83xx_setup_user_mdio, REALTEK_DSA);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ