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: 26822652c85e ("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>

authored by Nikita Travkin and committed by Dmitry Torokhov cf73ed89 bc7ec917

Changed files
+9 -9
drivers
input
touchscreen
+9 -9
drivers/input/touchscreen/zinitix.c
··· 488 488 return error; 489 489 } 490 490 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 + 491 500 error = zinitix_init_input_dev(bt541); 492 501 if (error) { 493 502 dev_err(&client->dev, ··· 520 511 "Malformed zinitix,mode property, must be 2 (supplied: %d)\n", 521 512 bt541->zinitix_mode); 522 513 return -EINVAL; 523 - } 524 - 525 - error = devm_request_threaded_irq(&client->dev, client->irq, 526 - NULL, zinitix_ts_irq_handler, 527 - IRQF_ONESHOT | IRQF_NO_AUTOEN, 528 - client->name, bt541); 529 - if (error) { 530 - dev_err(&client->dev, "Failed to request IRQ: %d\n", error); 531 - return error; 532 514 } 533 515 534 516 return 0;