@@ -177,3 +177,18 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
NULL, lock);
}
EXPORT_SYMBOL_GPL(clk_register_mux);
+
+void clk_unregister_mux(struct clk *clk)
+{
+ struct clk_hw *hw;
+ struct clk_mux *mux;
+
+ hw = __clk_get_hw(clk);
+ if (!hw)
+ return;
+
+ mux = to_clk_mux(hw);
+ clk_unregister(clk);
+ kfree(mux);
+}
+EXPORT_SYMBOL_GPL(clk_unregister_mux);
@@ -401,6 +401,8 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name,
void __iomem *reg, u8 shift, u32 mask,
u8 clk_mux_flags, u32 *table, spinlock_t *lock);
+void clk_unregister_mux(struct clk *clk);
+
void of_fixed_factor_clk_setup(struct device_node *node);
/**
Some drivers want to remove clocks they register with clk_unregister(). Unfortunately, calling clk_unregister() directly on the clock returned by clk_register_mux() would result in a memory leak of the clk_mux struct. Add an API to free that allocation and unregister the clock. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> --- drivers/clk/clk-mux.c | 15 +++++++++++++++ include/linux/clk-provider.h | 2 ++ 2 files changed, 17 insertions(+)