Skip to content

Commit b7520e2

Browse files
AngeloGioacchino Del Regnowens
authored andcommitted
clk: mediatek: clk-apmixed: Add helper function to unregister ref2usb_tx
The ref2usb_tx clock was introduced a long time ago and, at that time, the MediaTek clock drivers were using CLK_OF_DECLARE, so they would never unregister. Nowadays, unregistering clock drivers is a thing, as we're registering them as platform_driver and allowing them to be kernel modules: add a helper function to cleanup the ref2usb_tx clock during error handling and upon module removal. Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Chen-Yu Tsai <[email protected]>
1 parent 7cbe5cb commit b7520e2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

drivers/clk/mediatek/clk-apmixed.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,13 @@ struct clk_hw *mtk_clk_register_ref2usb_tx(const char *name,
100100
}
101101
EXPORT_SYMBOL_GPL(mtk_clk_register_ref2usb_tx);
102102

103+
void mtk_clk_unregister_ref2usb_tx(struct clk_hw *hw)
104+
{
105+
struct mtk_ref2usb_tx *tx = to_mtk_ref2usb_tx(hw);
106+
107+
clk_hw_unregister(hw);
108+
kfree(tx);
109+
}
110+
EXPORT_SYMBOL_GPL(mtk_clk_unregister_ref2usb_tx);
111+
103112
MODULE_LICENSE("GPL");

drivers/clk/mediatek/clk-mtk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ void mtk_free_clk_data(struct clk_hw_onecell_data *clk_data);
188188

189189
struct clk_hw *mtk_clk_register_ref2usb_tx(const char *name,
190190
const char *parent_name, void __iomem *reg);
191+
void mtk_clk_unregister_ref2usb_tx(struct clk_hw *hw);
191192

192193
struct mtk_clk_desc {
193194
const struct mtk_gate *clks;

0 commit comments

Comments
 (0)