From: Frank Li <Frank.li@nxp.com>
To: Carlos Song <carlos.song@nxp.com>
Cc: broonie@kernel.org, daniel.baluta@nxp.com,
andriy.shevchenko@intel.com, david.laight@runbox.com,
linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: spi-fsl-lpspi: convert min_t() to simple min()
Date: Tue, 9 Dec 2025 11:18:17 -0500 [thread overview]
Message-ID: <aThLyQ2ZqEyL2tI6@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20251209055634.3845602-1-carlos.song@nxp.com>
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@nxp.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
>
next prev parent reply other threads:[~2025-12-09 16:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-09 5:56 Carlos Song
2025-12-09 16:18 ` Frank Li [this message]
2025-12-09 19:20 ` david laight
2025-12-15 13:59 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aThLyQ2ZqEyL2tI6@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=andriy.shevchenko@intel.com \
--cc=broonie@kernel.org \
--cc=carlos.song@nxp.com \
--cc=daniel.baluta@nxp.com \
--cc=david.laight@runbox.com \
--cc=imx@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®