]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpio: nomadik: Back out some managed resources
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 5 Mar 2024 22:09:04 +0000 (23:09 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 6 Mar 2024 19:45:20 +0000 (20:45 +0100)
commit5545d5013c0ec96f2a920bdfc681cdd72a570dd8
treecadabb6ba5c639a9cfcb042ada2b0d8dde73e2ec
parentcaddc92c57451d983c7e31e60b961c5aae4ece63
gpio: nomadik: Back out some managed resources

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")
Link: https://lore.kernel.org/r/20240305-fix-nomadik-gpio-v2-1-e5d1fbdc3f5c@linaro.org
[Fixed some last minut print formatting]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-nomadik.c