spi_bitbang: short transfer status fix
authorJan Nikitenko <jan.nikitenko@gmail.com>
Thu, 13 Mar 2008 19:32:39 +0000 (12:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Mar 2008 20:11:43 +0000 (13:11 -0700)
commit2cfb8ce8c87802181ade74f5dadb3dded9bb4c7e
tree166b0cefcb24ac2b11667b8783db23c1efcb27a2
parent40369e1cdb71287662213ae214842899e77a0544
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>
drivers/spi/spi_bitbang.c