From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 7/7] devinfo: beautify output
Date: Mon, 15 Aug 2011 10:46:32 +0200 [thread overview]
Message-ID: <1313397992-3065-8-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1313397992-3065-1-git-send-email-s.hauer@pengutronix.de>
Files associated to a device showed up in a long list. Instead,
print them in seperate lines and also show offset/size information
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/base/driver.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index b8b2f39..0b80103 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -283,32 +283,33 @@ void devices_shutdown(void)
}
#ifdef CONFIG_CMD_DEVINFO
-static int do_devinfo_subtree(struct device_d *dev, int depth, char edge)
+static int do_devinfo_subtree(struct device_d *dev, int depth)
{
struct device_d *child;
struct cdev *cdev;
int i;
for (i = 0; i < depth; i++)
- printf("| ");
+ printf(" ");
- printf("%c----%s", edge, dev_name(dev));
+ printf("`---- %s", dev_name(dev));
if (!list_empty(&dev->cdevs)) {
- printf(" (");
+ printf("\n");
list_for_each_entry(cdev, &dev->cdevs, devices_list) {
- printf("%s", cdev->name);
- if (!list_is_last(&cdev->devices_list, &dev->cdevs))
- printf(", ");
+ for (i = 0; i < depth + 1; i++)
+ printf(" ");
+ printf("`---- 0x%08lx-0x%08lx: /dev/%s\n",
+ cdev->offset,
+ cdev->offset + cdev->size - 1,
+ cdev->name);
}
- printf(")");
+ } else {
+ printf("\n");
}
- printf("\n");
if (!list_empty(&dev->children)) {
device_for_each_child(dev, child) {
- do_devinfo_subtree(child, depth + 1,
- list_is_last(&child->sibling,
- &dev->children) ? '`' : '|');
+ do_devinfo_subtree(child, depth + 1);
}
}
@@ -328,7 +329,7 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
for_each_device(dev) {
if (!dev->parent)
- do_devinfo_subtree(dev, 0, '|');
+ do_devinfo_subtree(dev, 0);
}
printf("\ndrivers:\n");
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-08-15 8:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-15 8:46 [PATCH] parent fixups Sascha Hauer
2011-08-15 8:46 ` [PATCH 1/7] mci: embed mci_dev into mci_host instead of allocating it seperately Sascha Hauer
2011-08-15 8:46 ` [PATCH 2/7] net: make the ethernet device a child of the hardware device Sascha Hauer
2011-08-15 8:46 ` [PATCH 3/7] net mii: add a parent pointer to miidevs and set it to " Sascha Hauer
2011-08-15 8:46 ` [PATCH 4/7] console: make console device a child of " Sascha Hauer
2011-08-15 8:46 ` [PATCH 5/7] mci: parent fixups Sascha Hauer
2011-08-16 15:39 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-15 8:46 ` [PATCH 6/7] spi: make the spi devices children of the parent bus Sascha Hauer
2011-08-15 8:46 ` Sascha Hauer [this message]
2011-08-15 9:14 ` [PATCH] parent fixups Jean-Christophe PLAGNIOL-VILLARD
2011-08-15 15:50 ` Sascha Hauer
2011-08-16 5:29 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-16 5:36 ` [PATCH 1/4] device: update id support to allow device without id Jean-Christophe PLAGNIOL-VILLARD
2011-08-18 5:26 ` Sascha Hauer
2011-08-18 6:27 ` Jean-Christophe PLAGNIOL-VILLARD
2011-08-16 5:36 ` [PATCH 2/4] add bus registration support Jean-Christophe PLAGNIOL-VILLARD
2011-08-18 5:14 ` Sascha Hauer
2011-08-16 5:36 ` [PATCH 3/4] platform_bus: add registrattion to bus Jean-Christophe PLAGNIOL-VILLARD
2011-08-16 5:36 ` [PATCH 4/4] switch all device/driver to platform_device/driver_(un)register Jean-Christophe PLAGNIOL-VILLARD
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=1313397992-3065-8-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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