All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3] watchdog: cadence_wdt: Fix the suspend resume
@ 2016-09-12  7:23 Shubhrajyoti Datta
  2016-10-08 14:14 ` Wim Van Sebroeck
  0 siblings, 1 reply; 2+ messages in thread
From: Shubhrajyoti Datta @ 2016-09-12  7:23 UTC (permalink / raw)
  To: linux-watchdog, wim; +Cc: linux, shubhrajyoti.datta, Shubhrajyoti Datta

Currently even if no users are there the suspend tries to
stop the watchdog and resume starts it.

so after resume the watchdog starts and resets the board.
Fix the same by adding a check for users.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
v2: use watchdog_active
v3: Add Guenter Roeck reviewed by tag

 drivers/watchdog/cadence_wdt.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/watchdog/cadence_wdt.c b/drivers/watchdog/cadence_wdt.c
index 4dda902..0fd267e 100644
--- a/drivers/watchdog/cadence_wdt.c
+++ b/drivers/watchdog/cadence_wdt.c
@@ -424,8 +424,10 @@ static int __maybe_unused cdns_wdt_suspend(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct cdns_wdt *wdt = platform_get_drvdata(pdev);
 
-	cdns_wdt_stop(&wdt->cdns_wdt_device);
-	clk_disable_unprepare(wdt->clk);
+	if (watchdog_active(&wdt->cdns_wdt_device)) {
+		cdns_wdt_stop(&wdt->cdns_wdt_device);
+		clk_disable_unprepare(wdt->clk);
+	}
 
 	return 0;
 }
@@ -442,12 +444,14 @@ static int __maybe_unused cdns_wdt_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct cdns_wdt *wdt = platform_get_drvdata(pdev);
 
-	ret = clk_prepare_enable(wdt->clk);
-	if (ret) {
-		dev_err(dev, "unable to enable clock\n");
-		return ret;
+	if (watchdog_active(&wdt->cdns_wdt_device)) {
+		ret = clk_prepare_enable(wdt->clk);
+		if (ret) {
+			dev_err(dev, "unable to enable clock\n");
+			return ret;
+		}
+		cdns_wdt_start(&wdt->cdns_wdt_device);
 	}
-	cdns_wdt_start(&wdt->cdns_wdt_device);
 
 	return 0;
 }
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHv3] watchdog: cadence_wdt: Fix the suspend resume
  2016-09-12  7:23 [PATCHv3] watchdog: cadence_wdt: Fix the suspend resume Shubhrajyoti Datta
@ 2016-10-08 14:14 ` Wim Van Sebroeck
  0 siblings, 0 replies; 2+ messages in thread
From: Wim Van Sebroeck @ 2016-10-08 14:14 UTC (permalink / raw)
  To: Shubhrajyoti Datta; +Cc: linux-watchdog, linux, shubhrajyoti.datta

Hi Shubhrajyoti,

> Currently even if no users are there the suspend tries to
> stop the watchdog and resume starts it.
> 
> so after resume the watchdog starts and resets the board.
> Fix the same by adding a check for users.
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
> v2: use watchdog_active
> v3: Add Guenter Roeck reviewed by tag

This patch was added to linux-watchdog-next almost 2 weeks ago.

Kind regards,
Wim.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-08 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12  7:23 [PATCHv3] watchdog: cadence_wdt: Fix the suspend resume Shubhrajyoti Datta
2016-10-08 14:14 ` Wim Van Sebroeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.