From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Andreas Kemnade <andreas@kemnade.info>,
"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
"brgl@bgdev.pl" <brgl@bgdev.pl>,
"andy.shevchenko@gmail.com" <andy.shevchenko@gmail.com>,
"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 05:40:00 +0000 [thread overview]
Message-ID: <f6b261ad-3267-db70-c173-154a12c42bea@csgroup.eu> (raw)
In-Reply-To: <20230426220338.430638-1-andreas@kemnade.info>
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 ?
Thanks
Christophe
>
> Seen on a GTA04 when omap-gpio (static) and twl-gpio (dynamic)
> raced.
> On that device it is fixed invasively by
> commit 92bf78b33b0b4 ("gpio: omap: use dynamic allocation of base")
> but lets also fix that for devices where there is still
> a mixture of static and dynamic allocation.
>
> Fixes: 7b61212f2a07 ("gpiolib: Get rid of ARCH_NR_GPIOS")
> Suggested-by: andy.shevchenko@gmail.com
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> drivers/gpio/gpiolib.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 19bd23044b017..18b68d0aec7db 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -188,6 +188,10 @@ static int gpiochip_find_base(int ngpio)
> int base = GPIO_DYNAMIC_BASE;
>
> list_for_each_entry(gdev, &gpio_devices, list) {
> + /* do not pollute area for static allocation */
> + if (gdev->base < GPIO_DYNAMIC_BASE)
> + continue;
> +
> /* found a free space? */
> if (gdev->base >= base + ngpio)
> break;
> --
> 2.39.2
>
next prev parent reply other threads:[~2023-04-27 5:40 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 [this message]
2023-04-27 6:00 ` Andy Shevchenko
2023-04-27 6:20 ` Christophe Leroy
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=f6b261ad-3267-db70-c173-154a12c42bea@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;
as well as URLs for NNTP newsgroup(s).