From c933b1ccbc87525eba4f17f30ad7b3ab85481da8 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 15 Oct 2018 17:38:35 -0700 Subject: miitool: Fix inconsistent spacing Make sure that there's a space between device name and it's status string regardless if if device is using "id" field or not. Before: barebox@ZII RDU2 Board:/ miitool mdio0-phy00: mdio:no link mdio1-phy15: 2188000.ethernet@2188000:10 Mbit, half duplex, no link mdio1-phy16: 2188000.ethernet@2188000:10 Mbit, half duplex, no link mdio2-phy00: 2188000.ethernet@2188000:mdio:switch@0:no link mdio2-phy01: 2188000.ethernet@2188000:mdio:switch@0:no link mdio2-phy02: 2188000.ethernet@2188000:mdio:switch@0:negotiated 100baseTx-FD, link ok mdio2-phy03: 2188000.ethernet@2188000:mdio:switch@0:no link mdio2-phy04: 2188000.ethernet@2188000:mdio:switch@0:no link mdio3-phy01: eth1: negotiated 1000baseT-FD flow-control, link ok After: barebox@ZII RDU2 Board:/ miitool mdio0-phy00: mdio: no link mdio1-phy15: 2188000.ethernet@2188000: 10 Mbit, half duplex, no link mdio1-phy16: 2188000.ethernet@2188000: 10 Mbit, half duplex, no link mdio2-phy00: 2188000.ethernet@2188000:mdio:switch@0: no link mdio2-phy01: 2188000.ethernet@2188000:mdio:switch@0: no link mdio2-phy02: 2188000.ethernet@2188000:mdio:switch@0: no link mdio2-phy03: 2188000.ethernet@2188000:mdio:switch@0: no link mdio2-phy04: 2188000.ethernet@2188000:mdio:switch@0: no link mdio3-phy01: eth1: no link Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- commands/miitool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/miitool.c b/commands/miitool.c index dea4f853ce..acf61421b8 100644 --- a/commands/miitool.c +++ b/commands/miitool.c @@ -115,7 +115,7 @@ 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((mii->parent->id) < 0 ? "%s: %s:" : "%s: %s%d: ", + printf((mii->parent->id) < 0 ? "%s: %s: " : "%s: %s%d: ", phydev->cdev.name, mii->parent->name, mii->parent->id); -- cgit v1.2.3 From 20c12d090a1de80a3c58a232b4074067dcbb61a4 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Tue, 6 Nov 2018 17:14:07 +0100 Subject: commands: mem: truncate mem device size to fit the loff_t file size On 64bit arches the file covering the whole address space is larger than what can be represented in the loff_t type (s64) used for the file size. Thus the size of this device is interpreted as negative in a lot of places. Fix this by truncating the size to fit the file size type. Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- commands/mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/mem.c b/commands/mem.c index eb91ade05a..cdd7a492d0 100644 --- a/commands/mem.c +++ b/commands/mem.c @@ -96,7 +96,8 @@ static int mem_probe(struct device_d *dev) dev->priv = cdev; cdev->name = (char*)dev->resource[0].name; - cdev->size = (unsigned long)resource_size(&dev->resource[0]); + cdev->size = min(resource_size(&dev->resource[0]), + (unsigned long long)S64_MAX); cdev->ops = &memops; cdev->dev = dev; -- cgit v1.2.3