@@ -338,13 +338,8 @@ static bool clk_core_is_enabled(struct clk_core *core)
* taking enable spinlock, but the below check is needed if one tries
* to call it from other places.
*/
- if (core->rpm_enabled) {
- pm_runtime_get_noresume(core->dev);
- if (!pm_runtime_active(core->dev)) {
- ret = false;
- goto done;
- }
- }
+ if (clk_pm_runtime_get_if_active(core))
+ return false;
/*
* This could be called with the enable lock held, or from atomic
@@ -359,8 +354,7 @@ static bool clk_core_is_enabled(struct clk_core *core)
ret = core->ops->is_enabled(core->hw);
done:
- if (core->rpm_enabled)
- pm_runtime_put(core->dev);
+ clk_pm_runtime_put(core);
return ret;
}
The logic for checking whether a clock is already runtime resumed exists (and increasing the refcounting in this case) is already available. Reuse the helper instead of open-coding the logic here again. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> --- drivers/clk/clk.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)