[PATCH] commands: devinfo: Omit parent if direct descendent of bus

Ahmad Fatoum ahmad at a3f.at
Mon Nov 29 00:03:56 PST 2021


In that case parentage adds no extra info, so we can just omit it.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
v1 -> v2:
  - add commands: prefix
  - check dev->bus before dereferencing it
---
 commands/devinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/devinfo.c b/commands/devinfo.c
index 2e2e48e42cc5..32fd55ebd515 100644
--- a/commands/devinfo.c
+++ b/commands/devinfo.c
@@ -85,7 +85,7 @@ static int do_devinfo(int argc, char *argv[])
 		if (dev->info)
 			dev->info(dev);
 
-		if (dev->parent)
+		if (dev->parent && (!dev->bus || dev->bus->dev != dev->parent))
 			printf("Parent: %s\n", dev_name(dev->parent));
 
 		first = true;
-- 
2.33.0




More information about the barebox mailing list