Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: mxc: fix irq_high handling
@ 2026-05-22  7:01 Alexander Stein
  2026-05-22  7:01 ` [PATCH 2/2] gpio: mxc: use BIT() macro Alexander Stein
  2026-05-22 18:21 ` [PATCH 1/2] gpio: mxc: fix irq_high handling Frank Li
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Stein @ 2026-05-22  7:01 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam
  Cc: Alexander Stein, linux-gpio, imx, linux-arm-kernel, linux-kernel

If port->irq_high is -1 (fsl,imx21-gpio compatible) and gpio_idx is >= 16
enable_irq_wake() is called with -1 which is wrong.

Fixes: 5f6d1998adeb ("gpio: mxc: release the parent IRQ in runtime suspend")
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
I don't have hardware to test. I just noticed this by code review.

 drivers/gpio/gpio-mxc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 647b6f4861b74..12f11a6c96653 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -469,7 +469,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
 		 * the handler is needed only once, but doing it for every port
 		 * is more robust and easier.
 		 */
-		port->irq_high = -1;
+		port->irq_high = 0;
 		port->mx_irq_handler = mx2_gpio_irq_handler;
 	} else
 		port->mx_irq_handler = mx3_gpio_irq_handler;
-- 
2.43.0


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

* [PATCH 2/2] gpio: mxc: use BIT() macro
  2026-05-22  7:01 [PATCH 1/2] gpio: mxc: fix irq_high handling Alexander Stein
@ 2026-05-22  7:01 ` Alexander Stein
  2026-05-22 18:09   ` Frank Li
  2026-05-22 18:21 ` [PATCH 1/2] gpio: mxc: fix irq_high handling Frank Li
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Stein @ 2026-05-22  7:01 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam
  Cc: Alexander Stein, linux-gpio, imx, linux-arm-kernel, linux-kernel

Do not open-code the BIT() macro.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/gpio/gpio-mxc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 12f11a6c96653..7e2690d92df6f 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -330,13 +330,13 @@ static int gpio_set_wake_irq(struct irq_data *d, u32 enable)
 			ret = enable_irq_wake(port->irq_high);
 		else
 			ret = enable_irq_wake(port->irq);
-		port->wakeup_pads |= (1 << gpio_idx);
+		port->wakeup_pads |= BIT(gpio_idx);
 	} else {
 		if (port->irq_high && (gpio_idx >= 16))
 			ret = disable_irq_wake(port->irq_high);
 		else
 			ret = disable_irq_wake(port->irq);
-		port->wakeup_pads &= ~(1 << gpio_idx);
+		port->wakeup_pads &= ~BIT(gpio_idx);
 	}
 
 	return ret;
-- 
2.43.0


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

* Re: [PATCH 2/2] gpio: mxc: use BIT() macro
  2026-05-22  7:01 ` [PATCH 2/2] gpio: mxc: use BIT() macro Alexander Stein
@ 2026-05-22 18:09   ` Frank Li
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-05-22 18:09 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Linus Walleij, Bartosz Golaszewski, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, linux-gpio, imx,
	linux-arm-kernel, linux-kernel

On Fri, May 22, 2026 at 09:01:16AM +0200, Alexander Stein wrote:
> Do not open-code the BIT() macro.

Nit: Replace the open-code with the BIT() macro.

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  drivers/gpio/gpio-mxc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 12f11a6c96653..7e2690d92df6f 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -330,13 +330,13 @@ static int gpio_set_wake_irq(struct irq_data *d, u32 enable)
>  			ret = enable_irq_wake(port->irq_high);
>  		else
>  			ret = enable_irq_wake(port->irq);
> -		port->wakeup_pads |= (1 << gpio_idx);
> +		port->wakeup_pads |= BIT(gpio_idx);
>  	} else {
>  		if (port->irq_high && (gpio_idx >= 16))
>  			ret = disable_irq_wake(port->irq_high);
>  		else
>  			ret = disable_irq_wake(port->irq);
> -		port->wakeup_pads &= ~(1 << gpio_idx);
> +		port->wakeup_pads &= ~BIT(gpio_idx);
>  	}
>
>  	return ret;
> --
> 2.43.0
>

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

* Re: [PATCH 1/2] gpio: mxc: fix irq_high handling
  2026-05-22  7:01 [PATCH 1/2] gpio: mxc: fix irq_high handling Alexander Stein
  2026-05-22  7:01 ` [PATCH 2/2] gpio: mxc: use BIT() macro Alexander Stein
@ 2026-05-22 18:21 ` Frank Li
  1 sibling, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-05-22 18:21 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Linus Walleij, Bartosz Golaszewski, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, linux-gpio, imx,
	linux-arm-kernel, linux-kernel

On Fri, May 22, 2026 at 09:01:15AM +0200, Alexander Stein wrote:
> If port->irq_high is -1 (fsl,imx21-gpio compatible) and gpio_idx is >= 16
> enable_irq_wake() is called with -1 which is wrong.
>
> Fixes: 5f6d1998adeb ("gpio: mxc: release the parent IRQ in runtime suspend")
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> I don't have hardware to test. I just noticed this by code review.

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>
>  drivers/gpio/gpio-mxc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 647b6f4861b74..12f11a6c96653 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -469,7 +469,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
>  		 * the handler is needed only once, but doing it for every port
>  		 * is more robust and easier.
>  		 */
> -		port->irq_high = -1;
> +		port->irq_high = 0;
>  		port->mx_irq_handler = mx2_gpio_irq_handler;
>  	} else
>  		port->mx_irq_handler = mx3_gpio_irq_handler;
> --
> 2.43.0
>

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

end of thread, other threads:[~2026-05-22 18:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22  7:01 [PATCH 1/2] gpio: mxc: fix irq_high handling Alexander Stein
2026-05-22  7:01 ` [PATCH 2/2] gpio: mxc: use BIT() macro Alexander Stein
2026-05-22 18:09   ` Frank Li
2026-05-22 18:21 ` [PATCH 1/2] gpio: mxc: fix irq_high handling Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox