mirror of https://gitee.com/openkylin/linux.git
spi: spi-sun6i: sun6i_spi_fill_fifo(): remove not needed length argument
The function sun6i_spi_fill_fifo() is called with a length argument of "sspi->fifo_depth" and "SUN6I_FIFO_DEPTH". The driver reads the number of free bytes in the FIFO from the hardware and uses the length argument to limit this value. This is not needed as the number of free bytes in the FIFO is always less or equal the depth of the FIFO. This patch removes the length argument and check. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20200706143443.9855-9-mkl@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
92a52ee893
commit
e4e8ca3f43
|
@ -150,15 +150,16 @@ static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void sun6i_spi_fill_fifo(struct sun6i_spi *sspi, int len)
|
||||
static inline void sun6i_spi_fill_fifo(struct sun6i_spi *sspi)
|
||||
{
|
||||
u32 cnt;
|
||||
int len;
|
||||
u8 byte;
|
||||
|
||||
/* See how much data we can fit */
|
||||
cnt = sspi->fifo_depth - sun6i_spi_get_tx_fifo_count(sspi);
|
||||
|
||||
len = min3(len, (int)cnt, sspi->len);
|
||||
len = min((int)cnt, sspi->len);
|
||||
|
||||
while (len--) {
|
||||
byte = sspi->tx_buf ? *sspi->tx_buf++ : 0;
|
||||
|
@ -306,7 +307,7 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
|
|||
sun6i_spi_write(sspi, SUN6I_BURST_CTL_CNT_REG, tx_len);
|
||||
|
||||
/* Fill the TX FIFO */
|
||||
sun6i_spi_fill_fifo(sspi, sspi->fifo_depth);
|
||||
sun6i_spi_fill_fifo(sspi);
|
||||
|
||||
/* Enable the interrupts */
|
||||
sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, SUN6I_INT_CTL_TC);
|
||||
|
@ -360,7 +361,7 @@ static irqreturn_t sun6i_spi_handler(int irq, void *dev_id)
|
|||
|
||||
/* Transmit FIFO 3/4 empty */
|
||||
if (status & SUN6I_INT_CTL_TF_ERQ) {
|
||||
sun6i_spi_fill_fifo(sspi, SUN6I_FIFO_DEPTH);
|
||||
sun6i_spi_fill_fifo(sspi);
|
||||
|
||||
if (!sspi->len)
|
||||
/* nothing left to transmit */
|
||||
|
|
Loading…
Reference in New Issue