[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPLW+4nFLeBqNRh7g8a5eJZdT_G6Dtc4zs6nkyTpcG++mYHxfA@mail.gmail.com>
Date: Fri, 6 Oct 2023 21:14:45 -0500
From: Sam Protsenko <semen.protsenko@...aro.org>
To: Mateusz Majewski <m.majewski2@...sung.com>
Cc: linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, 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: Re: [PATCH 1/4] pinctrl: samsung: defer pinctrl_enable
On Fri, Oct 6, 2023 at 8:01 AM Mateusz Majewski <m.majewski2@...sung.com> wrote:
>
> dev_pinctrl_register function immediately enables the pinctrl subsystem,
Nitpick: dev -> devm
> 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