* [PATCH v2 1/2] phy-core: phy_get: Leave error logging to the caller
2014-01-07 17:57 [PATCH v2 1/2] phy-core: 2 small fixes Hans de Goede
@ 2014-01-07 17:57 ` Hans de Goede
2014-01-07 17:57 ` [PATCH v2 2/2] phy-core: Don't propagate -ENOSUPP from phy_pm_runtime_get_sync to caller Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2014-01-07 17:57 UTC (permalink / raw)
To: linux-arm-kernel
In various cases errors may be expected, ie probe-deferral or a call to
phy_get from a driver where the use of a phy is optional.
Rather then adding all sort of complicated checks for this, and/or adding
special functions like devm_phy_get_optional, simply don't log an error,
and let deciding if get_phy returning an error really should result in a
dev_err up to the caller.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/phy/phy-core.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 58e0e97..86a248b 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -371,17 +371,11 @@ struct phy *phy_get(struct device *dev, const char *string)
index = of_property_match_string(dev->of_node, "phy-names",
string);
phy = of_phy_get(dev, index);
- if (IS_ERR(phy)) {
- dev_err(dev, "unable to find phy\n");
- return phy;
- }
} else {
phy = phy_lookup(dev, string);
- if (IS_ERR(phy)) {
- dev_err(dev, "unable to find phy\n");
- return phy;
- }
}
+ if (IS_ERR(phy))
+ return phy;
if (!try_module_get(phy->ops->owner))
return ERR_PTR(-EPROBE_DEFER);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2 2/2] phy-core: Don't propagate -ENOSUPP from phy_pm_runtime_get_sync to caller
2014-01-07 17:57 [PATCH v2 1/2] phy-core: 2 small fixes Hans de Goede
2014-01-07 17:57 ` [PATCH v2 1/2] phy-core: phy_get: Leave error logging to the caller Hans de Goede
@ 2014-01-07 17:57 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2014-01-07 17:57 UTC (permalink / raw)
To: linux-arm-kernel
The phy-core allows phy_init and phy_power_on to be called multiple times,
but before this patch -ENOSUPP from phy_pm_runtime_get_sync would be
propagated to the caller for the 2nd and later calls.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/phy/phy-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 86a248b..4ea2987 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -161,6 +161,8 @@ int phy_init(struct phy *phy)
dev_err(&phy->dev, "phy init failed --> %d\n", ret);
goto out;
}
+ } else {
+ ret = 0; /* Override possible ret == -ENOTSUPP */
}
out:
@@ -209,6 +211,8 @@ int phy_power_on(struct phy *phy)
dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);
goto out;
}
+ } else {
+ ret = 0; /* Override possible ret == -ENOTSUPP */
}
out:
--
1.8.4.2
^ permalink raw reply related [flat|nested] 3+ messages in thread