sunxi: driver refresh for 3.13
[openwrt/svn-archive/archive.git] / target / linux / sunxi / patches-3.13 / 160-1-phy-core-phy_get_leave-error-logging-to-caller.patch
1 From cc8e5932c671ba2d3ce511a15c19c47b015bc4ab Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Sun, 5 Jan 2014 00:00:30 +0100
4 Subject: [PATCH] phy-core: phy_get: Leave error logging to the caller
5
6 In various cases errors may be expected, ie probe-deferral or a call to
7 phy_get from a driver where the use of a phy is optional.
8
9 Rather then adding all sort of complicated checks for this, and/or adding
10 special functions like devm_phy_get_optional, simply don't log an error,
11 and let deciding if get_phy returning an error really should result in a
12 dev_err up to the caller.
13
14 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
15 ---
16 drivers/phy/phy-core.c | 10 ++--------
17 1 file changed, 2 insertions(+), 8 deletions(-)
18
19 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
20 index 5f5b0f4..b355553 100644
21 --- a/drivers/phy/phy-core.c
22 +++ b/drivers/phy/phy-core.c
23 @@ -404,17 +404,11 @@ struct phy *phy_get(struct device *dev, const char *string)
24 index = of_property_match_string(dev->of_node, "phy-names",
25 string);
26 phy = of_phy_get(dev, index);
27 - if (IS_ERR(phy)) {
28 - dev_err(dev, "unable to find phy\n");
29 - return phy;
30 - }
31 } else {
32 phy = phy_lookup(dev, string);
33 - if (IS_ERR(phy)) {
34 - dev_err(dev, "unable to find phy\n");
35 - return phy;
36 - }
37 }
38 + if (IS_ERR(phy))
39 + return phy;
40
41 if (!try_module_get(phy->ops->owner))
42 return ERR_PTR(-EPROBE_DEFER);
43 --
44 1.8.5.5
45