Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a87cbca0 authored by Ricardo Ribalda Delgado's avatar Ricardo Ribalda Delgado Committed by Mark Brown
Browse files

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: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 899929ba
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -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;