All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Ardelean <ardeleanalex@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Gwendal Grignou <gwendal@chromium.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Stephen Boyd <swboyd@chromium.org>,
	Daniel Campello <campello@chromium.org>,
	linux-iio <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v6 1/2] iio: sx9310: Fix access to variable DT array
Date: Mon, 22 Mar 2021 17:16:44 +0200	[thread overview]
Message-ID: <CA+U=DsrMaQif+jC_PJixX=KKJ=t4Cqgn6cGUg6Dpdy8VtAviyw@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VcULMoQaDh5YEcJjJV2n_zSH236A=465Nki8QxPZ4n0jQ@mail.gmail.com>

On Mon, Mar 22, 2021 at 3:29 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Mon, Mar 22, 2021 at 1:16 PM Alexandru Ardelean
> <ardeleanalex@gmail.com> wrote:
> > On Mon, Mar 22, 2021 at 9:33 AM Gwendal Grignou <gwendal@chromium.org> wrote:
>
> ...
>
> > but i think there may be a bug, in the fact that number of elements in
> > the array must be 4 (no more, no less)
> > that is, when reading the DT, it implies a variable array size of 1 to
> > 4, which doesn't seem true in the code;
> >
> > maybe a better idea would be to use of_property_read_***variable***_u32_array()
> > this would allow for a flexible array size;
>
> Wouldn't work in conjunction with the second patch.
> The above API is OF specific.

oh
good point

>
> >                count = of_property_read_variable_u32_array(np,
> > "semtech,combined-sensors",
> >                                            combined, 1,
> > ARRAY_SIZE(combined));   // min 1 , max 4 elements
> >                // count must be int, so that if it is negative, the
> > array doesn't loop;
> >                 for (i = 0; i < count; i++) {
> >                         if (combined[i] <= SX9310_NUM_CHANNELS)
> >                                 comb_mask |= BIT(combined[i]);
> >                 }
> >
>
> --
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2021-03-22 15:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22  7:32 [PATCH v6 0/2] iio: sx9310: Support ACPI properties Gwendal Grignou
2021-03-22  7:32 ` [PATCH v6 1/2] iio: sx9310: Fix access to variable DT array Gwendal Grignou
2021-03-22 11:16   ` Alexandru Ardelean
2021-03-22 13:28     ` Andy Shevchenko
2021-03-22 15:16       ` Alexandru Ardelean [this message]
2021-03-22  7:32 ` [PATCH v6 2/2] iio: sx9310: Support ACPI properties Gwendal Grignou
2021-03-22  9:53   ` Alexandru Ardelean
2021-03-26 18:27     ` Gwendal Grignou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+U=DsrMaQif+jC_PJixX=KKJ=t4Cqgn6cGUg6Dpdy8VtAviyw@mail.gmail.com' \
    --to=ardeleanalex@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=campello@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.