9
0
Fork 0

devinfo: beautify output

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>
This commit is contained in:
Sascha Hauer 2011-08-10 14:48:18 +02:00
parent c574a0d1f1
commit 79884012c6
1 changed files with 14 additions and 13 deletions

View File

@ -283,32 +283,33 @@ void devices_shutdown(void)
} }
#ifdef CONFIG_CMD_DEVINFO #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 device_d *child;
struct cdev *cdev; struct cdev *cdev;
int i; int i;
for (i = 0; i < depth; 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)) { if (!list_empty(&dev->cdevs)) {
printf(" ("); printf("\n");
list_for_each_entry(cdev, &dev->cdevs, devices_list) { list_for_each_entry(cdev, &dev->cdevs, devices_list) {
printf("%s", cdev->name); for (i = 0; i < depth + 1; i++)
if (!list_is_last(&cdev->devices_list, &dev->cdevs)) printf(" ");
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)) { if (!list_empty(&dev->children)) {
device_for_each_child(dev, child) { device_for_each_child(dev, child) {
do_devinfo_subtree(child, depth + 1, do_devinfo_subtree(child, depth + 1);
list_is_last(&child->sibling,
&dev->children) ? '`' : '|');
} }
} }
@ -328,7 +329,7 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
for_each_device(dev) { for_each_device(dev) {
if (!dev->parent) if (!dev->parent)
do_devinfo_subtree(dev, 0, '|'); do_devinfo_subtree(dev, 0);
} }
printf("\ndrivers:\n"); printf("\ndrivers:\n");