From: Jean-Francois Moine Date: Mon, 25 Nov 2013 18:47:04 +0000 (+0100) Subject: clk: return probe defer when DT clock not yet ready X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a34cd4666f3da84228a82f70c94b8d9b692034ea;p=linux-beck.git 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 Reviewed-by: Sylwester Nawrocki Tested-by: Sylwester Nawrocki Signed-off-by: Mike Turquette --- diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index f30e6af90332..cc2ca9aebe02 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2466,7 +2466,7 @@ EXPORT_SYMBOL_GPL(of_clk_del_provider); struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec) { 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 */ list_for_each_entry(provider, &of_clk_providers, link) { diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 48f67218247c..a360b2eca5cb 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -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); if (!IS_ERR(clk)) return clk; + if (PTR_ERR(clk) == -EPROBE_DEFER) + return clk; } return clk_get_sys(dev_id, con_id);