Commit d3153113 authored by Varadarajan Narayanan's avatar Varadarajan Narayanan Committed by Bjorn Andersson

interconnect: icc-clk: Add devm_icc_clk_register

Wrap icc_clk_register to create devm_icc_clk_register to be
able to release the resources properly.
Acked-by: default avatarGeorgi Djakov <djakov@kernel.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarVaradarajan Narayanan <quic_varada@quicinc.com>
Link: https://lore.kernel.org/r/20240430064214.2030013-4-quic_varada@quicinc.comSigned-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent f45b94ff
......@@ -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()
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment