From: Michal Suchanek Date: Fri, 6 May 2016 00:31:56 +0000 (-0700) Subject: mtd: m25p80: read in spi_max_transfer_size chunks X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=95193796256cfce16e5d881318e15b6b04062c15;p=linux-beck.git mtd: m25p80: read in spi_max_transfer_size chunks Take into account transfer size limitation of SPI master. Signed-off-by: Michal Suchanek Signed-off-by: Brian Norris Acked-by: Michal Suchanek Tested-by: Michal Suchanek --- diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index eab46d211ae6..9cf7fcd28034 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);