From patchwork Thu Jul 5 12:33:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 1160011 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork1.kernel.org (Postfix) with ESMTP id F3BB23FD4F for ; Thu, 5 Jul 2012 12:33:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1SmlFR-0003Ex-MD; Thu, 05 Jul 2012 12:33:29 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1SmlFQ-0003Er-Ds for spi-devel-general@lists.sourceforge.net; Thu, 05 Jul 2012 12:33:28 +0000 X-ACL-Warn: Received: from opensource.wolfsonmicro.com ([80.75.67.52]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1SmlFK-0003Uc-N2 for spi-devel-general@lists.sourceforge.net; Thu, 05 Jul 2012 12:33:28 +0000 Received: from finisterre.wolfsonmicro.main (unknown [87.246.78.26]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id 10790750004; Thu, 5 Jul 2012 13:33:16 +0100 (BST) Received: from broonie by finisterre.wolfsonmicro.main with local (Exim 4.77) (envelope-from ) id 1SmlFC-0001lv-EJ; Thu, 05 Jul 2012 13:33:14 +0100 From: Mark Brown To: Grant Likely , Linus Walleij Subject: [PATCH] spi/s3c64xx: Convert to devm_request_and_ioremap() Date: Thu, 5 Jul 2012 13:33:13 +0100 Message-Id: <1341491593-6781-1-git-send-email-broonie@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.10 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1SmlFK-0003Uc-N2 Cc: spi-devel-general@lists.sourceforge.net, linux-samsung-soc@vger.kernel.org, Mark Brown 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: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net Saves some error handling and a small amount of code. Signed-off-by: Mark Brown Acked-by: Linus Walleij Reviewed-by: Sylwester Nawrocki --- drivers/spi/spi-s3c64xx.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index f4e2341..f62c13e 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1028,14 +1028,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) /* the spi->mode bits understood by this driver: */ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; - if (request_mem_region(mem_res->start, - resource_size(mem_res), pdev->name) == NULL) { - dev_err(&pdev->dev, "Req mem region failed\n"); - ret = -ENXIO; - goto err0; - } - - sdd->regs = ioremap(mem_res->start, resource_size(mem_res)); + sdd->regs = devm_request_and_ioremap(&pdev->dev, mem_res); if (sdd->regs == NULL) { dev_err(&pdev->dev, "Unable to remap IO\n"); ret = -ENXIO; @@ -1124,10 +1117,7 @@ err4: clk_put(sdd->clk); err3: err2: - iounmap((void *) sdd->regs); err1: - release_mem_region(mem_res->start, resource_size(mem_res)); -err0: platform_set_drvdata(pdev, NULL); spi_master_put(master); @@ -1138,7 +1128,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) { struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); - struct resource *mem_res; pm_runtime_disable(&pdev->dev); @@ -1154,12 +1143,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) clk_disable(sdd->clk); clk_put(sdd->clk); - iounmap((void *) sdd->regs); - - mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (mem_res != NULL) - release_mem_region(mem_res->start, resource_size(mem_res)); - platform_set_drvdata(pdev, NULL); spi_master_put(master);