linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: Allow a NULL phy name for devm_phy_get()
@ 2021-04-14 13:55 Rob Herring
  2021-05-14 12:18 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Herring @ 2021-04-14 13:55 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul
  Cc: linux-kernel, linux-arm-kernel, Aswath Govindraju

For a single PHY, there's no reason to have a phy-names entry in DT.
The DT specific get functions allow for this already, but devm_phy_get()
WARNs in this case. Other subsystems also don't warn in their get
functions. Let's drop the WARN for DT case in devm_phy_get().

Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
Note that I think the device_link_add later on is now redundant with 
fw_devlinks. If so, this can be simplified to just calling of_phy_get() 
for DT case.

 drivers/phy/phy-core.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 71cb10826326..3e4971253ec1 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -667,16 +667,18 @@ struct phy *phy_get(struct device *dev, const char *string)
 	struct phy *phy;
 	struct device_link *link;
 
-	if (string == NULL) {
-		dev_WARN(dev, "missing string\n");
-		return ERR_PTR(-EINVAL);
-	}
-
 	if (dev->of_node) {
-		index = of_property_match_string(dev->of_node, "phy-names",
-			string);
+		if (string)
+			index = of_property_match_string(dev->of_node, "phy-names",
+				string);
+		else
+			index = 0;
 		phy = _of_phy_get(dev->of_node, index);
 	} else {
+		if (string == NULL) {
+			dev_WARN(dev, "missing string\n");
+			return ERR_PTR(-EINVAL);
+		}
 		phy = phy_find(dev, string);
 	}
 	if (IS_ERR(phy))
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] phy: Allow a NULL phy name for devm_phy_get()
  2021-04-14 13:55 [PATCH] phy: Allow a NULL phy name for devm_phy_get() Rob Herring
@ 2021-05-14 12:18 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2021-05-14 12:18 UTC (permalink / raw)
  To: Rob Herring
  Cc: Kishon Vijay Abraham I, linux-kernel, linux-arm-kernel,
	Aswath Govindraju

On 14-04-21, 08:55, Rob Herring wrote:
> For a single PHY, there's no reason to have a phy-names entry in DT.
> The DT specific get functions allow for this already, but devm_phy_get()
> WARNs in this case. Other subsystems also don't warn in their get
> functions. Let's drop the WARN for DT case in devm_phy_get().

Applied, thanks

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-14 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 13:55 [PATCH] phy: Allow a NULL phy name for devm_phy_get() Rob Herring
2021-05-14 12:18 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).