diff mbox series

[v1] pinctrl: samsung: Finish initializing the gpios before registering them

Message ID 20220727013349.3056826-1-saravanak@google.com
State New
Headers show
Series [v1] pinctrl: samsung: Finish initializing the gpios before registering them | expand

Commit Message

Saravana Kannan July 27, 2022, 1:33 a.m. UTC
As soon as a gpio is registered, it should be usable by a consumer. So,
do all the initialization before registering the gpios. Without this
change, a consumer can request a GPIO IRQ and have the gpio to IRQ
mapping fail.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Chanho Park July 27, 2022, 2:01 a.m. UTC | #1
> Subject: [PATCH v1] pinctrl: samsung: Finish initializing the gpios before
> registering them
> 
> As soon as a gpio is registered, it should be usable by a consumer. So, do
> all the initialization before registering the gpios. Without this change,
> a consumer can request a GPIO IRQ and have the gpio to IRQ mapping fail.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Make sense for me and I tested this on my Exynos Auto v9 SADK board.

Reviewed-by: Chanho Park <chanho61.park@samsung.com>
Tested-by: Chanho Park <chanho61.park@samsung.com>

Best Regards,
Chanho Park
Sam Protsenko July 27, 2022, 1:54 p.m. UTC | #2
On Wed, 27 Jul 2022 at 04:33, Saravana Kannan <saravanak@google.com> wrote:
>
> As soon as a gpio is registered, it should be usable by a consumer. So,
> do all the initialization before registering the gpios. Without this
> change, a consumer can request a GPIO IRQ and have the gpio to IRQ
> mapping fail.
>
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

>  drivers/pinctrl/samsung/pinctrl-samsung.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
> index 26d309d2516d..a302b38a63a8 100644
> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
> @@ -1168,15 +1168,15 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
>         if (ret)
>                 goto err_put_banks;
>
> -       ret = samsung_gpiolib_register(pdev, drvdata);
> -       if (ret)
> -               goto err_unregister;
> -
>         if (ctrl->eint_gpio_init)
>                 ctrl->eint_gpio_init(drvdata);
>         if (ctrl->eint_wkup_init)
>                 ctrl->eint_wkup_init(drvdata);
>
> +       ret = samsung_gpiolib_register(pdev, drvdata);
> +       if (ret)
> +               goto err_unregister;
> +
>         platform_set_drvdata(pdev, drvdata);
>
>         return 0;
> --
> 2.37.1.359.gd136c6c3e2-goog
>
Krzysztof Kozlowski July 28, 2022, 8:32 a.m. UTC | #3
On 27/07/2022 03:33, Saravana Kannan wrote:
> As soon as a gpio is registered, it should be usable by a consumer. So,
> do all the initialization before registering the gpios. Without this
> change, a consumer can request a GPIO IRQ and have the gpio to IRQ
> mapping fail.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Looks good.

Linus,
It's too late for me to pick it up, so make you could grab it directly?

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Otherwise it will wait for merge window to finish.


Best regards,
Krzysztof
Krzysztof Kozlowski Aug. 16, 2022, 9:23 a.m. UTC | #4
On 28/07/2022 11:32, Krzysztof Kozlowski wrote:
> On 27/07/2022 03:33, Saravana Kannan wrote:
>> As soon as a gpio is registered, it should be usable by a consumer. So,
>> do all the initialization before registering the gpios. Without this
>> change, a consumer can request a GPIO IRQ and have the gpio to IRQ
>> mapping fail.
>>
>> Signed-off-by: Saravana Kannan <saravanak@google.com>
> 
> Looks good.
> 
> Linus,
> It's too late for me to pick it up, so make you could grab it directly?
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> Otherwise it will wait for merge window to finish.

Applied.

Best regards,
Krzysztof
Krzysztof Kozlowski Aug. 16, 2022, 9:24 a.m. UTC | #5
On Tue, 26 Jul 2022 18:33:48 -0700, Saravana Kannan wrote:
> As soon as a gpio is registered, it should be usable by a consumer. So,
> do all the initialization before registering the gpios. Without this
> change, a consumer can request a GPIO IRQ and have the gpio to IRQ
> mapping fail.
> 
> 

Applied, thanks!

