From: Cosmin Tanislav <demonsingur@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: cosmin.tanislav@analog.com, Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Rob Herring <robh+dt@kernel.org>,
linux-iio <linux-iio@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH 3/3] iio: addac: ad74413r: correct comparator gpio getters mask usage
Date: Mon, 10 Jan 2022 18:55:50 +0200 [thread overview]
Message-ID: <953f1539-a4fc-ab8e-bcf9-287ac91ba42b@gmail.com> (raw)
In-Reply-To: <CAHp75Vcq76iaHHp2oXFsaE4d_+EGH87DxQRYu7Ys-adN_4mmUw@mail.gmail.com>
On 1/9/22 14:13, Andy Shevchenko wrote:
> On Fri, Jan 7, 2022 at 7:34 AM Cosmin Tanislav <demonsingur@gmail.com> wrote:
>>
>> The value of the GPIOs is currently altered using offsets rather
>> than masks. Make use the BIT macro to turn the offsets into masks.
>
> of the
>
> ...
>
>> - status &= AD74413R_DIN_COMP_OUT_SHIFT_X(real_offset);
>> + status &= BIT(real_offset);
>
> But this is completely different.
What do you mean by this is completely different?
It was broken before, it is fixed now. Indeed, I'm missing
the Fixes tag, if that's what you meant.
>
>> + bitmap_zero(bits, chip->ngpio);
>> +
>> for_each_set_bit(offset, mask, chip->ngpio) {
>> unsigned int real_offset = st->comp_gpio_offsets[offset];
>>
>> if (val & BIT(real_offset))
>> - *bits |= offset;
>> + *bits |= BIT(offset);
>
> So, how was it working before? If it fixes, it should go with the
> Fixes tag and before patch 2.
>
>> }
>
> On top of that, you may try to see if one of bitmap_*() APIs can be
> suitable here to perform the above in a more optimal way.
> (At least this conditional can be replaced with __asign_bit() call,
> but I think refactoring the entire loop may reveal a better approach)
>
I can replace the if and bitmap_zero with __assign_bit, as you
suggested. I'm not familiar with bitmap APIs, do you have a suggestion?
next prev parent reply other threads:[~2022-01-10 16:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 6:22 [PATCH 1/3] iio: addac: ad74413r: use ngpio size when iterating over mask Cosmin Tanislav
2022-01-06 6:22 ` [PATCH 2/3] iio: addac: ad74413r: for_each_set_bit_from -> for_each_set_bit Cosmin Tanislav
2022-01-06 6:22 ` [PATCH 3/3] iio: addac: ad74413r: correct comparator gpio getters mask usage Cosmin Tanislav
2022-01-09 12:13 ` Andy Shevchenko
2022-01-09 12:14 ` Andy Shevchenko
2022-01-10 16:55 ` Cosmin Tanislav [this message]
2022-01-10 18:22 ` Andy Shevchenko
2022-01-09 12:07 ` [PATCH 1/3] iio: addac: ad74413r: use ngpio size when iterating over mask Andy Shevchenko
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=953f1539-a4fc-ab8e-bcf9-287ac91ba42b@gmail.com \
--to=demonsingur@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=cosmin.tanislav@analog.com \
--cc=devicetree@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox