summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-xilinx.c
diff options
context:
space:
mode:
authorRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>2015-01-28 13:23:42 +0100
committerMark Brown <broonie@kernel.org>2015-01-28 20:42:42 +0100
commita87cbca0acef0b1f57e4b216f1965468ee521cd3 (patch)
treea3a9668ab34f39cb78ed512fcebed228df904085 /drivers/spi/spi-xilinx.c
parentspi/xilinx: Leave the IRQ always enabled. (diff)
downloadlinux-a87cbca0acef0b1f57e4b216f1965468ee521cd3.tar.xz
linux-a87cbca0acef0b1f57e4b216f1965468ee521cd3.zip
spi/xilinx: Code cleanup
On the transmission loop, check for remaining bytes at the loop condition. This way we can handle transmissions of 0 bytes and clean the code. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-xilinx.c')
-rw-r--r--drivers/spi/spi-xilinx.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index d933207c212c..a0f7c9d4a349 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -248,7 +248,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
xspi->remaining_bytes = t->len;
reinit_completion(&xspi->done);
- for (;;) {
+ while (xspi->remaining_bytes) {
u16 cr;
int n_words;
@@ -278,10 +278,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
/* Read out all the data from the Rx FIFO */
while (n_words--)
xspi->rx_fn(xspi);
-
- /* See if there is more data to send */
- if (xspi->remaining_bytes <= 0)
- break;
}
return t->len - xspi->remaining_bytes;