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>
pull/1354/merge
Qianfeng Rong 2025-08-15 16:21:16 +08:00 committed by Mark Brown
parent a750050349
commit 1bdc716023
1 changed files with 2 additions and 4 deletions

View File

@ -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,