Commit 496eadf8 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Stephen Boyd

clk: Use lockdep asserts to find missing hold of prepare_lock

Add lockdep asserts for holding the prepare_lock to all functions
marking this as a requirement in description. Add this to private and
exported functions so all locking misuse could be detected during
debugging.
Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: default avatarMichael Turquette <mturquette@linaro.org>
parent c517d838
...@@ -480,6 +480,8 @@ static void clk_unprepare_unused_subtree(struct clk_core *clk) ...@@ -480,6 +480,8 @@ static void clk_unprepare_unused_subtree(struct clk_core *clk)
{ {
struct clk_core *child; struct clk_core *child;
lockdep_assert_held(&prepare_lock);
hlist_for_each_entry(child, &clk->children, child_node) hlist_for_each_entry(child, &clk->children, child_node)
clk_unprepare_unused_subtree(child); clk_unprepare_unused_subtree(child);
...@@ -503,6 +505,8 @@ static void clk_disable_unused_subtree(struct clk_core *clk) ...@@ -503,6 +505,8 @@ static void clk_disable_unused_subtree(struct clk_core *clk)
struct clk_core *child; struct clk_core *child;
unsigned long flags; unsigned long flags;
lockdep_assert_held(&prepare_lock);
hlist_for_each_entry(child, &clk->children, child_node) hlist_for_each_entry(child, &clk->children, child_node)
clk_disable_unused_subtree(child); clk_disable_unused_subtree(child);
...@@ -1106,6 +1110,8 @@ static unsigned long clk_core_round_rate_nolock(struct clk_core *clk, ...@@ -1106,6 +1110,8 @@ static unsigned long clk_core_round_rate_nolock(struct clk_core *clk,
struct clk_core *parent; struct clk_core *parent;
struct clk_hw *parent_hw; struct clk_hw *parent_hw;
lockdep_assert_held(&prepare_lock);
if (!clk) if (!clk)
return 0; return 0;
...@@ -1245,6 +1251,8 @@ static void __clk_recalc_accuracies(struct clk_core *clk) ...@@ -1245,6 +1251,8 @@ static void __clk_recalc_accuracies(struct clk_core *clk)
unsigned long parent_accuracy = 0; unsigned long parent_accuracy = 0;
struct clk_core *child; struct clk_core *child;
lockdep_assert_held(&prepare_lock);
if (clk->parent) if (clk->parent)
parent_accuracy = clk->parent->accuracy; parent_accuracy = clk->parent->accuracy;
...@@ -1318,6 +1326,8 @@ static void __clk_recalc_rates(struct clk_core *clk, unsigned long msg) ...@@ -1318,6 +1326,8 @@ static void __clk_recalc_rates(struct clk_core *clk, unsigned long msg)
unsigned long parent_rate = 0; unsigned long parent_rate = 0;
struct clk_core *child; struct clk_core *child;
lockdep_assert_held(&prepare_lock);
old_rate = clk->rate; old_rate = clk->rate;
if (clk->parent) if (clk->parent)
...@@ -1525,6 +1535,8 @@ static int __clk_speculate_rates(struct clk_core *clk, ...@@ -1525,6 +1535,8 @@ static int __clk_speculate_rates(struct clk_core *clk,
unsigned long new_rate; unsigned long new_rate;
int ret = NOTIFY_DONE; int ret = NOTIFY_DONE;
lockdep_assert_held(&prepare_lock);
new_rate = clk_recalc(clk, parent_rate); new_rate = clk_recalc(clk, parent_rate);
/* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */ /* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */
...@@ -2488,6 +2500,8 @@ static void __clk_release(struct kref *ref) ...@@ -2488,6 +2500,8 @@ static void __clk_release(struct kref *ref)
struct clk_core *clk = container_of(ref, struct clk_core, ref); struct clk_core *clk = container_of(ref, struct clk_core, ref);
int i = clk->num_parents; int i = clk->num_parents;
lockdep_assert_held(&prepare_lock);
kfree(clk->parents); kfree(clk->parents);
while (--i >= 0) while (--i >= 0)
kfree_const(clk->parent_names[i]); kfree_const(clk->parent_names[i]);
......
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