diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2015-01-09 03:28:10 -0500 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2015-03-12 15:18:45 -0400 |
commit | 496eadf821c2a5111a4b1b401ddda8d1fc18fb0b (patch) | |
tree | a9755af3fb7133be17b8b77fa9e7827c0462e4e1 | |
parent | c517d838eb7d07bbe9507871fab3931deccff539 (diff) |
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: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
-rw-r--r-- | drivers/clk/clk.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index eb0152961d3c..b0313cb4369c 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -480,6 +480,8 @@ static void clk_unprepare_unused_subtree(struct clk_core *clk) | |||
480 | { | 480 | { |
481 | struct clk_core *child; | 481 | struct clk_core *child; |
482 | 482 | ||
483 | lockdep_assert_held(&prepare_lock); | ||
484 | |||
483 | hlist_for_each_entry(child, &clk->children, child_node) | 485 | hlist_for_each_entry(child, &clk->children, child_node) |
484 | clk_unprepare_unused_subtree(child); | 486 | clk_unprepare_unused_subtree(child); |
485 | 487 | ||
@@ -503,6 +505,8 @@ static void clk_disable_unused_subtree(struct clk_core *clk) | |||
503 | struct clk_core *child; | 505 | struct clk_core *child; |
504 | unsigned long flags; | 506 | unsigned long flags; |
505 | 507 | ||
508 | lockdep_assert_held(&prepare_lock); | ||
509 | |||
506 | hlist_for_each_entry(child, &clk->children, child_node) | 510 | hlist_for_each_entry(child, &clk->children, child_node) |
507 | clk_disable_unused_subtree(child); | 511 | clk_disable_unused_subtree(child); |
508 | 512 | ||
@@ -1106,6 +1110,8 @@ static unsigned long clk_core_round_rate_nolock(struct clk_core *clk, | |||
1106 | struct clk_core *parent; | 1110 | struct clk_core *parent; |
1107 | struct clk_hw *parent_hw; | 1111 | struct clk_hw *parent_hw; |
1108 | 1112 | ||
1113 | lockdep_assert_held(&prepare_lock); | ||
1114 | |||
1109 | if (!clk) | 1115 | if (!clk) |
1110 | return 0; | 1116 | return 0; |
1111 | 1117 | ||
@@ -1245,6 +1251,8 @@ static void __clk_recalc_accuracies(struct clk_core *clk) | |||
1245 | unsigned long parent_accuracy = 0; | 1251 | unsigned long parent_accuracy = 0; |
1246 | struct clk_core *child; | 1252 | struct clk_core *child; |
1247 | 1253 | ||
1254 | lockdep_assert_held(&prepare_lock); | ||
1255 | |||
1248 | if (clk->parent) | 1256 | if (clk->parent) |
1249 | parent_accuracy = clk->parent->accuracy; | 1257 | parent_accuracy = clk->parent->accuracy; |
1250 | 1258 | ||
@@ -1318,6 +1326,8 @@ static void __clk_recalc_rates(struct clk_core *clk, unsigned long msg) | |||
1318 | unsigned long parent_rate = 0; | 1326 | unsigned long parent_rate = 0; |
1319 | struct clk_core *child; | 1327 | struct clk_core *child; |
1320 | 1328 | ||
1329 | lockdep_assert_held(&prepare_lock); | ||
1330 | |||
1321 | old_rate = clk->rate; | 1331 | old_rate = clk->rate; |
1322 | 1332 | ||
1323 | if (clk->parent) | 1333 | if (clk->parent) |
@@ -1525,6 +1535,8 @@ static int __clk_speculate_rates(struct clk_core *clk, | |||
1525 | unsigned long new_rate; | 1535 | unsigned long new_rate; |
1526 | int ret = NOTIFY_DONE; | 1536 | int ret = NOTIFY_DONE; |
1527 | 1537 | ||
1538 | lockdep_assert_held(&prepare_lock); | ||
1539 | |||
1528 | new_rate = clk_recalc(clk, parent_rate); | 1540 | new_rate = clk_recalc(clk, parent_rate); |
1529 | 1541 | ||
1530 | /* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */ | 1542 | /* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */ |
@@ -2488,6 +2500,8 @@ static void __clk_release(struct kref *ref) | |||
2488 | struct clk_core *clk = container_of(ref, struct clk_core, ref); | 2500 | struct clk_core *clk = container_of(ref, struct clk_core, ref); |
2489 | int i = clk->num_parents; | 2501 | int i = clk->num_parents; |
2490 | 2502 | ||
2503 | lockdep_assert_held(&prepare_lock); | ||
2504 | |||
2491 | kfree(clk->parents); | 2505 | kfree(clk->parents); |
2492 | while (--i >= 0) | 2506 | while (--i >= 0) |
2493 | kfree_const(clk->parent_names[i]); | 2507 | kfree_const(clk->parent_names[i]); |