From patchwork Mon Apr 7 07:10:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 3944521 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F11AD9F374 for ; Mon, 7 Apr 2014 07:11:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C04420340 for ; Mon, 7 Apr 2014 07:11:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF80C202DD for ; Mon, 7 Apr 2014 07:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754636AbaDGHLK (ORCPT ); Mon, 7 Apr 2014 03:11:10 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:15637 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753408AbaDGHLJ (ORCPT ); Mon, 7 Apr 2014 03:11:09 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N3N007CZFYHC070@mailout4.w1.samsung.com>; Mon, 07 Apr 2014 08:11:05 +0100 (BST) X-AuditID: cbfec7f5-b7fc96d000004885-e1-53424f8a16d0 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id EF.EF.18565.A8F42435; Mon, 07 Apr 2014 08:11:06 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N3N00GAKFYFH460@eusync2.samsung.com>; Mon, 07 Apr 2014 08:11:06 +0100 (BST) From: Krzysztof Kozlowski To: linux-samsung-soc@vger.kernel.org, Mike Turquette , linux-kernel@vger.kernel.org Cc: Tushar Behera , Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Tomasz Figa , Krzysztof Kozlowski Subject: [PATCH RESEND 1/2] clk: s2mps11: Add missing of_node_put and of_clk_del_provider Date: Mon, 07 Apr 2014 09:10:43 +0200 Message-id: <1396854644-7409-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDJMWRmVeSWpSXmKPExsVy+t/xK7pd/k7BBst+yVpsnLGe1eL1C0OL s01v2C0u75rDZjHj/D4mi7VH7rJbPJ1wkc1i/YzXLBbtf/eyOXB63Lm2h82jb8sqRo/Pm+QC mKO4bFJSczLLUov07RK4Mq7+nchWsFOwYsK/KSwNjOf4uhg5OSQETCQuzHzNDGGLSVy4t54N xBYSWMoosWNFfhcjF5DdxyTR9/oME0iCTcBYYvPyJWBFIgK5Ej17lrKDFDELTGaSWLbsICNI QlggWqJ5zRt2EJtFQFXiwtuXrCA2r4CbRPPXPSxdjBxA2xQk5kyymcDIvYCRYRWjaGppckFx UnqukV5xYm5xaV66XnJ+7iZGSIh83cG49JjVIUYBDkYlHt6AA47BQqyJZcWVuYcYJTiYlUR4 d7M7BQvxpiRWVqUW5ccXleakFh9iZOLglGpgzOU9cneOyrf9858WPl89+a/gikN3FN+cfvhh ytoEtblH+q8aZNo+3cQ+VbraNO7n+Z/uufMzG2LsWGbyxa+pfeA6U/Ga+Pz3OZwq+yx+Xfzt 6WF6iF/y15nH+s/cnoe2aV/Yc1xSx2n14Q8bI9LdHt7q7FBbeoh5vrbkD/HsGbxLb4tF/9rQ f0mJpTgj0VCLuag4EQBA/Atr7wEAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add of_clk_del_provider to remove previously registered clock provider. Add of_node_put to decrement the ref count of clock nodes. Signed-off-by: Krzysztof Kozlowski --- drivers/clk/clk-s2mps11.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index f2f62a1bf61a..843ec3646501 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c @@ -44,6 +44,7 @@ enum { struct s2mps11_clk { struct sec_pmic_dev *iodev; + struct device_node *clk_np; struct clk_hw hw; struct clk *clk; struct clk_lookup *lookup; @@ -156,7 +157,6 @@ static int s2mps11_clk_probe(struct platform_device *pdev) { struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct s2mps11_clk *s2mps11_clks, *s2mps11_clk; - struct device_node *clk_np = NULL; unsigned int s2mps11_reg; int i, ret = 0; u32 val; @@ -168,9 +168,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev) s2mps11_clk = s2mps11_clks; - clk_np = s2mps11_clk_parse_dt(pdev); - if (IS_ERR(clk_np)) - return PTR_ERR(clk_np); + /* Store clocks of_node in first element of s2mps11_clks array */ + s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev); + if (IS_ERR(s2mps11_clks->clk_np)) + return PTR_ERR(s2mps11_clks->clk_np); switch(platform_get_device_id(pdev)->driver_data) { case S2MPS11X: @@ -225,7 +226,8 @@ static int s2mps11_clk_probe(struct platform_device *pdev) clk_data.clks = clk_table; clk_data.clk_num = S2MPS11_CLKS_NUM; - of_clk_add_provider(clk_np, of_clk_src_onecell_get, &clk_data); + of_clk_add_provider(s2mps11_clks->clk_np, + of_clk_src_onecell_get, &clk_data); } platform_set_drvdata(pdev, s2mps11_clks); @@ -250,6 +252,10 @@ static int s2mps11_clk_remove(struct platform_device *pdev) struct s2mps11_clk *s2mps11_clks = platform_get_drvdata(pdev); int i; + of_clk_del_provider(s2mps11_clks[0].clk_np); + /* Drop the reference obtained in s2mps11_clk_parse_dt */ + of_node_put(s2mps11_clks[0].clk_np); + for (i = 0; i < S2MPS11_CLKS_NUM; i++) clkdev_drop(s2mps11_clks[i].lookup);