All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Kemnade <andreas@kemnade.info>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	"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 12:37:33 +0200	[thread overview]
Message-ID: <20230427123733.15ad4aa3@aktux> (raw)
In-Reply-To: <52453352-74bd-979f-03b6-322489800538@csgroup.eu>

On Thu, 27 Apr 2023 06:20:34 +0000
Christophe Leroy <christophe.leroy@csgroup.eu> wrote:

> 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.
> 
and that not with simple continue or base might simply stay at DYNAMIC_BASE.

I will send a v2 of this patch with refined logic.

Regards,
Andreas

  reply	other threads:[~2023-04-27 10:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26 22:03 [PATCH] gpiolib: fix allocation of mixed dynamic/static GPIOs Andreas Kemnade
2023-04-27  5:40 ` Christophe Leroy
2023-04-27  6:00   ` Andy Shevchenko
2023-04-27  6:20     ` Christophe Leroy
2023-04-27 10:37       ` Andreas Kemnade [this message]
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=20230427123733.15ad4aa3@aktux \
    --to=andreas@kemnade.info \
    --cc=aaro.koskinen@iki.fi \
    --cc=andy.shevchenko@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=christophe.leroy@csgroup.eu \
    --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 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.