diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2015-01-28 07:23:42 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-28 14:42:42 -0500 |
commit | a87cbca0acef0b1f57e4b216f1965468ee521cd3 (patch) | |
tree | a3a9668ab34f39cb78ed512fcebed228df904085 /drivers/spi/spi-xilinx.c | |
parent | 899929babac9d85ddd3f86b813a8b8654ab93523 (diff) |
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.c | 6 |
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) | |||
248 | xspi->remaining_bytes = t->len; | 248 | xspi->remaining_bytes = t->len; |
249 | reinit_completion(&xspi->done); | 249 | reinit_completion(&xspi->done); |
250 | 250 | ||
251 | for (;;) { | 251 | while (xspi->remaining_bytes) { |
252 | u16 cr; | 252 | u16 cr; |
253 | int n_words; | 253 | int n_words; |
254 | 254 | ||
@@ -278,10 +278,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
278 | /* Read out all the data from the Rx FIFO */ | 278 | /* Read out all the data from the Rx FIFO */ |
279 | while (n_words--) | 279 | while (n_words--) |
280 | xspi->rx_fn(xspi); | 280 | xspi->rx_fn(xspi); |
281 | |||
282 | /* See if there is more data to send */ | ||
283 | if (xspi->remaining_bytes <= 0) | ||
284 | break; | ||
285 | } | 281 | } |
286 | 282 | ||
287 | return t->len - xspi->remaining_bytes; | 283 | return t->len - xspi->remaining_bytes; |