lkml.org 
[lkml]   [2022]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 3/3] iio: addac: ad74413r: correct comparator gpio getters mask usage
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.

> + 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)

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2022-01-09 13:15    [W:0.083 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site