[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4b41be0c9874c5873c0cf4b6e210812d.sboyd@kernel.org>
Date: Fri, 02 Aug 2024 18:04:22 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Bartosz Golaszewski <brgl@...ev.pl>, Luiz Augusto von Dentz <luiz.dentz@...il.com>, Marcel Holtmann <marcel@...tmann.org>, Michael Turquette <mturquette@...libre.com>, Russell King <linux@...linux.org.uk>
Cc: linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org, linux-bluetooth@...r.kernel.org, Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH RFC 1/2] clk: provide devm_clk_get_optional_enabled_with_rate()
Quoting Bartosz Golaszewski (2024-08-01 08:58:49)
> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
> index 90e6078fb6e1..34e800525e21 100644
> --- a/drivers/clk/clk-devres.c
> +++ b/drivers/clk/clk-devres.c
> @@ -99,6 +99,34 @@ struct clk *devm_clk_get_optional_enabled(struct device *dev, const char *id)
> }
> EXPORT_SYMBOL_GPL(devm_clk_get_optional_enabled);
>
> +struct clk *devm_clk_get_optional_enabled_with_rate(struct device *dev,
> + const char *id,
> + unsigned long rate)
> +{
> + struct clk *clk;
> + int ret;
> +
> + clk = __devm_clk_get(dev, id, clk_get_optional, NULL,
> + clk_disable_unprepare);
> + if (IS_ERR(clk))
> + return ERR_CAST(clk);
> +
> + ret = clk_set_rate(clk, rate);
> + if (ret)
> + goto out_put_clk;
> +
> + ret = clk_prepare_enable(clk);
> + if (ret)
> + goto out_put_clk;
> +
> + return clk;
> +
> +out_put_clk:
> + devm_clk_put(dev, clk);
> + return ERR_PTR(ret);
> +}
> +EXPORT_SYMBOL(devm_clk_get_optional_enabled_with_rate);
GPL
Powered by blists - more mailing lists