Thread (38 messages) 38 messages, 5 authors, 2021-01-22

Re: [net-next PATCH v3 11/15] net: mdiobus: Introduce fwnode_mdiobus_register()

From: Andy Shevchenko <hidden>
Date: 2021-01-12 15:52:14
Also in: linux-acpi, linux-arm-kernel, lkml

On Tue, Jan 12, 2021 at 3:42 PM Calvin Johnson
[off-list ref] wrote:
Introduce fwnode_mdiobus_register() to register PHYs on the  mdiobus.
If the fwnode is DT node, then call of_mdiobus_register().
If it is an ACPI node, then call acpi_mdiobus_register().
...
+/**
+ * fwnode_mdiobus_register - Register mii_bus and create PHYs from fwnode
+ * @mdio: pointer to mii_bus structure
+ * @fwnode: pointer to fwnode of MDIO bus.
+ *
+ * This function returns of_mdiobus_register() for DT and
+ * acpi_mdiobus_register() for ACPI.
+ */
+int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
+{
+       if (is_of_node(fwnode))
+               return of_mdiobus_register(mdio, to_of_node(fwnode));
+       else if (is_acpi_node(fwnode))
Redundant 'else'
+               return acpi_mdiobus_register(mdio, fwnode);
+
+       return -EINVAL;
+}
-- 
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