Re: [PATCH net-next 07/10] net: phy: switch to using class_find_device_by_fwnode()
Dmitry Torokhov <[email protected]> Mon, 23 Mar 2026 11:33:36 -0700
| Newsgroups | org.kernel.vger.linux-fpga,dev.linux.lists.driver-core,org.infradead.lists.linux-phy,org.kernel.vger.linux-kernel,org.kernel.vger.linux-leds,org.kernel.vger.linux-spi,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Mar 23, 2026 at 08:59:52AM +0000, Russell King (Oracle) wrote: > On Sun, Mar 22, 2026 at 10:17:15PM -0700, Dmitry Torokhov wrote: > > On Mon, Mar 23, 2026 at 03:54:09AM +0100, Andrew Lunn wrote: > > > > - d = class_find_device_by_of_node(&mdio_bus_class, mdio_bus_np); > > > > + d = class_find_device_by_fwnode(&mdio_bus_class, > > > > + of_fwnode_handle(mdio_bus_np)); > > > > > > When you look at this, why is it better? > > > > I think we should move as much as possible towards firmware-agnostic > > APIs and use fwnode_handle instead of device_node or software_node or > > ACPI companion. To discourage this I think we better remove > > firmware-specific APIs where we have firmware-agnostic ones and > > eventually clean up drivers that use OF- or ACPI-specific APIs. > > Basically, no. This is wrong. > > It may sound like a good goal, but there's an underlying issue. This > goal assumes that the firmware description in OF and ACPI are > indentical. If they are different then drivers will make allowance for this, like I2C core or SPI core does. But most of the modern drivers use firmware-agnostic APIs (device_property_*()). ACPI has allowance for device tree properties (via PRP0001 HID entries), and drivers should work with them. > > Sure, looking up devices by fwnode handle makes sense, but looking up > anything that is described in firmware is not suitable for this kind > of conversion, because in doing so, you effectively "port" the DT > bindings to ACPI, and it may not be suitable for ACPI. > > So, please don't make wholesale changes that transfer the DT bindings > into ACPI. > I am not "transferring" anything, but I want to make sure the code works even if we augment OF with software nodes or if DT properties are used in ACPI. Thanks. -- Dmitry