[PATCH v2 01/10] net: eth-uclass: eth_get_dev based on SEQ_ALIAS instead of probe order
Keerthy
j-keerthy at ti.com
Tue Feb 18 06:09:55 CET 2020
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 at 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
More information about the U-Boot
mailing list