Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
[cascardo/linux.git] / drivers / clk / clk.c
index 2db08c0..a004769 100644 (file)
@@ -458,7 +458,6 @@ static void clk_unprepare_unused_subtree(struct clk *clk)
                        clk->ops->unprepare(clk->hw);
        }
 }
-EXPORT_SYMBOL_GPL(__clk_get_flags);
 
 /* caller must hold prepare_lock */
 static void clk_disable_unused_subtree(struct clk *clk)
@@ -607,6 +606,7 @@ unsigned long __clk_get_flags(struct clk *clk)
 {
        return !clk ? 0 : clk->flags;
 }
+EXPORT_SYMBOL_GPL(__clk_get_flags);
 
 bool __clk_is_prepared(struct clk *clk)
 {
@@ -1108,16 +1108,17 @@ static u8 clk_fetch_parent_index(struct clk *clk, struct clk *parent)
 
 static void clk_reparent(struct clk *clk, struct clk *new_parent)
 {
-       /* avoid duplicate POST_RATE_CHANGE notifications */
-       if (new_parent->new_child == clk)
-               new_parent->new_child = NULL;
-
        hlist_del(&clk->child_node);
 
-       if (new_parent)
+       if (new_parent) {
+               /* avoid duplicate POST_RATE_CHANGE notifications */
+               if (new_parent->new_child == clk)
+                       new_parent->new_child = NULL;
+
                hlist_add_head(&clk->child_node, &new_parent->children);
-       else
+       } else {
                hlist_add_head(&clk->child_node, &clk_orphan_list);
+       }
 
        clk->parent = new_parent;
 }
@@ -1741,7 +1742,7 @@ int __clk_init(struct device *dev, struct clk *clk)
         * this clock
         */
        hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) {
-               if (orphan->ops->get_parent) {
+               if (orphan->num_parents && orphan->ops->get_parent) {
                        i = orphan->ops->get_parent(orphan->hw);
                        if (!strcmp(clk->name, orphan->parent_names[i]))
                                __clk_reparent(orphan, clk);