From: David Laight <david.laight.linux@gmail.com>
To: Hungyu Lin <dennylin0707@gmail.com>
Cc: jagathjog1996@gmail.com, jic23@kernel.org, dlechner@baylibre.com,
nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: imu: bmi323: use min_t() for watermark limit
Date: Sun, 7 Jun 2026 18:28:01 +0100 [thread overview]
Message-ID: <20260607182801.2624d7fc@pumpkin> (raw)
In-Reply-To: <20260607132200.56495-1-dennylin0707@gmail.com>
On Sun, 7 Jun 2026 13:22:00 +0000
Hungyu Lin <dennylin0707@gmail.com> wrote:
> Use min_t(u32, ...) instead of min() with an explicit cast to
> match the argument types and address a checkpatch.pl warning.
>
> No functional change intended.
Right - provided when you read the code you find the definition of 'val'
and check that it isn't 64bit.
min_t(u32, x, y) is just min((u32)x, (u32)y) so using it adds another cast.
I really don't see why that was ever a good idea...
>
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---
> drivers/iio/imu/bmi323/bmi323_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
> index f3d499423399..38ad05f9ef58 100644
> --- a/drivers/iio/imu/bmi323/bmi323_core.c
> +++ b/drivers/iio/imu/bmi323/bmi323_core.c
> @@ -1128,7 +1128,7 @@ static int bmi323_set_watermark(struct iio_dev *indio_dev, unsigned int val)
> {
> struct bmi323_data *data = iio_priv(indio_dev);
>
> - val = min(val, (u32)BMI323_FIFO_FULL_IN_FRAMES);
> + val = min_t(u32, val, BMI323_FIFO_FULL_IN_FRAMES);
Ignore checkpatch :-)
Or just remove the original (u32) cast.
I really must rewrite the checkpatch 'stuff' about min_t().
-- David
>
> guard(mutex)(&data->mutex);
> data->watermark = val;
prev parent reply other threads:[~2026-06-07 17:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 13:22 [PATCH] iio: imu: bmi323: use min_t() for watermark limit Hungyu Lin
2026-06-07 17:28 ` David Laight [this message]
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=20260607182801.2624d7fc@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=andy@kernel.org \
--cc=dennylin0707@gmail.com \
--cc=dlechner@baylibre.com \
--cc=jagathjog1996@gmail.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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.