diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index ac7182903d88..e62552a75f08 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1302,26 +1302,14 @@ static void clk_core_disable_unprepare(struct clk_core *core) clk_core_unprepare_lock(core); } -static void clk_unprepare_unused_subtree(struct clk_core *core, - struct device *dev) +static void __init clk_unprepare_unused_subtree(struct clk_core *core) { - bool from_sync_state = !!dev; struct clk_core *child; lockdep_assert_held(&prepare_lock); hlist_for_each_entry(child, &core->children, child_node) - clk_unprepare_unused_subtree(child, dev); - - if (from_sync_state && core->dev != dev) - return; - - /* - * clock will be unprepared on sync_state, - * so leave as is for now - */ - if (!from_sync_state && dev_has_sync_state(core->dev)) - return; + clk_unprepare_unused_subtree(child); if (core->prepare_count) return; @@ -1344,27 +1332,15 @@ static void clk_unprepare_unused_subtree(struct clk_core *core, clk_pm_runtime_put(core); } -static void clk_disable_unused_subtree(struct clk_core *core, - struct device *dev) +static void __init clk_disable_unused_subtree(struct clk_core *core) { - bool from_sync_state = !!dev; struct clk_core *child; unsigned long flags; lockdep_assert_held(&prepare_lock); hlist_for_each_entry(child, &core->children, child_node) - clk_disable_unused_subtree(child, dev); - - if (from_sync_state && core->dev != dev) - return; - - /* - * clock will be disabled on sync_state, - * so leave as is for now - */ - if (!from_sync_state && dev_has_sync_state(core->dev)) - return; + clk_disable_unused_subtree(child); if (core->flags & CLK_OPS_PARENT_ENABLE) clk_core_prepare_enable(core->parent); @@ -1402,7 +1378,7 @@ unprepare_out: clk_core_disable_unprepare(core->parent); } -static bool clk_ignore_unused; +static bool clk_ignore_unused __initdata; static int __init clk_ignore_unused_setup(char *__unused) { clk_ignore_unused = true; @@ -1410,46 +1386,35 @@ static int __init clk_ignore_unused_setup(char *__unused) } __setup("clk_ignore_unused", clk_ignore_unused_setup); -static void __clk_disable_unused(struct device *dev) +static int __init clk_disable_unused(void) { struct clk_core *core; if (clk_ignore_unused) { pr_warn("clk: Not disabling unused clocks\n"); - return; + return 0; } clk_prepare_lock(); hlist_for_each_entry(core, &clk_root_list, child_node) - clk_disable_unused_subtree(core, dev); + clk_disable_unused_subtree(core); hlist_for_each_entry(core, &clk_orphan_list, child_node) - clk_disable_unused_subtree(core, dev); + clk_disable_unused_subtree(core); hlist_for_each_entry(core, &clk_root_list, child_node) - clk_unprepare_unused_subtree(core, dev); + clk_unprepare_unused_subtree(core); hlist_for_each_entry(core, &clk_orphan_list, child_node) - clk_unprepare_unused_subtree(core, dev); + clk_unprepare_unused_subtree(core); clk_prepare_unlock(); -} - -static int __init clk_disable_unused(void) -{ - __clk_disable_unused(NULL); return 0; } late_initcall_sync(clk_disable_unused); -void clk_sync_state_disable_unused(struct device *dev) -{ - __clk_disable_unused(dev); -} -EXPORT_SYMBOL_GPL(clk_sync_state_disable_unused); - static int clk_core_determine_round_nolock(struct clk_core *core, struct clk_rate_request *req) { diff --git a/drivers/clk/qcom/camcc-sdm845.c b/drivers/clk/qcom/camcc-sdm845.c index e5aeb832e47b..27d44188a7ab 100644 --- a/drivers/clk/qcom/camcc-sdm845.c +++ b/drivers/clk/qcom/camcc-sdm845.c @@ -1743,7 +1743,6 @@ static struct platform_driver cam_cc_sdm845_driver = { .driver = { .name = "sdm845-camcc", .of_match_table = cam_cc_sdm845_match_table, - .sync_state = clk_sync_state_disable_unused, }, }; diff --git a/drivers/clk/qcom/dispcc-sc8280xp.c b/drivers/clk/qcom/dispcc-sc8280xp.c index c84a6481b879..167470beb369 100644 --- a/drivers/clk/qcom/dispcc-sc8280xp.c +++ b/drivers/clk/qcom/dispcc-sc8280xp.c @@ -3199,7 +3199,6 @@ static struct platform_driver disp_cc_sc8280xp_driver = { .driver = { .name = "disp_cc-sc8280xp", .of_match_table = disp_cc_sc8280xp_match_table, - .sync_state = clk_sync_state_disable_unused, }, }; diff --git a/drivers/clk/qcom/dispcc-sdm845.c b/drivers/clk/qcom/dispcc-sdm845.c index 1810d58bad09..735adfefc379 100644 --- a/drivers/clk/qcom/dispcc-sdm845.c +++ b/drivers/clk/qcom/dispcc-sdm845.c @@ -869,7 +869,6 @@ static struct platform_driver disp_cc_sdm845_driver = { .driver = { .name = "disp_cc-sdm845", .of_match_table = disp_cc_sdm845_match_table, - .sync_state = clk_sync_state_disable_unused, }, }; diff --git a/drivers/clk/qcom/gcc-sc8280xp.c b/drivers/clk/qcom/gcc-sc8280xp.c index f4fdc5b9663c..b3198784e1c3 100644 --- a/drivers/clk/qcom/gcc-sc8280xp.c +++ b/drivers/clk/qcom/gcc-sc8280xp.c @@ -7441,7 +7441,6 @@ static struct platform_driver gcc_sc8280xp_driver = { .driver = { .name = "gcc-sc8280xp", .of_match_table = gcc_sc8280xp_match_table, - .sync_state = clk_sync_state_disable_unused, }, }; diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c index 0ff05af515c4..6af08e0ca847 100644 --- a/drivers/clk/qcom/gcc-sdm845.c +++ b/drivers/clk/qcom/gcc-sdm845.c @@ -4020,7 +4020,6 @@ static struct platform_driver gcc_sdm845_driver = { .driver = { .name = "gcc-sdm845", .of_match_table = gcc_sdm845_match_table, - .sync_state = clk_sync_state_disable_unused, }, }; diff --git a/drivers/clk/qcom/gpucc-sdm845.c b/drivers/clk/qcom/gpucc-sdm845.c index d48ad19e832d..970d7414bdf0 100644 --- a/drivers/clk/qcom/gpucc-sdm845.c +++ b/drivers/clk/qcom/gpucc-sdm845.c @@ -200,7 +200,6 @@ static struct platform_driver gpu_cc_sdm845_driver = { .driver = { .name = "sdm845-gpucc", .of_match_table = gpu_cc_sdm845_match_table, - .sync_state = clk_sync_state_disable_unused, }, }; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index cf1adfeaf257..842e72a5348f 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -720,7 +720,6 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name, void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags, const struct clk_div_table *table, spinlock_t *lock); -void clk_sync_state_disable_unused(struct device *dev); /** * clk_register_divider - register a divider clock with the clock framework * @dev: device registering this clock