Orphan clocks or children of orphan clocks don't have rate information at all and can produce strange results if they're allowed to be used and the parent becomes available later on.
So using the newly introduced orphan status bit defer __of_clk_get_from_provider calls for orphan clocks. Signed-off-by: Heiko Stuebner <[email protected]> Cc: Boris Brezillon <[email protected]> Cc: Alex Elder <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Stephen Warren <[email protected]> Cc: Max Filippov <[email protected]> Cc: [email protected] Cc: Zhangfei Gao <[email protected]> Cc: Santosh Shilimkar <[email protected]> Cc: Chao Xie <[email protected]> Cc: Jason Cooper <[email protected]> Cc: Stefan Wahren <[email protected]> Cc: Andrew Bresticker <[email protected]> Cc: Robert Jarzmik <[email protected]> Cc: Georgi Djakov <[email protected]> Cc: Sylwester Nawrocki <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Barry Song <[email protected]> Cc: Dinh Nguyen <[email protected]> Cc: Viresh Kumar <[email protected]> Cc: Gabriel FERNANDEZ <[email protected]> Cc: [email protected] Cc: Peter De Schrijver <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Ulf Hansson <[email protected]> Cc: Pawel Moll <[email protected]> Cc: Michal Simek <[email protected]> --- drivers/clk/clk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 341904f..27d2d4b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2226,6 +2226,14 @@ bool clk_is_match(const struct clk *p, const struct clk *q) } EXPORT_SYMBOL_GPL(clk_is_match); +static bool clk_is_orphan(const struct clk *clk) +{ + if (!clk) + return false; + + return clk->core->orphan; +} + /** * __clk_init - initialize the data structures in a struct clk * @dev: device initializing this clk, placeholder for now @@ -2968,6 +2976,11 @@ struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec, if (provider->node == clkspec->np) clk = provider->get(clkspec, provider->data); if (!IS_ERR(clk)) { + if (clk_is_orphan(clk)) { + clk = ERR_PTR(-EPROBE_DEFER); + break; + } + clk = __clk_create_clk(__clk_get_hw(clk), dev_id, con_id); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

