diff mbox series

dm: fix alignment in DM dump when 2-digit index exists

Message ID 1536318942-12061-1-git-send-email-yamada.masahiro@socionext.com
State New
Headers show
Series dm: fix alignment in DM dump when 2-digit index exists | expand

Commit Message

Masahiro Yamada Sept. 7, 2018, 11:15 a.m. UTC
If there exist 10 or more nodes of the same type, the alignment
of "dm tree" command is broken.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/core/dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marek Vasut Sept. 7, 2018, 11:20 a.m. UTC | #1
On 09/07/2018 01:15 PM, Masahiro Yamada wrote:
> If there exist 10 or more nodes of the same type, the alignment
> of "dm tree" command is broken.

But what if there exist 100 or mode nodes of the same type ? :-)

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/core/dump.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/core/dump.c b/drivers/core/dump.c
> index d7cdb14..c86f889 100644
> --- a/drivers/core/dump.c
> +++ b/drivers/core/dump.c
> @@ -16,7 +16,7 @@ static void show_devices(struct udevice *dev, int depth, int last_flag)
>  	struct udevice *child;
>  
>  	/* print the first 11 characters to not break the tree-format. */
> -	printf(" %-10.10s  %d  [ %c ]   %-10.10s  ", dev->uclass->uc_drv->name,
> +	printf(" %-10.10s  %2d  [ %c ]   %-10.10s  ", dev->uclass->uc_drv->name,
>  	       dev_get_uclass_index(dev, NULL),
>  	       dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
>  
>
Bin Meng Sept. 7, 2018, 1:17 p.m. UTC | #2
On Fri, Sep 7, 2018 at 7:17 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> If there exist 10 or more nodes of the same type, the alignment
> of "dm tree" command is broken.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/dump.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass Sept. 18, 2018, 6:16 a.m. UTC | #3
Hi Masahiro,

On 7 September 2018 at 13:15, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> If there exist 10 or more nodes of the same type, the alignment
> of "dm tree" command is broken.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/dump.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

This seems to break the test:

test_bind_unbind_with_node

Can you please check it?

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index d7cdb14..c86f889 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -16,7 +16,7 @@  static void show_devices(struct udevice *dev, int depth, int last_flag)
 	struct udevice *child;
 
 	/* print the first 11 characters to not break the tree-format. */
-	printf(" %-10.10s  %d  [ %c ]   %-10.10s  ", dev->uclass->uc_drv->name,
+	printf(" %-10.10s  %2d  [ %c ]   %-10.10s  ", dev->uclass->uc_drv->name,
 	       dev_get_uclass_index(dev, NULL),
 	       dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);