Quoting Jerome Brunet (2018-12-04 08:34:03)
> clk_mux_val_to_index() is meant to be used by .get_parent(), which
> returns a u8, so when the value provided does not map to any valid index,
> it is not a good idea to return a negative error value.
> 
> Instead, return num_parents which we know is an invalid index and let
> CCF deal with it.
> 
> Fixes: 77deb66d262f ("clk: mux: add helper function for index/value 
> translation")
> Signed-off-by: Jerome Brunet <[email protected]>
> ---

Thanks!

> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> index 60c51871b04b..fc20886ef069 100644
> --- a/include/linux/clk-provider.h
> +++ b/include/linux/clk-provider.h
> @@ -550,8 +550,8 @@ struct clk_hw *clk_hw_register_mux_table(struct device 
> *dev, const char *name,
>                 void __iomem *reg, u8 shift, u32 mask,
>                 u8 clk_mux_flags, u32 *table, spinlock_t *lock);
>  
> -int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags,
> -                        unsigned int val);
> +u8 clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags,

I wonder if we should just make this unsigned int? Does it hurt at all
to have it be a wider type even though it doesn't match the CCF decision
to make this a u8 for the parent index number space?

Reply via email to