[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vc_3VYAkVcTCAXzqxqFnpQ4Qi=iPSFW_sUjYGO=o6YMtA@mail.gmail.com>
Date: Wed, 29 Jul 2020 10:00:16 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Stephen Boyd <swboyd@...omium.org>
Cc: Daniel Campello <campello@...omium.org>,
LKML <devicetree@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Jonathan Cameron <jic23@...nel.org>,
Douglas Anderson <dianders@...omium.org>,
Enrico Granata <egranata@...omium.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
linux-iio <linux-iio@...r.kernel.org>
Subject: Re: [PATCH v2 07/14] iio: sx9310: Use long instead of int for channel bitmaps
On Wed, Jul 29, 2020 at 4:03 AM Stephen Boyd <swboyd@...omium.org> wrote:
> Quoting Daniel Campello (2020-07-28 16:05:13)
> > Uses for_each_set_bit() macro to loop over channel bitmaps.
...
> > + unsigned long chan_prox_stat;
>
> This can be DECLARE_BITMAP(chan_prox_stat, SX9310_NUM_CHANNELS)
> > + unsigned long chan_read;
> > + unsigned long chan_event;
>
> Same for these?
...
> > + prox_changed = (data->chan_prox_stat ^ val) & data->chan_event;
>
> I was expecting:
>
>
> bitmap_xor(&prox_changed, &data->chan_prox_stat, &val, SX9310_NUM_CHANNELS);
> bitmap_and(&prox_changed, &data->chan_event, SX9310_NUM_CHANNELS);
I agree with this. On a small number of channels (up to 32) it will be
reduced to simple operations, but will leave a possibility to have
more with easy redefine.
(though _and() above misses one argument AFAICT)
...
> > + unsigned long channels = 0;
>
> Use DECLARE_BITMAP(channels, SX9310_NUM_CHANNELS)?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists