aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_bitbang.c
diff options
context:
space:
mode:
authorJan Nikitenko <jan.nikitenko@gmail.com>2008-03-13 15:32:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-03-13 16:11:43 -0400
commit2cfb8ce8c87802181ade74f5dadb3dded9bb4c7e (patch)
tree166b0cefcb24ac2b11667b8783db23c1efcb27a2 /drivers/spi/spi_bitbang.c
parent40369e1cdb71287662213ae214842899e77a0544 (diff)
spi_bitbang: short transfer status fix
SPI controller drivers return number of bytes actually transfered from bitbang->txrx_bufs() method. This updates handling of short transfers (where the transfer size is less than requested): - Even zero byte short transfers should report errors; - Include short transfers in the total of transferred bytes; - Use EREMOTEIO (like USB) not EMSGSIZE to report short transfers Short transfers don't normally mean invalid message sizes, but if the underlying controller driver needs to use EMSGSIZE it can still do so. [db: fix two more minor issues] Signed-off-by: Jan Nikitenko <jan.nikitenko@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/spi_bitbang.c')
-rw-r--r--drivers/spi/spi_bitbang.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index f7f8580edad8..71e881419cdd 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -344,12 +344,14 @@ static void bitbang_work(struct work_struct *work)
344 t->rx_dma = t->tx_dma = 0; 344 t->rx_dma = t->tx_dma = 0;
345 status = bitbang->txrx_bufs(spi, t); 345 status = bitbang->txrx_bufs(spi, t);
346 } 346 }
347 if (status > 0)
348 m->actual_length += status;
347 if (status != t->len) { 349 if (status != t->len) {
348 if (status > 0) 350 /* always report some kind of error */
349 status = -EMSGSIZE; 351 if (status >= 0)
352 status = -EREMOTEIO;
350 break; 353 break;
351 } 354 }
352 m->actual_length += status;
353 status = 0; 355 status = 0;
354 356
355 /* protocol tweaks before next transfer */ 357 /* protocol tweaks before next transfer */