[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <846cc6e5-1db0-4399-9525-917328e535c3@roeck-us.net>
Date: Fri, 10 Nov 2023 07:05:18 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Vignesh Raghavendra <vigneshr@...com>,
Wim Van Sebroeck <wim@...ux-watchdog.org>
Cc: Tero Kristo <t-kristo@...nel.org>, linux-watchdog@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
afd@...com, n-francis@...com
Subject: Re: [PATCH 2/2] watchdog: rti_wdt: Drop RPM watchdog when unused
On 11/10/23 02:07, Vignesh Raghavendra wrote:
> Do a RPM put if watchdog is not already started during probe and re
> enable it in watchdog start.
>
> On K3 SoCs, watchdogs and their corresponding CPUs are under same PD, so
> if the reference count of unused watchdogs aren't dropped, it will lead
> to CPU hotplug failures as Device Management firmware won't allow to
> turn off the PD due to dangling reference count.
>
> Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support")
> Signed-off-by: Vignesh Raghavendra <vigneshr@...com>
> ---
> drivers/watchdog/rti_wdt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
> index 163bdeb6929a..87f2c333a41d 100644
> --- a/drivers/watchdog/rti_wdt.c
> +++ b/drivers/watchdog/rti_wdt.c
> @@ -78,6 +78,9 @@ static int rti_wdt_start(struct watchdog_device *wdd)
> u32 timer_margin;
> struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd);
>
> + if (pm_runtime_suspended(wdd->parent))
> + pm_runtime_get_sync(wdd->parent);
> +
> /* set timeout period */
> timer_margin = (u64)wdd->timeout * wdt->freq;
> timer_margin >>= WDT_PRELOAD_SHIFT;
> @@ -337,6 +340,9 @@ static int rti_wdt_probe(struct platform_device *pdev)
> if (last_ping)
> watchdog_set_last_hw_keepalive(wdd, last_ping);
>
> + if (!watchdog_hw_running(wdd))
> + pm_runtime_put_sync(&pdev->dev);
> +
You will have to explain why this is needed here, but not as error handling,
and why it is added in this patch after the changes in patch 1 of the series
which essentially declared that no error cleanup would be needed under
any circumstances.
Guenter
> return 0;
> }
>
> @@ -345,6 +351,9 @@ static void rti_wdt_remove(struct platform_device *pdev)
> struct rti_wdt_device *wdt = platform_get_drvdata(pdev);
>
> watchdog_unregister_device(&wdt->wdd);
> +
> + if (!pm_runtime_suspended(&pdev->dev))
> + pm_runtime_put_sync(&pdev->dev);
> }
>
> static const struct of_device_id rti_wdt_of_match[] = {
Powered by blists - more mailing lists