lkml.org 
[lkml]   [2020]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 07/15] iio: sx9310: Use long instead of int for channel bitmaps
From
Date
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;

\
 
 \ /
  Last update: 2020-07-28 21:38    [W:0.396 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site