diff mbox series

[v5,5/7] pinctrl: s32cc: change to "devm_pinctrl_register_and_init"

Message ID 20241101080614.1070819-6-andrei.stefanescu@oss.nxp.com
State New
Headers show
Series gpio: siul2-s32g2: add initial GPIO driver | expand

Commit Message

Andrei Stefanescu Nov. 1, 2024, 8:06 a.m. UTC
Switch from "devm_pinctrl_register" to "devm_pinctrl_register_and_init"
and "pinctrl_enable" since this is the recommended way.

Signed-off-by: Andrei Stefanescu <andrei.stefanescu@oss.nxp.com>
---
 drivers/pinctrl/nxp/pinctrl-s32cc.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Linus Walleij Nov. 1, 2024, 11:54 a.m. UTC | #1
On Fri, Nov 1, 2024 at 9:06 AM Andrei Stefanescu
<andrei.stefanescu@oss.nxp.com> wrote:

> Switch from "devm_pinctrl_register" to "devm_pinctrl_register_and_init"
> and "pinctrl_enable" since this is the recommended way.
>
> Signed-off-by: Andrei Stefanescu <andrei.stefanescu@oss.nxp.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
I assume this needs to go in with the rest of the patches.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c
index 709e823b9c7c..10bff48852b9 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32cc.c
+++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c
@@ -950,10 +950,10 @@  int s32_pinctrl_probe(struct platform_device *pdev,
 		return ret;
 	}
 
-	ipctl->pctl = devm_pinctrl_register(&pdev->dev, s32_pinctrl_desc,
-					    ipctl);
-	if (IS_ERR(ipctl->pctl))
-		return dev_err_probe(&pdev->dev, PTR_ERR(ipctl->pctl),
+	ret = devm_pinctrl_register_and_init(&pdev->dev, s32_pinctrl_desc,
+					     ipctl, &ipctl->pctl);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
 				     "could not register s32 pinctrl driver\n");
 
 #ifdef CONFIG_PM_SLEEP
@@ -966,6 +966,11 @@  int s32_pinctrl_probe(struct platform_device *pdev,
 		return -ENOMEM;
 #endif
 
+	ret = pinctrl_enable(ipctl->pctl);
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret,
+				     "failed to enable pinctrl\n");
+
 	dev_info(&pdev->dev, "initialized s32 pinctrl driver\n");
 
 	return 0;