drivers/pinctrl/cirrus/pinctrl-madera-core.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
Use devm_pinctrl_register_mappings(), so the mappings are automatically
unregistered by the core. If pinctrl_enable() failed during the probe,
pinctrl_mappings were not freed. Now it is done by the core.
Fixes: 218d72a77b0b ("pinctrl: madera: Add driver for Cirrus Logic Madera codecs")
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
---
Compile tested only.
---
drivers/pinctrl/cirrus/pinctrl-madera-core.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c
index 73ec5b9beb49..d19ef13224cc 100644
--- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c
+++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c
@@ -1061,8 +1061,9 @@ static int madera_pin_probe(struct platform_device *pdev)
/* if the configuration is provided through pdata, apply it */
if (pdata->gpio_configs) {
- ret = pinctrl_register_mappings(pdata->gpio_configs,
- pdata->n_gpio_configs);
+ ret = devm_pinctrl_register_mappings(priv->dev,
+ pdata->gpio_configs,
+ pdata->n_gpio_configs);
if (ret)
return dev_err_probe(priv->dev, ret,
"Failed to register pdata mappings\n");
@@ -1081,17 +1082,8 @@ static int madera_pin_probe(struct platform_device *pdev)
return 0;
}
-static void madera_pin_remove(struct platform_device *pdev)
-{
- struct madera_pin_private *priv = platform_get_drvdata(pdev);
-
- if (priv->madera->pdata.gpio_configs)
- pinctrl_unregister_mappings(priv->madera->pdata.gpio_configs);
-}
-
static struct platform_driver madera_pin_driver = {
.probe = madera_pin_probe,
- .remove = madera_pin_remove,
.driver = {
.name = "madera-pinctrl",
},
---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250609-pinctrl-madera-devm-pinctrl-register-mappings-a60a0bcb9154
Best regards,
--
Thomas Richard <thomas.richard@bootlin.com>
On Mon, Jun 9, 2025 at 1:51 PM Thomas Richard
<thomas.richard@bootlin.com> wrote:
> Use devm_pinctrl_register_mappings(), so the mappings are automatically
> unregistered by the core. If pinctrl_enable() failed during the probe,
> pinctrl_mappings were not freed. Now it is done by the core.
>
> Fixes: 218d72a77b0b ("pinctrl: madera: Add driver for Cirrus Logic Madera codecs")
> Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Patch applied as non-urgent for v6.17.
Yours,
Linus Walleij
On 09/06/2025 12:51 pm, Thomas Richard wrote:
> Use devm_pinctrl_register_mappings(), so the mappings are automatically
> unregistered by the core. If pinctrl_enable() failed during the probe,
> pinctrl_mappings were not freed. Now it is done by the core.
>
> Fixes: 218d72a77b0b ("pinctrl: madera: Add driver for Cirrus Logic Madera codecs")
> Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
© 2016 - 2025 Red Hat, Inc.