aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2018-10-02 07:52:10 -0400
committerSylwester Nawrocki <snawrocki@kernel.org>2018-10-05 07:36:39 -0400
commit1da220e3a5d22fccda0bc8542997abc1d1741268 (patch)
tree8e386d38d8d6c8b4d9379f25773630be10f4934e
parentb33228029d842269e17bba591609e83ed422005d (diff)
clk: samsung: Use clk_hw API for calling clk framework from clk notifiers
clk_notifier_register() documentation states, that the provided notifier callbacks associated with the notifier must not re-enter into the clk framework by calling any top-level clk APIs. Fix this by replacing clk_get_rate() calls with clk_hw_get_rate(), which is safe in this context. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <snawrocki@kernel.org>
-rw-r--r--drivers/clk/samsung/clk-cpu.c6
-rw-r--r--drivers/clk/samsung/clk-cpu.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c
index d2c99d8916b8..a5fddebbe530 100644
--- a/drivers/clk/samsung/clk-cpu.c
+++ b/drivers/clk/samsung/clk-cpu.c
@@ -152,7 +152,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
152 struct exynos_cpuclk *cpuclk, void __iomem *base) 152 struct exynos_cpuclk *cpuclk, void __iomem *base)
153{ 153{
154 const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg; 154 const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg;
155 unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent); 155 unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent);
156 unsigned long alt_div = 0, alt_div_mask = DIV_MASK; 156 unsigned long alt_div = 0, alt_div_mask = DIV_MASK;
157 unsigned long div0, div1 = 0, mux_reg; 157 unsigned long div0, div1 = 0, mux_reg;
158 unsigned long flags; 158 unsigned long flags;
@@ -280,7 +280,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
280 struct exynos_cpuclk *cpuclk, void __iomem *base) 280 struct exynos_cpuclk *cpuclk, void __iomem *base)
281{ 281{
282 const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg; 282 const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg;
283 unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent); 283 unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent);
284 unsigned long alt_div = 0, alt_div_mask = DIV_MASK; 284 unsigned long alt_div = 0, alt_div_mask = DIV_MASK;
285 unsigned long div0, div1 = 0, mux_reg; 285 unsigned long div0, div1 = 0, mux_reg;
286 unsigned long flags; 286 unsigned long flags;
@@ -432,7 +432,7 @@ int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,
432 else 432 else
433 cpuclk->clk_nb.notifier_call = exynos_cpuclk_notifier_cb; 433 cpuclk->clk_nb.notifier_call = exynos_cpuclk_notifier_cb;
434 434
435 cpuclk->alt_parent = __clk_lookup(alt_parent); 435 cpuclk->alt_parent = __clk_get_hw(__clk_lookup(alt_parent));
436 if (!cpuclk->alt_parent) { 436 if (!cpuclk->alt_parent) {
437 pr_err("%s: could not lookup alternate parent %s\n", 437 pr_err("%s: could not lookup alternate parent %s\n",
438 __func__, alt_parent); 438 __func__, alt_parent);
diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h
index d4b6b517fe1b..bd38c6aa3897 100644
--- a/drivers/clk/samsung/clk-cpu.h
+++ b/drivers/clk/samsung/clk-cpu.h
@@ -49,7 +49,7 @@ struct exynos_cpuclk_cfg_data {
49 */ 49 */
50struct exynos_cpuclk { 50struct exynos_cpuclk {
51 struct clk_hw hw; 51 struct clk_hw hw;
52 struct clk *alt_parent; 52 struct clk_hw *alt_parent;
53 void __iomem *ctrl_base; 53 void __iomem *ctrl_base;
54 spinlock_t *lock; 54 spinlock_t *lock;
55 const struct exynos_cpuclk_cfg_data *cfg; 55 const struct exynos_cpuclk_cfg_data *cfg;