Thread (39 messages) 39 messages, 5 authors, 2024-10-04

Re: [PATCH 05/14] Input: samsung-keypad - use devm to disable runtime PM

From: Krzysztof Kozlowski <krzk@kernel.org>
Date: 2024-08-19 12:54:44
Also in: linux-devicetree, linux-input, linux-samsung-soc, lkml

On Sun, Aug 18, 2024 at 09:58:02PM -0700, Dmitry Torokhov wrote:
quoted hunk ↗ jump to hunk
To make sure that runtime PM is disabled at the right time relative
to all other devm-managed resources use devm_add_action_or_reset()
to register a handler that will disable it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/samsung-keypad.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index 7adcd2657bca..924327de4d8f 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -310,6 +310,13 @@ samsung_keypad_parse_dt(struct device *dev)
 }
 #endif
 
+static void samsung_disable_runtime_pm(void *data)
+{
+	struct samsung_keypad *keypad = data;
+
+	pm_runtime_disable(&keypad->pdev->dev);
+}
+
 static int samsung_keypad_probe(struct platform_device *pdev)
 {
 	const struct samsung_keypad_platdata *pdata;
@@ -420,11 +427,16 @@ static int samsung_keypad_probe(struct platform_device *pdev)
 
 	device_init_wakeup(&pdev->dev, pdata->wakeup);
 	platform_set_drvdata(pdev, keypad);
+
 	pm_runtime_enable(&pdev->dev);
+	error = devm_add_action_or_reset(&pdev->dev, samsung_disable_runtime_pm,
+					 keypad);
+	if (error)
+		return error;
I think you are open-coding devm_pm_runtime_enable().
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help