Re: [PATCH v5] Fix freeze in lm8333 i2c keyboard driver
From: Jeff LaBundy <hidden>
Date: 2023-05-12 16:55:08
Also in:
lkml
Hi Dmitry, On Thu, May 11, 2023 at 04:44:08PM -0700, Dmitry Torokhov wrote:
On Wed, May 03, 2023 at 08:44:06PM -0500, Jeff LaBundy wrote:quoted
Hi Tomas, On Wed, May 03, 2023 at 05:32:31PM +0200, Tomas Mudrunka wrote:quoted
LM8333 uses gpio interrupt line which is triggered by falling edge. When button is pressed before driver is loaded, driver will miss the edge and never respond again. To fix this we run the interrupt handler before registering IRQ to clear the interrupt via i2c command. Signed-off-by: Tomas Mudrunka <redacted> ---Reviewed-by: Jeff LaBundy <redacted>quoted
drivers/input/keyboard/lm8333.c | 2 ++ 1 file changed, 2 insertions(+)diff --git a/drivers/input/keyboard/lm8333.c b/drivers/input/keyboard/lm8333.c index 7457c3220..52108c370 100644 --- a/drivers/input/keyboard/lm8333.c +++ b/drivers/input/keyboard/lm8333.c@@ -178,6 +178,8 @@ static int lm8333_probe(struct i2c_client *client) dev_warn(&client->dev, "Unable to set active time\n"); } + lm8333_irq_thread(client->irq, lm8333);So this is still racy, isn't it? The interrupt may come after read is done, but before we register the handler.
You're absolutely correct; I had not considered this corner case. Apologies for the churn Tomas. In that case, it seems the solution is to either move the dummy read after the handler is registered as in v4, or remove the hard-coded flag and allow dts to specify level sensitivity.
quoted
quoted
+ err = request_threaded_irq(client->irq, NULL, lm8333_irq_thread, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "lm8333", lm8333); -- 2.40.1Thanks. -- Dmitry
Kind regards, Jeff LaBundy