Commit a34cd466 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mike Turquette

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: default avatarJean-Francois Moine <moinejf@free.fr>
Reviewed-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMike Turquette <mturquette@linaro.org>
parent 86bcfa2e
...@@ -2466,7 +2466,7 @@ EXPORT_SYMBOL_GPL(of_clk_del_provider); ...@@ -2466,7 +2466,7 @@ EXPORT_SYMBOL_GPL(of_clk_del_provider);
struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec) struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec)
{ {
struct of_clk_provider *provider; struct of_clk_provider *provider;
struct clk *clk = ERR_PTR(-ENOENT); struct clk *clk = ERR_PTR(-EPROBE_DEFER);
/* Check if we have such a provider in our array */ /* Check if we have such a provider in our array */
list_for_each_entry(provider, &of_clk_providers, link) { list_for_each_entry(provider, &of_clk_providers, link) {
......
...@@ -167,6 +167,8 @@ struct clk *clk_get(struct device *dev, const char *con_id) ...@@ -167,6 +167,8 @@ struct clk *clk_get(struct device *dev, const char *con_id)
clk = of_clk_get_by_name(dev->of_node, con_id); clk = of_clk_get_by_name(dev->of_node, con_id);
if (!IS_ERR(clk)) if (!IS_ERR(clk))
return clk; return clk;
if (PTR_ERR(clk) == -EPROBE_DEFER)
return clk;
} }
return clk_get_sys(dev_id, con_id); return clk_get_sys(dev_id, con_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment