summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKeerthy <j-keerthy@ti.com>2021-06-23 20:40:46 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2021-06-23 22:58:16 -0500
commitbad069367cccb7cc349a652c015ec1bc67820879 (patch)
tree7d2a1fd3b943057c654efc32c3f6425c78456fd8 /net
parent51afd0146f3765d8fa4cff99dd3ef641ddab07c1 (diff)
net: eth-uclass: eth_get_dev based on SEQ_ALIAS instead of probe order
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> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'net')
-rw-r--r--net/eth-uclass.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index e14695c0f1..e1b9fbd14a 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -78,9 +78,14 @@ struct udevice *eth_get_dev(void)
if (!uc_priv)
return NULL;
- 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;
}