-/**
- * omap_clk_for_each_child - call callback on each child clock of clk
- * @clk: struct clk * to use as the "parent"
- * @parent_rate: rate of the parent of @clk to pass along
- * @rate_storage: flag indicating whether current or temporary rates are used
- * @cb: pointer to a callback function
- *
- * For each child clock of @clk, call the callback function @cb, passing
- * along the contents of @parent_rate and @rate_storage. If the callback
- * function returns non-zero, terminate the function and pass along the
- * return value.
- */
-static int omap_clk_for_each_child(struct clk *clk, unsigned long parent_rate,
- u8 rate_storage,
- int (*cb)(struct clk *clk,
- unsigned long parent_rate,
- u8 rate_storage))
-{
- struct clk_child *child;
- int ret;
-
- list_for_each_entry(child, &clk->children, node) {
- ret = (*cb)(child->clk, parent_rate, rate_storage);
- if (ret)
- break;
- }
-
- return ret;
-}
-
-/**
- * omap_clk_has_children - does clk @clk have any child clocks?
- * @clk: struct clk * to test for child clocks
- *
- * If clock @clk has any child clocks, return 1; otherwise, return 0.
- */
-static int omap_clk_has_children(struct clk *clk)
-{
- return (list_empty(&clk->children)) ? 0 : 1;
-}
-
-/**
- * _do_propagate_rate - callback function for rate propagation
- * @clk: struct clk * to recalc and propagate from
- * @parent_rate: rate of the parent of @clk, to use in recalculation
- * @rate_storage: flag indicating whether current or temporary rates are used
- *
- * If @clk has a recalc function, call it. If @clk has any children,
- * propagate @clk's rate. Returns 0.
- */
-static int _do_propagate_rate(struct clk *clk, unsigned long parent_rate,
- u8 rate_storage)
-{
- if (clk->recalc)
- clk->recalc(clk, parent_rate, rate_storage);
- if (omap_clk_has_children(clk))
- propagate_rate(clk, rate_storage);
- return 0;
-}
-
-/**
- * omap_clk_add_child - add a child clock @clk2 to @clk
- * @clk: parent struct clk *
- * @clk2: new child struct clk *
- *
- * Add a child clock @clk2 to the list of children of parent clock
- * @clk. Will potentially allocate memory from bootmem or, if
- * available, from slab. Must only be called with the clock framework
- * spinlock held. No return value.
- */
-void omap_clk_add_child(struct clk *clk, struct clk *clk2)
-{
- struct clk_child *child;
- int reuse = 0;
-
- if (!clk->children.next)
- INIT_LIST_HEAD(&clk->children);
-
- list_for_each_entry(child, &clk->children, node) {
- if (child->flags & CLK_CHILD_DELETED) {
- reuse = 1;
- child->flags &= ~CLK_CHILD_DELETED;
- break;
- }
- }
-
- if (!reuse) {
- if (slab_is_available())
- child = kmalloc(sizeof(struct clk_child), GFP_ATOMIC);
- else
- child = alloc_bootmem(sizeof(struct clk_child));
-
- if (!child) {
- WARN_ON(1);
- return;
- }
-
- memset(child, 0, sizeof(struct clk_child));
-
- if (slab_is_available())
- child->flags |= CLK_CHILD_SLAB_ALLOC;
- }
-
- child->clk = clk2;
-
- list_add_tail(&child->node, &clk->children);
-}
-
-/**
- * omap_clk_del_child - add a child clock @clk2 to @clk
- * @clk: parent struct clk *
- * @clk2: former child struct clk *
- *
- * Remove a child clock @clk2 from the list of children of parent
- * clock @clk. Must only be called with the clock framework spinlock
- * held. No return value.
- */
-void omap_clk_del_child(struct clk *clk, struct clk *clk2)
-{
- struct clk_child *child, *tmp;
-
- /* Loop over all existing clk_childs, when found, deallocate */
- list_for_each_entry_safe(child, tmp, &clk->children, node) {
- if (child->clk == clk2) {
- list_del(&child->node);
- if (child->flags & CLK_CHILD_SLAB_ALLOC) {
- kfree(child);
- } else {
- child->clk = NULL;
- child->flags |= CLK_CHILD_DELETED;
- }
- break;
- }
- }
-}
-