From patchwork Tue Jul 2 17:08:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hartley Sweeten X-Patchwork-Id: 2814071 Return-Path: X-Original-To: patchwork-spi-devel-general@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 9AF029F3C3 for ; Tue, 2 Jul 2013 17:09:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86A0B2017C for ; Tue, 2 Jul 2013 17:09:19 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73A3C20179 for ; Tue, 2 Jul 2013 17:09:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Uu44r-0007Hf-Sf; Tue, 02 Jul 2013 17:09:17 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Uu44q-0007HZ-TV for spi-devel-general@lists.sourceforge.net; Tue, 02 Jul 2013 17:09:17 +0000 X-ACL-Warn: Received: from mail1.bemta8.messagelabs.com ([216.82.243.202]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1Uu44n-0000gP-Lv for spi-devel-general@lists.sourceforge.net; Tue, 02 Jul 2013 17:09:16 +0000 Received: from [216.82.242.115:14921] by server-10.bemta-8.messagelabs.com id 7D/8F-06587-43903D15; Tue, 02 Jul 2013 17:09:08 +0000 X-Env-Sender: hartleys@visionengravers.com X-Msg-Ref: server-7.tower-132.messagelabs.com!1372784944!9645535!8 X-Originating-IP: [216.166.12.69] X-StarScan-Received: X-StarScan-Version: 6.9.9; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30112 invoked from network); 2 Jul 2013 17:09:08 -0000 Received: from out001.collaborationhost.net (HELO out001.collaborationhost.net) (216.166.12.69) by server-7.tower-132.messagelabs.com with RC4-SHA encrypted SMTP; 2 Jul 2013 17:09:08 -0000 Received: from etch.local (10.2.3.210) by smtp.collaborationhost.net (10.2.0.118) with Microsoft SMTP Server (TLS) id 8.3.213.0; Tue, 2 Jul 2013 12:08:37 -0500 From: H Hartley Sweeten To: Linux Kernel Subject: [PATCH v2 05/11] spi: spi-ep93xx: use devm_clk_get() Date: Tue, 2 Jul 2013 10:08:21 -0700 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Disposition: inline Message-ID: <201307021008.22347.hartleys@visionengravers.com> X-Spam-Score: 0.0 (/) X-Headers-End: 1Uu44n-0000gP-Lv Cc: Ryan Mallon , mika.westerberg@iki.fi, hsweeten@visionengravers.com, broonie@kernel.org, grant.likely@linaro.org, spi-devel-general@lists.sourceforge.net X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net 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 Use devm_clk_get() so that the clk_put() happens automatically when the last reference to this driver is dropped. Signed-off-by: H Hartley Sweeten Cc: Ryan Mallon Cc: Mika Westerberg Cc: Mark Brown Cc: Grant Likely Acked-by: Mika Westerberg --- drivers/spi/spi-ep93xx.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index c2660c2..c1a610e 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c @@ -1021,7 +1021,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev) espi = spi_master_get_devdata(master); - espi->clk = clk_get(&pdev->dev, NULL); + espi->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(espi->clk)) { dev_err(&pdev->dev, "unable to get spi clock\n"); error = PTR_ERR(espi->clk); @@ -1044,14 +1044,14 @@ static int ep93xx_spi_probe(struct platform_device *pdev) espi->regs_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(espi->regs_base)) { error = PTR_ERR(espi->regs_base); - goto fail_put_clock; + goto fail_release_master; } error = devm_request_irq(&pdev->dev, irq, ep93xx_spi_interrupt, 0, "ep93xx-spi", espi); if (error) { dev_err(&pdev->dev, "failed to request irq\n"); - goto fail_put_clock; + goto fail_release_master; } if (info->use_dma && ep93xx_spi_setup_dma(espi)) @@ -1085,8 +1085,6 @@ fail_free_queue: destroy_workqueue(espi->wq); fail_free_dma: ep93xx_spi_release_dma(espi); -fail_put_clock: - clk_put(espi->clk); fail_release_master: spi_master_put(master); @@ -1122,7 +1120,6 @@ static int ep93xx_spi_remove(struct platform_device *pdev) spin_unlock_irq(&espi->lock); ep93xx_spi_release_dma(espi); - clk_put(espi->clk); spi_unregister_master(master); return 0;