Skip to content

Commit 7c45951

Browse files
committed
Input: ili210x - use guard notation when disabling and reenabling IRQ
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>
1 parent ac7e083 commit 7c45951

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

drivers/input/touchscreen/ili210x.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -860,19 +860,17 @@ static ssize_t ili210x_firmware_update_store(struct device *dev,
860860
* the touch controller to disable the IRQs during update, so we have
861861
* to do it this way here.
862862
*/
863-
disable_irq(client->irq);
863+
scoped_guard(disable_irq, &client->irq) {
864+
dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname);
864865

865-
dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname);
866+
ili210x_hardware_reset(priv->reset_gpio);
866867

867-
ili210x_hardware_reset(priv->reset_gpio);
868+
error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end);
868869

869-
error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end);
870+
ili210x_hardware_reset(priv->reset_gpio);
870871

871-
ili210x_hardware_reset(priv->reset_gpio);
872-
873-
dev_dbg(dev, "Firmware update ended, error=%i\n", error);
874-
875-
enable_irq(client->irq);
872+
dev_dbg(dev, "Firmware update ended, error=%i\n", error);
873+
}
876874

877875
return error ?: count;
878876
}

0 commit comments

Comments
 (0)