Re: [PATCH] clk: qcom: Fix parent_map translations

From: Stephen Boyd
Date: Mon Apr 06 2015 - 16:58:07 EST


On 04/03/15 07:00, Georgi Djakov wrote:
> When we introduced the parent_map tables, we missed to update some
> of the functions where mapping is translated. Fix this.
>
> Signed-off-by: Georgi Djakov <georgi.djakov@xxxxxxxxxx>
> ---
> drivers/clk/qcom/clk-rcg.c | 13 ++++++++++---
> drivers/clk/qcom/clk-rcg2.c | 20 +++++++++++++++-----
> 2 files changed, 25 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/qcom/clk-rcg.c b/drivers/clk/qcom/clk-rcg.c
> index 8f2f48071a7a..e30821a3ba68 100644
> --- a/drivers/clk/qcom/clk-rcg.c
> +++ b/drivers/clk/qcom/clk-rcg.c
> @@ -319,7 +319,7 @@ static int clk_dyn_rcg_set_parent(struct clk_hw *hw, u8 index)
> if (banked_p)
> f.pre_div = ns_to_pre_div(&rcg->p[bank], ns) + 1;
>
> - f.src = index;
> + f.src = qcom_find_src_index(hw, rcg->s[bank].parent_map, index);
> return configure_bank(rcg, &f);
> }
>
> @@ -411,13 +411,19 @@ static long _freq_tbl_determine_rate(struct clk_hw *hw,
> {
> unsigned long clk_flags;
> struct clk *p;
> + struct clk_rcg *rcg = to_clk_rcg(hw);

This function is called by both clk_dyn_rcg_determine_rate() and
clk_rcg_determine_rate() which means struct clk_hw is wrapped by
different structs. The to_clk_rcg() is wrong here. How about we pass the
parent map to this function?

> + int index;
>
> f = qcom_find_freq(f, rate);
> if (!f)
> return -EINVAL;
>
> + index = qcom_find_src_index(hw, rcg->s.parent_map, f->src);
> + if (index < 0)
> + return index;
> +
> clk_flags = __clk_get_flags(hw->clk);
> - p = clk_get_parent_by_index(hw->clk, f->src);
> + p = clk_get_parent_by_index(hw->clk, index);
> if (clk_flags & CLK_SET_RATE_PARENT) {
> rate = rate * f->pre_div;
> if (f->n) {
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/