Skip to contentSkip to conversation

gpio: omap: Fix GPIO numbering for deferred probe

PATCH New Tony Lindgren 3 participants 4 messages Sep 3, 2015 – Sep 8, 2015

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

PATCH 1/1 gpio: omap: Fix GPIO numbering for deferred probe

If gpio-omap probe fails with -EPROBE_DEFER, the GPIO numbering keeps increasing. Only increase the gpio count if gpiochip_add() was successful as otherwise the numbers will increase for each probe attempt.

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +3 -1
@@ -1095,7 +1095,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
 	} else {
 		bank->chip.label = "gpio";
 		bank->chip.base = gpio;
-		gpio += bank->width;
 	}
 	bank->chip.ngpio = bank->width;
 
@@ -1105,6 +1104,9 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
 		return ret;
 	}
 
+	if (!bank->is_mpuio)
+		gpio += bank->width;
+
 #ifdef CONFIG_ARCH_OMAP1
 	/*
 	 * REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 gpio: omap: Fix GPIO numbering for deferred probe

Quoted 26 lines · Tony Lindgren

If gpio-omap probe fails with -EPROBE_DEFER, the GPIO numbering keeps increasing. Only increase the gpio count if gpiochip_add() was successful as otherwise the numbers will increase for each probe attempt.

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 | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +0 -1
@@ -1095,7 +1095,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
  	} else {
  		bank->chip.label = "gpio";
  		bank->chip.base = gpio;
-		gpio += bank->width;
  	}
  	bank->chip.ngpio = bank->width;
 

drivers/gpio/gpio-omap.c static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) · line 1112

Quoted 9 lines
drivers/gpio/gpio-omap.c +3 -0
@@ -1105,6 +1104,9 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
  		return ret;
  	}
 
+	if (!bank->is_mpuio)
+		gpio += bank->width;
+
  #ifdef CONFIG_ARCH_OMAP1
  	/*
  	 * REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop

With hope that only GPIO0 will be deferred, otherwise there will be total mess in gpios enumeration ;)

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

PATCH 1/1 gpio: omap: Fix GPIO numbering for deferred probe

Quoted 39 lines · Grygorii Strashko
Quoted 26 lines · Tony Lindgren

If gpio-omap probe fails with -EPROBE_DEFER, the GPIO numbering keeps increasing. Only increase the gpio count if gpiochip_add() was successful as otherwise the numbers will increase for each probe attempt.

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +0 -1
@@ -1095,7 +1095,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
 	} else {
 		bank->chip.label = "gpio";
 		bank->chip.base = gpio;
-		gpio += bank->width;
 	}
 	bank->chip.ngpio = bank->width;
 

drivers/gpio/gpio-omap.c static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) · line 1112

Quoted 9 lines
drivers/gpio/gpio-omap.c +3 -0
@@ -1105,6 +1104,9 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
 		return ret;
 	}
 
+	if (!bank->is_mpuio)
+		gpio += bank->width;
+
 #ifdef CONFIG_ARCH_OMAP1
 	/*
 	 * REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop
Quoted 2 lines

With hope that only GPIO0 will be deferred, otherwise there will be total mess in gpios enumeration ;)

Heh nope :) If pinctrl currently ever causes deferred probe things will get totally messed up.. Works fine after $subject patch.

Regards,

Tony

#3 lore raw

PATCH 1/1 gpio: omap: Fix GPIO numbering for deferred probe

In reply to Tony Lindgren
Quoted 10 lines · Tony Lindgren

If gpio-omap probe fails with -EPROBE_DEFER, the GPIO numbering keeps increasing. Only increase the gpio count if gpiochip_add() was successful as otherwise the numbers will increase for each probe attempt.

Cc Grygorii Strashko <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Santosh Shilimkar <[email protected]>

Patch applied with Grygorii's review tag.

Yours,
Linus Walleij