From: Heiko Stuebner <heiko@...>
Date: Fri, 1 May 2015 21:50:46 +0200
Commit-Message
The orphan-check in __of_clk_get_from_provider only prevents orphan-access
on devicetree platforms. To bring non-dt platforms to the same level of
functionality let clk_get_sys (called from clk_get for non-dt platforms)
also check for orphans and return -EPROBE_DEFER in that case.
Signed-off-by: Heiko Stuebner <heiko@...>
Patch-Comment
drivers/clk/clk.c | 2 +-
drivers/clk/clk.h | 5 +++++
drivers/clk/clkdev.c | 5 +++++
3 files changed, 11 insertions(+), 1 deletion(-)
Statistics
- 11 lines added
- 1 lines removed
Changes
@@ -2220,7 +2220,7 @@ static inline void clk_debug_unregister(struct clk_core *core)
}
#endif
-static bool clk_is_orphan(const struct clk *clk)
+bool clk_is_orphan(const struct clk *clk)
{
if (!clk)
return false;
@@ -20,6 +20,7 @@ struct clk *__of_clk_get_from_provider(struct of_phandle_args *clkspec,
struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id,
const char *con_id);
void __clk_free_clk(struct clk *clk);
+bool clk_is_orphan(const struct clk *clk);
#else
/* All these casts to avoid ifdefs in clkdev... */
static inline struct clk *
@@ -32,5 +33,9 @@ static struct clk_hw *__clk_get_hw(struct clk *clk)
{
return (struct clk_hw *)clk;
}
+static inline bool clk_is_orphan(const struct clk *clk)
+{
+ return false;
+}
#endif
@@ -177,6 +177,11 @@ struct clk *clk_get_sys(const char *dev_id, const char *con_id)
if (!cl)
goto out;
+ if (clk_is_orphan(cl->clk)) {
+ clk = ERR_PTR(-EPROBE_DEFER);
+ goto out;
+ }
+
clk = __clk_create_clk(__clk_get_hw(cl->clk), dev_id, con_id);
if (IS_ERR(clk))
goto out;