[PATCH v5 10/10] spi: m25p80: read in spi_max_transfer_size chunks
Michal Suchanek
hramrach at gmail.com
Tue Dec 1 08:51:06 PST 2015
Take into account transfer size limitation of SPI master.
Signed-off-by: Michal Suchanek <hramrach at gmail.com>
---
drivers/mtd/devices/m25p80.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 58ecfa4..4f21755 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -150,7 +150,10 @@ 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;
+ if (spi_max_transfer_size(spi))
+ t[1].len = min_t(size_t, len, spi_max_transfer_size(spi));
+ else
+ t[1].len = len;
spi_message_add_tail(&t[1], &m);
ret = spi_sync(spi, &m);
--
2.6.2
More information about the linux-mtd
mailing list