Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Claudiu Beznea" <claudiu.beznea@kernel.org>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org,
	wsa+renesas@sang-engineering.com, robh@kernel.org
Subject: Re: [PATCH v2 1/7] pinctrl: renesas: rzg2l: Generalize the power source code
Date: Thu, 28 May 2026 08:48:14 +0000	[thread overview]
Message-ID: <20260528084814.962511F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260528080439.615958-2-claudiu.beznea@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Acquiring an IRQ-safe lock without disabling interrupts causes lockdep inconsistency and potential deadlocks.
--

commit 22349bc4fa49f3c73863f4e8930404081ba4603f
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

pinctrl: renesas: rzg2l: Generalize the power source code

This commit generalizes the get/set pin power source functions to allow
extension for other functionalities like I3C on RZ/G3S. It introduces a
register masks data structure and updates the register modification in
rzg2l_set_power_source() to use a generic read-modify-write approach.

> diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> index ac42093fc579c..a648d75a2bd23 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c

[ ... ]

> @@ -1077,76 +1144,51 @@ static int rzg2l_get_power_source(struct rzg2l_pinctrl *pctrl, u32 pin, u32 caps
>  static int rzg2l_set_power_source(struct rzg2l_pinctrl *pctrl, u32 pin, u32 caps, u32 ps)
>  {

[ ... ]

> -	if (pwr_reg == OTHER_POC) {
> -		scoped_guard(raw_spinlock, &pctrl->lock) {
> -			val = readb(pctrl->base + pwr_reg);
> -			if (poc_val)
> -				val |= mask;
> -			else
> -				val &= ~mask;
> -			writeb(val, pctrl->base + pwr_reg);
> -		}
> -	} else {
> -		writeb(poc_val, pctrl->base + pwr_reg);
> +	scoped_guard(raw_spinlock, &pctrl->lock) {
> +		u8 tmp = readb(pctrl->base + offset);

[Severity: High]
This isn't a bug introduced by this patch, but since this change expands the
lock usage to all power source updates, could this result in a deadlock?

The lock pctrl->lock is an IRQ-safe raw spinlock, acquired with interrupts
disabled in functions like rzg2l_gpio_irq_disable().

Using scoped_guard(raw_spinlock, &pctrl->lock) disables preemption but
leaves local hardware interrupts enabled. If a GPIO interrupt fires on the
same CPU while this lock is held, and the client interrupt handler calls
disable_irq_nosync(), the system would attempt to acquire the already-held
lock.

Would it be safer to use scoped_guard(raw_spinlock_irqsave, &pctrl->lock)
instead?

>  
> +		tmp &= ~mask;
> +		tmp |= field_prep(mask, val);
> +		writeb(tmp, pctrl->base + offset);
>  	}
>  
>  	pctrl->settings[pin].power_source = ps;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260528080439.615958-1-claudiu.beznea@kernel.org?part=1

  reply	other threads:[~2026-05-28  8:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  8:04 [PATCH v2 0/7] pinctrl: renesas: rzg2l: Add support for RZ/G3S I3C Claudiu Beznea
2026-05-28  8:04 ` [PATCH v2 1/7] pinctrl: renesas: rzg2l: Generalize the power source code Claudiu Beznea
2026-05-28  8:48   ` sashiko-bot [this message]
2026-05-28  8:04 ` [PATCH v2 2/7] pinctrl: renesas: rzg2l: Drop defines present in struct rzg2l_hwcfg Claudiu Beznea
2026-05-28  8:16   ` Biju Das
2026-05-28  8:46     ` Claudiu Beznea
2026-05-28  8:54       ` Biju Das
2026-05-28 11:20   ` Wolfram Sang
2026-05-28  8:04 ` [PATCH v2 3/7] pinctrl: renesas: rzg2l: Keep member documentation aligned Claudiu Beznea
2026-05-28 11:21   ` Wolfram Sang
2026-05-28  8:04 ` [PATCH v2 4/7] pinctrl: renesas: rzg2l: Use tab instead of spaces Claudiu Beznea
2026-05-28 11:23   ` Wolfram Sang
2026-05-28  8:04 ` [PATCH v2 5/7] dt-bindings: pinctrl: renesas,rzg2l-pinctrl: Document the missing I3C power source option Claudiu Beznea
2026-05-28 11:23   ` Wolfram Sang
2026-05-28  8:04 ` [PATCH v2 6/7] pinctrl: renesas: rzg2l: Add RZ/G3S support for selecting the I3C power source Claudiu Beznea
2026-05-28 11:24   ` Wolfram Sang
2026-05-28  8:04 ` [PATCH v2 7/7] arm64: dts: renesas: rzg3s-smarc-som: Enable I3C Claudiu Beznea
2026-05-28 11:25   ` Wolfram Sang
2026-05-28  8:15 ` [PATCH v2 0/7] pinctrl: renesas: rzg2l: Add support for RZ/G3S I3C Claudiu Beznea
2026-05-28 11:34   ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260528084814.962511F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=claudiu.beznea@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox