Skip to content

Commit

Permalink
mtd: spi-nor: update ptr pointer after spi_nor_read_data
Browse files Browse the repository at this point in the history
In spi_nor_spimem_xfer_data, it will limit the transfer size
according to nor->bouncebuf_size which is usually equal to
PAGE_SIZE. This means that sometimes a spi_nor_read operation
will be split into several spi_nor_read_data operations if
the transfer size is bigger than PAGE_SIZE .

Considering the case above, when is_ofst_odd is 0, we initialize
the "ptr" to be the "buf" and pass "ptr" as the argument to
spi_nor_read_data, the "ptr" should be updated as the "buf"
after spi_nor_read_data is called, or else the receive data
will be stored in the same place every time.

Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
State: pending
  • Loading branch information
wqyoung authored and Michal Simek committed Mar 22, 2021
1 parent f413bd6 commit 10a306e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/mtd/spi-nor/core.c
Expand Up @@ -2192,6 +2192,8 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
*retlen += ret;
}
buf += ret;
if (!is_ofst_odd)
ptr += ret;
from += ret;
len -= ret;
}
Expand Down

0 comments on commit 10a306e

Please sign in to comment.