From: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: "Marcelo Schmitt" <marcelo.schmitt@analog.com>,
linux-iio@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
"Andy Shevchenko" <andy@kernel.org>,
"Dan Carpenter" <dan.carpenter@linaro.org>,
"David Lechner" <dlechner@baylibre.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <michael.hennerich@analog.com>
Subject: Re: [PATCH] iio: adc: ad4170-4: Correctly update filter_fs after filter type change
Date: Sun, 20 Jul 2025 10:33:00 -0300 [thread overview]
Message-ID: <aHzwDHcmU23Er-35@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <43ed8918-0116-4e8b-943c-2e62906b1fdb@web.de>
On 07/20, Markus Elfring wrote:
> …
> > +++ b/drivers/iio/adc/ad4170-4.c
> > @@ -880,10 +880,12 @@ static int ad4170_set_filter_type(struct iio_dev *indio_dev,
> > return -EBUSY;
> >
> > if (val == AD4170_SINC5_AVG || val == AD4170_SINC3)
> > - setup->filter_fs = clamp(val, AD4170_SINC3_MIN_FS,
> > + setup->filter_fs = clamp(setup->filter_fs,
> > + AD4170_SINC3_MIN_FS,
> > AD4170_SINC3_MAX_FS);
> > else
> > - setup->filter_fs = clamp(val, AD4170_SINC5_MIN_FS,
> > + setup->filter_fs = clamp(setup->filter_fs,
> > + AD4170_SINC5_MIN_FS,
> > AD4170_SINC5_MAX_FS);
> >
> > setup->filter &= ~AD4170_FILTER_FILTER_TYPE_MSK;
>
> How do you think about to use the following code variant?
>
> setup->filter_fs = (val == AD4170_SINC5_AVG || val == AD4170_SINC3)
> ? clamp(setup->filter_fs,
> AD4170_SINC3_MIN_FS, AD4170_SINC3_MAX_FS)
> : clamp(setup->filter_fs,
> AD4170_SINC5_MIN_FS, AD4170_SINC5_MAX_FS);
>
Looks good to me.
I'll send v2 with that.
Thanks,
Marcelo
prev parent reply other threads:[~2025-07-20 13:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-19 20:36 Marcelo Schmitt
2025-07-20 8:48 ` Markus Elfring
2025-07-20 13:33 ` Marcelo Schmitt [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=aHzwDHcmU23Er-35@debian-BULLSEYE-live-builder-AMD64 \
--to=marcelo.schmitt1@gmail.com \
--cc=Markus.Elfring@web.de \
--cc=andy@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt@analog.com \
--cc=michael.hennerich@analog.com \
--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 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®