Message ID | 20200218051004.32524-2-j-keerthy@ti.com |
---|---|
State | New |
Headers | show |
Series | net: ti: icssg: Add prueth support | expand |
Hi Keerthy, On Mon, 17 Feb 2020 at 22:10, Keerthy <j-keerthy at ti.com> wrote: > > 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(-) This one is for Joe to review. But please do add/update the network tests to cover this behaviour. Regards, Simon
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; }
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(-)