Skip to content

Commit

Permalink
spi/xilinx: Make spi_tx and spi_rx simmetric
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ricardo Ribalda Delgado authored and Mark Brown committed Jan 28, 2015
1 parent 24ba5e5 commit c309294
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/spi/spi-xilinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ static unsigned int xspi_read32_be(void __iomem *addr)

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;
}
Expand Down Expand Up @@ -230,10 +234,7 @@ static void xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi, int n_words)
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;
}

Expand Down

0 comments on commit c309294

Please sign in to comment.