Skip to contentSkip to conversation

phy: core: Fix phy_get() to not return error on link creation failure

PATCH In review Kishon Vijay Abraham I 2 participants 2 messages Feb 18, 2020 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: core: Fix phy_get() to not return error on link creation failure

commit 987351e1ea77 ("phy: core: Add consumer device link support") added device link support between PHY consumer and PHY provider. However certain peripherals (DWC3 ULPI) have cyclic dependency between the PHY provider and PHY consumer causing the device link creation to fail.

Instead of erroring out on failure to create device link, only add a debug print to indicate device link creation failed to get USB working again in multiple platforms.

Fixes 987351e1ea77 ("phy: core: Add consumer device link support")
Cc Alexandre Torgue <[email protected]>
---
 drivers/phy/phy-core.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/phy/phy-core.c +6 -12
index cd5a6c95dbdc..a27b8d578d7f 100644
@@ -688,11 +688,9 @@ struct phy *phy_get(struct device *dev, const char *string)
 	get_device(&phy->dev);
 
 	link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-	if (!link) {
-		dev_err(dev, "failed to create device link to %s\n",
+	if (!link)
+		dev_dbg(dev, "failed to create device link to %s\n",
 			dev_name(phy->dev.parent));
-		return ERR_PTR(-EINVAL);
-	}
 
 	return phy;
 }
@@ -803,11 +801,9 @@ struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
 	}
 
 	link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-	if (!link) {
-		dev_err(dev, "failed to create device link to %s\n",
+	if (!link)
+		dev_dbg(dev, "failed to create device link to %s\n",
 			dev_name(phy->dev.parent));
-		return ERR_PTR(-EINVAL);
-	}
 
 	return phy;
 }
@@ -852,11 +848,9 @@ struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
 	devres_add(dev, ptr);
 
 	link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-	if (!link) {
-		dev_err(dev, "failed to create device link to %s\n",
+	if (!link)
+		dev_dbg(dev, "failed to create device link to %s\n",
 			dev_name(phy->dev.parent));
-		return ERR_PTR(-EINVAL);
-	}
 
 	return phy;
 }
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Kishon

Quoted 6 lines · Kishon Vijay Abraham I

commit 987351e1ea77 ("phy: core: Add consumer device link support") added device link support between PHY consumer and PHY provider. However certain peripherals (DWC3 ULPI) have cyclic dependency between the PHY provider and PHY consumer causing the device link creation to fail.

Quoted 8 lines

Instead of erroring out on failure to create device link, only add a debug print to indicate device link creation failed to get USB working again in multiple platforms.

Fixes 987351e1ea77 ("phy: core: Add consumer device link support")
Cc Alexandre Torgue <[email protected]>

---

I was close to send it also :). Thanks for it.

Thanks
Alex

Quoted 50 lines
  drivers/phy/phy-core.c | 18 ++++++------------
  1 file changed, 6 insertions(+), 12 deletions(-)
drivers/phy/phy-core.c +6 -12
index cd5a6c95dbdc..a27b8d578d7f 100644
@@ -688,11 +688,9 @@ struct phy *phy_get(struct device *dev, const char *string)
  	get_device(&phy->dev);
 
  	link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-	if (!link) {
-		dev_err(dev, "failed to create device link to %s\n",
+	if (!link)
+		dev_dbg(dev, "failed to create device link to %s\n",
  			dev_name(phy->dev.parent));
-		return ERR_PTR(-EINVAL);
-	}
 
  	return phy;
  }
@@ -803,11 +801,9 @@ struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
  	}
 
  	link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-	if (!link) {
-		dev_err(dev, "failed to create device link to %s\n",
+	if (!link)
+		dev_dbg(dev, "failed to create device link to %s\n",
  			dev_name(phy->dev.parent));
-		return ERR_PTR(-EINVAL);
-	}
 
  	return phy;
  }
@@ -852,11 +848,9 @@ struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
  	devres_add(dev, ptr);
 
  	link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-	if (!link) {
-		dev_err(dev, "failed to create device link to %s\n",
+	if (!link)
+		dev_dbg(dev, "failed to create device link to %s\n",
  			dev_name(phy->dev.parent));
-		return ERR_PTR(-EINVAL);
-	}
 
  	return phy;
  }