mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Andreas Kemnade <andreas@kemnade.info>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"brgl@bgdev.pl" <brgl@bgdev.pl>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	": Tony Lindgren" <tony@atomide.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] gpiolib: fix allocation of mixed dynamic/static GPIOs
Date: Thu, 27 Apr 2023 06:20:34 +0000	[thread overview]
Message-ID: <52453352-74bd-979f-03b6-322489800538@csgroup.eu> (raw)
In-Reply-To: <CAHp75Vep8VSirY7mvGGCubNi-O4jS_inTALS3Ei9mQu98RV+7Q@mail.gmail.com>



Le 27/04/2023 à 08:00, Andy Shevchenko a écrit :
> On Thu, Apr 27, 2023 at 8:40 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>>
>>
>> Le 27/04/2023 à 00:03, Andreas Kemnade a écrit :
>>> [Vous ne recevez pas souvent de courriers de andreas@kemnade.info. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>>>
>>> If static allocation and dynamic allocation GPIOs are present,
>>> dynamic allocation pollutes the numberspace for static allocation,
>>> causing static allocation to fail.
>>> Enfore dynamic allocation above GPIO_DYNAMIC_BASE.
>>
>> Hum ....
>>
>> Commit 7b61212f2a07 ("gpiolib: Get rid of ARCH_NR_GPIOS") was supposed
>> to enforce dynamic allocation above GPIO_DYNAMIC_BASE already.
>>
>> Can you describe what is going wrong exactly with the above commit ?
> 
> Above commit only works to the first dynamic allocation, if you need
> more than one with static ones present it mistakenly will give you a
> base _below_ DYNAMIC_BASE.

Ah right, that needs to be fixed.

> 
> However, this change is just PoC I proposed, the conditional and
> action should be slightly different to cover a corner case, when
> statically allocated chip overlaps the DYNAMIC_BASE, i.e. gdev->base <
> DYNAMIC_BASE, while gdev->base + gdev->ngpio >= DYNAMIC_BASE.
> 

Yes you are right, that's gdev->base + gdev->ngpio that should be checked.

Christophe

  reply	other threads:[~2023-04-27  6:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26 22:03 Andreas Kemnade
2023-04-27  5:40 ` Christophe Leroy
2023-04-27  6:00   ` Andy Shevchenko
2023-04-27  6:20     ` Christophe Leroy [this message]
2023-04-27 10:37       ` Andreas Kemnade
2023-04-27 10:46         ` Andy Shevchenko
2023-04-27 10:55           ` Christophe Leroy
2023-04-27 11:01             ` 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=52453352-74bd-979f-03b6-322489800538@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=aaro.koskinen@iki.fi \
    --cc=andreas@kemnade.info \
    --cc=andy.shevchenko@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /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

all inboxes | Powered by JetHome®