Commit 300796ca authored by Chun-Jie Chen's avatar Chun-Jie Chen Committed by Stephen Boyd

clk: mediatek: Add API for clock resource recycle

In order to avoid resource leak when fail clock registration appears,
so adds the common interface to handle it.
Signed-off-by: default avatarChun-Jie Chen <chun-jie.chen@mediatek.com>
Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20210914021633.26377-5-chun-jie.chen@mediatek.comSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent cb95c169
...@@ -43,6 +43,15 @@ struct clk_onecell_data *mtk_alloc_clk_data(unsigned int clk_num) ...@@ -43,6 +43,15 @@ struct clk_onecell_data *mtk_alloc_clk_data(unsigned int clk_num)
return NULL; return NULL;
} }
void mtk_free_clk_data(struct clk_onecell_data *clk_data)
{
if (!clk_data)
return;
kfree(clk_data->clks);
kfree(clk_data);
}
void mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, void mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks,
int num, struct clk_onecell_data *clk_data) int num, struct clk_onecell_data *clk_data)
{ {
......
...@@ -202,6 +202,7 @@ void mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, ...@@ -202,6 +202,7 @@ void mtk_clk_register_dividers(const struct mtk_clk_divider *mcds,
struct clk_onecell_data *clk_data); struct clk_onecell_data *clk_data);
struct clk_onecell_data *mtk_alloc_clk_data(unsigned int clk_num); struct clk_onecell_data *mtk_alloc_clk_data(unsigned int clk_num);
void mtk_free_clk_data(struct clk_onecell_data *clk_data);
#define HAVE_RST_BAR BIT(0) #define HAVE_RST_BAR BIT(0)
#define PLL_AO BIT(1) #define PLL_AO BIT(1)
......
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