Skip to content

Commit f0ba0fc

Browse files
claudiubezneaWim Van Sebroeck
authored andcommitted
watchdog: rzg2l_wdt: Use pm_runtime_resume_and_get()
pm_runtime_get_sync() may return with error. In case it returns with error dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get() takes care of this. Thus use it. Along with it the rzg2l_wdt_set_timeout() function was updated to propagate the result of rzg2l_wdt_start() to its caller. Fixes: 2cbc5cd ("watchdog: Add Watchdog Timer driver for RZ/G2L") Signed-off-by: Claudiu Beznea <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 9e69846 commit f0ba0fc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/watchdog/rzg2l_wdt.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ static void rzg2l_wdt_init_timeout(struct watchdog_device *wdev)
123123
static int rzg2l_wdt_start(struct watchdog_device *wdev)
124124
{
125125
struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);
126+
int ret;
126127

127-
pm_runtime_get_sync(wdev->parent);
128+
ret = pm_runtime_resume_and_get(wdev->parent);
129+
if (ret)
130+
return ret;
128131

129132
/* Initialize time out */
130133
rzg2l_wdt_init_timeout(wdev);
@@ -150,6 +153,8 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev)
150153

151154
static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int timeout)
152155
{
156+
int ret = 0;
157+
153158
wdev->timeout = timeout;
154159

155160
/*
@@ -159,10 +164,10 @@ static int rzg2l_wdt_set_timeout(struct watchdog_device *wdev, unsigned int time
159164
*/
160165
if (watchdog_active(wdev)) {
161166
rzg2l_wdt_stop(wdev);
162-
rzg2l_wdt_start(wdev);
167+
ret = rzg2l_wdt_start(wdev);
163168
}
164169

165-
return 0;
170+
return ret;
166171
}
167172

168173
static int rzg2l_wdt_restart(struct watchdog_device *wdev,

0 commit comments

Comments
 (0)