linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: renesas: rzg2l: use spin_{lock,unlock}_irq{save,restore}
@ 2024-05-20  7:20 Claudiu
  2024-05-21 14:22 ` Sebastian Andrzej Siewior
  2024-05-21 15:08 ` Diederik de Haas
  0 siblings, 2 replies; 3+ messages in thread
From: Claudiu @ 2024-05-20  7:20 UTC (permalink / raw)
  To: geert+renesas, linus.walleij, didi.debian, efault
  Cc: linux-renesas-soc, linux-gpio, linux-kernel, claudiu.beznea,
	linux-rt-users, Claudiu Beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

On PREEMPT_RT kernels the spinlock_t maps to an rtmutex. Using
raw_spin_lock_irqsave()/raw_spin_unlock_irqrestore() on
&pctrl->lock.rlock breaks the PREEMPT_RT builds. To fix this use
spin_lock_irqsave()/spin_unlock_irqrestore() on &pctrl->lock.

Fixes: e1fd1f9f457b ("pinctrl: renesas: rzg2l: Configure the interrupt type on resume")
Reported-by: Diederik de Haas <didi.debian@cknow.org>
Closes: https://lore.kernel.org/all/131999629.KQPSlr0Zke@bagend
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 20425afc6b33..78f947a8e26e 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -2069,11 +2069,11 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl)
 		 * This has to be atomically executed to protect against a concurrent
 		 * interrupt.
 		 */
-		raw_spin_lock_irqsave(&pctrl->lock.rlock, flags);
+		spin_lock_irqsave(&pctrl->lock, flags);
 		ret = rzg2l_gpio_irq_set_type(data, irqd_get_trigger_type(data));
 		if (!ret && !irqd_irq_disabled(data))
 			rzg2l_gpio_irq_enable(data);
-		raw_spin_unlock_irqrestore(&pctrl->lock.rlock, flags);
+		spin_unlock_irqrestore(&pctrl->lock, flags);
 
 		if (ret)
 			dev_crit(pctrl->dev, "Failed to set IRQ type for virq=%u\n", virq);
-- 
2.39.2


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

* Re: [PATCH] pinctrl: renesas: rzg2l: use spin_{lock,unlock}_irq{save,restore}
  2024-05-20  7:20 [PATCH] pinctrl: renesas: rzg2l: use spin_{lock,unlock}_irq{save,restore} Claudiu
@ 2024-05-21 14:22 ` Sebastian Andrzej Siewior
  2024-05-21 15:08 ` Diederik de Haas
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-05-21 14:22 UTC (permalink / raw)
  To: Claudiu
  Cc: geert+renesas, linus.walleij, didi.debian, efault,
	linux-renesas-soc, linux-gpio, linux-kernel, linux-rt-users,
	Claudiu Beznea

On 2024-05-20 10:20:33 [+0300], Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> On PREEMPT_RT kernels the spinlock_t maps to an rtmutex. Using
> raw_spin_lock_irqsave()/raw_spin_unlock_irqrestore() on
> &pctrl->lock.rlock breaks the PREEMPT_RT builds. To fix this use
> spin_lock_irqsave()/spin_unlock_irqrestore() on &pctrl->lock.
> 
> Fixes: e1fd1f9f457b ("pinctrl: renesas: rzg2l: Configure the interrupt type on resume")

02cd2d3be1c31 ("pinctrl: renesas: rzg2l: Configure the interrupt type on resume")

> Reported-by: Diederik de Haas <didi.debian@cknow.org>
> Closes: https://lore.kernel.org/all/131999629.KQPSlr0Zke@bagend
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Sebastian

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

* Re: [PATCH] pinctrl: renesas: rzg2l: use spin_{lock,unlock}_irq{save,restore}
  2024-05-20  7:20 [PATCH] pinctrl: renesas: rzg2l: use spin_{lock,unlock}_irq{save,restore} Claudiu
  2024-05-21 14:22 ` Sebastian Andrzej Siewior
@ 2024-05-21 15:08 ` Diederik de Haas
  1 sibling, 0 replies; 3+ messages in thread
From: Diederik de Haas @ 2024-05-21 15:08 UTC (permalink / raw)
  To: geert+renesas, linus.walleij, efault, Claudiu
  Cc: linux-renesas-soc, linux-gpio, linux-kernel, claudiu.beznea,
	linux-rt-users, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1691 bytes --]

On Monday, 20 May 2024 09:20:33 CEST Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> On PREEMPT_RT kernels the spinlock_t maps to an rtmutex. Using
> raw_spin_lock_irqsave()/raw_spin_unlock_irqrestore() on
> &pctrl->lock.rlock breaks the PREEMPT_RT builds. To fix this use
> spin_lock_irqsave()/spin_unlock_irqrestore() on &pctrl->lock.
> 
> Fixes: e1fd1f9f457b ("pinctrl: renesas: rzg2l: Configure the interrupt type
> on resume") Reported-by: Diederik de Haas <didi.debian@cknow.org>
> Closes: https://lore.kernel.org/all/131999629.KQPSlr0Zke@bagend
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
>  drivers/pinctrl/renesas/pinctrl-rzg2l.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index 20425afc6b33..78f947a8e26e
> 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -2069,11 +2069,11 @@ static void rzg2l_gpio_irq_restore(struct
> rzg2l_pinctrl *pctrl) * This has to be atomically executed to protect
> against a concurrent * interrupt.
>  		 */
> -		raw_spin_lock_irqsave(&pctrl->lock.rlock, flags);
> +		spin_lock_irqsave(&pctrl->lock, flags);
>  		ret = rzg2l_gpio_irq_set_type(data, 
irqd_get_trigger_type(data));
>  		if (!ret && !irqd_irq_disabled(data))
>  			rzg2l_gpio_irq_enable(data);
> -		raw_spin_unlock_irqrestore(&pctrl->lock.rlock, flags);
> +		spin_unlock_irqrestore(&pctrl->lock, flags);
> 
>  		if (ret)
>  			dev_crit(pctrl->dev, "Failed to set IRQ type 
for virq=%u\n", virq);

Now the build succeeds on both amd64 and arm64.
Thanks!

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2024-05-21 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-20  7:20 [PATCH] pinctrl: renesas: rzg2l: use spin_{lock,unlock}_irq{save,restore} Claudiu
2024-05-21 14:22 ` Sebastian Andrzej Siewior
2024-05-21 15:08 ` Diederik de Haas

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).