From patchwork Wed Jul 18 11:28:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 1210541 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 0DAC83FD4F for ; Wed, 18 Jul 2012 11:37:30 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SrST0-0001JU-9D; Wed, 18 Jul 2012 11:30:54 +0000 Received: from opensource.wolfsonmicro.com ([80.75.67.52]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SrSQv-0000nT-AN for linux-arm-kernel@lists.infradead.org; Wed, 18 Jul 2012 11:28:48 +0000 Received: from finisterre.wolfsonmicro.main (unknown [87.246.78.26]) by opensource.wolfsonmicro.com (Postfix) with ESMTPSA id 4434A110A04; Wed, 18 Jul 2012 12:28:43 +0100 (BST) Received: from broonie by finisterre.wolfsonmicro.main with local (Exim 4.80) (envelope-from ) id 1SrSQs-0008Kd-Ky; Wed, 18 Jul 2012 12:28:42 +0100 From: Mark Brown To: Grant Likely , Kukjin Kim Subject: [PATCH 3/4] spi/s3c64xx: Convert to devm_request_and_ioremap() Date: Wed, 18 Jul 2012 12:28:40 +0100 Message-Id: <1342610921-31986-3-git-send-email-broonie@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1342610921-31986-1-git-send-email-broonie@opensource.wolfsonmicro.com> References: <1342610921-31986-1-git-send-email-broonie@opensource.wolfsonmicro.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_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] Cc: spi-devel-general@lists.sourceforge.net, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mark Brown 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Saves some error handling and a small amount of code. Signed-off-by: Mark Brown Reviewed-by: Sylwester Nawrocki Acked-by: Linus Walleij --- drivers/spi/spi-s3c64xx.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 6ed3ba8..1781365 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1278,14 +1278,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; @@ -1379,9 +1372,7 @@ err3: if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) s3c64xx_spi_dt_gpio_free(sdd); 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); @@ -1393,7 +1384,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); @@ -1412,12 +1402,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev) if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) s3c64xx_spi_dt_gpio_free(sdd); - 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);