Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Marek Szyprowski and committed by
Sylwester Nawrocki
1da220e3 b3322802

+4 -4
+3 -3
drivers/clk/samsung/clk-cpu.c
··· 152 152 struct exynos_cpuclk *cpuclk, void __iomem *base) 153 153 { 154 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 156 unsigned long alt_div = 0, alt_div_mask = DIV_MASK; 157 157 unsigned long div0, div1 = 0, mux_reg; 158 158 unsigned long flags; ··· 280 280 struct exynos_cpuclk *cpuclk, void __iomem *base) 281 281 { 282 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 284 unsigned long alt_div = 0, alt_div_mask = DIV_MASK; 285 285 unsigned long div0, div1 = 0, mux_reg; 286 286 unsigned long flags; ··· 432 432 else 433 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 436 if (!cpuclk->alt_parent) { 437 437 pr_err("%s: could not lookup alternate parent %s\n", 438 438 __func__, alt_parent);
+1 -1
drivers/clk/samsung/clk-cpu.h
··· 49 49 */ 50 50 struct exynos_cpuclk { 51 51 struct clk_hw hw; 52 - struct clk *alt_parent; 52 + struct clk_hw *alt_parent; 53 53 void __iomem *ctrl_base; 54 54 spinlock_t *lock; 55 55 const struct exynos_cpuclk_cfg_data *cfg;