All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] net: phy: Move fixed link code to separate routine
Date: Tue, 27 Nov 2018 11:49:10 +0530	[thread overview]
Message-ID: <1543299551-1965-1-git-send-email-siva.durga.paladugu@xilinx.com> (raw)

This patch moves fixed-link functionality code to a separate
routine inorder to make it more modular and cleaner.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 drivers/net/phy/phy.c | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index e837eb7..3cb2785 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -875,18 +875,18 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev)
 	debug("%s connected to %s\n", dev->name, phydev->drv->name);
 }
 
+#ifdef CONFIG_PHY_FIXED
 #ifdef CONFIG_DM_ETH
-struct phy_device *phy_connect(struct mii_dev *bus, int addr,
-			       struct udevice *dev,
-			       phy_interface_t interface)
+static struct phy_device *phy_connect_fixed(struct mii_dev *bus,
+					    struct udevice *dev,
+					    phy_interface_t interface)
 #else
-struct phy_device *phy_connect(struct mii_dev *bus, int addr,
-			       struct eth_device *dev,
-			       phy_interface_t interface)
+static struct phy_device *phy_connect_fixed(struct mii_dev *bus,
+					    struct eth_device *dev,
+					    phy_interface_t interface)
 #endif
 {
 	struct phy_device *phydev = NULL;
-#ifdef CONFIG_PHY_FIXED
 	int sn;
 	const char *name;
 
@@ -900,7 +900,27 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 		}
 		sn = fdt_next_subnode(gd->fdt_blob, sn);
 	}
+
+	return phydev;
+}
 #endif
+
+#ifdef CONFIG_DM_ETH
+struct phy_device *phy_connect(struct mii_dev *bus, int addr,
+			       struct udevice *dev,
+			       phy_interface_t interface)
+#else
+struct phy_device *phy_connect(struct mii_dev *bus, int addr,
+			       struct eth_device *dev,
+			       phy_interface_t interface)
+#endif
+{
+	struct phy_device *phydev = NULL;
+
+#ifdef CONFIG_PHY_FIXED
+	phydev = phy_connect_fixed(bus, dev, interface);
+#endif
+
 	if (!phydev)
 		phydev = phy_find_by_mask(bus, 1 << addr, interface);
 
-- 
2.7.4

             reply	other threads:[~2018-11-27  6:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27  6:19 Siva Durga Prasad Paladugu [this message]
2018-11-27  6:19 ` [U-Boot] [PATCH 2/2] net: phy: Add gmiitorgmii converter support Siva Durga Prasad Paladugu
2018-12-21  7:35   ` Michal Simek
2019-01-23 18:20   ` Joe Hershberger
2019-01-24  8:06     ` Michal Simek
2019-01-24 17:24       ` Joe Hershberger
2019-01-25 12:35         ` Michal Simek
2018-12-03 14:15 ` [U-Boot] [PATCH 1/2] net: phy: Move fixed link code to separate routine Michal Simek
2019-01-23 18:21 ` Joe Hershberger

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=1543299551-1965-1-git-send-email-siva.durga.paladugu@xilinx.com \
    --to=siva.durga.paladugu@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.