mtd: m25p80: read in spi_max_transfer_size chunks

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Aug 1 18:59:02 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=95193796256cfce16e5d881318e15b6b04062c15
Commit:     95193796256cfce16e5d881318e15b6b04062c15
Parent:     26f9bcad29a6c240881bd4efc90f16a9990dd6c2
Author:     Michal Suchanek <hramrach at gmail.com>
AuthorDate: Thu May 5 17:31:56 2016 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Jun 1 17:23:06 2016 -0700

    mtd: m25p80: read in spi_max_transfer_size chunks
    
    Take into account transfer size limitation of SPI master.
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
    Acked-by: Michal Suchanek <hramrach at gmail.com>
    Tested-by: Michal Suchanek <hramrach at gmail.com>
---
 drivers/mtd/devices/m25p80.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index eab46d2..9cf7fcd 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -172,7 +172,7 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 
 	t[1].rx_buf = buf;
 	t[1].rx_nbits = m25p80_rx_nbits(nor);
-	t[1].len = len;
+	t[1].len = min(len, spi_max_transfer_size(spi));
 	spi_message_add_tail(&t[1], &m);
 
 	ret = spi_sync(spi, &m);



More information about the linux-mtd-cvs mailing list