[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bkkh2as5v44nldhpnmswt7pssiude6ddci7v5nvzqhba6xxbnj@veoftlgrhu6p>
Date: Mon, 19 Aug 2024 14:54:39 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Arnd Bergmann <arnd@...db.de>, Mark Brown <broonie@...nel.org>,
linux-input@...r.kernel.org, devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-samsung-soc@...r.kernel.org, patches@...nsource.cirrus.com
Subject: Re: [PATCH 05/14] Input: samsung-keypad - use devm to disable
runtime PM
On Sun, Aug 18, 2024 at 09:58:02PM -0700, Dmitry Torokhov wrote:
> 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@...il.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().
Powered by blists - more mailing lists