[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1131b1a-5706-4675-8c97-c2e6a58d6be0@kernel.org>
Date: Mon, 29 Apr 2024 14:10:47 +0300
From: Georgi Djakov <djakov@...nel.org>
To: Varadarajan Narayanan <quic_varada@...cinc.com>, andersson@...nel.org,
mturquette@...libre.com, sboyd@...nel.org, robh@...nel.org,
krzk+dt@...nel.org, conor+dt@...nel.org, konrad.dybcio@...aro.org,
dmitry.baryshkov@...aro.org, quic_anusha@...cinc.com,
linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH v10 3/6] interconnect: icc-clk: Add devm_icc_clk_register
On 29.04.24 12:13, Varadarajan Narayanan wrote:
> Wrap icc_clk_register to create devm_icc_clk_register to be
> able to release the resources properly.
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> Signed-off-by: Varadarajan Narayanan <quic_varada@...cinc.com>
Acked-by: Georgi Djakov <djakov@...nel.org>
> ---
> v8: Added Reviewed-by: Dmitry Baryshkov
> v7: Simplify devm_icc_clk_register implementation as suggested in review
> v5: Introduced devm_icc_clk_register
> ---
> drivers/interconnect/icc-clk.c | 18 ++++++++++++++++++
> include/linux/interconnect-clk.h | 2 ++
> 2 files changed, 20 insertions(+)
>
> diff --git a/drivers/interconnect/icc-clk.c b/drivers/interconnect/icc-clk.c
> index 2be193fd7d8f..f788db15cd76 100644
> --- a/drivers/interconnect/icc-clk.c
> +++ b/drivers/interconnect/icc-clk.c
> @@ -148,6 +148,24 @@ struct icc_provider *icc_clk_register(struct device *dev,
> }
> EXPORT_SYMBOL_GPL(icc_clk_register);
>
> +static void devm_icc_release(void *res)
> +{
> + icc_clk_unregister(res);
> +}
> +
> +int devm_icc_clk_register(struct device *dev, unsigned int first_id,
> + unsigned int num_clocks, const struct icc_clk_data *data)
> +{
> + struct icc_provider *prov;
> +
> + prov = icc_clk_register(dev, first_id, num_clocks, data);
> + if (IS_ERR(prov))
> + return PTR_ERR(prov);
> +
> + return devm_add_action_or_reset(dev, devm_icc_release, prov);
> +}
> +EXPORT_SYMBOL_GPL(devm_icc_clk_register);
> +
> /**
> * icc_clk_unregister() - unregister a previously registered clk interconnect provider
> * @provider: provider returned by icc_clk_register()
> diff --git a/include/linux/interconnect-clk.h b/include/linux/interconnect-clk.h
> index 170898faaacb..9bcee3e9c56c 100644
> --- a/include/linux/interconnect-clk.h
> +++ b/include/linux/interconnect-clk.h
> @@ -19,6 +19,8 @@ struct icc_provider *icc_clk_register(struct device *dev,
> unsigned int first_id,
> unsigned int num_clocks,
> const struct icc_clk_data *data);
> +int devm_icc_clk_register(struct device *dev, unsigned int first_id,
> + unsigned int num_clocks, const struct icc_clk_data *data);
> void icc_clk_unregister(struct icc_provider *provider);
>
> #endif
Powered by blists - more mailing lists