All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>
Cc: <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] gpio: nomadik: Back out some managed resources
Date: Tue, 05 Mar 2024 10:42:58 +0100	[thread overview]
Message-ID: <CZLPVWGIVG99.2DX2ZTGMOSVS5@bootlin.com> (raw)
In-Reply-To: <20240305-fix-nomadik-gpio-v1-1-73162e3a388e@linaro.org>

Hello,

On Tue Mar 5, 2024 at 9:26 AM CET, Linus Walleij wrote:
> Several commits introduce managed resources (devm_*) into the
> nmk_gpio_populate_chip() function.
>
> This isn't always working because when called from the Nomadik pin
> control driver we just want to populate some states for the device as
> the same states are used by the pin control driver.
>
> Some managed resources such as devm_kzalloc() etc will work, as the
> passed in platform device will be used for lifecycle management,
> but in some cases where we used the looked-up platform device
> for the GPIO block, this will cause problems for the combined
> pin control and GPIO driver, because it adds managed resources
> to the GPIO device before it is probed, which is something that
> the device core will not accept, and all of the GPIO blocks will
> refuse to probe:
>
> platform 8012e000.gpio: Resources present before probing
> platform 8012e080.gpio: Resources present before probing
> (...)
>
> Fix this by not tying any managed resources to the looked-up
> gpio_pdev/gpio_dev device, let's just live with the fact that
> these need imperative resource management for now.
>
> Drop in some notes and use a local *dev variable to clarify the
> code.
>
> Cc: Théo Lebrun <theo.lebrun@bootlin.com>
> Fixes: 12410e95903c ("gpio: nomadik: use devm_platform_ioremap_resource() helper")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Thanks Linus for this follow-up. Makes complete sense. Tested on
Mobileye hardware.

This nmk_gpio_populate_chip() function being called by two different
platform drivers makes for a complex setup. I should have been more
wary when modifying it.

Tested-by: Théo Lebrun <theo.lebrun@bootlin.com>

Regards,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2024-03-05  9:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05  8:26 [PATCH] gpio: nomadik: Back out some managed resources Linus Walleij
2024-03-05  9:42 ` Théo Lebrun [this message]
2024-03-05 17:05 ` Andy Shevchenko
2024-03-05 17:43   ` Théo Lebrun

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=CZLPVWGIVG99.2DX2ZTGMOSVS5@bootlin.com \
    --to=theo.lebrun@bootlin.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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.