]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: Tidy up 'dm tree' output when there are many devices
authorSimon Glass <sjg@chromium.org>
Thu, 6 Dec 2018 01:42:52 +0000 (18:42 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 15 Jan 2019 00:47:13 +0000 (17:47 -0700)
At present the 'Index' column assumes there is only one digit. But on some
devices (e.g. snow) there are a lot of regulators and GPIO banks. Adjust
the output to allow for two digits without messing up the display.

Also capatalise the heading to match.

Fixes: 5197dafc42 (dm: core: Widen the dump tree to show more of the
driver's name.)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Liviu Dudau <liviu.dudau@foss.arm.com>
drivers/core/dump.c
test/py/tests/test_bind.py

index 04217cbde876b34ef2925fd49a0581ff317a0176..8fbfd93fb5e4ef5e79657e5c702404aef012ab70 100644 (file)
@@ -16,7 +16,7 @@ static void show_devices(struct udevice *dev, int depth, int last_flag)
        struct udevice *child;
 
        /* print the first 20 characters to not break the tree-format. */
-       printf(" %-10.10s  %d  [ %c ]   %-20.20s  ", dev->uclass->uc_drv->name,
+       printf(" %-10.10s  %2d  [ %c ]   %-20.20s  ", dev->uclass->uc_drv->name,
               dev_get_uclass_index(dev, NULL),
               dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
 
@@ -49,7 +49,7 @@ void dm_dump_all(void)
 
        root = dm_root();
        if (root) {
-               printf(" Class    index  Probed  Driver                Name\n");
+               printf(" Class     Index  Probed  Driver                Name\n");
                printf("-----------------------------------------------------------\n");
                show_devices(root, -1, 0);
        }
index dee3fee56619a24d7e72e1d24424c3e0ca26d5c7..917839f62865d03c4e0a7d7378fa4b3e4b2e5b81 100644 (file)
@@ -13,7 +13,8 @@ def in_tree(response, name, uclass, drv, depth, last_child):
        else:
                leaf = leaf + '`'
        leaf = leaf + '-- ' + name
-       line = ' *{:10.10}  [0-9]*  \[ [ +] \]   {:20.20}  {}$'.format(uclass, drv, leaf)
+       line = (' *{:10.10}   [0-9]*  \[ [ +] \]   {:20.20}  {}$'
+               .format(uclass, drv, leaf))
        prog = re.compile(line)
        for l in lines:
                if prog.match(l):