Re: [PATCH 07/15] iio: sx9310: Use long instead of int for channel bitmaps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux