Commit 35a79631 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Stephen Boyd

clk: use clk_core_enable_lock() a bit more

Use clk_core_enable_lock() and clk_core_disable_lock() in a few places
rather than open-coding them.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Link: https://lore.kernel.org/r/20210305003334.575831-1-linux@rasmusvillemoes.dkSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent a38fd874
...@@ -2078,12 +2078,8 @@ static void clk_change_rate(struct clk_core *core) ...@@ -2078,12 +2078,8 @@ static void clk_change_rate(struct clk_core *core)
return; return;
if (core->flags & CLK_SET_RATE_UNGATE) { if (core->flags & CLK_SET_RATE_UNGATE) {
unsigned long flags;
clk_core_prepare(core); clk_core_prepare(core);
flags = clk_enable_lock(); clk_core_enable_lock(core);
clk_core_enable(core);
clk_enable_unlock(flags);
} }
if (core->new_parent && core->new_parent != core->parent) { if (core->new_parent && core->new_parent != core->parent) {
...@@ -2116,11 +2112,7 @@ static void clk_change_rate(struct clk_core *core) ...@@ -2116,11 +2112,7 @@ static void clk_change_rate(struct clk_core *core)
core->rate = clk_recalc(core, best_parent_rate); core->rate = clk_recalc(core, best_parent_rate);
if (core->flags & CLK_SET_RATE_UNGATE) { if (core->flags & CLK_SET_RATE_UNGATE) {
unsigned long flags; clk_core_disable_lock(core);
flags = clk_enable_lock();
clk_core_disable(core);
clk_enable_unlock(flags);
clk_core_unprepare(core); clk_core_unprepare(core);
} }
...@@ -3564,8 +3556,6 @@ static int __clk_core_init(struct clk_core *core) ...@@ -3564,8 +3556,6 @@ static int __clk_core_init(struct clk_core *core)
* reparenting clocks * reparenting clocks
*/ */
if (core->flags & CLK_IS_CRITICAL) { if (core->flags & CLK_IS_CRITICAL) {
unsigned long flags;
ret = clk_core_prepare(core); ret = clk_core_prepare(core);
if (ret) { if (ret) {
pr_warn("%s: critical clk '%s' failed to prepare\n", pr_warn("%s: critical clk '%s' failed to prepare\n",
...@@ -3573,9 +3563,7 @@ static int __clk_core_init(struct clk_core *core) ...@@ -3573,9 +3563,7 @@ static int __clk_core_init(struct clk_core *core)
goto out; goto out;
} }
flags = clk_enable_lock(); ret = clk_core_enable_lock(core);
ret = clk_core_enable(core);
clk_enable_unlock(flags);
if (ret) { if (ret) {
pr_warn("%s: critical clk '%s' failed to enable\n", pr_warn("%s: critical clk '%s' failed to enable\n",
__func__, core->name); __func__, core->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment