From: "Nuno Sá" <noname.nuno@gmail.com>
To: "David Lechner" <dlechner@baylibre.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Esteban Blanc" <eblanc@baylibre.com>,
"Jonathan Cameron" <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] iio: adc: ad4030: remove some duplicate code
Date: Tue, 11 Mar 2025 09:27:10 +0000 [thread overview]
Message-ID: <2faccc64193c7a6e3585bfbd5a91a1968d0fe8da.camel@gmail.com> (raw)
In-Reply-To: <20250310-iio-adc-ad4030-check-scan-type-err-v1-2-589e4ebd9711@baylibre.com>
On Mon, 2025-03-10 at 15:43 -0500, David Lechner wrote:
> Remove some duplicate code in the ad4030_get_chan_scale() function by
> simplifying the if statement.
>
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> drivers/iio/adc/ad4030.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/adc/ad4030.c b/drivers/iio/adc/ad4030.c
> index
> af7a817e8273496e8856a5ba1a9c2e66a11f0a84..f24b46164a477f9b6b5c93ffeba0a335f7b3
> de5a 100644
> --- a/drivers/iio/adc/ad4030.c
> +++ b/drivers/iio/adc/ad4030.c
> @@ -394,14 +394,13 @@ static int ad4030_get_chan_scale(struct iio_dev
> *indio_dev,
> if (IS_ERR(scan_type))
> return PTR_ERR(scan_type);
>
> - if (chan->differential) {
> + if (chan->differential)
> *val = (st->vref_uv * 2) / MILLI;
> - *val2 = scan_type->realbits;
> - return IIO_VAL_FRACTIONAL_LOG2;
> - }
> + else
> + *val = st->vref_uv / MILLI;
>
> - *val = st->vref_uv / MILLI;
> *val2 = scan_type->realbits;
> +
> return IIO_VAL_FRACTIONAL_LOG2;
> }
>
>
next prev parent reply other threads:[~2025-03-11 9:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 20:43 [PATCH 0/5] iio: adc: ad4030: scan_type cleanups David Lechner
2025-03-10 20:43 ` [PATCH 1/5] iio: adc: ad4030: check scan_type for error David Lechner
2025-03-11 9:26 ` Nuno Sá
2025-03-10 20:43 ` [PATCH 2/5] iio: adc: ad4030: remove some duplicate code David Lechner
2025-03-11 9:27 ` Nuno Sá [this message]
2025-03-10 20:43 ` [PATCH 3/5] iio: adc: ad4030: move setting mode to update_scan_mode David Lechner
2025-03-11 9:27 ` Nuno Sá
2025-03-10 20:43 ` [PATCH 4/5] iio: adc: ad4030: don't store scan_type in state David Lechner
2025-03-11 9:29 ` Nuno Sá
2025-03-10 20:43 ` [PATCH 5/5] iio: adc: ad4030: explain rearranging raw sample data David Lechner
2025-03-11 9:30 ` Nuno Sá
2025-03-15 13:04 ` Jonathan Cameron
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=2faccc64193c7a6e3585bfbd5a91a1968d0fe8da.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=dlechner@baylibre.com \
--cc=eblanc@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).