spi/xilinx: Make spi_tx and spi_rx simmetric
spi_rx handles the case where the buffer is null. Nevertheless spi_tx
did not handle it, and was handled by the caller function.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index ac94e54..6ce1066 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -116,6 +116,10 @@
static void xilinx_spi_tx(struct xilinx_spi *xspi)
{
+ if (!xspi->tx_ptr) {
+ xspi->write_fn(0, xspi->regs + XSPI_TXD_OFFSET);
+ return;
+ }
xspi->write_fn(*(u32 *)(xspi->tx_ptr), xspi->regs + XSPI_TXD_OFFSET);
xspi->tx_ptr += xspi->bits_per_word / 8;
}
@@ -230,10 +234,7 @@
xspi->remaining_bytes -= n_words * xspi->bits_per_word / 8;
while (n_words--)
- if (xspi->tx_ptr)
- xilinx_spi_tx(xspi);
- else
- xspi->write_fn(0, xspi->regs + XSPI_TXD_OFFSET);
+ xilinx_spi_tx(xspi);
return;
}