* [PATCH v3] spi: spi-fsl-lpspi: convert min_t() to simple min()
@ 2025-12-10 10:50 Carlos Song
2025-12-10 15:21 ` Frank Li
2025-12-15 13:59 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Carlos Song @ 2025-12-10 10:50 UTC (permalink / raw)
To: Frank.Li, broonie, daniel.baluta, carlos.song, david.laight,
andriy.shevchenko
Cc: linux-spi, imx, linux-kernel, David Laight
Current min() has supported comparison by normal integer promotion rules,
so explicit type casts or min_t() are not needed.
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Reviewed-by: David Laight <david.laight.linux@gmail.com>
---
Change since v2:
* remove 'Fixes' tag according to David's comment
* add review-by tag.
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;
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] spi: spi-fsl-lpspi: convert min_t() to simple min()
2025-12-10 10:50 [PATCH v3] spi: spi-fsl-lpspi: convert min_t() to simple min() Carlos Song
@ 2025-12-10 15:21 ` Frank Li
2025-12-15 13:59 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2025-12-10 15:21 UTC (permalink / raw)
To: Carlos Song
Cc: broonie, daniel.baluta, david.laight, andriy.shevchenko,
linux-spi, imx, linux-kernel, David Laight
On Wed, Dec 10, 2025 at 06:50:01PM +0800, Carlos Song wrote:
> Current min() has supported comparison by normal integer promotion rules,
> so explicit type casts or min_t() are not needed.
>
> Signed-off-by: Carlos Song <carlos.song@nxp.com>
> Reviewed-by: David Laight <david.laight.linux@gmail.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> Change since v2:
> * remove 'Fixes' tag according to David's comment
> * add review-by tag.
> 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;
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] spi: spi-fsl-lpspi: convert min_t() to simple min()
2025-12-10 10:50 [PATCH v3] spi: spi-fsl-lpspi: convert min_t() to simple min() Carlos Song
2025-12-10 15:21 ` Frank Li
@ 2025-12-15 13:59 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-12-15 13:59 UTC (permalink / raw)
To: Frank.Li, daniel.baluta, david.laight, andriy.shevchenko, Carlos Song
Cc: linux-spi, imx, linux-kernel, David Laight
On Wed, 10 Dec 2025 18:50:01 +0800, Carlos Song wrote:
> Current min() has supported comparison by normal integer promotion rules,
> so explicit type casts or min_t() are not needed.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: spi-fsl-lpspi: convert min_t() to simple min()
commit: b884e34994ca41f7b7819f3c41b78ff494787b27
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-15 13:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-10 10:50 [PATCH v3] spi: spi-fsl-lpspi: convert min_t() to simple min() Carlos Song
2025-12-10 15:21 ` Frank Li
2025-12-15 13:59 ` Mark Brown
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®