clk: samsung: Register clk provider only after registering its all clocks
Ensure the clock provider is not registered until after all its related clocks were created and are ready to use. Currently there are races possible and any (of_)clk_get() call right after a clock provider's clk_init_cb callback call may fail. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
This commit is contained in:
committed by
Tomasz Figa
parent
bdfcdf18c3
commit
d5e136a21b
@ -53,7 +53,6 @@ struct samsung_clk_provider *__init samsung_clk_init(struct device_node *np,
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
struct clk **clk_table;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
ctx = kzalloc(sizeof(struct samsung_clk_provider), GFP_KERNEL);
|
||||
@ -72,17 +71,19 @@ struct samsung_clk_provider *__init samsung_clk_init(struct device_node *np,
|
||||
ctx->clk_data.clk_num = nr_clks;
|
||||
spin_lock_init(&ctx->lock);
|
||||
|
||||
if (!np)
|
||||
return ctx;
|
||||
|
||||
ret = of_clk_add_provider(np, of_clk_src_onecell_get,
|
||||
&ctx->clk_data);
|
||||
if (ret)
|
||||
panic("could not register clock provide\n");
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void __init samsung_clk_of_add_provider(struct device_node *np,
|
||||
struct samsung_clk_provider *ctx)
|
||||
{
|
||||
if (np) {
|
||||
if (of_clk_add_provider(np, of_clk_src_onecell_get,
|
||||
&ctx->clk_data))
|
||||
panic("could not register clk provider\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* add a clock instance to the clock lookup table used for dt based lookup */
|
||||
void samsung_clk_add_lookup(struct samsung_clk_provider *ctx, struct clk *clk,
|
||||
unsigned int id)
|
||||
|
Reference in New Issue
Block a user