Skip to content

Commit a34cd46

Browse files
moinejfMike Turquette
authored andcommitted
clk: return probe defer when DT clock not yet ready
At probe time, a clock device may not be ready when some other device wants to use it. This patch lets the functions clk_get/devm_clk_get return a probe defer when the clock is defined in the DT but not yet available. Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
1 parent 86bcfa2 commit a34cd46

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/clk/clk.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,7 +2466,7 @@ EXPORT_SYMBOL_GPL(of_clk_del_provider);
24662466
struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec)
24672467
{
24682468
struct of_clk_provider *provider;
2469-
struct clk *clk = ERR_PTR(-ENOENT);
2469+
struct clk *clk = ERR_PTR(-EPROBE_DEFER);
24702470

24712471
/* Check if we have such a provider in our array */
24722472
list_for_each_entry(provider, &of_clk_providers, link) {

‎drivers/clk/clkdev.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ struct clk *clk_get(struct device *dev, const char *con_id)
167167
clk = of_clk_get_by_name(dev->of_node, con_id);
168168
if (!IS_ERR(clk))
169169
return clk;
170+
if (PTR_ERR(clk) == -EPROBE_DEFER)
171+
return clk;
170172
}
171173

172174
return clk_get_sys(dev_id, con_id);

0 commit comments

Comments
 (0)