Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363547

[PATCH v3 01/19] clk: composite: Add unregister function

From Maxime Ripard <maxime.ripard@free-electrons.com>
Newsgroups linux.kernel
Subject [PATCH v3 01/19] clk: composite: Add unregister function
Date 2016-03-23 17:50 +0100
Message-ID <rfU8P-6dp-29@gated-at.bofh.it> (permalink)
References <rfTZ8-69G-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/clk/clk-composite.c  | 15 +++++++++++++++
 include/linux/clk-provider.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 1f903e1f86a2..b0f3b84ebd13 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -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);
+}
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index da95258127aa..26a8c9b7be71 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -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
-- 
2.7.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/19] drm: Add Allwinner A10 display engine support Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 16/19] drm: sun4i: tv: Add PAL output standard Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 02/19] clk: sunxi: Add display and TCON0 clocks driver Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 06/19] ARM: sun5i: dt: Add pll3 and pll7 clocks Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 07/19] ARM: sun5i: a13: Add display and TCON clocks Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 05/19] dt-bindings: clk: sun5i: add DRAM gates compatible Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 15/19] drm: sun4i: Add composite output Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 19/19] ARM: sun5i: chip: Enable the TV Encoder Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 08/19] ARM: sun5i: Add DRAM gates Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
    Re: [linux-sunxi] [PATCH v3 08/19] ARM: sun5i: Add DRAM gates Chen-Yu Tsai <wens@csie.org> - 2016-03-24 05:40 +0100
      Re: [linux-sunxi] [PATCH v3 08/19] ARM: sun5i: Add DRAM gates Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-29 12:10 +0200
  [PATCH v3 18/19] ARM: sun5i: r8: Add display blocks to the DTSI Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 10/19] drm: fb: Add seq_file definition Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 01/19] clk: composite: Add unregister function Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 17/19] drm: sun4i: tv: Add NTSC output standard Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100
  [PATCH v3 04/19] clk: sunxi: Add TCON channel1 clock Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-03-23 17:50 +0100

csiph-web