clk: Add some more lockdep assertions
authorStephen Boyd <sboyd@codeaurora.org>
Thu, 7 May 2015 00:00:54 +0000 (17:00 -0700)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 7 May 2015 18:32:54 +0000 (11:32 -0700)
We don't check to make sure the enable_lock is held across
enable/disable and we don't check if the prepare_lock is held
across prepare/unprepare. Add some asserts to catch any future
locking problems.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk.c

index 9e9d18cadeeef8f0144a99bae95594759f76346e..659f2b036cf5b591013c0787f5ee2f1931a4d304 100644 (file)
@@ -543,6 +543,8 @@ EXPORT_SYMBOL_GPL(__clk_mux_determine_rate_closest);
 
 static void clk_core_unprepare(struct clk_core *core)
 {
+       lockdep_assert_held(&prepare_lock);
+
        if (!core)
                return;
 
@@ -589,6 +591,8 @@ static int clk_core_prepare(struct clk_core *core)
 {
        int ret = 0;
 
+       lockdep_assert_held(&prepare_lock);
+
        if (!core)
                return 0;
 
@@ -644,6 +648,8 @@ EXPORT_SYMBOL_GPL(clk_prepare);
 
 static void clk_core_disable(struct clk_core *core)
 {
+       lockdep_assert_held(&enable_lock);
+
        if (!core)
                return;
 
@@ -692,6 +698,8 @@ static int clk_core_enable(struct clk_core *core)
 {
        int ret = 0;
 
+       lockdep_assert_held(&enable_lock);
+
        if (!core)
                return 0;