Skip to contentSkip to conversation

gpio: omap: Fix gpiochip_add() handling for deferred probe

PATCH New Tony Lindgren 4 participants 6 messages Aug 28, 2015 – Sep 8, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: omap: Fix gpiochip_add() handling for deferred probe

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 <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Santosh Shilimkar <[email protected]>
---
 drivers/gpio/gpio-omap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +4 -1
index b0c57d5..f09bf0b 100644
@@ -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);
 
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 gpio: omap: Fix gpiochip_add() handling for deferred probe

Quoted 9 lines · Tony Lindgren

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.

Quoted 9 lines
Cc Grygorii Strashko <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Santosh Shilimkar <[email protected]>
---
  drivers/gpio/gpio-omap.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
#2 lore raw

PATCH 1/1 gpio: omap: Fix gpiochip_add() handling for deferred probe

In reply to Tony Lindgren

Hi Tony,

Quoted 6 lines · Tony Lindgren

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?

Quoted 30 lines

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

Cc Grygorii Strashko <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Santosh Shilimkar <[email protected]>
---
  drivers/gpio/gpio-omap.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +4 -1
index b0c57d5..f09bf0b 100644
@@ -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);
 
Signature · 2 lines
regards,
-grygorii
#3 lore raw

PATCH 1/1 gpio: omap: Fix gpiochip_add() handling for deferred probe

Quoted 5 lines · Grygorii Strashko

Hi Tony,

Quoted 2 lines · Tony Lindgren

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

Quoted 8 lines
Quoted 4 lines
[    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

#4 lore raw

PATCH 1/1 gpio: omap: Fix gpiochip_add() handling for deferred probe

Quoted 13 lines · Tony Lindgren
Quoted 12 lines · Grygorii Strashko

Hi Tony,

Quoted 6 lines · Tony Lindgren

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.

Quoted 8 lines
Quoted 1 line

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.

Signature · 2 lines
regards,
-grygorii
#5 lore raw

PATCH 1/1 gpio: omap: Fix gpiochip_add() handling for deferred probe

In reply to Tony Lindgren
Quoted 24 lines · Tony Lindgren

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 <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Santosh Shilimkar <[email protected]>
---
 drivers/gpio/gpio-omap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +0 -0
index b0c57d5..f09bf0b 100644
@@ -1232,8 +1232,11 @@ static int omap_gpio_probe(struct platform_device *pdev)
        omap_gpio_mod_init(bank);

drivers/gpio/gpio-omap.c static int omap_gpio_probe(struct platform_device *pdev) · line 1241

Quoted 10 lines
drivers/gpio/gpio-omap.c +4 -1
 
        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