[PATCH 01/32] clk: define stub implementation for clk_get_parent

Sascha Hauer sha at pengutronix.de
Mon Sep 12 02:23:33 PDT 2022


On Mon, Sep 05, 2022 at 11:55:26AM +0200, Ahmad Fatoum wrote:
> To make it easier to build drivers utilizing clk_get_parent on sandbox
> for static analysis, provide a stub implementation of the function.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  include/linux/clk.h | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)

This will break architectures which do not use the common clk framework
and implement clk_get_parent themselves.

Fortunately there's only one architecture left doing this: AT91

Sascha

> 
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 42c64d650d1f..b18fc733843d 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -128,14 +128,6 @@ int clk_hw_set_rate(struct clk_hw *hw, unsigned long rate);
>  int clk_set_parent(struct clk *clk, struct clk *parent);
>  int clk_hw_set_parent(struct clk_hw *hw, struct clk_hw *hwp);
>  
> -/**
> - * clk_get_parent - get the parent clock source for this clock
> - * @clk: clock source
> - *
> - * Returns struct clk corresponding to parent clock source, or
> - * valid IS_ERR() condition containing errno.
> - */
> -struct clk *clk_get_parent(struct clk *clk);
>  struct clk_hw *clk_hw_get_parent(struct clk_hw *hw);
>  
>  int clk_set_phase(struct clk *clk, int degrees);
> @@ -658,6 +650,14 @@ struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, void *data)
>  struct clk *of_clk_get(struct device_node *np, int index);
>  struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
>  struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
> +/**
> + * clk_get_parent - get the parent clock source for this clock
> + * @clk: clock source
> + *
> + * Returns struct clk corresponding to parent clock source, or
> + * valid IS_ERR() condition containing errno.
> + */
> +struct clk *clk_get_parent(struct clk *clk);
>  unsigned int of_clk_get_parent_count(struct device_node *np);
>  int of_clk_parent_fill(struct device_node *np, const char **parents,
>  		       unsigned int size);
> @@ -717,6 +717,10 @@ static inline unsigned int of_clk_get_parent_count(struct device_node *np)
>  {
>  	return 0;
>  }
> +static inline struct clk *clk_get_parent(struct clk *clk)
> +{
> +	return ERR_PTR(-ENOENT);
> +}
>  static inline int of_clk_init(struct device_node *root,
>  			      const struct of_device_id *matches)
>  {
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list