linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: madera: Add missing call to pinctrl_unregister_mappings
@ 2020-02-28 15:42 Charles Keepax
  2020-02-28 23:35 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Keepax @ 2020-02-28 15:42 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, patches

pinctrl_register_mappings is called in the pdata case, however a call to
pinctrl_unregister_mappings is missing causing the mappings to be leaked
on driver unbind. Add the missing call to correct this issue.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/pinctrl/cirrus/pinctrl-madera-core.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c
index 7b6409ef553c9..dce2626384a90 100644
--- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c
+++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c
@@ -1073,13 +1073,26 @@ static int madera_pin_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	platform_set_drvdata(pdev, priv);
+
 	dev_dbg(priv->dev, "pinctrl probed ok\n");
 
 	return 0;
 }
 
+static int 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);
+
+	return 0;
+}
+
 static struct platform_driver madera_pin_driver = {
 	.probe = madera_pin_probe,
+	.remove = madera_pin_remove,
 	.driver = {
 		.name = "madera-pinctrl",
 	},
-- 
2.11.0


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

* Re: [PATCH] pinctrl: madera: Add missing call to pinctrl_unregister_mappings
  2020-02-28 15:42 [PATCH] pinctrl: madera: Add missing call to pinctrl_unregister_mappings Charles Keepax
@ 2020-02-28 23:35 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2020-02-28 23:35 UTC (permalink / raw)
  To: Charles Keepax; +Cc: open list:GPIO SUBSYSTEM, linux-kernel, patches

On Fri, Feb 28, 2020 at 4:42 PM Charles Keepax
<ckeepax@opensource.cirrus.com> wrote:

> pinctrl_register_mappings is called in the pdata case, however a call to
> pinctrl_unregister_mappings is missing causing the mappings to be leaked
> on driver unbind. Add the missing call to correct this issue.
>
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

end of thread, other threads:[~2020-02-28 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28 15:42 [PATCH] pinctrl: madera: Add missing call to pinctrl_unregister_mappings Charles Keepax
2020-02-28 23:35 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).