Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752672AbcDOW3B (ORCPT ); Fri, 15 Apr 2016 18:29:01 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55272 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbcDOW27 (ORCPT ); Fri, 15 Apr 2016 18:28:59 -0400 Date: Fri, 15 Apr 2016 15:28:56 -0700 From: Stephen Boyd To: Maxime Ripard Cc: Mike Turquette , David Airlie , Thierry Reding , Rob Herring , Chen-Yu Tsai , Daniel Vetter , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Laurent Pinchart , Hans de Goede , Alexander Kaplan , Boris Brezillon , Thomas Petazzoni , Rob Clark Subject: Re: [PATCH v3 01/19] clk: composite: Add unregister function Message-ID: <20160415222856.GQ14441@codeaurora.org> References: <1458751122-23976-1-git-send-email-maxime.ripard@free-electrons.com> <1458751122-23976-2-git-send-email-maxime.ripard@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458751122-23976-2-git-send-email-maxime.ripard@free-electrons.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1585 Lines: 54 On 03/23, Maxime Ripard wrote: > 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 > --- I'm currently attempting to change the way clks are registered so that we don't return clk pointers from clk_register and have users add OF clk providers that return clk_hw pointers instead of clk pointers. Just a note, that this whole thing should be deleted in the next cycle if I can convert everything! > 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); > +} EXPORT_SYMBOL_GPL? Do I need to pick this up? -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project