From: Jan Nikitenko <[EMAIL PROTECTED]>
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.
Signed-off-by: Jan Nikitenko <[EMAIL PROTECTED]>
[db: fix two more minor issues]
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
drivers/spi/spi_bitbang.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- g26.orig/drivers/spi/spi_bitbang.c 2008-03-10 19:44:19.000000000 -0700
+++ g26/drivers/spi/spi_bitbang.c 2008-03-11 09:24:03.000000000 -0700
@@ -343,12 +343,14 @@ static void bitbang_work(struct work_str
t->rx_dma = t->tx_dma = 0;
status = bitbang->txrx_bufs(spi, t);
}
+ if (status > 0)
+ m->actual_length += status;
if (status != t->len) {
- if (status > 0)
- status = -EMSGSIZE;
+ /* always report some kind of error */
+ if (status >= 0)
+ status = -EREMOTEIO;
break;
}
- m->actual_length += status;
status = 0;
/* protocol tweaks before next transfer */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general