Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xianwei Zhao via B4 Relay"
	<devnull+xianwei.zhao.amlogic.com@kernel.org>
Cc: conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] irqchip/meson-gpio: Add support for Amlogic A9 SoCs
Date: Fri, 08 May 2026 19:44:42 +0000	[thread overview]
Message-ID: <20260508194442.D6DECC2BCC7@smtp.kernel.org> (raw)
In-Reply-To: <20260508-a9-gpio-irqchip-v1-3-9dc5f3e022e0@amlogic.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Fragile bitmask logic when clearing the both-edge trigger bit.
- [Low] Extraneous trailing semicolon after the function definition.
--

commit 295d9fc711855b4e0f9dd4bdc918ad1908141ca0
Author: Xianwei Zhao <xianwei.zhao@amlogic.com>

irqchip/meson-gpio: Add support for Amlogic A9 SoCs

This commit adds GPIO interrupt support for the Amlogic A9 SoCs. It defines
the mappings for the main and AO interrupt lines and implements the
interrupt type setting behavior for the A9 AO domain.

> diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c
> index 74a376ef452e2..f68476b2c5382 100644
> --- a/drivers/irqchip/irq-meson-gpio.c
> +++ b/drivers/irqchip/irq-meson-gpio.c

[ ... ]

> @@ -375,6 +403,53 @@ static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl,
>  	return 0;
>  }
>  
> +/*
> + * gpio irq relative registers for a9_ao
> + * -PADCTRL_GPIO_IRQ_CTRL0
> + * bit[31]:    enable/disable all the irq lines
> + * bit[0-19]:  polarity trigger
> + *
> + * -PADCTRL_GPIO_IRQ_CTRL[X]
> + * bit[0-5]: 6 bits to choose gpio source for irq line 2*[X] - 2
> + * bit[16-21]:6 bits to choose gpio source for irq line 2*[X] - 1
> + * where X = 1-10
> + *
> + * -PADCTRL_GPIO_IRQ_CTRL[11]
> + * bit[0-19]: both edge trigger
> + *
> + * -PADCTRL_GPIO_IRQ_CTRL[12]
> + * bit[0-19]: single edge trigger
> + */
> +static int meson_a9_ao_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl,
> +					 unsigned int type, u32 *channel_hwirq)
> +{
> +	const struct meson_gpio_irq_params *params = ctl->params;
> +	unsigned int idx;
> +	u32 val = 0;
> +
> +	idx = meson_gpio_irq_get_channel_idx(ctl, channel_hwirq);
> +
> +	type &= IRQ_TYPE_SENSE_MASK;
> +
> +	meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, BIT(idx), 0);

Is this asymmetric bitmask logic intentional?

The both-edge trigger bit is cleared using BIT(idx), but it is set using
BIT(ctl->params->edge_both_offset + idx) just below.

While edge_both_offset is initialized to 0 for the A9 AO domain, will this
clearing operation target the wrong bit if the code is ever reused with a
non-zero offset?

> +
> +	if (type == IRQ_TYPE_EDGE_BOTH) {
> +		val = BIT(ctl->params->edge_both_offset + idx);
> +		meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, val, val);
> +		return 0;
> +	}
> +
> +	if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_EDGE_FALLING))
> +		val = BIT(idx);
> +	meson_gpio_irq_update_bits(ctl, REG_A9_AO_POL, BIT(idx), val);
> +
> +	val = 0;
> +	if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
> +		val = BIT(idx);
> +	meson_gpio_irq_update_bits(ctl, REG_A9_AO_EDGE, BIT(idx), val);
> +
> +	return 0;
> +};

This isn't a bug, but there is an extraneous trailing semicolon after the
function definition.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260508-a9-gpio-irqchip-v1-0-9dc5f3e022e0@amlogic.com?part=3

      reply	other threads:[~2026-05-08 19:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08  7:36 [PATCH 0/3] irqchip: Add GPIO interrupt support for Amlogic A9 Xianwei Zhao via B4 Relay
2026-05-08  7:36 ` [PATCH 1/3] irqchip/meson-gpio: fix incorrect register address Xianwei Zhao via B4 Relay
2026-05-08  7:36 ` [PATCH 2/3] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs Xianwei Zhao via B4 Relay
2026-05-08 15:03   ` Conor Dooley
2026-05-08 19:26   ` sashiko-bot
2026-05-08  7:36 ` [PATCH 3/3] irqchip/meson-gpio: " Xianwei Zhao via B4 Relay
2026-05-08 19:44   ` sashiko-bot [this message]

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=20260508194442.D6DECC2BCC7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+xianwei.zhao.amlogic.com@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko@lists.linux.dev \
    /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