mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
spi: spi-fsl-lpspi: use min_t() to improve code
Use min_t() to reduce the code in fsl_lpspi_setup_transfer() and improve its readability. Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> Link: https://patch.msgid.link/20250815082118.586422-2-rongqianfeng@vivo.com Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
c17b750b3a
commit
a750050349
@@ -25,6 +25,7 @@
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/spi/spi_bitbang.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/minmax.h>
|
||||
|
||||
#define DRIVER_NAME "fsl_lpspi"
|
||||
|
||||
@@ -475,10 +476,9 @@ static int fsl_lpspi_setup_transfer(struct spi_controller *controller,
|
||||
fsl_lpspi->tx = fsl_lpspi_buf_tx_u32;
|
||||
}
|
||||
|
||||
if (t->len <= fsl_lpspi->txfifosize)
|
||||
fsl_lpspi->watermark = t->len;
|
||||
else
|
||||
fsl_lpspi->watermark = fsl_lpspi->txfifosize;
|
||||
fsl_lpspi->watermark = min_t(typeof(fsl_lpspi->watermark),
|
||||
fsl_lpspi->txfifosize,
|
||||
t->len);
|
||||
|
||||
if (fsl_lpspi_can_dma(controller, spi, t))
|
||||
fsl_lpspi->usedma = true;
|
||||
|
||||
Reference in New Issue
Block a user