]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
onenand_spl_simple: Call onenand_spl_get_geometry() only once
authorLadislav Michl <ladis@linux-mips.org>
Tue, 20 Jun 2017 09:43:22 +0000 (11:43 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 23 Jun 2017 14:38:06 +0000 (10:38 -0400)
Do not call onenand_spl_get_geometry() for each block read.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
drivers/mtd/onenand/onenand_spl.c

index 1925f41d8a22ee020417b794c67e347bd511c4cb..6fad34aa1dc3e7b0bd8b6f752223279e444a4501 100644 (file)
@@ -110,9 +110,12 @@ static u8 scratch_buf[PAGE_4K];
  */
 int onenand_spl_read_block(int block, int offset, int len, void *dst)
 {
-       int page, read, psize;
+       int page, read;
+       static int psize;
+
+       if (!psize)
+               psize = onenand_spl_get_geometry();
 
-       psize = onenand_spl_get_geometry();
        /* Calculate the page number */
        page = offset / psize;
        /* Offset to the start of a flash page */