Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Qianfeng Rong and committed by
Mark Brown
1bdc7160 a7500503

+2 -4
+2 -4
drivers/spi/spi-npcm-fiu.c
··· 13 13 #include <linux/vmalloc.h> 14 14 #include <linux/regmap.h> 15 15 #include <linux/of.h> 16 + #include <linux/minmax.h> 16 17 #include <linux/spi/spi-mem.h> 17 18 #include <linux/mfd/syscon.h> 18 19 ··· 499 498 500 499 do { 501 500 addr = ((u32)op->addr.val + i); 502 - if (currlen < 16) 503 - readlen = currlen; 504 - else 505 - readlen = 16; 501 + readlen = min_t(int, currlen, 16); 506 502 507 503 buf_ptr = data + i; 508 504 ret = npcm_fiu_uma_read(mem, op, addr, true, buf_ptr,