diff options
| author | Qianfeng Rong <rongqianfeng@vivo.com> | 2025-08-15 16:21:16 +0800 | 
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-08-18 13:14:03 +0100 | 
| commit | 1bdc716023a78c2c41fdcb3fc37f09da1be4b7df (patch) | |
| tree | 6e875d934eff9bb7da68e4480e1ff58998a55586 | |
| parent | a750050349ea138e3e86c66a8a41de736619b9de (diff) | |
spi: npcm-fiu: use min_t() to improve code
Use min_t() to reduce the code in npcm_fiu_read() and improve its
readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://patch.msgid.link/20250815082118.586422-3-rongqianfeng@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | drivers/spi/spi-npcm-fiu.c | 6 | 
1 files changed, 2 insertions, 4 deletions
| diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c index 67cc1d86de42..cccd17f24775 100644 --- a/drivers/spi/spi-npcm-fiu.c +++ b/drivers/spi/spi-npcm-fiu.c @@ -13,6 +13,7 @@  #include <linux/vmalloc.h>  #include <linux/regmap.h>  #include <linux/of.h> +#include <linux/minmax.h>  #include <linux/spi/spi-mem.h>  #include <linux/mfd/syscon.h> @@ -498,10 +499,7 @@ static int npcm_fiu_read(struct spi_mem *mem, const struct spi_mem_op *op)  	do {  		addr = ((u32)op->addr.val + i); -		if (currlen < 16) -			readlen = currlen; -		else -			readlen = 16; +		readlen = min_t(int, currlen, 16);  		buf_ptr = data + i;  		ret = npcm_fiu_uma_read(mem, op, addr, true, buf_ptr, | 
