diff mbox series

[U-Boot] dm: Tidy up 'dm tree' output when there are many devices

Message ID 20181206014252.133273-1-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show
Series [U-Boot] dm: Tidy up 'dm tree' output when there are many devices | expand

Commit Message

Simon Glass Dec. 6, 2018, 1:42 a.m. UTC
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>
---

 drivers/core/dump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Liviu Dudau Dec. 7, 2018, 1:37 p.m. UTC | #1
On Wed, Dec 05, 2018 at 06:42:52PM -0700, Simon Glass wrote:
> 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>

Best regards,
Liviu

> ---
> 
>  drivers/core/dump.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/core/dump.c b/drivers/core/dump.c
> index 04217cbde87..8fbfd93fb5e 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 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);
>  	}
> -- 
> 2.20.0.rc1.387.gf8505762e3-goog
>
Simon Glass Dec. 28, 2018, 8:47 p.m. UTC | #2
On Wed, Dec 05, 2018 at 06:42:52PM -0700, Simon Glass wrote:
> 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>

Best regards,
Liviu

> ---
>
>  drivers/core/dump.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
Applied to u-boot-dm/master, thanks!
diff mbox series

Patch

diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index 04217cbde87..8fbfd93fb5e 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 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);
 	}