[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aThLyQ2ZqEyL2tI6@lizhi-Precision-Tower-5810>
Date: Tue, 9 Dec 2025 11:18:17 -0500
From: Frank Li <Frank.li@....com>
To: Carlos Song <carlos.song@....com>
Cc: broonie@...nel.org, daniel.baluta@....com, andriy.shevchenko@...el.com,
david.laight@...box.com, linux-spi@...r.kernel.org,
imx@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spi: spi-fsl-lpspi: convert min_t() to simple min()
On Tue, Dec 09, 2025 at 01:56:34PM +0800, Carlos Song wrote:
> Convert min_t() to simple min() for better readability.
>
Ref below thread.
https://lore.kernel.org/all/20251119224140.8616-1-david.laight.linux@gmail.com/
at least need summary some important information here even it is simple
change.
Frank
> Fixes: 9f0c21bac5a8 ("spi: spi-fsl-lpspi: fix watermark truncation caused by type cast")
> Signed-off-by: Carlos Song <carlos.song@....com>
> ---
> drivers/spi/spi-fsl-lpspi.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
> index 065456aba2ae..01c674d466ed 100644
> --- a/drivers/spi/spi-fsl-lpspi.c
> +++ b/drivers/spi/spi-fsl-lpspi.c
> @@ -489,12 +489,9 @@ static int fsl_lpspi_setup_transfer(struct spi_controller *controller,
> /*
> * t->len is 'unsigned' and txfifosize and watermrk is 'u8', force
> * type cast is inevitable. When len > 255, len will be truncated in min_t(),
> - * it caused wrong watermark set. 'unsigned int' is as the designated type
> - * for min_t() to avoid truncation.
> + * it caused wrong watermark set. Simple min() helps to do type cast.
> */
> - fsl_lpspi->watermark = min_t(unsigned int,
> - fsl_lpspi->txfifosize,
> - t->len);
> + fsl_lpspi->watermark = min(fsl_lpspi->txfifosize, t->len);
>
> if (fsl_lpspi_can_dma(controller, spi, t))
> fsl_lpspi->usedma = true;
> --
> 2.34.1
>
Powered by blists - more mailing lists