Re: [net-next PATCH v1 3/7] net: phy: Introduce fwnode_get_phy_id()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 01/10/2020 05:00, Calvin Johnson wrote:
On Wed, Sep 30, 2020 at 08:19:02PM +0200, Andrew Lunn wrote:
On Wed, Sep 30, 2020 at 07:07:25PM +0100, Russell King - ARM Linux admin wrote:
On Wed, Sep 30, 2020 at 06:34:40PM +0200, Andrew Lunn wrote:
@@ -2866,7 +2888,15 @@ EXPORT_SYMBOL_GPL(device_phy_find_device);
   */
  struct fwnode_handle *fwnode_get_phy_node(struct fwnode_handle *fwnode)
  {
-	return fwnode_find_reference(fwnode, "phy-handle", 0);
+	struct fwnode_handle *phy_node;
+
+	phy_node = fwnode_find_reference(fwnode, "phy-handle", 0);
+	if (is_acpi_node(fwnode) || !IS_ERR(phy_node))
+		return phy_node;
+	phy_node = fwnode_find_reference(fwnode, "phy", 0);
+	if (IS_ERR(phy_node))
+		phy_node = fwnode_find_reference(fwnode, "phy-device", 0);
+	return phy_node;

Why do you have three different ways to reference a PHY?

Compatibility with the DT version - note that "phy" and "phy-device"
are only used for non-ACPI fwnodes. This should allow us to convert
drivers where necessary without fear of causing DT regressions.

Ah.

A comment would be good here.

Sure. Will add comment.

Actually, I agree with Andrew. I don't see why new properties are being defined for following a reference from a property to a PHY node. This function shouldn't need to change at all.

g.



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux