From patchwork Thu Dec 12 16:07:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 3332941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 466A8C0D4A for ; Thu, 12 Dec 2013 16:11:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 977E9205C1 for ; Thu, 12 Dec 2013 16:11:08 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57AE5205BE for ; Thu, 12 Dec 2013 16:11:07 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vr8pC-0001w6-D5; Thu, 12 Dec 2013 16:09:19 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vr8oo-0001Br-QH; Thu, 12 Dec 2013 16:08:54 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vr8o6-00015u-FF for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2013 16:08:11 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MXP007EXBGYGT60@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2013 16:07:46 +0000 (GMT) X-AuditID: cbfec7f5-b7fd16d000007299-82-52a9df51836c Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id B7.59.29337.15FD9A25; Thu, 12 Dec 2013 16:07:45 +0000 (GMT) Received: from amdc1227.digital.local ([106.116.147.199]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MXP00BIHBGQS260@eusync3.samsung.com>; Thu, 12 Dec 2013 16:07:45 +0000 (GMT) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 6/8] clk: max77686: Refactor driver data handling Date: Thu, 12 Dec 2013 17:07:19 +0100 Message-id: <1386864441-19561-7-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.8.4.3 In-reply-to: <1386864441-19561-1-git-send-email-t.figa@samsung.com> References: <1386864441-19561-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNJMWRmVeSWpSXmKPExsVy+t/xq7qB91cGGez4YmMx/8g5VouzTW/Y Le5/PcposenxNVaLGef3MVk8nXCRzeLkn15Gi9PdrBbrZ7xmceD0uHNtD5vHvJOBHpuX1Hv0 bVnF6PF5k1wAaxSXTUpqTmZZapG+XQJXxu9pNQVfhSumNbYyNTBuEuhi5OSQEDCRmLHjLAuE LSZx4d56NhBbSGApo8TX+0BxLiC7j0lix7VNYEVsAmoSnxsegRWJCGhITOl6zA5SxCywhkmi d/NUVpCEsICLxILVU4AaODhYBFQlmu4xg4R5BZwkunYtZIdYpiDRueY/I4jNKeAscePwbEaI xU4S2xZPYp/AyLuAkWEVo2hqaXJBcVJ6rpFecWJucWleul5yfu4mRkiAfd3BuPSY1SFGAQ5G JR7eFwdXBAmxJpYVV+YeYpTgYFYS4b23ZWWQEG9KYmVValF+fFFpTmrxIUYmDk6pBsZJojm/ Inf5OJzU3jTvhWvL2dD72t/SJ/TyZYXkzNFiqmbu5T9hu31j7r0N0ned85xKc+aofrLI36Gb 4XpSJ3r57bCz1s8DfjGILpw2yyynv5Clgq8mRW4l06E3SoYsRtvtd86etLU34JpWsMmco20T n19PybycELbh5K3XF7vzYjsTvY7vWqvEUpyRaKjFXFScCAACRY3vDgIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131212_110810_585093_52AC6CFD X-CRM114-Status: GOOD ( 10.30 ) X-Spam-Score: -6.9 (------) Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Mike Turquette , Samuel Ortiz , Sachin Kamat , Tomasz Figa , Kyungmin Park , Lee Jones X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 As a prerequisite for further patch adding OF clock provider support to the driver, this patch changes the driver to store an array of struct clk * as driver data. Signed-off-by: Tomasz Figa Acked-by: Kyungmin Park --- drivers/clk/clk-max77686.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c index 81b3680..3cf38dc 100644 --- a/drivers/clk/clk-max77686.c +++ b/drivers/clk/clk-max77686.c @@ -137,12 +137,13 @@ static struct clk *max77686_clk_register(struct device *dev, static int max77686_clk_probe(struct platform_device *pdev) { struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); - struct max77686_clk **max77686_clks; + struct max77686_clk *max77686_clks[MAX77686_CLKS_NUM]; + struct clk **clocks; int i, ret; - max77686_clks = devm_kzalloc(&pdev->dev, sizeof(struct max77686_clk *) + clocks = devm_kzalloc(&pdev->dev, sizeof(struct clk *) * MAX77686_CLKS_NUM, GFP_KERNEL); - if (!max77686_clks) + if (!clocks) return -ENOMEM; for (i = 0; i < MAX77686_CLKS_NUM; i++) { @@ -153,22 +154,20 @@ static int max77686_clk_probe(struct platform_device *pdev) } for (i = 0; i < MAX77686_CLKS_NUM; i++) { - struct clk *clk; - max77686_clks[i]->iodev = iodev; max77686_clks[i]->mask = 1 << i; max77686_clks[i]->hw.init = &max77686_clks_init[i]; - clk = max77686_clk_register(&pdev->dev, max77686_clks[i]); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); + clocks[i] = max77686_clk_register(&pdev->dev, max77686_clks[i]); + if (IS_ERR(clocks[i])) { + ret = PTR_ERR(clocks[i]); dev_err(&pdev->dev, "failed to register %s\n", max77686_clks[i]->hw.init->name); goto err_clocks; } } - platform_set_drvdata(pdev, max77686_clks); + platform_set_drvdata(pdev, clocks); return 0; @@ -183,12 +182,15 @@ err_clocks: static int max77686_clk_remove(struct platform_device *pdev) { - struct max77686_clk **max77686_clks = platform_get_drvdata(pdev); + struct clk **clocks = platform_get_drvdata(pdev); int i; for (i = 0; i < MAX77686_CLKS_NUM; i++) { - clkdev_drop(max77686_clks[i]->lookup); - clk_unregister(max77686_clks[i]->hw.clk); + struct clk_hw *hw = __clk_get_hw(clocks[i]); + struct max77686_clk *max77686 = to_max77686_clk(hw); + + clkdev_drop(max77686->lookup); + clk_unregister(clocks[i]); } return 0; }