From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: John Keeping <jkeeping@inmusicbrands.com>,
Marek Vasut <marex@denx.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] Input: ili210x - use guard notation when disabling and reenabling IRQ
Date: Sun, 9 Jun 2024 16:47:55 -0700 [thread overview]
Message-ID: <20240609234757.610273-3-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20240609234757.610273-1-dmitry.torokhov@gmail.com>
This makes the code more compact and error handling more robust.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/ili210x.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 55f3852c8dae..4573844c3395 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -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;
}
--
2.45.2.505.gda0bf45e8d-goog
next prev parent reply other threads:[~2024-06-09 23:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-09 23:47 [PATCH 1/3] Input: ili210x - use kvmalloc() to allocate buffer for firmware update Dmitry Torokhov
2024-06-09 23:47 ` [PATCH 2/3] Input: ili210x - switch to using cleanup functions in firmware code Dmitry Torokhov
2024-06-09 23:47 ` Dmitry Torokhov [this message]
2024-06-10 14:11 ` [PATCH 3/3] Input: ili210x - use guard notation when disabling and reenabling IRQ Markus Elfring
2024-06-10 14:00 ` [PATCH 1/3] Input: ili210x - use kvmalloc() to allocate buffer for firmware update Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240609234757.610273-3-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=jkeeping@inmusicbrands.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).