[1/1] pinctrl: samsung: Finish initializing the gpios before registering them
      https://git.kernel.org/pinctrl/samsung/c/152a81a0b1204e9c7f4af0004b5ed7a8d67dd037

Best regards,
Linus Walleij Aug. 25, 2022, 12:08 p.m. UTC | #6
On Thu, Jul 28, 2022 at 10:32 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
> On 27/07/2022 03:33, Saravana Kannan wrote:

> > As soon as a gpio is registered, it should be usable by a consumer. So,
> > do all the initialization before registering the gpios. Without this
> > change, a consumer can request a GPIO IRQ and have the gpio to IRQ
> > mapping fail.
> >
> > Signed-off-by: Saravana Kannan <saravanak@google.com>
>
> Looks good.
>
> Linus,
> It's too late for me to pick it up, so make you could grab it directly?
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> Otherwise it will wait for merge window to finish.

I sadly missed this during the merge window, as the commit message didn't
make it look like a fix or something urgent. (I don't know if it is?)
Just send me the patch as fix or for -next, I let you decide.

Yours,
Linus Walleij
Krzysztof Kozlowski Aug. 25, 2022, 12:11 p.m. UTC | #7
On 25/08/2022 15:08, Linus Walleij wrote:
> On Thu, Jul 28, 2022 at 10:32 AM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>> On 27/07/2022 03:33, Saravana Kannan wrote:
> 
>>> As soon as a gpio is registered, it should be usable by a consumer. So,
>>> do all the initialization before registering the gpios. Without this
>>> change, a consumer can request a GPIO IRQ and have the gpio to IRQ
>>> mapping fail.
>>>
>>> Signed-off-by: Saravana Kannan <saravanak@google.com>
>>
>> Looks good.
>>
>> Linus,
>> It's too late for me to pick it up, so make you could grab it directly?
>>
>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>
>> Otherwise it will wait for merge window to finish.
> 
> I sadly missed this during the merge window, as the commit message didn't
> make it look like a fix or something urgent. (I don't know if it is?)
> Just send me the patch as fix or for -next, I let you decide.

I understood, so I already picked it up after merge window. I'll send
you this in a pull.

Best regards,
Krzysztof
Saravana Kannan Aug. 25, 2022, 5:05 p.m. UTC | #8
On Thu, Aug 25, 2022 at 5:11 AM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 25/08/2022 15:08, Linus Walleij wrote:
> > On Thu, Jul 28, 2022 at 10:32 AM Krzysztof Kozlowski
> > <krzysztof.kozlowski@linaro.org> wrote:
> >> On 27/07/2022 03:33, Saravana Kannan wrote:
> >
> >>> As soon as a gpio is registered, it should be usable by a consumer. So,
> >>> do all the initialization before registering the gpios. Without this
> >>> change, a consumer can request a GPIO IRQ and have the gpio to IRQ
> >>> mapping fail.
> >>>
> >>> Signed-off-by: Saravana Kannan <saravanak@google.com>
> >>
> >> Looks good.
> >>
> >> Linus,
> >> It's too late for me to pick it up, so make you could grab it directly?
> >>
> >> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> >>
> >> Otherwise it will wait for merge window to finish.
> >
> > I sadly missed this during the merge window, as the commit message didn't
> > make it look like a fix or something urgent. (I don't know if it is?)
> > Just send me the patch as fix or for -next, I let you decide.

It wasn't anything urgent. I found this issue when I was refactoring
fw_devlink, but that series hasn't landed yet. So it's okay if it's
landing only in 6.0.

-Saravana

>
> I understood, so I already picked it up after merge window. I'll send
> you this in a pull.
>
> Best regards,
> Krzysztof
diff mbox series

Patch

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 26d309d2516d..a302b38a63a8 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -1168,15 +1168,15 @@  static int samsung_pinctrl_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_put_banks;
 
-	ret = samsung_gpiolib_register(pdev, drvdata);
-	if (ret)
-		goto err_unregister;
-
 	if (ctrl->eint_gpio_init)
 		ctrl->eint_gpio_init(drvdata);
 	if (ctrl->eint_wkup_init)
 		ctrl->eint_wkup_init(drvdata);
 
+	ret = samsung_gpiolib_register(pdev, drvdata);
+	if (ret)
+		goto err_unregister;
+
 	platform_set_drvdata(pdev, drvdata);
 
 	return 0;