mtd: m25p80: read in spi_max_transfer_size chunks
authorMichal Suchanek <hramrach@gmail.com>
Fri, 6 May 2016 00:31:56 +0000 (17:31 -0700)
committerBrian Norris <computersforpeace@gmail.com>
Thu, 2 Jun 2016 00:23:06 +0000 (17:23 -0700)
Take into account transfer size limitation of SPI master.

Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Michal Suchanek <hramrach@gmail.com>
Tested-by: Michal Suchanek <hramrach@gmail.com>
drivers/mtd/devices/m25p80.c

index eab46d211ae6a93fcb49abfd836743d4c91e5cdd..9cf7fcd280340ea2b5f72de499b7bba7e6893f34 100644 (file)
@@ -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);