From patchwork Fri Apr 26 20:02:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 2495741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 5C1683FC64 for ; Fri, 26 Apr 2013 20:07:24 +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 1UVott-00071X-8N; Fri, 26 Apr 2013 20:05:48 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVotG-0004OE-Mw; Fri, 26 Apr 2013 20:05:06 +0000 Received: from mail-ea0-x233.google.com ([2a00:1450:4013:c01::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVosd-0004Kz-Mx for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2013 20:04:28 +0000 Received: by mail-ea0-f179.google.com with SMTP id h10so1790969eaj.38 for ; Fri, 26 Apr 2013 13:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=7A9Hh5BpCZ+hDyFvq55MY/Xf406YPqDBUt74pvK6wx0=; b=lVrW55bcHyruwChUwToUORP1HslOalOp7vlX0688BSazaUAZJhJavTq8rcqWt0XleI UOtvEyvuublhsPD7WaLHSSsWGdBBs4lJ5hN25tCCsMahKoR7+gCQsndNMe6uiX0buV/t cUYh2k2Q73qTGvADHEaEpPb3Yo3PUijvId7WxpscU9EoXYj8VL1eMamkTHmuKL9pYmx+ jqauuFFgLGgdc8/kWtcTDOMe8fV1N0oJyMpLCUKBiNdzv474dYOuIBa1gXa1k1E9dbp/ AkNL51w6RiL+Xx3UCr5AXe07L6gHt0hcw1nQDjB9jW+LhNKznAGhSebsrzX9p+rlXDqw LWmQ== X-Received: by 10.14.109.131 with SMTP id s3mr46412402eeg.26.1367006665744; Fri, 26 Apr 2013 13:04:25 -0700 (PDT) Received: from localhost.localdomain (093105185086.warszawa.vectranet.pl. [93.105.185.86]) by mx.google.com with ESMTPSA id cd3sm17841788eeb.6.2013.04.26.13.04.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Apr 2013 13:04:25 -0700 (PDT) From: Sylwester Nawrocki To: kgene.kim@samsung.com, FlorianSchandinat@gmx.de Subject: [PATCH 7/9] s3c2410fb: Use devm_ioremap_resource() Date: Fri, 26 Apr 2013 22:02:21 +0200 Message-Id: <1367006543-5458-8-git-send-email-sylvester.nawrocki@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1367006543-5458-1-git-send-email-sylvester.nawrocki@gmail.com> References: <1367006543-5458-1-git-send-email-sylvester.nawrocki@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130426_160427_916883_8F849876 X-CRM114-Status: GOOD ( 11.01 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sylvester.nawrocki[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-fbdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org 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 Use devm_ioremap_resource instead of reques_mem_region()/ioremap(). This ensures more consistent error values and simplifies error paths. Signed-off-by: Sylwester Nawrocki --- drivers/video/s3c2410fb.c | 32 ++++---------------------------- 1 files changed, 4 insertions(+), 28 deletions(-) diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index da8b6c2..11f98ca 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -825,7 +825,6 @@ static int s3c2410fb_probe(struct platform_device *pdev) int ret; int irq; int i; - int size; u32 lcdcon1; mach_info = pdev->dev.platform_data; @@ -860,27 +859,12 @@ static int s3c2410fb_probe(struct platform_device *pdev) info->drv_type = platform_get_device_id(pdev)->driver_data; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { - dev_err(&pdev->dev, "failed to get memory registers\n"); - ret = -ENXIO; + info->io = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(info->io)) { + ret = PTR_ERR(info->io); goto dealloc_fb; } - size = resource_size(res); - info->mem = request_mem_region(res->start, size, pdev->name); - if (info->mem == NULL) { - dev_err(&pdev->dev, "failed to get memory region\n"); - ret = -ENOENT; - goto dealloc_fb; - } - - info->io = ioremap(res->start, size); - if (info->io == NULL) { - dev_err(&pdev->dev, "ioremap() of registers failed\n"); - ret = -ENXIO; - goto release_mem; - } - if (info->drv_type == DRV_S3C2412) info->irq_base = info->io + S3C2412_LCDINTBASE; else @@ -917,7 +901,7 @@ static int s3c2410fb_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret); ret = -EBUSY; - goto release_regs; + goto dealloc_fb; } info->clk = clk_get(NULL, "lcd"); @@ -997,10 +981,6 @@ release_clock: clk_put(info->clk); release_irq: free_irq(irq, info); -release_regs: - iounmap(info->io); -release_mem: - release_mem_region(res->start, size); dealloc_fb: platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo); @@ -1033,10 +1013,6 @@ static int s3c2410fb_remove(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); free_irq(irq, info); - iounmap(info->io); - - release_mem_region(info->mem->start, resource_size(info->mem)); - platform_set_drvdata(pdev, NULL); framebuffer_release(fbinfo);