From cbf9591f665d44f40795afe2eee4fcbcd32575d6 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 6 Jan 2016 13:25:09 +0900 Subject: [PATCH] clk: add clk_unregister_fixed_factor() Allow to unregister fixed factor clock. Signed-off-by: Masahiro Yamada Signed-off-by: Stephen Boyd --- drivers/clk/clk-fixed-factor.c | 13 +++++++++++++ include/linux/clk-provider.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index f0ddf37d5e15..053448e2453d 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -100,6 +100,19 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, } EXPORT_SYMBOL_GPL(clk_register_fixed_factor); +void clk_unregister_fixed_factor(struct clk *clk) +{ + struct clk_hw *hw; + + hw = __clk_get_hw(clk); + if (!hw) + return; + + clk_unregister(clk); + kfree(to_clk_fixed_factor(hw)); +} +EXPORT_SYMBOL_GPL(clk_unregister_fixed_factor); + #ifdef CONFIG_OF /** * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 33dc814d0f43..3641eecf462a 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -498,6 +498,7 @@ extern const struct clk_ops clk_fixed_factor_ops; struct clk *clk_register_fixed_factor(struct device *dev, const char *name, const char *parent_name, unsigned long flags, unsigned int mult, unsigned int div); +void clk_unregister_fixed_factor(struct clk *clk); /** * struct clk_fractional_divider - adjustable fractional divider clock