Thread (48 messages) 48 messages, 6 authors, 2026-01-29

Re: [PATCH v2 net-next 02/15] net: mdio: add driver for NXP SJA1110 100BASE-T1 embedded PHYs

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2026-01-23 07:25:30
Also in: linux-devicetree, lkml

On Fri, Jan 23, 2026 at 12:10:03AM +0200, Vladimir Oltean wrote:
On Thu, Jan 22, 2026 at 04:44:47PM +0200, Andy Shevchenko wrote:
quoted
On Thu, Jan 22, 2026 at 02:47:08PM +0200, Vladimir Oltean wrote:
quoted
On Thu, Jan 22, 2026 at 02:12:21PM +0200, Andy Shevchenko wrote:
quoted
On Thu, Jan 22, 2026 at 12:56:41PM +0200, Vladimir Oltean wrote:
...
quoted
quoted
quoted
quoted
+	if (!dev->of_node || !dev->parent)
Can we avoid dereferencing? And perhaps dev_fwnode(dev)?
Avoid dereferencing what?
of_node
Why? The driver is useless when bound to a device without an of_node.
of_mdiobus_register() will fall back gracefully to __mdiobus_register(),
and still technically get registered, but its child PHYs will be
inaccessible through phandles.
dereferencing != use
quoted
quoted
quoted
quoted
+		return -ENODEV;
What I meant is to avoid accessing of_node directly, use APIs: dev_of_node().

...
quoted
quoted
quoted
quoted
+	err = of_mdiobus_register(bus, dev->of_node);
Why would I use dev_fwnode() if I need to pass it as OF to
of_mdiobus_register() here?
dev_of_node() then. Wondering if we can use fwnode_mdiobus_register_phy() here
(I remember that OF/fwnode code in MDIO/PHY is not trivial, but I don't know
 all the details).
fwnode_mdiobus_register_phy() shall be read as: "hey MDIO bus, please
register a PHY for this fwnode!"

of_mdiobus_register() shall be read as: "I have this mii_bus structure
and I want it registered as an active MDIO bus, associated with this OF
node".

So the two do not serve the same purpose; one is not the more generic
variant of the other.

There is no fwnode variant of of_mdiobus_register(). Perhaps this
snippet from drivers/net/ethernet/marvell/mvmdio.c can clarify:

	/* For the platforms not supporting DT/ACPI fall-back
	 * to mdiobus_register via of_mdiobus_register.
	 */
	if (is_acpi_node(pdev->dev.fwnode))
		ret = acpi_mdiobus_register(bus, pdev->dev.fwnode);
	else
		ret = of_mdiobus_register(bus, pdev->dev.of_node);

Out of the two API functions, I used OF because that's what I need
to support.
I see, so perhaps in the future we will see this snipped to be converted to
fwnode_mdiobus_register() then. Thank you for clarification.
quoted
quoted
quoted
quoted
+	if (err)
+		goto err_free_bus;
-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help