From: Liam Beguin <liambeguin@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Peter Rosin <peda@axentia.se>,
Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>,
stable@vger.kernel.org
Subject: Re: [PATCH] iio: afe: rescale: Fix logic bug
Date: Wed, 25 May 2022 21:29:27 -0400 [thread overview]
Message-ID: <Yo7X9w6i3uiNZqpW@shaak> (raw)
In-Reply-To: <20220524075448.140238-1-linus.walleij@linaro.org>
On Tue, May 24, 2022 at 09:54:48AM +0200, Linus Walleij wrote:
> When introducing support for processed channels I needed
> to invert the expression:
>
> if (!iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) ||
> !iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE))
> dev_err(dev, "source channel does not support raw/scale\n");
>
> To the inverse, meaning detect when we can usse raw+scale
> rather than when we can not. This was the result:
>
> if (iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) ||
> iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE))
> dev_info(dev, "using raw+scale source channel\n");
>
> Ooops. Spot the error. Yep old George Boole came up and bit me.
> That should be an &&.
>
> The current code "mostly works" because we have not run into
> systems supporting only raw but not scale or only scale but not
> raw, and I doubt there are few using the rescaler on anything
> such, but let's fix the logic.
Maybe `iio: afe: rescale: Fix boolean logic bug` if you're resending,
otherwise,
Reviewed-by: Liam Beguin <liambeguin@gmail.com>
Thanks,
Liam
> Cc: Liam Beguin <liambeguin@gmail.com>
> Cc: stable@vger.kernel.org
> Fixes: 53ebee949980 ("iio: afe: iio-rescale: Support processed channels")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/iio/afe/iio-rescale.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
> index 7e511293d6d1..dc426e1484f0 100644
> --- a/drivers/iio/afe/iio-rescale.c
> +++ b/drivers/iio/afe/iio-rescale.c
> @@ -278,7 +278,7 @@ static int rescale_configure_channel(struct device *dev,
> chan->ext_info = rescale->ext_info;
> chan->type = rescale->cfg->type;
>
> - if (iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) ||
> + if (iio_channel_has_info(schan, IIO_CHAN_INFO_RAW) &&
> iio_channel_has_info(schan, IIO_CHAN_INFO_SCALE)) {
> dev_info(dev, "using raw+scale source channel\n");
> } else if (iio_channel_has_info(schan, IIO_CHAN_INFO_PROCESSED)) {
> --
> 2.35.3
>
next prev parent reply other threads:[~2022-05-26 1:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 7:54 [PATCH] iio: afe: rescale: Fix logic bug Linus Walleij
2022-05-25 14:08 ` Peter Rosin
2022-05-26 1:29 ` Liam Beguin [this message]
2022-05-28 17:01 ` Jonathan Cameron
2023-08-09 13:43 ` Mighty
2023-08-10 8:56 ` Linus Walleij
2023-08-21 16:45 ` Mighty
2023-08-23 8:21 ` Linus Walleij
2023-08-24 7:39 ` Mighty
2023-08-24 8:24 ` Linus Walleij
2023-08-24 8:28 ` Linus Walleij
2023-08-28 18:18 ` Jonathan Cameron
2023-08-29 7:17 ` Linus Walleij
2023-08-29 11:37 ` Jonathan Cameron
2023-09-03 17:10 ` Mighty
2023-09-04 7:20 ` Linus Walleij
2023-09-03 18:04 ` Mighty
2023-09-04 7:25 ` Linus Walleij
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=Yo7X9w6i3uiNZqpW@shaak \
--to=liambeguin@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=peda@axentia.se \
--cc=stable@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.