* [PATCH] clk: Use lockdep asserts to find missing hold of prepare_lock
@ 2015-01-09 8:28 Krzysztof Kozlowski
2015-02-25 19:40 ` Mike Turquette
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2015-01-09 8:28 UTC (permalink / raw)
To: Mike Turquette, Stephen Boyd, linux-kernel; +Cc: Krzysztof Kozlowski
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>
---
drivers/clk/clk.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f4963b7d4e17..cdbfaa34ace4 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -432,6 +432,8 @@ static void clk_unprepare_unused_subtree(struct clk *clk)
{
struct clk *child;
+ lockdep_assert_held(&prepare_lock);
+
if (!clk)
return;
@@ -458,6 +460,8 @@ static void clk_disable_unused_subtree(struct clk *clk)
struct clk *child;
unsigned long flags;
+ lockdep_assert_held(&prepare_lock);
+
if (!clk)
goto out;
@@ -947,6 +951,8 @@ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate)
struct clk *parent;
struct clk_hw *parent_hw;
+ lockdep_assert_held(&prepare_lock);
+
if (!clk)
return 0;
@@ -1040,6 +1046,8 @@ static void __clk_recalc_accuracies(struct clk *clk)
unsigned long parent_accuracy = 0;
struct clk *child;
+ lockdep_assert_held(&prepare_lock);
+
if (clk->parent)
parent_accuracy = clk->parent->accuracy;
@@ -1104,6 +1112,8 @@ static void __clk_recalc_rates(struct clk *clk, unsigned long msg)
unsigned long parent_rate = 0;
struct clk *child;
+ lockdep_assert_held(&prepare_lock);
+
old_rate = clk->rate;
if (clk->parent)
@@ -1297,6 +1307,8 @@ static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate)
unsigned long new_rate;
int ret = NOTIFY_DONE;
+ lockdep_assert_held(&prepare_lock);
+
new_rate = clk_recalc(clk, parent_rate);
/* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */
@@ -2110,6 +2122,8 @@ static void __clk_release(struct kref *ref)
struct clk *clk = container_of(ref, struct clk, ref);
int i = clk->num_parents;
+ lockdep_assert_held(&prepare_lock);
+
kfree(clk->parents);
while (--i >= 0)
kfree(clk->parent_names[i]);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: Use lockdep asserts to find missing hold of prepare_lock
2015-01-09 8:28 [PATCH] clk: Use lockdep asserts to find missing hold of prepare_lock Krzysztof Kozlowski
@ 2015-02-25 19:40 ` Mike Turquette
0 siblings, 0 replies; 2+ messages in thread
From: Mike Turquette @ 2015-02-25 19:40 UTC (permalink / raw)
To: Krzysztof Kozlowski, Stephen Boyd, linux-kernel; +Cc: Krzysztof Kozlowski
Quoting Krzysztof Kozlowski (2015-01-09 00:28:10)
> 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>
Applied.
Thanks,
Mike
> ---
> drivers/clk/clk.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index f4963b7d4e17..cdbfaa34ace4 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -432,6 +432,8 @@ static void clk_unprepare_unused_subtree(struct clk *clk)
> {
> struct clk *child;
>
> + lockdep_assert_held(&prepare_lock);
> +
> if (!clk)
> return;
>
> @@ -458,6 +460,8 @@ static void clk_disable_unused_subtree(struct clk *clk)
> struct clk *child;
> unsigned long flags;
>
> + lockdep_assert_held(&prepare_lock);
> +
> if (!clk)
> goto out;
>
> @@ -947,6 +951,8 @@ unsigned long __clk_round_rate(struct clk *clk, unsigned long rate)
> struct clk *parent;
> struct clk_hw *parent_hw;
>
> + lockdep_assert_held(&prepare_lock);
> +
> if (!clk)
> return 0;
>
> @@ -1040,6 +1046,8 @@ static void __clk_recalc_accuracies(struct clk *clk)
> unsigned long parent_accuracy = 0;
> struct clk *child;
>
> + lockdep_assert_held(&prepare_lock);
> +
> if (clk->parent)
> parent_accuracy = clk->parent->accuracy;
>
> @@ -1104,6 +1112,8 @@ static void __clk_recalc_rates(struct clk *clk, unsigned long msg)
> unsigned long parent_rate = 0;
> struct clk *child;
>
> + lockdep_assert_held(&prepare_lock);
> +
> old_rate = clk->rate;
>
> if (clk->parent)
> @@ -1297,6 +1307,8 @@ static int __clk_speculate_rates(struct clk *clk, unsigned long parent_rate)
> unsigned long new_rate;
> int ret = NOTIFY_DONE;
>
> + lockdep_assert_held(&prepare_lock);
> +
> new_rate = clk_recalc(clk, parent_rate);
>
> /* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */
> @@ -2110,6 +2122,8 @@ static void __clk_release(struct kref *ref)
> struct clk *clk = container_of(ref, struct clk, ref);
> int i = clk->num_parents;
>
> + lockdep_assert_held(&prepare_lock);
> +
> kfree(clk->parents);
> while (--i >= 0)
> kfree(clk->parent_names[i]);
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-25 19:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-09 8:28 [PATCH] clk: Use lockdep asserts to find missing hold of prepare_lock Krzysztof Kozlowski
2015-02-25 19:40 ` Mike Turquette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox