]> www.infradead.org Git - linux.git/commitdiff
Input: ili210x - use guard notation when disabling and reenabling IRQ
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 9 Jun 2024 23:47:55 +0000 (16:47 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 28 Jun 2024 22:15:20 +0000 (15:15 -0700)
This makes the code more compact and error handling more robust.

Link: https://lore.kernel.org/r/20240609234757.610273-3-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/ili210x.c

index d0713a27ad6a9645dee6c553b338eb11081bef8e..b6d0c14635956dbdbd0fb6f3315bc97e1736f2f9 100644 (file)
@@ -860,19 +860,17 @@ static ssize_t ili210x_firmware_update_store(struct device *dev,
         * the touch controller to disable the IRQs during update, so we have
         * to do it this way here.
         */
-       disable_irq(client->irq);
+       scoped_guard(disable_irq, &client->irq) {
+               dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname);
 
-       dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname);
+               ili210x_hardware_reset(priv->reset_gpio);
 
-       ili210x_hardware_reset(priv->reset_gpio);
+               error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end);
 
-       error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end);
+               ili210x_hardware_reset(priv->reset_gpio);
 
-       ili210x_hardware_reset(priv->reset_gpio);
-
-       dev_dbg(dev, "Firmware update ended, error=%i\n", error);
-
-       enable_irq(client->irq);
+               dev_dbg(dev, "Firmware update ended, error=%i\n", error);
+       }
 
        return error ?: count;
 }