clk: composite: Add unregister function
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Wed, 23 Mar 2016 16:38:24 +0000 (17:38 +0100)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 21 Apr 2016 21:43:28 +0000 (14:43 -0700)
The composite clock didn't have any unregistration function, which forced
us to use clk_unregister directly on it.

While it was already not great from an API point of view, it also meant
that we were leaking the clk_composite structure allocated in
clk_register_composite.

Add a clk_unregister_composite function to fix this.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk-composite.c
include/linux/clk-provider.h

index 1f903e1f86a281385a817d0a450404240ac40109..b0f3b84ebd136423a90518d4650bb30a24dd40dd 100644 (file)
@@ -286,3 +286,18 @@ err:
        kfree(composite);
        return clk;
 }
+
+void clk_unregister_composite(struct clk *clk)
+{
+       struct clk_composite *composite;
+       struct clk_hw *hw;
+
+       hw = __clk_get_hw(clk);
+       if (!hw)
+               return;
+
+       composite = to_clk_composite(hw);
+
+       clk_unregister(clk);
+       kfree(composite);
+}
index da95258127aace556dc32810c0b483bcda95198f..26a8c9b7be7124a341218fe0e9ea4951bc5212f5 100644 (file)
@@ -603,6 +603,7 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
                struct clk_hw *rate_hw, const struct clk_ops *rate_ops,
                struct clk_hw *gate_hw, const struct clk_ops *gate_ops,
                unsigned long flags);
+void clk_unregister_composite(struct clk *clk);
 
 /***
  * struct clk_gpio_gate - gpio gated clock
This page took 0.026413 seconds and 5 git commands to generate.