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@xxxxxxxxxxx> > Fixes: 12410e95903c ("gpio: nomadik: use devm_platform_ioremap_resource() helper") > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> 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@xxxxxxxxxxx> Regards, -- Théo Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com