dm: Tidy up dump output when there are many devices
authorPatrick Delaunay <patrick.delaunay@st.com>
Mon, 30 Sep 2019 08:19:13 +0000 (10:19 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 15 Oct 2019 14:40:03 +0000 (08:40 -0600)
At present the 'Index' column of 'dm tree' assumes there is
two digits, this patch increase it to 3 digits.

It also aligns output of 'dm uclass', assuming the same 3 digits index.

The boards with CONFIG_PINCTRL_FULL activated have one pinconfig
by pin configuration, so they can have more than 100 devices
pinconfig (for example with stm32mp157c-ev1 board we have
106 pinconfig node).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/core/dump.c
test/py/tests/test_bind.py

index 8fbfd93..4704049 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  %2d  [ %c ]   %-20.20s  ", dev->uclass->uc_drv->name,
+       printf(" %-10.10s  %3d  [ %c ]   %-20.20s  ", dev->uclass->uc_drv->name,
               dev_get_uclass_index(dev, NULL),
               dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
 
@@ -64,7 +64,7 @@ void dm_dump_all(void)
  */
 static void dm_display_line(struct udevice *dev, int index)
 {
-       printf("%i %c %s @ %08lx", index,
+       printf("%-3i %c %s @ %08lx", index,
               dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
               dev->name, (ulong)map_to_sysmem(dev));
        if (dev->seq != -1 || dev->req_seq != -1)
index ccf6d62..2d48484 100644 (file)
@@ -13,7 +13,7 @@ def in_tree(response, name, uclass, drv, depth, last_child):
        else:
                leaf = leaf + '`'
        leaf = leaf + '-- ' + name
-       line = (' *{:10.10}   [0-9]*  \[ [ +] \]   {:20.20}  {}$'
+       line = (' *{:10.10}    [0-9]*  \[ [ +] \]   {:20.20}  {}$'
                .format(uclass, drv, leaf))
        prog = re.compile(line)
        for l in lines: