diff mbox series

dm: core: Show device sequence instead in dm_dump_tree()

Message ID 20240802092820.917450-2-admin@hifiphile.com
State Accepted
Commit 2d76e724b412bbe8cfed2157f78a3fb2602c2d6d
Delegated to: Tom Rini
Headers show
Series dm: core: Show device sequence instead in dm_dump_tree() | expand

Commit Message

Zixun LI Aug. 2, 2024, 9:28 a.m. UTC
Currently uclass index is shown in DM tree dump which ignores alias
sequence numbering. The result could be confusing since these 2 numbers
could be different. Show device sequence number instead as it's more
meaningful.

Also update documentation to use sequence number.

Signed-off-by: Zixun LI <admin@hifiphile.com>
---
 doc/usage/cmd/dm.rst | 7 +++----
 drivers/core/dump.c  | 4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

--
2.45.2

Comments

Simon Glass Aug. 6, 2024, 9:50 p.m. UTC | #1
On Fri, 2 Aug 2024 at 03:31, Zixun LI <admin@hifiphile.com> wrote:
>
> Currently uclass index is shown in DM tree dump which ignores alias
> sequence numbering. The result could be confusing since these 2 numbers
> could be different. Show device sequence number instead as it's more
> meaningful.
>
> Also update documentation to use sequence number.
>
> Signed-off-by: Zixun LI <admin@hifiphile.com>
> ---
>  doc/usage/cmd/dm.rst | 7 +++----
>  drivers/core/dump.c  | 4 ++--
>  2 files changed, 5 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>


>
> diff --git a/doc/usage/cmd/dm.rst b/doc/usage/cmd/dm.rst
> index 7651507937..196b22d137 100644
> --- a/doc/usage/cmd/dm.rst
> +++ b/doc/usage/cmd/dm.rst
> @@ -112,9 +112,8 @@ This shows the full tree of devices including the following fields:
>  uclass
>      Shows the name of the uclass for the device
>
> -Index
> -    Shows the index number of the device, within the uclass. This shows the
> -    ordering within the uclass, but not the sequence number.
> +Seq
> +    Shows the sequence number of the device, within the uclass.
>
>  Probed
>      Shows `+` if the device is active
> @@ -366,7 +365,7 @@ dm tree
>  This example shows the abridged sandbox output::
>
>      => dm tree
> -    Class     Index  Probed  Driver                Name
> +    Class     Seq    Probed  Driver                Name
>      -----------------------------------------------------------
>      root          0  [ + ]   root_driver           root_driver
>      demo          0  [   ]   demo_shape_drv        |-- demo_shape_drv
> diff --git a/drivers/core/dump.c b/drivers/core/dump.c
> index 5ec30d5b3c..5cbaa97fa3 100644
> --- a/drivers/core/dump.c
> +++ b/drivers/core/dump.c
> @@ -40,7 +40,7 @@ static void show_devices(struct udevice *dev, int depth, int last_flag,
>         /* print the first 20 characters to not break the tree-format. */
>         printf(CONFIG_IS_ENABLED(USE_TINY_PRINTF) ? " %s  %d  [ %c ]   %s  " :
>                " %-10.10s  %3d  [ %c ]   %-20.20s  ", dev->uclass->uc_drv->name,
> -              dev_get_uclass_index(dev, NULL),
> +              dev->seq_,
>                flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
>
>         for (i = depth; i >= 0; i--) {
> @@ -129,7 +129,7 @@ void dm_dump_tree(char *dev_name, bool extended, bool sort)
>  {
>         struct udevice *root;
>
> -       printf(" Class     Index  Probed  Driver                Name\n");
> +       printf(" Class     Seq    Probed  Driver                Name\n");
>         printf("-----------------------------------------------------------\n");
>
>         root = dm_root();
> --
> 2.45.2
>
Tom Rini Aug. 27, 2024, 11:22 p.m. UTC | #2
On Fri, 02 Aug 2024 11:28:12 +0200, Zixun LI wrote:

> Currently uclass index is shown in DM tree dump which ignores alias
> sequence numbering. The result could be confusing since these 2 numbers
> could be different. Show device sequence number instead as it's more
> meaningful.
> 
> Also update documentation to use sequence number.
> 
> [...]

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/doc/usage/cmd/dm.rst b/doc/usage/cmd/dm.rst
index 7651507937..196b22d137 100644
--- a/doc/usage/cmd/dm.rst
+++ b/doc/usage/cmd/dm.rst
@@ -112,9 +112,8 @@  This shows the full tree of devices including the following fields:
 uclass
     Shows the name of the uclass for the device

-Index
-    Shows the index number of the device, within the uclass. This shows the
-    ordering within the uclass, but not the sequence number.
+Seq
+    Shows the sequence number of the device, within the uclass.

 Probed
     Shows `+` if the device is active
@@ -366,7 +365,7 @@  dm tree
 This example shows the abridged sandbox output::

     => dm tree
-    Class     Index  Probed  Driver                Name
+    Class     Seq    Probed  Driver                Name
     -----------------------------------------------------------
     root          0  [ + ]   root_driver           root_driver
     demo          0  [   ]   demo_shape_drv        |-- demo_shape_drv
diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index 5ec30d5b3c..5cbaa97fa3 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -40,7 +40,7 @@  static void show_devices(struct udevice *dev, int depth, int last_flag,
 	/* print the first 20 characters to not break the tree-format. */
 	printf(CONFIG_IS_ENABLED(USE_TINY_PRINTF) ? " %s  %d  [ %c ]   %s  " :
 	       " %-10.10s  %3d  [ %c ]   %-20.20s  ", dev->uclass->uc_drv->name,
-	       dev_get_uclass_index(dev, NULL),
+	       dev->seq_,
 	       flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);

 	for (i = depth; i >= 0; i--) {
@@ -129,7 +129,7 @@  void dm_dump_tree(char *dev_name, bool extended, bool sort)
 {
 	struct udevice *root;

-	printf(" Class     Index  Probed  Driver                Name\n");
+	printf(" Class     Seq    Probed  Driver                Name\n");
 	printf("-----------------------------------------------------------\n");

 	root = dm_root();