summaryrefslogtreecommitdiff
path: root/drivers/mtd/onenand/onenand_spl.c
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2017-06-20 11:43:22 +0200
committerTom Rini <trini@konsulko.com>2017-06-23 10:38:06 -0400
commit0da008ef8d0441d582619c279212e65f9f0bd2fa (patch)
tree9f909884d444e1d82b306d2d2343d84e8998d342 /drivers/mtd/onenand/onenand_spl.c
parent6d7a57076476789c77d59a0e8b47fc975de7231e (diff)
onenand_spl_simple: Call onenand_spl_get_geometry() only once
Do not call onenand_spl_get_geometry() for each block read. Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Diffstat (limited to 'drivers/mtd/onenand/onenand_spl.c')
-rw-r--r--drivers/mtd/onenand/onenand_spl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/onenand/onenand_spl.c b/drivers/mtd/onenand/onenand_spl.c
index 1925f41d8a..6fad34aa1d 100644
--- a/drivers/mtd/onenand/onenand_spl.c
+++ b/drivers/mtd/onenand/onenand_spl.c
@@ -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 */