Skip to content

Commit

Permalink
watchdog: rzg2l_wdt: Fix Runtime PM usage
Browse files Browse the repository at this point in the history
[ Upstream commit 95abafe ]

Both rzg2l_wdt_probe() and rzg2l_wdt_start() calls pm_runtime_get() which
results in a usage counter imbalance. This patch fixes this issue by
removing pm_runtime_get() call from probe.

Fixes: 2cbc5cd ("watchdog: Add Watchdog Timer driver for RZ/G2L")
Signed-off-by: Biju Das <[email protected]>
Reviewed-by: Geert Uytterhoeven <[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]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Biju Das authored and Sasha Levin committed Jun 13, 2022
1 parent 55166bb commit fcb33ab
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions drivers/watchdog/rzg2l_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,11 @@ static const struct watchdog_ops rzg2l_wdt_ops = {
.restart = rzg2l_wdt_restart,
};

static void rzg2l_wdt_reset_assert_pm_disable_put(void *data)
static void rzg2l_wdt_reset_assert_pm_disable(void *data)
{
struct watchdog_device *wdev = data;
struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev);

pm_runtime_put(wdev->parent);
pm_runtime_disable(wdev->parent);
reset_control_assert(priv->rstc);
}
Expand Down Expand Up @@ -206,11 +205,6 @@ static int rzg2l_wdt_probe(struct platform_device *pdev)

reset_control_deassert(priv->rstc);
pm_runtime_enable(&pdev->dev);
ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0) {
dev_err(dev, "pm_runtime_resume_and_get failed ret=%pe", ERR_PTR(ret));
goto out_pm_get;
}

priv->wdev.info = &rzg2l_wdt_ident;
priv->wdev.ops = &rzg2l_wdt_ops;
Expand All @@ -222,7 +216,7 @@ static int rzg2l_wdt_probe(struct platform_device *pdev)

watchdog_set_drvdata(&priv->wdev, priv);
ret = devm_add_action_or_reset(&pdev->dev,
rzg2l_wdt_reset_assert_pm_disable_put,
rzg2l_wdt_reset_assert_pm_disable,
&priv->wdev);
if (ret < 0)
return ret;
Expand All @@ -235,12 +229,6 @@ static int rzg2l_wdt_probe(struct platform_device *pdev)
dev_warn(dev, "Specified timeout invalid, using default");

return devm_watchdog_register_device(&pdev->dev, &priv->wdev);

out_pm_get:
pm_runtime_disable(dev);
reset_control_assert(priv->rstc);

return ret;
}

static const struct of_device_id rzg2l_wdt_ids[] = {
Expand Down

0 comments on commit fcb33ab

Please sign in to comment.