linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe
@ 2015-08-28 18:44 Tony Lindgren
  2015-08-29 17:11 ` santosh shilimkar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tony Lindgren @ 2015-08-28 18:44 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: linux-gpio, linux-omap, linux-arm-kernel, Grygorii Strashko,
	Javier Martinez Canillas, Kevin Hilman, Santosh Shilimkar

Currently we gpio-omap breaks if gpiochip_add() returns -EPROBE_DEFER:

[    0.570000] gpiochip_add: GPIOs 0..31 (gpio) failed to register
[    0.570000] omap_gpio 48310000.gpio: Could not register gpio chip -517
...
[    3.670000] omap_gpio 48310000.gpio: Unbalanced pm_runtime_enable!

Let's fix the issue by adding the missing pm_runtime_put() on error.

Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Javier Martinez Canillas <javier@dowhile0.org>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/gpio/gpio-omap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b0c57d5..f09bf0b 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1232,8 +1232,11 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	omap_gpio_mod_init(bank);
 
 	ret = omap_gpio_chip_init(bank, irqc);
-	if (ret)
+	if (ret) {
+		pm_runtime_put_sync(bank->dev);
+		pm_runtime_disable(bank->dev);
 		return ret;
+	}
 
 	omap_gpio_show_rev(bank);
 
-- 
2.1.4


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

* Re: [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe
  2015-08-28 18:44 [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe Tony Lindgren
@ 2015-08-29 17:11 ` santosh shilimkar
  2015-08-31  9:03 ` Grygorii Strashko
  2015-09-08 13:57 ` Linus Walleij
  2 siblings, 0 replies; 6+ messages in thread
From: santosh shilimkar @ 2015-08-29 17:11 UTC (permalink / raw)
  To: Tony Lindgren, Linus Walleij, Alexandre Courbot
  Cc: linux-gpio, linux-omap, linux-arm-kernel, Grygorii Strashko,
	Javier Martinez Canillas, Kevin Hilman, Santosh Shilimkar

8/28/2015 11:44 AM, Tony Lindgren wrote:
> Currently we gpio-omap breaks if gpiochip_add() returns -EPROBE_DEFER:
>
> [    0.570000] gpiochip_add: GPIOs 0..31 (gpio) failed to register
> [    0.570000] omap_gpio 48310000.gpio: Could not register gpio chip -517
> ...
> [    3.670000] omap_gpio 48310000.gpio: Unbalanced pm_runtime_enable!
>
> Let's fix the issue by adding the missing pm_runtime_put() on error.
>
> Cc: Grygorii Strashko <grygorii.strashko@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>   drivers/gpio/gpio-omap.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>

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

