linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Andrei Lalaev <andrei.lalaev@emlid.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gpiolib: of: fix bounds check for valid mask
Date: Mon, 11 Apr 2022 19:55:43 +0300	[thread overview]
Message-ID: <CAHp75VePiCm6wH7aXcbnrt-4nntqx99s45wYk3+C2AKs=Usang@mail.gmail.com> (raw)
In-Reply-To: <20220411144602.127262-1-andrei.lalaev@emlid.com>

On Mon, Apr 11, 2022 at 5:46 PM Andrei Lalaev <andrei.lalaev@emlid.com> wrote:

...

> > What does documentation tell about it?
>
> Documentation (devicetree/bindings/gpio/gpio.txt line 152) tells that
> "This property indicates the start and size of the GPIOs that can't be used."
> And the example (line 178) at the same file shows that the second element of
> a tuple is the count: "gpio-reserved-ranges = <0 4>, <12 2>;"
>
> > Does it need to be fixed?

This question was related to the documentation contents.

> I think so, because the current implementation doesn't reserve some GPIO ranges.
> For example, we have 20 GPIOs and we want to reserve GPIOs from 14 to 19.
> In this case the "reserved-ranges" looks like "<14 6>" but the
> "of_gpiochip_init_valid_mask" drops the range and this is not expected behavior.

On top of that, it would be nice to be sure that at least all current
in-kernel users (meaning all DTS provided so far by the kernel) do
interpret it as start,size. Otherwise this will be an (unacceptable)
ABI change and hence documentation would need to be fixed with
variable names in the code.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2022-04-11 17:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11  6:33 [PATCH] gpiolib: of: fix bounds check for valid mask Andrei Lalaev
2022-04-11 10:48 ` Bartosz Golaszewski
2022-04-11 12:12 ` Andy Shevchenko
2022-04-11 14:46   ` Andrei Lalaev
2022-04-11 16:55     ` Andy Shevchenko [this message]
2022-04-12  7:03       ` Andrei Lalaev
2022-04-12  8:35         ` Andy Shevchenko
2022-04-12  8:28   ` Bartosz Golaszewski
2022-04-12  8:36     ` Andy Shevchenko

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='CAHp75VePiCm6wH7aXcbnrt-4nntqx99s45wYk3+C2AKs=Usang@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=andrei.lalaev@emlid.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).