summaryrefslogtreecommitdiffstats
path: root/commands/miitool.c
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2016-01-31 19:10:08 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2016-02-03 07:58:28 +0100
commit060e8590ee685b634e847a7b4152b12911c8dbe3 (patch)
tree67491cd028b4f63f1ded9fc4348de5b4ec80dd75 /commands/miitool.c
parent09c56012a45df438b8e8dbd728c80e23db541497 (diff)
downloadbarebox-060e8590ee685b634e847a7b4152b12911c8dbe3.tar.gz
barebox-060e8590ee685b634e847a7b4152b12911c8dbe3.tar.xz
miitool: Fix PHY argument handling
Instead of displaying the status of PHY "PHY" the tool will print status of all PHYs it encounters while searching for the one that was requested. This commit fixes the logic such that only requested information is printed. Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> 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.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/commands/miitool.c b/commands/miitool.c
index c62e7588a8..9ee3597618 100644
--- a/commands/miitool.c
+++ b/commands/miitool.c
@@ -233,18 +233,27 @@ static void mdiobus_show(struct device_d *dev, char *phydevname, int verbose)
struct phy_device *phydev;
phydev = mdiobus_scan(mii, i);
- if (IS_ERR(phydev))
+ if (IS_ERR(phydev) || !phydev->registered)
continue;
- if (phydev->registered) {
- show_basic_mii(mii, phydev, verbose);
+ /*
+ * If we are looking for a secific phy, called
+ * 'phydevname', but current phydev is not it, skip to
+ * the next iteration
+ */
+ if (phydevname &&
+ strcmp(phydev->cdev.name, phydevname))
+ continue;
- if (phydevname &&
- !strcmp(phydev->cdev.name, phydevname)) {
- return;
- }
- }
+ show_basic_mii(mii, phydev, verbose);
+ /*
+ * We were looking for a specific device and at this
+ * point we already shown the info about it so end the
+ * loop and exit
+ */
+ if (phydevname)
+ break;
}
return;