diff mbox series

[11/13] clk: mediatek: reset: Implement mtk_unregister_reset_controller() API

Message ID 20220504122601.335495-12-y.oudjana@protonmail.com (mailing list archive)
State New, archived
Headers show
Series Mediatek MT6735 main clock and reset drivers | expand

Commit Message

Yassine Oudjana May 4, 2022, 12:26 p.m. UTC
From: Yassine Oudjana <y.oudjana@protonmail.com>

Add a function to unregister a reset controller previously
registered with mtk_register_reset_controller() or
mtk_register_reset_controller_set_clr(), and do the necessary cleanup.

Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
---
 drivers/clk/mediatek/clk-mtk.h | 2 ++
 drivers/clk/mediatek/reset.c   | 7 +++++++
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
index 317905ec4a36..1a0462d9c20b 100644
--- a/drivers/clk/mediatek/clk-mtk.h
+++ b/drivers/clk/mediatek/clk-mtk.h
@@ -196,6 +196,8 @@  struct mtk_reset *mtk_register_reset_controller(struct device_node *np,
 struct mtk_reset *mtk_register_reset_controller_set_clr(struct device_node *np,
 	unsigned int num_regs, int regofs);
 
+void mtk_unregister_reset_controller(struct mtk_reset *data);
+
 struct mtk_clk_desc {
 	const struct mtk_gate *clks;
 	size_t num_clks;
diff --git a/drivers/clk/mediatek/reset.c b/drivers/clk/mediatek/reset.c
index f853bc8a7092..7201e1f5e07b 100644
--- a/drivers/clk/mediatek/reset.c
+++ b/drivers/clk/mediatek/reset.c
@@ -141,4 +141,11 @@  struct mtk_reset *mtk_register_reset_controller_set_clr(struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(mtk_register_reset_controller_set_clr);
 
+void mtk_unregister_reset_controller(struct mtk_reset *data)
+{
+	reset_controller_unregister(&data->rcdev);
+	kfree(data);
+}
+EXPORT_SYMBOL_GPL(mtk_unregister_reset_controller);
+
 MODULE_LICENSE("GPL");