Skip to contentSkip to conversation

clk: Add some more lockdep assertions

PATCH New Stephen Boyd 1 participant 1 message May 7, 2015 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: Add some more lockdep assertions

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.

---

Based on clk-next

 drivers/clk/clk.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/clk/clk.c +8 -0
index 8cea0ec7179b..bbc04eae3b92 100644
@@ -544,6 +544,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;
 
@@ -590,6 +592,8 @@ static int clk_core_prepare(struct clk_core *core)
 {
 	int ret = 0;
 
+	lockdep_assert_held(&prepare_lock);
+
 	if (!core)
 		return 0;
 
@@ -645,6 +649,8 @@ EXPORT_SYMBOL_GPL(clk_prepare);
 
 static void clk_core_disable(struct clk_core *core)
 {
+	lockdep_assert_held(&enable_lock);
+
 	if (!core)
 		return;
 
@@ -693,6 +699,8 @@ static int clk_core_enable(struct clk_core *core)
 {
 	int ret = 0;
 
+	lockdep_assert_held(&enable_lock);
+
 	if (!core)
 		return 0;
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project