* Re: [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe
  2015-08-28 18:44 [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe Tony Lindgren
  2015-08-29 17:11 ` santosh shilimkar
@ 2015-08-31  9:03 ` Grygorii Strashko
  2015-08-31 14:11   ` Tony Lindgren
  2015-09-08 13:57 ` Linus Walleij
  2 siblings, 1 reply; 6+ messages in thread
From: Grygorii Strashko @ 2015-08-31  9:03 UTC (permalink / raw)
  To: Tony Lindgren, Linus Walleij, Alexandre Courbot
  Cc: linux-gpio, linux-omap, linux-arm-kernel,
	Javier Martinez Canillas, Kevin Hilman, Santosh Shilimkar

Hi Tony,

On 08/28/2015 09:44 PM, Tony Lindgren wrote:
> Currently we gpio-omap breaks if gpiochip_add() returns -EPROBE_DEFER:
>
> [    0.570000] gpiochip_add: GPIOs 0..31 (gpio) failed to register
> [    0.570000] omap_gpio 48310000.gpio: Could not register gpio chip -517
> ...
> [    3.670000] omap_gpio 48310000.gpio: Unbalanced pm_runtime_enable!

I have no objection to the patch itself.

But I curious, How have you got this error output? Was it simulated?

>
> Let's fix the issue by adding the missing pm_runtime_put() on error.
>
> Cc: Grygorii Strashko <grygorii.strashko@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>   drivers/gpio/gpio-omap.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index b0c57d5..f09bf0b 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1232,8 +1232,11 @@ static int omap_gpio_probe(struct platform_device *pdev)
>   	omap_gpio_mod_init(bank);
>
>   	ret = omap_gpio_chip_init(bank, irqc);
> -	if (ret)
> +	if (ret) {
> +		pm_runtime_put_sync(bank->dev);
> +		pm_runtime_disable(bank->dev);
>   		return ret;
> +	}
>
>   	omap_gpio_show_rev(bank);
>
>


-- 
regards,
-grygorii

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

* Re: [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe
  2015-08-31  9:03 ` Grygorii Strashko
@ 2015-08-31 14:11   ` Tony Lindgren
  2015-08-31 14:37     ` Grygorii Strashko
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2015-08-31 14:11 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio, linux-omap,
	linux-arm-kernel, Javier Martinez Canillas, Kevin Hilman,
	Santosh Shilimkar

* Grygorii Strashko <grygorii.strashko@ti.com> [150831 02:07]:
> Hi Tony,
> 
> On 08/28/2015 09:44 PM, Tony Lindgren wrote:
> >Currently we gpio-omap breaks if gpiochip_add() returns -EPROBE_DEFER:
> >
> >[    0.570000] gpiochip_add: GPIOs 0..31 (gpio) failed to register
> >[    0.570000] omap_gpio 48310000.gpio: Could not register gpio chip -517
> >...
> >[    3.670000] omap_gpio 48310000.gpio: Unbalanced pm_runtime_enable!
> 
> I have no objection to the patch itself.
> 
> But I curious, How have you got this error output? Was it simulated?

I ran into it when trying to get rid of all the custom initcalls
for various drivers. And especially if adding dts mappings for
gpio-ranges to try to find some solution for the 1.158 issue that
keeps me from having a mainline GPIO PM regresion test with
pinging wl12xx during off idle :)

Regards,

Tony

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

* Re: [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe
  2015-08-31 14:11   ` Tony Lindgren
@ 2015-08-31 14:37     ` Grygorii Strashko
  0 siblings, 0 replies; 6+ messages in thread
From: Grygorii Strashko @ 2015-08-31 14:37 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio, linux-omap,
	linux-arm-kernel, Javier Martinez Canillas, Kevin Hilman,
	Santosh Shilimkar

On 08/31/2015 05:11 PM, Tony Lindgren wrote:
> * Grygorii Strashko <grygorii.strashko@ti.com> [150831 02:07]:
>> Hi Tony,
>>
>> On 08/28/2015 09:44 PM, Tony Lindgren wrote:
>>> Currently we gpio-omap breaks if gpiochip_add() returns -EPROBE_DEFER:
>>>
>>> [    0.570000] gpiochip_add: GPIOs 0..31 (gpio) failed to register
>>> [    0.570000] omap_gpio 48310000.gpio: Could not register gpio chip -517
>>> ...
>>> [    3.670000] omap_gpio 48310000.gpio: Unbalanced pm_runtime_enable!
>>
>> I have no objection to the patch itself.
>>
>> But I curious, How have you got this error output? Was it simulated?
> 
> I ran into it when trying to get rid of all the custom initcalls
> for various drivers. And especially if adding dts mappings for
> gpio-ranges to try to find some solution for the 1.158 issue that
> keeps me from having a mainline GPIO PM regresion test with
> pinging wl12xx during off idle :)
> 

Ah. So, -EPROBE_DEFER was returned by of_gpiochip_add_pin_range(),
I was not able to find a place where gpiochip_add() can return -EPROBE_DEFER ;)

Thanks for clarification.


-- 
regards,
-grygorii

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

* Re: [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe
  2015-08-28 18:44 [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe Tony Lindgren
  2015-08-29 17:11 ` santosh shilimkar
  2015-08-31  9:03 ` Grygorii Strashko
@ 2015-09-08 13:57 ` Linus Walleij
  2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-09-08 13:57 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Alexandre Courbot, linux-gpio@vger.kernel.org, Linux-OMAP,
	linux-arm-kernel@lists.infradead.org, Grygorii Strashko,
	Javier Martinez Canillas, Kevin Hilman, Santosh Shilimkar

On Fri, Aug 28, 2015 at 8:44 PM, Tony Lindgren <tony@atomide.com> wrote:

> Currently we gpio-omap breaks if gpiochip_add() returns -EPROBE_DEFER:
>
> [    0.570000] gpiochip_add: GPIOs 0..31 (gpio) failed to register
> [    0.570000] omap_gpio 48310000.gpio: Could not register gpio chip -517
> ...
> [    3.670000] omap_gpio 48310000.gpio: Unbalanced pm_runtime_enable!
>
> Let's fix the issue by adding the missing pm_runtime_put() on error.
>
> Cc: Grygorii Strashko <grygorii.strashko@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/gpio/gpio-omap.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index b0c57d5..f09bf0b 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1232,8 +1232,11 @@ static int omap_gpio_probe(struct platform_device *pdev)
>         omap_gpio_mod_init(bank);
>
>         ret = omap_gpio_chip_init(bank, irqc);
> -       if (ret)
> +       if (ret) {
> +               pm_runtime_put_sync(bank->dev);
> +               pm_runtime_disable(bank->dev);
>                 return ret;
> +       }
>
>         omap_gpio_show_rev(bank);

Patch applied for fixes with Santosh's ACK.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-09-08 13:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-28 18:44 [PATCH] gpio: omap: Fix gpiochip_add() handling for deferred probe Tony Lindgren
2015-08-29 17:11 ` santosh shilimkar
2015-08-31  9:03 ` Grygorii Strashko
2015-08-31 14:11   ` Tony Lindgren
2015-08-31 14:37     ` Grygorii Strashko
2015-09-08 13:57 ` 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).