]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd-tests: flash_speed: Drop read_eraseblock_by_page()
authorMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 26 Aug 2024 09:46:28 +0000 (11:46 +0200)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Tue, 8 Oct 2024 06:14:57 +0000 (08:14 +0200)
The read_eraseblock_by_2pages() has been generalized so it became
read_eraseblock_by_npages(), but there is no limitation (besides 0)
regarding the number of pages. Hence, drop the _by_page() helper and
replace it with the _by_npages(), using 'npages = 1'.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
tests/mtd-tests/flash_speed.c

index 6df056856d793d460005fb26b6b1fd58cb63e044..1064491656c33d13f863d93258a06997c3bac476 100644 (file)
@@ -233,24 +233,6 @@ static int write_eraseblock_by_2pages(int ebnum)
        return err;
 }
 
-static int read_eraseblock_by_page(int ebnum)
-{
-       void *buf = iobuf;
-       int i, err = 0;
-
-       for (i = 0; i < pgcnt; ++i) {
-               err = mtd_read(&mtd, fd, ebnum, i * pgsize, iobuf, pgsize);
-               if (err) {
-                       fprintf(stderr, "Error reading block %d, page %d!\n",
-                                       ebnum, i);
-                       break;
-               }
-               buf += pgsize;
-       }
-
-       return err;
-}
-
 static int read_eraseblock_by_npages(int ebnum)
 {
        int i, n = pgcnt / npages, err = 0;
@@ -454,7 +436,8 @@ int main(int argc, char **argv)
 
        /* Read all eraseblocks, 1 page at a time */
        puts("testing page read speed");
-       TIME_OP_PER_PEB(read_eraseblock_by_page, 1);
+       npages = 1;
+       TIME_OP_PER_PEB(read_eraseblock_by_npages, npages);
        printf("page read speed is %ld KiB/s\n", speed);
 
        /* Write all eraseblocks, 2 pages at a time */