From: david laight <david.laight@runbox.com>
To: Carlos Song <carlos.song@nxp.com>
Cc: Frank.Li@nxp.com, broonie@kernel.org, daniel.baluta@nxp.com,
andriy.shevchenko@intel.com, linux-spi@vger.kernel.org,
imx@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] spi: spi-fsl-lpspi: convert min_t() to simple min()
Date: Wed, 10 Dec 2025 09:49:46 +0000 [thread overview]
Message-ID: <20251210094946.6823aef2@pumpkin> (raw)
In-Reply-To: <20251210074115.3883180-1-carlos.song@nxp.com>
On Wed, 10 Dec 2025 15:41:15 +0800
Carlos Song <carlos.song@nxp.com> wrote:
> Current min() has supported comparison by normal integer promotion rules,
> so explicit type casts or min_t() are not needed.
>
> Fixes: 9f0c21bac5a8 ("spi: spi-fsl-lpspi: fix watermark truncation caused by type cast")
I don't think it needs a 'Fixes' tag since it is just a cleanup, but apart from that:
Reviewed-by: David Laight <david.laight.linux@gmail.com>
> Signed-off-by: Carlos Song <carlos.song@nxp.com>
> ---
> Change since v1:
> * remove unused comment according to David's comment
> * improve commit log according to Frank's comment
> ---
> drivers/spi/spi-fsl-lpspi.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
> index 065456aba2ae..8f45ead23836 100644
> --- a/drivers/spi/spi-fsl-lpspi.c
> +++ b/drivers/spi/spi-fsl-lpspi.c
> @@ -486,15 +486,7 @@ static int fsl_lpspi_setup_transfer(struct spi_controller *controller,
> fsl_lpspi->tx = fsl_lpspi_buf_tx_u32;
> }
>
> - /*
> - * 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.
> - */
> - 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;
next prev parent reply other threads:[~2025-12-10 9:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-10 7:41 [PATCH v2] spi: spi-fsl-lpspi: convert min_t() to simple min() Carlos Song
2025-12-10 9:49 ` david laight [this message]
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=20251210094946.6823aef2@pumpkin \
--to=david.laight@runbox.com \
--cc=Frank.Li@nxp.com \
--cc=andriy.shevchenko@intel.com \
--cc=broonie@kernel.org \
--cc=carlos.song@nxp.com \
--cc=daniel.baluta@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.