mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pinctrl: cirrus: madera-core: Use devm_pinctrl_register_mappings()
@ 2025-06-09 11:51 Thomas Richard
  2025-06-09 11:57 ` Richard Fitzgerald
  2025-06-10 12:45 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Richard @ 2025-06-09 11:51 UTC (permalink / raw)
  To: Charles Keepax, Richard Fitzgerald, Linus Walleij, Lee Jones
  Cc: Thomas Petazzoni, linux-sound, patches, linux-gpio, linux-kernel,
	Thomas Richard

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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: cirrus: madera-core: Use devm_pinctrl_register_mappings()
  2025-06-09 11:51 [PATCH] pinctrl: cirrus: madera-core: Use devm_pinctrl_register_mappings() Thomas Richard
@ 2025-06-09 11:57 ` Richard Fitzgerald
  2025-06-10 12:45 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Fitzgerald @ 2025-06-09 11:57 UTC (permalink / raw)
  To: Thomas Richard, Charles Keepax, Linus Walleij, Lee Jones
  Cc: Thomas Petazzoni, linux-sound, patches, linux-gpio, linux-kernel

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: cirrus: madera-core: Use devm_pinctrl_register_mappings()
  2025-06-09 11:51 [PATCH] pinctrl: cirrus: madera-core: Use devm_pinctrl_register_mappings() Thomas Richard
  2025-06-09 11:57 ` Richard Fitzgerald
@ 2025-06-10 12:45 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2025-06-10 12:45 UTC (permalink / raw)
  To: Thomas Richard
  Cc: Charles Keepax, Richard Fitzgerald, Lee Jones, Thomas Petazzoni,
	linux-sound, patches, linux-gpio, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-10 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-09 11:51 [PATCH] pinctrl: cirrus: madera-core: Use devm_pinctrl_register_mappings() Thomas Richard
2025-06-09 11:57 ` Richard Fitzgerald
2025-06-10 12:45 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®