Skip to content

Commit cf73ed8

Browse files
TravMuravdtor
authored andcommitted
Input: zinitix - make sure the IRQ is allocated before it gets enabled
Since irq request is the last thing in the driver probe, it happens later than the input device registration. This means that there is a small time window where if the open method is called the driver will attempt to enable not yet available irq. Fix that by moving the irq request before the input device registration. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Fixes: 2682265 ("Input: add zinitix touchscreen driver") Signed-off-by: Nikita Travkin <nikita@trvn.ru> Link: https://lore.kernel.org/r/20220106072840.36851-2-nikita@trvn.ru Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent bc7ec91 commit cf73ed8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/input/touchscreen/zinitix.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,15 @@ static int zinitix_ts_probe(struct i2c_client *client)
488488
return error;
489489
}
490490

491+
error = devm_request_threaded_irq(&client->dev, client->irq,
492+
NULL, zinitix_ts_irq_handler,
493+
IRQF_ONESHOT | IRQF_NO_AUTOEN,
494+
client->name, bt541);
495+
if (error) {
496+
dev_err(&client->dev, "Failed to request IRQ: %d\n", error);
497+
return error;
498+
}
499+
491500
error = zinitix_init_input_dev(bt541);
492501
if (error) {
493502
dev_err(&client->dev,
@@ -513,15 +522,6 @@ static int zinitix_ts_probe(struct i2c_client *client)
513522
return -EINVAL;
514523
}
515524

516-
error = devm_request_threaded_irq(&client->dev, client->irq,
517-
NULL, zinitix_ts_irq_handler,
518-
IRQF_ONESHOT | IRQF_NO_AUTOEN,
519-
client->name, bt541);
520-
if (error) {
521-
dev_err(&client->dev, "Failed to request IRQ: %d\n", error);
522-
return error;
523-
}
524-
525525
return 0;
526526
}
527527

0 commit comments

Comments
 (0)