From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] Input: samsung-keypad - use pm_runtime_active guard
Date: Mon, 13 Jul 2026 18:53:07 -0700 [thread overview]
Message-ID: <20260714015309.2140694-3-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20260714015309.2140694-1-dmitry.torokhov@gmail.com>
Simplify the driver by using the block-scope guard(pm_runtime_active)
instead of manually invoking pm_runtime_get_sync() and
pm_runtime_put().
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/samsung-keypad.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index 88e733c1eabe..5f6535b49761 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -142,7 +142,7 @@ static irqreturn_t samsung_keypad_irq(int irq, void *dev_id)
unsigned int row_state[SAMSUNG_MAX_COLS];
bool key_down;
- pm_runtime_get_sync(&keypad->pdev->dev);
+ guard(pm_runtime_active)(&keypad->pdev->dev);
do {
readl(keypad->base + SAMSUNG_KEYIFSTSCLR);
@@ -158,8 +158,6 @@ static irqreturn_t samsung_keypad_irq(int irq, void *dev_id)
} while (key_down && !keypad->stopped);
- pm_runtime_put(&keypad->pdev->dev);
-
return IRQ_HANDLED;
}
@@ -167,7 +165,7 @@ static void samsung_keypad_start(struct samsung_keypad *keypad)
{
unsigned int val;
- pm_runtime_get_sync(&keypad->pdev->dev);
+ guard(pm_runtime_active)(&keypad->pdev->dev);
/* Tell IRQ thread that it may poll the device. */
keypad->stopped = false;
@@ -182,8 +180,6 @@ static void samsung_keypad_start(struct samsung_keypad *keypad)
/* KEYIFCOL reg clear. */
writel(0, keypad->base + SAMSUNG_KEYIFCOL);
- pm_runtime_put(&keypad->pdev->dev);
-
enable_irq(keypad->irq);
}
@@ -191,7 +187,7 @@ static void samsung_keypad_stop(struct samsung_keypad *keypad)
{
unsigned int val;
- pm_runtime_get_sync(&keypad->pdev->dev);
+ guard(pm_runtime_active)(&keypad->pdev->dev);
/* Signal IRQ thread to stop polling and disable the handler. */
keypad->stopped = true;
@@ -207,8 +203,6 @@ static void samsung_keypad_stop(struct samsung_keypad *keypad)
writel(val, keypad->base + SAMSUNG_KEYIFCON);
clk_disable(keypad->clk);
-
- pm_runtime_put(&keypad->pdev->dev);
}
static int samsung_keypad_open(struct input_dev *input_dev)
--
2.55.0.795.g602f6c329a-goog
next prev parent reply other threads:[~2026-07-14 1:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 1:53 [PATCH 1/3] Input: samsung-keypad - clean up wakeup configuration logic Dmitry Torokhov
2026-07-14 1:53 ` [PATCH 2/3] Input: samsung-keypad - keep interrupt disabled while closed Dmitry Torokhov
2026-07-14 2:08 ` sashiko-bot
2026-07-14 1:53 ` Dmitry Torokhov [this message]
2026-07-14 2:08 ` [PATCH 3/3] Input: samsung-keypad - use pm_runtime_active guard sashiko-bot
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=20260714015309.2140694-3-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=krzk@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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