From patchwork Thu Oct 17 16:30:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 3061981 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 5FA58BF924 for ; Thu, 17 Oct 2013 16:34:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A5EE203C4 for ; Thu, 17 Oct 2013 16:34:39 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D0C42039F for ; Thu, 17 Oct 2013 16:34:38 +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 1VWqVP-00087B-Oh; Thu, 17 Oct 2013 16:33:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VWqUq-0003Iv-Nr; Thu, 17 Oct 2013 16:32:24 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VWqU1-0003BH-85 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2013 16:31:35 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MUT009VUN7NN610@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2013 17:31:00 +0100 (BST) X-AuditID: cbfec7f4-b7f0a6d000007b1b-eb-526010c45411 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id F0.BD.31515.4C010625; Thu, 17 Oct 2013 17:31:00 +0100 (BST) Received: from amdc1227.digital.local ([106.116.147.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MUT00F39N7B2000@eusync1.samsung.com>; Thu, 17 Oct 2013 17:31:00 +0100 (BST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/8] clk: max77686: Refactor driver data handling Date: Thu, 17 Oct 2013 18:30:40 +0200 Message-id: <1382027442-1992-7-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.8.3.2 In-reply-to: <1382027442-1992-1-git-send-email-t.figa@samsung.com> References: <1382027442-1992-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBJMWRmVeSWpSXmKPExsVy+t/xy7pHBBKCDPY1CFnMP3KO1eJs0xt2 i/tfjzJabHp8jdVixvl9TBZPJ1xkszjdzWqxfsZrFgcOjzvX9rB5zDsZ6LF5Sb1H35ZVjB6f N8kFsEZx2aSk5mSWpRbp2yVwZUya+Z294JdwxYvnr1kbGLcLdDFyckgImEj8+D6BDcIWk7hw bz2QzcUhJLCUUeJe+2tmCKePSeLDtJXMIFVsAmoSnxsegXWICGhITOl6zA5SxCzQwiSxav1n JpCEsICjRE/TVJYuRg4OFgFVicWLA0DCvEDhPbfnMUFsU5BY9mUt2ExOASeJeYtvMYLYQkA1 f1ufM01g5F3AyLCKUTS1NLmgOCk911CvODG3uDQvXS85P3cTIyS0vuxgXHzM6hCjAAejEg/v gW/xQUKsiWXFlbmHGCU4mJVEeOO4EoKEeFMSK6tSi/Lji0pzUosPMTJxcEo1MIrpl8pfcL/F wyZXv8Jm13RehpnafKabmjZ9nDIx+BSL6dNtxm+lnkp8/nbr6yPnu0Lc5i8MVevyM1uPTFQN K5DSaJv36HmJnUL//YQ96Z5GgV0Kxs0+8rmMp63vbbM6uyQleNWJ9LdGO48m+/1ymPXE8EDN 2uLvtnPb399h33Js35vEnC+3NZRYijMSDbWYi4oTAUEyuncLAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131017_123133_430371_1EC83A41 X-CRM114-Status: GOOD ( 10.39 ) X-Spam-Score: -7.3 (-------) Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Mike Turquette , Samuel Ortiz , 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.6 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 Signed-off-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; }