]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
clk: mediatek: clk-apmixed: Add helper function to unregister ref2usb_tx
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Wed, 21 Sep 2022 09:14:54 +0000 (11:14 +0200)
committerChen-Yu Tsai <wenst@chromium.org>
Mon, 26 Sep 2022 03:13:09 +0000 (11:13 +0800)
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 <angelogioacchino.delregno@collabora.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20220921091455.41327-8-angelogioacchino.delregno@collabora.com
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
drivers/clk/mediatek/clk-apmixed.c
drivers/clk/mediatek/clk-mtk.h

index f126da693a7fff2a3744b93ccc3efc1408f04492..60e34f124250ddceaf97373397718c1c235f3c90 100644 (file)
@@ -100,4 +100,13 @@ struct clk_hw *mtk_clk_register_ref2usb_tx(const char *name,
 }
 EXPORT_SYMBOL_GPL(mtk_clk_register_ref2usb_tx);
 
+void mtk_clk_unregister_ref2usb_tx(struct clk_hw *hw)
+{
+       struct mtk_ref2usb_tx *tx = to_mtk_ref2usb_tx(hw);
+
+       clk_hw_unregister(hw);
+       kfree(tx);
+}
+EXPORT_SYMBOL_GPL(mtk_clk_unregister_ref2usb_tx);
+
 MODULE_LICENSE("GPL");
index 1b95c484d5aa42ed81d49ce8e520989b92894de8..62d650045cbaf6334bf2c6f35711f756f5a5922b 100644 (file)
@@ -188,6 +188,7 @@ void mtk_free_clk_data(struct clk_hw_onecell_data *clk_data);
 
 struct clk_hw *mtk_clk_register_ref2usb_tx(const char *name,
                        const char *parent_name, void __iomem *reg);
+void mtk_clk_unregister_ref2usb_tx(struct clk_hw *hw);
 
 struct mtk_clk_desc {
        const struct mtk_gate *clks;