All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: armada-37xx: Fix irq mask access in armada_37xx_irq_set_type()
@ 2019-11-15 15:57 ` Gregory CLEMENT
  0 siblings, 0 replies; 4+ messages in thread
From: Gregory CLEMENT @ 2019-11-15 15:57 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio, linux-kernel
  Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
	Gregory CLEMENT, Thomas Petazzoni, linux-arm-kernel, stable,
	Russell King

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")
Cc: stable@vger.kernel.org
Reported-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
index 9df4277a16be..aa9dcde0f069 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
@@ -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:
-- 
2.24.0


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

* [PATCH] pinctrl: armada-37xx: Fix irq mask access in armada_37xx_irq_set_type()
@ 2019-11-15 15:57 ` Gregory CLEMENT
  0 siblings, 0 replies; 4+ messages in thread
From: Gregory CLEMENT @ 2019-11-15 15:57 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio, linux-kernel
  Cc: Andrew Lunn, Jason Cooper, Gregory CLEMENT, stable, Russell King,
	Thomas Petazzoni, linux-arm-kernel, Sebastian Hesselbarth

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")
Cc: stable@vger.kernel.org
Reported-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
index 9df4277a16be..aa9dcde0f069 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
@@ -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:
-- 
2.24.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] pinctrl: armada-37xx: Fix irq mask access in armada_37xx_irq_set_type()
  2019-11-15 15:57 ` Gregory CLEMENT
@ 2019-11-21 13:55   ` Linus Walleij
  -1 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-11-21 13:55 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: open list:GPIO SUBSYSTEM, linux-kernel, Jason Cooper,
	Andrew Lunn, Sebastian Hesselbarth, Thomas Petazzoni, Linux ARM,
	stable, Russell King

On Fri, Nov 15, 2019 at 4:58 PM Gregory CLEMENT
<gregory.clement@bootlin.com> wrote:

> 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")
> Cc: stable@vger.kernel.org
> Reported-by: Russell King <rmk+kernel@armlinux.org.uk>
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>

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

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

* Re: [PATCH] pinctrl: armada-37xx: Fix irq mask access in armada_37xx_irq_set_type()
@ 2019-11-21 13:55   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-11-21 13:55 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Andrew Lunn, Jason Cooper, linux-kernel, stable,
	open list:GPIO SUBSYSTEM, Russell King, Thomas Petazzoni,
	Linux ARM, Sebastian Hesselbarth

On Fri, Nov 15, 2019 at 4:58 PM Gregory CLEMENT
<gregory.clement@bootlin.com> wrote:

> 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")
> Cc: stable@vger.kernel.org
> Reported-by: Russell King <rmk+kernel@armlinux.org.uk>
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-11-21 13:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15 15:57 [PATCH] pinctrl: armada-37xx: Fix irq mask access in armada_37xx_irq_set_type() Gregory CLEMENT
2019-11-15 15:57 ` Gregory CLEMENT
2019-11-21 13:55 ` Linus Walleij
2019-11-21 13:55   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.