public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/9] dm: eth: Correctly detect alias in eth_get_dev_by_name()
Date: Tue, 25 Aug 2015 00:22:22 -0700	[thread overview]
Message-ID: <1440487347-10517-4-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1440487347-10517-1-git-send-email-bmeng.cn@gmail.com>

When given a device name string, we should test if it contains "eth"
before we treat it as an alias.

With this commit, now we are really able to rotate between network
interfaces with driver model (previously it was broken).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

 net/eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/eth.c b/net/eth.c
index 0b4b08a..fbf30b0 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -197,7 +197,7 @@ struct udevice *eth_get_dev_by_name(const char *devname)
 	struct uclass *uc;
 
 	/* Must be longer than 3 to be an alias */
-	if (strlen(devname) > strlen("eth")) {
+	if (strstr(devname, "eth") && strlen(devname) > strlen("eth")) {
 		startp = devname + strlen("eth");
 		seq = simple_strtoul(startp, &endp, 10);
 	}
-- 
1.8.2.1

  parent reply	other threads:[~2015-08-25  7:22 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25  7:22 [U-Boot] [PATCH 1/9] net: Revert "tftp: adjust settings to be suitable for 100Mbit ethernet" Bin Meng
2015-08-25  7:22 ` [U-Boot] [PATCH 2/9] net: e1000: Fix build warnings for 32-bit Bin Meng
2015-08-25 17:57   ` Scott Wood
2015-08-25  7:22 ` [U-Boot] [PATCH 3/9] dm: eth: Do not call board_eth_init() or cpu_eth_init() Bin Meng
2015-08-25 18:43   ` Joe Hershberger
2015-08-26  1:29     ` Bin Meng
2015-08-26  2:04       ` Bin Meng
2015-08-26  2:24       ` Joe Hershberger
2015-08-26  2:36         ` Bin Meng
2015-08-26  2:41           ` Joe Hershberger
2015-08-26  3:06           ` Simon Glass
2015-08-25  7:22 ` Bin Meng [this message]
2015-08-25 18:55   ` [U-Boot] [PATCH 4/9] dm: eth: Correctly detect alias in eth_get_dev_by_name() Joe Hershberger
2015-08-25  7:22 ` [U-Boot] [PATCH 5/9] x86: crownbay: Convert to use CONFIG_DM_USB Bin Meng
2015-08-25 18:57   ` Joe Hershberger
2015-08-25 20:31   ` Simon Glass
2015-08-25  7:22 ` [U-Boot] [PATCH 6/9] x86: crownbay: Convert to use CONFIG_DM_ETH for E1000 Bin Meng
2015-08-25 18:59   ` Joe Hershberger
2015-08-26  2:20     ` Bin Meng
2015-08-26  2:28       ` Simon Glass
2015-08-26  2:30         ` Joe Hershberger
2015-08-25  7:22 ` [U-Boot] [PATCH 7/9] net: pch_gbe: Convert to driver model Bin Meng
2015-08-25 19:04   ` Joe Hershberger
2015-08-25 20:32   ` Simon Glass
2015-08-25  7:22 ` [U-Boot] [PATCH 8/9] net: pch_gbe: Add Kconfig option Bin Meng
2015-08-25 19:10   ` Joe Hershberger
2015-08-26  1:25     ` Bin Meng
2015-08-26  2:19       ` Joe Hershberger
2015-08-25  7:22 ` [U-Boot] [PATCH 9/9] x86: crownbay: Enable CONFIG_PCH_GBE Bin Meng
2015-08-25 19:07   ` Joe Hershberger
2015-08-25 20:32   ` Simon Glass
2015-08-25  9:26 ` [U-Boot] [PATCH 1/9] net: Revert "tftp: adjust settings to be suitable for 100Mbit ethernet" Bin Meng
2015-08-25 16:05   ` 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=1440487347-10517-4-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.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