From patchwork Wed Jan 16 09:48:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Fuzzey X-Patchwork-Id: 1987311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id BCAD33FDD1 for ; Wed, 16 Jan 2013 09:52:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TvPcn-0003jQ-7L; Wed, 16 Jan 2013 09:49:37 +0000 Received: from mta1.parkeon.com ([91.121.43.66]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TvPbx-0003Zk-N3 for linux-arm-kernel@lists.infradead.org; Wed, 16 Jan 2013 09:48:46 +0000 Received: from mta2.parkeon.com ([81.80.172.220]) by mta1.parkeon.com with esmtp (Exim 4.76) (envelope-from ) id 1TvPbj-000740-V4; Wed, 16 Jan 2013 10:48:32 +0100 Received: from [10.32.16.23] (helo=mail.besancon.parkeon.com) by mta2.parkeon.com with esmtp (Exim 4.77) (envelope-from ) id 1TvPbh-0006Wf-NA; Wed, 16 Jan 2013 10:48:29 +0100 Received: from [10.32.51.221] (port=41462 helo=[127.0.0.1]) by mail.besancon.parkeon.com with esmtp (Exim 4.71) (envelope-from ) id 1TvPbj-0000BF-QP; Wed, 16 Jan 2013 10:48:31 +0100 Subject: [PATCH 5/5] W1: Convert MXC onewire master to devm_ functions. To: Evgeniy Polyakov , Sascha Hauer , linux-arm-kernel@lists.infradead.org From: Martin Fuzzey Date: Wed, 16 Jan 2013 10:48:31 +0100 Message-ID: <20130116094831.9660.15981.stgit@localhost> In-Reply-To: <20130116094821.9660.18278.stgit@localhost> References: <20130116094821.9660.18278.stgit@localhost> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Virus-Scanned: by ClamAV at mta2.parkeon.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130116_044845_951813_9185811B X-CRM114-Status: UNSURE ( 8.52 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Signed-off-by: Martin Fuzzey --- drivers/w1/masters/mxc_w1.c | 35 ++++++++--------------------------- 1 files changed, 8 insertions(+), 27 deletions(-) diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c index 7454938..5b0c700 100644 --- a/drivers/w1/masters/mxc_w1.c +++ b/drivers/w1/masters/mxc_w1.c @@ -123,28 +123,22 @@ static int mxc_w1_probe(struct platform_device *pdev) if (IS_ERR(pinctrl)) { err = PTR_ERR(pinctrl); dev_err(&pdev->dev, "failed to get default pinctrl: %d\n", err); - goto failed_pin; + goto failed; } - mdev->clk = clk_get(&pdev->dev, NULL); + mdev->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(mdev->clk)) { err = PTR_ERR(mdev->clk); - goto failed_clk; + goto failed; } mdev->clkdiv = (clk_get_rate(mdev->clk) / 1000000) - 1; - res = request_mem_region(res->start, resource_size(res), - "mxc_w1"); - if (!res) { - err = -EBUSY; - goto failed_req; - } - - mdev->regs = ioremap(res->start, resource_size(res)); + mdev->regs = devm_request_and_ioremap(&pdev->dev, res); if (!mdev->regs) { dev_err(&pdev->dev, "Cannot map mxc_w1 registers\n"); - goto failed_ioremap; + err = -ENXIO; + goto failed; } clk_prepare_enable(mdev->clk); @@ -157,19 +151,12 @@ static int mxc_w1_probe(struct platform_device *pdev) err = w1_add_master_device(&mdev->bus_master); if (err) - goto failed_add; + goto failed; platform_set_drvdata(pdev, mdev); return 0; -failed_add: - iounmap(mdev->regs); -failed_ioremap: - release_mem_region(res->start, resource_size(res)); -failed_req: - clk_put(mdev->clk); -failed_pin: -failed_clk: +failed: kfree(mdev); return err; } @@ -180,16 +167,10 @@ failed_clk: static int mxc_w1_remove(struct platform_device *pdev) { struct mxc_w1_device *mdev = platform_get_drvdata(pdev); - struct resource *res; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); w1_remove_master_device(&mdev->bus_master); - iounmap(mdev->regs); - release_mem_region(res->start, resource_size(res)); clk_disable_unprepare(mdev->clk); - clk_put(mdev->clk); platform_set_drvdata(pdev, NULL);