[PATCH 4/4] mtd-utils: remove unnecessary ioctl from mtd_info

Marian Rotariu marian_rotariu at mentor.com
Tue Apr 26 02:30:24 PDT 2016


Signed-off-by: Marian Rotariu <marian_rotariu at mentor.com>
---
 ubi-utils/mtdinfo.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c
index a86abd1..25a96eb 100644
--- a/ubi-utils/mtdinfo.c
+++ b/ubi-utils/mtdinfo.c
@@ -246,9 +246,7 @@ static void print_region_info(const struct mtd_dev_info *mtd)
 	/*
 	 * If we don't have any region info, just return
 	 *
-	 * FIXME: We can't get region_info (via ioctl) without having the MTD
-	 *        node path. This is a problem for `mtdinfo -a', for example,
-	 *        since it doesn't provide any filepath information.
+	 * FIXME: We still need the filepath for the region map
 	 */
 	if (!args.node || (!args.map && mtd->region_cnt == 0))
 		return;
@@ -267,14 +265,12 @@ static void print_region_info(const struct mtd_dev_info *mtd)
 	if (mtd->region_cnt) {
 		for (r = 0; r < mtd->region_cnt; ++r) {
 			printf("Eraseblock region %i: ", r);
-			if (mtd_regioninfo(fd, r, &reginfo) == 0) {
-				printf(" offset: %#x size: %#x numblocks: %#x\n",
-					reginfo.offset, reginfo.erasesize,
-					reginfo.numblocks);
-				if (args.map)
-					print_region_map(mtd, fd, &reginfo);
-			} else
-				printf(" info is unavailable\n");
+			printf(" offset: %#x size: %#x numblocks: %#x\n",
+					mtd->reginfo[r].offset,
+					mtd->reginfo[r].erasesize,
+					mtd->reginfo[r].numblocks);
+			if (args.map)
+				print_region_map(mtd, fd, &(mtd->reginfo[r]));
 		}
 	} else {
 		reginfo.offset = 0;
-- 
1.9.1




More information about the linux-mtd mailing list