mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 11:37:06 +02:00
clk: qcom: use spin_lock to guard qcom_regmap_list
qcom_regmap_list can get corrupted if multiple clock controllers probe at same time. And clk_is_regmap can be invoked from clk_enable API. Hence add spin_lock to avoid list corruption. Change-Id: Iec5abdb2d6f1a47667e7f6d2430f6f32c0ca4829 Signed-off-by: Veera Vegivada <quic_vvegivad@quicinc.com>
This commit is contained in:
parent
262e30a4f3
commit
85c8c38084
|
|
@ -13,7 +13,7 @@
|
|||
#include "clk-debug.h"
|
||||
|
||||
static LIST_HEAD(clk_regmap_list);
|
||||
static DEFINE_MUTEX(clk_regmap_lock);
|
||||
static DEFINE_SPINLOCK(clk_regmap_lock);
|
||||
|
||||
/**
|
||||
* clk_is_enabled_regmap - standard is_enabled() for regmap users
|
||||
|
|
@ -251,14 +251,14 @@ bool clk_is_regmap_clk(struct clk_hw *hw)
|
|||
bool is_regmap_clk = false;
|
||||
|
||||
if (hw) {
|
||||
mutex_lock(&clk_regmap_lock);
|
||||
spin_lock(&clk_regmap_lock);
|
||||
list_for_each_entry(rclk, &clk_regmap_list, list_node) {
|
||||
if (&rclk->hw == hw) {
|
||||
is_regmap_clk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&clk_regmap_lock);
|
||||
spin_unlock(&clk_regmap_lock);
|
||||
}
|
||||
|
||||
return is_regmap_clk;
|
||||
|
|
@ -299,9 +299,9 @@ int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk)
|
|||
|
||||
ret = devm_clk_hw_register(dev, &rclk->hw);
|
||||
if (!ret) {
|
||||
mutex_lock(&clk_regmap_lock);
|
||||
spin_lock(&clk_regmap_lock);
|
||||
list_add(&rclk->list_node, &clk_regmap_list);
|
||||
mutex_unlock(&clk_regmap_lock);
|
||||
spin_unlock(&clk_regmap_lock);
|
||||
|
||||
ret = clk_hw_debug_register(dev, &rclk->hw);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user