linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: ps2-gpio - Use IRQF_NO_AUTOEN flag in request_irq()
@ 2024-09-12  3:30 Jinjie Ruan
  2024-09-12 20:49 ` Danilo Krummrich
  2024-09-13 17:21 ` Dmitry Torokhov
  0 siblings, 2 replies; 3+ messages in thread
From: Jinjie Ruan @ 2024-09-12  3:30 UTC (permalink / raw)
  To: dmitry.torokhov, erick.archer, u.kleine-koenig, danilokrummrich,
	linus.walleij, robh, linux-input
  Cc: ruanjinjie

disable_irq() after request_irq() still has a time gap in which
interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
disable IRQ auto-enable when request IRQ.

Fixes: 9ee0a0558819 ("Input: PS/2 gpio bit banging driver for serio bus")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/input/serio/ps2-gpio.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c
index 0c8b390b8b4f..3a431395c464 100644
--- a/drivers/input/serio/ps2-gpio.c
+++ b/drivers/input/serio/ps2-gpio.c
@@ -429,16 +429,14 @@ static int ps2_gpio_probe(struct platform_device *pdev)
 	}
 
 	error = devm_request_irq(dev, drvdata->irq, ps2_gpio_irq,
-				 IRQF_NO_THREAD, DRIVER_NAME, drvdata);
+				 IRQF_NO_THREAD | IRQF_NO_AUTOEN, DRIVER_NAME,
+				 drvdata);
 	if (error) {
 		dev_err(dev, "failed to request irq %d: %d\n",
 			drvdata->irq, error);
 		goto err_free_serio;
 	}
 
-	/* Keep irq disabled until serio->open is called. */
-	disable_irq(drvdata->irq);
-
 	serio->id.type = SERIO_8042;
 	serio->open = ps2_gpio_open;
 	serio->close = ps2_gpio_close;
-- 
2.34.1


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

* Re: [PATCH] Input: ps2-gpio - Use IRQF_NO_AUTOEN flag in request_irq()
  2024-09-12  3:30 [PATCH] Input: ps2-gpio - Use IRQF_NO_AUTOEN flag in request_irq() Jinjie Ruan
@ 2024-09-12 20:49 ` Danilo Krummrich
  2024-09-13 17:21 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Danilo Krummrich @ 2024-09-12 20:49 UTC (permalink / raw)
  To: Jinjie Ruan
  Cc: dmitry.torokhov, erick.archer, u.kleine-koenig, linus.walleij,
	robh, linux-input

On 9/12/24 5:30 AM, Jinjie Ruan wrote:
> disable_irq() after request_irq() still has a time gap in which
> interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
> disable IRQ auto-enable when request IRQ.
> 
> Fixes: 9ee0a0558819 ("Input: PS/2 gpio bit banging driver for serio bus")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

Acked-by: Danilo Krummrich <dakr@kernel.org>

> ---
>   drivers/input/serio/ps2-gpio.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c
> index 0c8b390b8b4f..3a431395c464 100644
> --- a/drivers/input/serio/ps2-gpio.c
> +++ b/drivers/input/serio/ps2-gpio.c
> @@ -429,16 +429,14 @@ static int ps2_gpio_probe(struct platform_device *pdev)
>   	}
>   
>   	error = devm_request_irq(dev, drvdata->irq, ps2_gpio_irq,
> -				 IRQF_NO_THREAD, DRIVER_NAME, drvdata);
> +				 IRQF_NO_THREAD | IRQF_NO_AUTOEN, DRIVER_NAME,
> +				 drvdata);
>   	if (error) {
>   		dev_err(dev, "failed to request irq %d: %d\n",
>   			drvdata->irq, error);
>   		goto err_free_serio;
>   	}
>   
> -	/* Keep irq disabled until serio->open is called. */
> -	disable_irq(drvdata->irq);
> -
>   	serio->id.type = SERIO_8042;
>   	serio->open = ps2_gpio_open;
>   	serio->close = ps2_gpio_close;

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

* Re: [PATCH] Input: ps2-gpio - Use IRQF_NO_AUTOEN flag in request_irq()
  2024-09-12  3:30 [PATCH] Input: ps2-gpio - Use IRQF_NO_AUTOEN flag in request_irq() Jinjie Ruan
  2024-09-12 20:49 ` Danilo Krummrich
@ 2024-09-13 17:21 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2024-09-13 17:21 UTC (permalink / raw)
  To: Jinjie Ruan
  Cc: erick.archer, u.kleine-koenig, danilokrummrich, linus.walleij,
	robh, linux-input

On Thu, Sep 12, 2024 at 11:30:13AM +0800, Jinjie Ruan wrote:
> disable_irq() after request_irq() still has a time gap in which
> interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
> disable IRQ auto-enable when request IRQ.
> 
> Fixes: 9ee0a0558819 ("Input: PS/2 gpio bit banging driver for serio bus")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

Applied, thank you.

-- 
Dmitry

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

end of thread, other threads:[~2024-09-13 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-12  3:30 [PATCH] Input: ps2-gpio - Use IRQF_NO_AUTOEN flag in request_irq() Jinjie Ruan
2024-09-12 20:49 ` Danilo Krummrich
2024-09-13 17:21 ` Dmitry Torokhov

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