diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2016-01-31 19:10:11 -0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-02-03 07:58:28 +0100 |
commit | b88381df6ef2930fb6072489b93b1fc31257162a (patch) | |
tree | 363a8595e4af2a8595ee273025aab033c4c7bdcd /commands/miitool.c | |
parent | 109543cf88d9357e23d2be6381a044e84aa5ef1b (diff) | |
download | barebox-b88381df6ef2930fb6072489b93b1fc31257162a.tar.gz barebox-b88381df6ef2930fb6072489b93b1fc31257162a.tar.xz |
miitool: Don't print negative parent IDs
Do not include ID of the parent to mii_bus if that ID is negative since
it produces a rather confusing string (e.g. "mdio.11-1", which is very
likely to be interpreted as "mdio.11<dash>1").
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/miitool.c')
-rw-r--r-- | commands/miitool.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/commands/miitool.c b/commands/miitool.c index 9ee3597618..9ea5ab5cd3 100644 --- a/commands/miitool.c +++ b/commands/miitool.c @@ -115,8 +115,9 @@ static int show_basic_mii(struct mii_bus *mii, struct phy_device *phydev, for (i = 0; i < 32; i++) mii_val[i] = mii->read(mii, phydev->addr, i); - printf("%s: %s%d: ", phydev->cdev.name, - mii->parent->name, mii->parent->id); + printf((mii->parent->id) < 0 ? "%s: %s:" : "%s: %s%d: ", + phydev->cdev.name, mii->parent->name, mii->parent->id); + if (mii_val[MII_BMCR] == 0xffff || mii_val[MII_BMSR] == 0x0000) { fprintf(stderr, " No MII transceiver present!.\n"); |