[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231006125557.212681-2-m.majewski2@samsung.com>
Date: Fri, 6 Oct 2023 14:55:54 +0200
From: Mateusz Majewski <m.majewski2@...sung.com>
To: linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Mateusz Majewski <m.majewski2@...sung.com>,
Tomasz Figa <tomasz.figa@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Sylwester Nawrocki <s.nawrocki@...sung.com>,
Alim Akhtar <alim.akhtar@...sung.com>,
Linus Walleij <linus.walleij@...aro.org>,
Marek Szyprowski <m.szyprowski@...sung.com>
Subject: [PATCH 1/4] pinctrl: samsung: defer pinctrl_enable
dev_pinctrl_register function immediately enables the pinctrl subsystem,
which is unpreferable in general, since drivers might be unable to
handle calls immediately. Hence devm_pinctrl_register_and_init, which
does not call pinctrl_enable, is preferred.
In case of our driver using the old function does not seem to be
problematic for now, but will become an issue when we postpone parts of
pinctrl initialization in a future commit, and it is a good idea to move
off a deprecated-ish function anyway.
Signed-off-by: Mateusz Majewski <m.majewski2@...sung.com>
---
drivers/pinctrl/samsung/pinctrl-samsung.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index e54847040b4a..e496af72a587 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -904,11 +904,11 @@ static int samsung_pinctrl_register(struct platform_device *pdev,
if (ret)
return ret;
- drvdata->pctl_dev = devm_pinctrl_register(&pdev->dev, ctrldesc,
- drvdata);
- if (IS_ERR(drvdata->pctl_dev)) {
+ ret = devm_pinctrl_register_and_init(&pdev->dev, ctrldesc, drvdata,
+ &drvdata->pctl_dev);
+ if (ret) {
dev_err(&pdev->dev, "could not register pinctrl driver\n");
- return PTR_ERR(drvdata->pctl_dev);
+ return ret;
}
for (bank = 0; bank < drvdata->nr_banks; ++bank) {
@@ -1176,6 +1176,10 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
if (ret)
goto err_unregister;
+ ret = pinctrl_enable(drvdata->pctl_dev);
+ if (ret)
+ goto err_unregister;
+
platform_set_drvdata(pdev, drvdata);
return 0;
--
2.42.0
Powered by blists - more mailing lists