Re: [PATCH 1/2] clk: divider: don't set_rate with CLK_DIVIDER_READ_ONLY flag

From: Stephen Boyd
Date: Thu Jun 04 2015 - 18:44:17 EST


On 04/07, Joonyoung Shim wrote:
> Even if use CLK_DIVIDER_READ_ONLY flag, divider setting can be changed
> by set_rate callback. Don't change divider setting from set_rate
> callback of divider with CLK_DIVIDER_READ_ONLY flag.
>
> Signed-off-by: Joonyoung Shim <jy0922.shim@xxxxxxxxxxx>
> ---
> drivers/clk/clk-divider.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
> index 25006a8..ce34d29a 100644
> --- a/drivers/clk/clk-divider.c
> +++ b/drivers/clk/clk-divider.c
> @@ -384,6 +384,9 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
> unsigned long flags = 0;
> u32 val;
>
> + if (divider->flags & CLK_DIVIDER_READ_ONLY)
> + return 0;
> +
> value = divider_get_val(rate, parent_rate, divider->table,
> divider->width, divider->flags);
>

I wonder if it would make more sense to have different ops for
read only dividers. We would need to have an empty clk_set_rate
op in the case where the CCF tries to set the rate to what it
already is and then the proper recalc_rate and round_rate ops for
read only devices. At the least, this patch looks correct.

--
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/