[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <159596502543.1360974.12774369809044939362@swboyd.mtv.corp.google.com>
Date: Tue, 28 Jul 2020 12:37:05 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Daniel Campello <campello@...omium.org>,
LKML <devicetree@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Cc: Jonathan Cameron <jic23@...nel.org>,
Daniel Campello <campello@...omium.org>,
Douglas Anderson <dianders@...omium.org>,
Enrico Granata <egranata@...omium.org>,
Gwendal Grignou <gwendal@...omium.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
linux-iio@...r.kernel.org
Subject: Re: [PATCH 07/15] iio: sx9310: Use long instead of int for channel bitmaps
Quoting Daniel Campello (2020-07-28 08:12:50)
> diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
> index fb5c16f2aa6b1a..2465064971d0a7 100644
> --- a/drivers/iio/proximity/sx9310.c
> +++ b/drivers/iio/proximity/sx9310.c
> @@ -538,13 +540,13 @@ static void sx9310_push_events(struct iio_dev *indio_dev)
> return;
> }
>
> - for (chan = 0; chan < SX9310_NUM_CHANNELS; chan++) {
> + for_each_set_bit(chan, &data->chan_event, SX9310_NUM_CHANNELS) {
> int dir;
> u64 ev;
> - bool new_prox = val & BIT(chan);
> + bool new_prox;
> +
> + new_prox = val & BIT(chan);
>
> - if (!(data->chan_event & BIT(chan)))
> - continue;
> if (new_prox == data->prox_stat[chan])
Why not make 'prox_stat' a bitmap too and then xor them to iterate over
that bitmap instead?
> /* No change on this channel. */
> continue;
Powered by blists - more mailing lists