diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2021-07-16 19:39:27 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-07-19 13:58:55 +0200 |
commit | bd9616996bb8cd6fbceedf00f1aa72fd9a845519 (patch) | |
tree | a6f8d2a730766695d1474d16f38be4ed75596c78 /drivers/spi | |
parent | spi: pxa2xx: Reuse int_stop_and_reset() in couple of places (diff) | |
download | linux-bd9616996bb8cd6fbceedf00f1aa72fd9a845519.tar.xz linux-bd9616996bb8cd6fbceedf00f1aa72fd9a845519.zip |
spi: imx: Simplify logic in spi_imx_push()
For each usage of fifo_words it is clear if ->dynamic_burst is true or
not. This can be used to simplify the function a bit.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210716173927.2050620-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-imx.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 4aee3db6d6df..593b63be73de 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1038,12 +1038,8 @@ static void spi_imx_set_burst_len(struct spi_imx_data *spi_imx, int n_bits) static void spi_imx_push(struct spi_imx_data *spi_imx) { - unsigned int burst_len, fifo_words; + unsigned int burst_len; - if (spi_imx->dynamic_burst) - fifo_words = 4; - else - fifo_words = spi_imx_bytes_per_word(spi_imx->bits_per_word); /* * Reload the FIFO when the remaining bytes to be transferred in the * current burst is 0. This only applies when bits_per_word is a @@ -1062,7 +1058,7 @@ static void spi_imx_push(struct spi_imx_data *spi_imx) spi_imx->remainder = burst_len; } else { - spi_imx->remainder = fifo_words; + spi_imx->remainder = spi_imx_bytes_per_word(spi_imx->bits_per_word); } } @@ -1070,8 +1066,7 @@ static void spi_imx_push(struct spi_imx_data *spi_imx) if (!spi_imx->count) break; if (spi_imx->dynamic_burst && - spi_imx->txfifo >= DIV_ROUND_UP(spi_imx->remainder, - fifo_words)) + spi_imx->txfifo >= DIV_ROUND_UP(spi_imx->remainder, 4)) break; spi_imx->tx(spi_imx); spi_imx->txfifo++; |