Commit 92a52ee8 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde Committed by Mark Brown

spi: spi-sun6i: sun6i_spi_drain_fifo(): remove not needed length argument

The function sun6i_spi_drain_fifo() is called with a length argument of
"sspi->fifo_depth" and "SUN6I_FIFO_DEPTH".

The driver reads the number of available bytes to read from the FIFO from the
hardware and uses the length argument to limit this value. This is not needed
as the FIFO can contain only the fifo depth number of bytes.

This patch removes the length argument and check.
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Acked-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20200706143443.9855-8-mkl@pengutronix.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5197da03
...@@ -135,16 +135,13 @@ static inline void sun6i_spi_disable_interrupt(struct sun6i_spi *sspi, u32 mask) ...@@ -135,16 +135,13 @@ static inline void sun6i_spi_disable_interrupt(struct sun6i_spi *sspi, u32 mask)
sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, reg); sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, reg);
} }
static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi, int len) static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi)
{ {
u32 cnt; u32 len;
u8 byte; u8 byte;
/* See how much data is available */ /* See how much data is available */
cnt = sun6i_spi_get_rx_fifo_count(sspi); len = sun6i_spi_get_rx_fifo_count(sspi);
if (len > cnt)
len = cnt;
while (len--) { while (len--) {
byte = readb(sspi->base_addr + SUN6I_RXDATA_REG); byte = readb(sspi->base_addr + SUN6I_RXDATA_REG);
...@@ -348,14 +345,14 @@ static irqreturn_t sun6i_spi_handler(int irq, void *dev_id) ...@@ -348,14 +345,14 @@ static irqreturn_t sun6i_spi_handler(int irq, void *dev_id)
/* Transfer complete */ /* Transfer complete */
if (status & SUN6I_INT_CTL_TC) { if (status & SUN6I_INT_CTL_TC) {
sun6i_spi_write(sspi, SUN6I_INT_STA_REG, SUN6I_INT_CTL_TC); sun6i_spi_write(sspi, SUN6I_INT_STA_REG, SUN6I_INT_CTL_TC);
sun6i_spi_drain_fifo(sspi, sspi->fifo_depth); sun6i_spi_drain_fifo(sspi);
complete(&sspi->done); complete(&sspi->done);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/* Receive FIFO 3/4 full */ /* Receive FIFO 3/4 full */
if (status & SUN6I_INT_CTL_RF_RDY) { if (status & SUN6I_INT_CTL_RF_RDY) {
sun6i_spi_drain_fifo(sspi, SUN6I_FIFO_DEPTH); sun6i_spi_drain_fifo(sspi);
/* Only clear the interrupt _after_ draining the FIFO */ /* Only clear the interrupt _after_ draining the FIFO */
sun6i_spi_write(sspi, SUN6I_INT_STA_REG, SUN6I_INT_CTL_RF_RDY); sun6i_spi_write(sspi, SUN6I_INT_STA_REG, SUN6I_INT_CTL_RF_RDY);
return IRQ_HANDLED; return IRQ_HANDLED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment