[PATCH 2/3] clk: add prepare/unprepare helpers

Sascha Hauer sha at pengutronix.de
Thu Dec 15 22:38:57 PST 2022


On Fri, Dec 09, 2022 at 08:10:01AM +0100, Ahmad Fatoum wrote:
> barebox doesn't use interrupts, so it need not differentiate between a
> possibly sleeping prepare/unprepare and an atomic enable/disable.
> 
> Provide a wrapper that just expands to the already existing functions to
> simplify porting of Linux kernel drivers.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  include/linux/clk.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 42c64d650d1f..afa62cdccc02 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -71,6 +71,7 @@ struct clk *clk_get(struct device_d *dev, const char *id);
>   * Returns success (0) or negative errno.
>   */
>  int clk_enable(struct clk *clk);
> +#define clk_prepare_enable(clk) clk_enable(clk)
>  
>  /**
>   * clk_disable - inform the system when the clock source is no longer required.
> @@ -85,6 +86,7 @@ int clk_enable(struct clk *clk);
>   * disabled.
>   */
>  void clk_disable(struct clk *clk);
> +#define clk_disable_unprepare(clk) clk_disable(clk)

You should define this outside of #ifdef CONFIG_HAVE_CLK.

Sascha

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