public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@list•ru>
To: netdev@vger•kernel.org
Cc: Rami Rosen <rosenr@marvell•com>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons•com>
Subject: [PATCH 1/6] restructure of_phy_register_fixed_link() for further modifications
Date: Thu, 26 Mar 2015 18:58:41 +0300	[thread overview]
Message-ID: <55142CB1.1080107@list.ru> (raw)
In-Reply-To: <55142C31.5050504@list.ru>

-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
Signed-off-by: Stas Sergeev <stsp@users•sourceforge.net>
---
 drivers/of/of_mdio.c |   32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 1bd4305..b3dc1e6 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -301,22 +301,26 @@ int of_phy_register_fixed_link(struct device_node *np)
                               "asym-pause");
         of_node_put(fixed_link_node);
         phy = fixed_phy_register(PHY_POLL, &status, np);
-        return IS_ERR(phy) ? PTR_ERR(phy) : 0;
-    }
-
-    /* Old binding */
-    fixed_link_prop = of_get_property(np, "fixed-link", &len);
-    if (fixed_link_prop && len == (5 * sizeof(__be32))) {
-        status.link = 1;
-        status.duplex = be32_to_cpu(fixed_link_prop[1]);
-        status.speed = be32_to_cpu(fixed_link_prop[2]);
-        status.pause = be32_to_cpu(fixed_link_prop[3]);
-        status.asym_pause = be32_to_cpu(fixed_link_prop[4]);
-        phy = fixed_phy_register(PHY_POLL, &status, np);
-        return IS_ERR(phy) ? PTR_ERR(phy) : 0;
+        if (IS_ERR(phy))
+            return PTR_ERR(phy);
+    } else {
+        /* Old binding */
+        fixed_link_prop = of_get_property(np, "fixed-link", &len);
+        if (fixed_link_prop && len == (5 * sizeof(__be32))) {
+            status.link = 1;
+            status.duplex = be32_to_cpu(fixed_link_prop[1]);
+            status.speed = be32_to_cpu(fixed_link_prop[2]);
+            status.pause = be32_to_cpu(fixed_link_prop[3]);
+            status.asym_pause = be32_to_cpu(fixed_link_prop[4]);
+            phy = fixed_phy_register(PHY_POLL, &status, np);
+            if (IS_ERR(phy))
+                return PTR_ERR(phy);
+        } else {
+            return -ENODEV;
+        }
     }
 
-    return -ENODEV;
+    return 0;
 }
 EXPORT_SYMBOL(of_phy_register_fixed_link);
 #endif
-- 
1.7.9.5

  reply	other threads:[~2015-03-26 16:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26 15:56 [PATCH 0/6] mvneta: SGMII-based in-band link status signaling Stas Sergeev
2015-03-26 15:58 ` Stas Sergeev [this message]
2015-03-26 16:00   ` [PATCH 2/6] pass phy_device instead of net_device to fixed_phy link_update() function Stas Sergeev
2015-03-26 16:01     ` [PATCH 3/6] fixed_phy: add fixed_phy_unregister() Stas Sergeev
2015-03-26 16:02       ` [PATCH 4/6] of: add API for changing parameters of fixed link Stas Sergeev
2015-03-26 16:03         ` [PATCH 5/6] mvneta: implement SGMII-based in-band link status signaling Stas Sergeev
2015-03-26 16:04           ` [PATCH 6/6] mvneta: port marvell's official in-band status enabling procedure Stas Sergeev
2015-03-26 22:49     ` [PATCH 2/6] pass phy_device instead of net_device to fixed_phy link_update() function David Miller
2015-03-26 22:55       ` Stas Sergeev
2015-03-26 22:59         ` Thomas Petazzoni
2015-03-26 19:01   ` [PATCH 1/6] restructure of_phy_register_fixed_link() for further modifications Sergei Shtylyov
2015-03-26 20:26     ` Stas Sergeev
2015-03-26 17:13 ` [PATCH 0/6] mvneta: SGMII-based in-band link status signaling Florian Fainelli
2015-03-26 17:23   ` Stas Sergeev
2015-03-26 17:29     ` Florian Fainelli
2015-03-26 17:34       ` Stas Sergeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55142CB1.1080107@list.ru \
    --to=stsp@list$(echo .)ru \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rosenr@marvell$(echo .)com \
    --cc=thomas.petazzoni@free-electrons$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox