[RFC V1 2/8] clk: pass parent rate if recalc_rate is NULL

Mike Turquette mturquette at linaro.org
Wed Nov 23 17:17:50 EST 2011


On Wed, Nov 23, 2011 at 3:12 AM, Richard Zhao <richard.zhao at linaro.org> wrote:
> Signed-off-by: Richard Zhao <richard.zhao at linaro.org>
> ---
>  drivers/clk/clk.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index ed557c9..2d8422f 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -256,6 +256,8 @@ static void clk_recalc_rates(struct clk *clk)
>
>        if (clk->ops->recalc_rate)
>                clk->rate = clk->ops->recalc_rate(clk);
> +       else if (clk->parent)
> +               clk->rate = clk->parent->rate;

My code at Linaro Connect did this but Saravana expressed that this
was not a safe assumption to make.  I suppose it depends on how many
clks you want to model, but don't provide good support with
clk_hw_ops.

I'm inclined to leave it out if it is making assumptions that work for
one platform but not another.  Saravana can you clarify if I
understood you correctly?

Regards,
Mike

>
>        if (old_rate == clk->rate)
>                return;
> @@ -527,6 +529,8 @@ void clk_init(struct device *dev, struct clk *clk)
>
>        if (clk->ops->recalc_rate)
>                clk->rate = clk->ops->recalc_rate(clk);
> +       else if (clk->parent)
> +               clk->rate = clk->parent->rate;
>        else
>                clk->rate = 0;
>
> --
> 1.7.5.4
>
>
>



More information about the linux-arm-kernel mailing list