From patchwork Wed Jan 20 10:14:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 8070631 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 00A209FC36 for ; Wed, 20 Jan 2016 10:16:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 22C7A203A5 for ; Wed, 20 Jan 2016 10:16:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24A9720443 for ; Wed, 20 Jan 2016 10:16:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934971AbcATKQX (ORCPT ); Wed, 20 Jan 2016 05:16:23 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:34644 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934350AbcATKOh (ORCPT ); Wed, 20 Jan 2016 05:14:37 -0500 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O1801MZOXSBT470@mailout1.samsung.com>; Wed, 20 Jan 2016 19:14:35 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.113]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id C4.9C.04972.B0E5F965; Wed, 20 Jan 2016 19:14:35 +0900 (KST) X-AuditID: cbfee68e-f793c6d00000136c-8f-569f5e0b48de Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id A3.31.13906.B0E5F965; Wed, 20 Jan 2016 19:14:35 +0900 (KST) Received: from samsunx.samsung ([10.113.63.54]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O1800E77XS6VX80@mmp1.samsung.com>; Wed, 20 Jan 2016 19:14:34 +0900 (KST) From: Andi Shyti To: linux-samsung-soc@vger.kernel.org Cc: Sangbeom Kim , Krzysztof Kozlowski , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Andi Shyti , Andi Shyti , Yadwinder Singh Brar , Jaehoon Chung Subject: [PATCH v3 4/4] clk: s2mps11: remove redundant code Date: Wed, 20 Jan 2016 19:14:24 +0900 Message-id: <1453284864-8082-5-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.6.4 In-reply-to: <1453284864-8082-1-git-send-email-andi.shyti@samsung.com> References: <1453284864-8082-1-git-send-email-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrELMWRmVeSWpSXmKPExsWyRsSkUJc7bn6YwZeH/BbbjzxjtVj84zmT xY1fbawWr18YWnzsucdqcXnXHDaLGef3MVlcPOVqcXHFFyaLH2e6WSzm/m5kdeD2eH+jld3j cl8vk8f1JZ+YPXbOusvu0bdlFaPH501yAWxRXDYpqTmZZalF+nYJXBk9uy+wFSyWrDi16RZb A+MLkS5GTg4JAROJBQsOsELYYhIX7q1n62Lk4hASWMEo0bP1BgtM0ZVd/UwgtpDAUkaJV6tU IIo+Mkqsn36EDSTBJqAp0XT7B5gtIqAq8bltATtIEbNAG7NE+9EtYJOEBawlXrUdArNZgIoe 7J8BNpVXwFVi09FpjF2MHEDb5CQmTXAACXMKuEl8mrMEarGrxJOW+WAzJQT2sUscX32ODWKO gMS3ySAzQXplJTYdYIY4WlLi4IobLBMYhRcwMqxiFE0tSC4oTkovMtIrTswtLs1L10vOz93E CIyK0/+e9e1gvHnA+hCjAAejEg8vQ/O8MCHWxLLiytxDjKZAGyYyS4km5wNj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PR4V15i+3t048X7Dl5iQN9r6 M3Ym/RNk5PNouLBOvjbq7zeRpcHmPWU3uwqaLHR0zBY0Lu4/JJryedrU60znK6ymq8Xz3Ttw QGVlBKf/BSWW4oxEQy3mouJEAFlLtj3SAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected 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=-6.9 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 The definition of s2mps11_name is meant to resolve the name of a given clock. Remove it because the clocks have the same name we can get it directly from the s2mps11_clks_init structure. While in the probe function the s2mps11_clks is used only to iterate through the s2mps11_clks. The naming itself brings confusion and the readability does not improve much. Signed-off-by: Andi Shyti Reviewed-by: Krzysztof Kozlowski --- drivers/clk/clk-s2mps11.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index fac0e20..371150a 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c @@ -28,8 +28,6 @@ #include #include -#define s2mps11_name(a) (a->hw.init->name) - enum { S2MPS11_CLK_AP = 0, S2MPS11_CLK_CP, @@ -141,19 +139,17 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev, 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 s2mps11_clk *s2mps11_clks; struct clk_onecell_data *clk_data; unsigned int s2mps11_reg; int i, ret = 0; enum sec_device_type hwid = platform_get_device_id(pdev)->driver_data; s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM, - sizeof(*s2mps11_clk), GFP_KERNEL); + sizeof(*s2mps11_clks), GFP_KERNEL); if (!s2mps11_clks) return -ENOMEM; - s2mps11_clk = s2mps11_clks; - clk_data = devm_kzalloc(&pdev->dev, sizeof(*clk_data), GFP_KERNEL); if (!clk_data) return -ENOMEM; @@ -186,26 +182,26 @@ static int s2mps11_clk_probe(struct platform_device *pdev) if (IS_ERR(s2mps11_clks->clk_np)) return PTR_ERR(s2mps11_clks->clk_np); - for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) { + for (i = 0; i < S2MPS11_CLKS_NUM; i++) { if (i == S2MPS11_CLK_CP && hwid == S2MPS14X) continue; /* Skip clocks not present in some devices */ - s2mps11_clk->iodev = iodev; - s2mps11_clk->hw.init = &s2mps11_clks_init[i]; - s2mps11_clk->mask = 1 << i; - s2mps11_clk->reg = s2mps11_reg; - - s2mps11_clk->clk = devm_clk_register(&pdev->dev, - &s2mps11_clk->hw); - if (IS_ERR(s2mps11_clk->clk)) { + s2mps11_clks[i].iodev = iodev; + s2mps11_clks[i].hw.init = &s2mps11_clks_init[i]; + s2mps11_clks[i].mask = 1 << i; + s2mps11_clks[i].reg = s2mps11_reg; + + s2mps11_clks[i].clk = devm_clk_register(&pdev->dev, + &s2mps11_clks[i].hw); + if (IS_ERR(s2mps11_clks[i].clk)) { dev_err(&pdev->dev, "Fail to register : %s\n", - s2mps11_name(s2mps11_clk)); - ret = PTR_ERR(s2mps11_clk->clk); + s2mps11_clks_init[i].name); + ret = PTR_ERR(s2mps11_clks[i].clk); goto err_reg; } - s2mps11_clk->lookup = clkdev_create(s2mps11_clk->clk, - s2mps11_name(s2mps11_clk), NULL); - if (!s2mps11_clk->lookup) { + s2mps11_clks[i].lookup = clkdev_create(s2mps11_clks[i].clk, + s2mps11_clks_init[i].name, NULL); + if (!s2mps11_clks[i].lookup) { ret = -ENOMEM; goto err_reg; }