Print MTD's device OF path in the output of `mtd list` command.

Signed-off-by: Marek Behún <marek.be...@nic.cz>
Reviewed-by: Miquel Raynal <miquel.ray...@bootlin.com>
Tested-by: Patrice Chotard <patrice.chot...@foss.st.com>
Cc: Jagan Teki <ja...@amarulasolutions.com>
Cc: Priyanka Jain <priyanka.j...@nxp.com>
Cc: Simon Glass <s...@chromium.org>
Cc: Heiko Schocher <h...@denx.de>
Cc: Jagan Teki <ja...@amarulasolutions.com>
Cc: Patrick Delaunay <patrick.delau...@st.com>
---
 cmd/mtd.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/cmd/mtd.c b/cmd/mtd.c
index 485a963bdd..2aabfd4d29 100644
--- a/cmd/mtd.c
+++ b/cmd/mtd.c
@@ -126,6 +126,13 @@ static void mtd_show_device(struct mtd_info *mtd)
                printf("  - driver: %s\n", mtd->dev->driver->name);
        }
 #endif
+       if (IS_ENABLED(CONFIG_OF_CONTROL) && mtd->dev) {
+               char buf[256];
+               int res;
+
+               res = ofnode_get_path(mtd_get_ofnode(mtd), buf, 256);
+               printf("  - path: %s\n", res == 0 ? buf : "unavailable");
+       }
 
        /* MTD device information */
        printf("  - type: ");
-- 
2.26.3

Reply via email to