Re: [PATCH 01/14] clk: introduce clk init op

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 18.05.21 13:49, Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>

Reviewed-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>

> ---
>  drivers/clk/clk.c   | 12 ++++++++++++
>  include/linux/clk.h |  1 +
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index b04d44593b..fb5bf57e4b 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -261,6 +261,7 @@ struct clk *clk_get_parent(struct clk *clk)
>  int clk_register(struct clk *clk)
>  {
>  	struct clk *c;
> +	int ret;
>  
>  	list_for_each_entry(c, &clks, list) {
>  		if (!strcmp(c->name, clk->name)) {
> @@ -274,10 +275,21 @@ int clk_register(struct clk *clk)
>  
>  	list_add_tail(&clk->list, &clks);
>  
> +	if (clk->ops->init) {
> +		ret = clk->ops->init(clk);
> +		if (ret)
> +			goto out;
> +	}
> +
>  	if (clk->flags & CLK_IS_CRITICAL)
>  		clk_enable(clk);
>  
>  	return 0;
> +out:
> +	list_del(&clk->list);
> +	free(clk->parents);
> +
> +	return ret;
>  }
>  
>  int clk_is_enabled(struct clk *clk)
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index c49fe9a54c..5d05ffd1b3 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -336,6 +336,7 @@ static inline void clk_put(struct clk *clk)
>  #define CLK_GATE_HIWORD_MASK	(1 << 1)
>  
>  struct clk_ops {
> +	int 		(*init)(struct clk *clk);
>  	int		(*enable)(struct clk *clk);
>  	void		(*disable)(struct clk *clk);
>  	int		(*is_enabled)(struct clk *clk);
> 

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

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux