public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Keerthy <j-keerthy@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 01/10] net: eth-uclass: eth_get_dev based on SEQ_ALIAS instead of probe order
Date: Tue, 18 Feb 2020 10:39:55 +0530	[thread overview]
Message-ID: <20200218051004.32524-2-j-keerthy@ti.com> (raw)
In-Reply-To: <20200218051004.32524-1-j-keerthy@ti.com>

In case of multiple eth interfaces currently eth_get_dev
fetches the device based on the probe order which can be
random hence try with the alias.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---

Changes in v2:

  * Fixed comments from Tom & Lokesh as per:
    https://patchwork.ozlabs.org/patch/1142697/

 net/eth-uclass.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index ed81cbd537..93855e933b 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -68,9 +68,15 @@ struct udevice *eth_get_dev(void)
 	struct eth_uclass_priv *uc_priv;
 
 	uc_priv = eth_get_uclass_priv();
-	if (!uc_priv->current)
-		eth_errno = uclass_first_device(UCLASS_ETH,
-				    &uc_priv->current);
+
+	if (!uc_priv->current) {
+		eth_errno = uclass_get_device_by_seq(UCLASS_ETH, 0,
+						     &uc_priv->current);
+		if (eth_errno || !uc_priv->current)
+			 eth_errno = uclass_first_device(UCLASS_ETH,
+							 &uc_priv->current);
+	}
+
 	return uc_priv->current;
 }
 
-- 
2.17.1

  reply	other threads:[~2020-02-18  5:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18  5:09 [PATCH v2 00/10] net: ti: icssg: Add prueth support Keerthy
2020-02-18  5:09 ` Keerthy [this message]
2020-02-18 18:31   ` [PATCH v2 01/10] net: eth-uclass: eth_get_dev based on SEQ_ALIAS instead of probe order Simon Glass
2020-02-18  5:09 ` [PATCH v2 02/10] soc: ti: pruss: add a misc driver for PRUSS in TI SoCs Keerthy
2020-02-18  5:09 ` [PATCH v2 03/10] remoteproc: pruss: add PRU remoteproc driver Keerthy
2020-02-18  5:09 ` [PATCH v2 04/10] net: ti: icssg-prueth: Add ICSSG ethernet driver Keerthy
2020-02-18  5:09 ` [PATCH v2 05/10] arm: dts: k3-am65-main: Add msmc_ram node Keerthy
2020-02-18  5:10 ` [PATCH v2 06/10] arm: dts: k3-am654-base-board-u-boot: Add icssg specific msmc_ram carveout nodes Keerthy
2020-02-18  5:10 ` [PATCH v2 07/10] arm: dts: k3-am65-main: Add scm_conf node Keerthy
2020-02-18  5:10 ` [PATCH v2 08/10] arm: dts: k3-am65-main: Add pruss nodes for ICSSG2 Keerthy
2020-02-18  5:10 ` [PATCH v2 09/10] arm64: dts: ti: am654-base-board: add ICSSG2 Ethernet support Keerthy
2020-02-18  5:10 ` [PATCH v2 10/10] configs: am65x_evm_a53_defconfig: Enable CONFIG_TI_AM64_ICSSG_PRUETH Keerthy
2020-02-20  9:18 ` [PATCH v2 00/10] net: ti: icssg: Add prueth support Keerthy
2020-10-26 12:37   ` Christian Gmeiner
2020-10-26 12:47     ` Roger Quadros

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=20200218051004.32524-2-j-keerthy@ti.com \
    --to=j-keerthy@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox