Skip to contentSkip to conversation

pinctrl: armada-37xx: Fix irq mask access in armada_37xx_irq_set_type()

PATCH In review Gregory CLEMENT 2 participants 2 messages Nov 15, 2019 – Nov 21, 2019

Subsystems (4)
lore
Share & tools
lore

Gregory CLEMENT

author maintainer
#0 lore raw

PATCH 1/1 pinctrl: armada-37xx: Fix irq mask access in armada_37xx_irq_set_type()

As explained in the following commit a9a1a4833613 ("pinctrl:
armada-37xx: Fix gpio interrupt setup") the armada_37xx_irq_set_type() function can be called before the initialization of the mask field.

That means that we can't use this field in this function and need to workaround it using hwirq.

Fixes 30ac0d3b0702 ("pinctrl: armada-37xx: Add edge both type gpio irq support")
---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +3 -3
index 9df4277a16be..aa9dcde0f069 100644
@@ -595,10 +595,10 @@ static int armada_37xx_irq_set_type(struct irq_data *d, unsigned int type)
 		regmap_read(info->regmap, in_reg, &in_val);
 
 		/* Set initial polarity based on current input level. */
-		if (in_val & d->mask)
-			val |= d->mask;		/* falling */
+		if (in_val & BIT(d->hwirq % GPIO_PER_REG))
+			val |= BIT(d->hwirq % GPIO_PER_REG);	/* falling */
 		else
-			val &= ~d->mask;	/* rising */
+			val &= ~(BIT(d->hwirq % GPIO_PER_REG));	/* rising */
 		break;
 	}
 	default:
Signature · 1 line
2.24.0
#1 lore raw
Quoted 11 lines · Gregory CLEMENT

As explained in the following commit a9a1a4833613 ("pinctrl:
armada-37xx: Fix gpio interrupt setup") the armada_37xx_irq_set_type() function can be called before the initialization of the mask field.

That means that we can't use this field in this function and need to workaround it using hwirq.

Fixes 30ac0d3b0702 ("pinctrl: armada-37xx: Add edge both type gpio irq support")

Patch applied.

I do not have time to send any more fixes pull requests at this point, so this will go into v5.5 in the merge window with everything else, and then to stable from there.

Yours,
Linus Walleij