From patchwork Thu May 16 07:10:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2575541 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork1.kernel.org (Postfix) with ESMTP id 2BA9A3FE1F for ; Thu, 16 May 2013 07:13:02 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4G7BTNO010007; Thu, 16 May 2013 02:11:29 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r4G7BTpm002038; Thu, 16 May 2013 02:11:29 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Thu, 16 May 2013 02:11:28 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id r4G7BSWv016652; Thu, 16 May 2013 02:11:28 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 3648180627; Thu, 16 May 2013 02:11:28 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 6142780626 for ; Thu, 16 May 2013 02:11:26 -0500 (CDT) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r4G7BQ1g006175 for ; Thu, 16 May 2013 02:11:26 -0500 (CDT) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4G7BPGh032355 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 May 2013 02:11:26 -0500 Received: from [216.82.253.163:12044] by server-13.bemta-7.messagelabs.com id 5E/80-24792-D9684915; Thu, 16 May 2013 07:11:25 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-15.tower-166.messagelabs.com!1368688284!11125278!1 X-Originating-IP: [209.85.160.41] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.9.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20936 invoked from network); 16 May 2013 07:11:25 -0000 Received: from mail-pb0-f41.google.com (HELO mail-pb0-f41.google.com) (209.85.160.41) by server-15.tower-166.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2013 07:11:25 -0000 Received: by mail-pb0-f41.google.com with SMTP id xb12so2073675pbc.14 for ; Thu, 16 May 2013 00:11:21 -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=BgSbKJTX5dzYN20+iniDuDkE1xSn+wseGl6VOyJEzGs=; b=y6Sk4+kOpmDaORguxGLT734OEOXny/f3x3wigLknXA+CQRhQdp+rERlXZWppbi6rk+ 2SrbTqyCR+wONKwZynzFBhKBCoHrCJia5GMT/yRISDYEwKpFgydSLJwnrzdHDHJ8nh9j e3NGUrFnmD0fA+oQ7Oi3oLJyAICalKYon7J8abEBc8KeCoNnj1cEWTmE7CljEmGGNyHP +pQWbSq4XUjE6lRrqMgAyPPIDGw6S+TpU4QOFfE93Fi3SY8p5ercljI+rHCWhOwLeCA3 qkadcmzZ1v60a6sfqe0MMoc3yOhEEM4mBjdmLjcwNQxwAG3YcRlC2HkYJDnXJhMkj3At 1SOQ== X-Received: by 10.66.144.5 with SMTP id si5mr42828710pab.6.1368688281392; Thu, 16 May 2013 00:11:21 -0700 (PDT) Received: from localhost.localdomain ([59.98.240.128]) by mx.google.com with ESMTPSA id 10sm5675951pbr.45.2013.05.16.00.11.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 16 May 2013 00:11:20 -0700 (PDT) From: Lad Prabhakar To: DLOS , LFBDEV , Florian Tobias Schandinat Subject: [PATCH 2/2] video:da8xx-fb: Convert to devm_* api Date: Thu, 16 May 2013 12:40:57 +0530 Message-ID: <1368688257-18705-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1368688257-18705-1-git-send-email-prabhakar.csengg@gmail.com> References: <1368688257-18705-1-git-send-email-prabhakar.csengg@gmail.com> CC: LKML X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Lad, Prabhakar Use devm_ioremap_resource instead of reques_mem_region()/ioremap() and devm_request_irq() instead of request_irq(). This ensures more consistent error values and simplifies error paths. Signed-off-by: Lad, Prabhakar --- drivers/video/da8xx-fb.c | 39 +++++++-------------------------------- 1 files changed, 7 insertions(+), 32 deletions(-) diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index aafe8b9..d35ea1d 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c @@ -134,7 +134,6 @@ #define LOWER_MARGIN 32 static void __iomem *da8xx_fb_reg_base; -static struct resource *lcdc_regs; static unsigned int lcd_revision; static irq_handler_t lcdc_irq_handler; static wait_queue_head_t frame_done_wq; @@ -1015,12 +1014,9 @@ static int fb_remove(struct platform_device *dev) par->p_palette_base); dma_free_coherent(NULL, par->vram_size, par->vram_virt, par->vram_phys); - free_irq(par->irq, par); pm_runtime_put_sync(&dev->dev); pm_runtime_disable(&dev->dev); framebuffer_release(info); - iounmap(da8xx_fb_reg_base); - release_mem_region(lcdc_regs->start, resource_size(lcdc_regs)); } return 0; @@ -1212,12 +1208,12 @@ static int fb_probe(struct platform_device *device) { struct da8xx_lcdc_platform_data *fb_pdata = device->dev.platform_data; + static struct resource *lcdc_regs; struct lcd_ctrl_config *lcd_cfg; struct fb_videomode *lcdc_info; struct fb_info *da8xx_fb_info; struct clk *fb_clk = NULL; struct da8xx_fb_par *par; - resource_size_t len; int ret, i; unsigned long ulcm; @@ -1227,29 +1223,14 @@ static int fb_probe(struct platform_device *device) } lcdc_regs = platform_get_resource(device, IORESOURCE_MEM, 0); - if (!lcdc_regs) { - dev_err(&device->dev, - "Can not get memory resource for LCD controller\n"); - return -ENOENT; - } - - len = resource_size(lcdc_regs); - - lcdc_regs = request_mem_region(lcdc_regs->start, len, lcdc_regs->name); - if (!lcdc_regs) - return -EBUSY; - - da8xx_fb_reg_base = ioremap(lcdc_regs->start, len); - if (!da8xx_fb_reg_base) { - ret = -EBUSY; - goto err_request_mem; - } + da8xx_fb_reg_base = devm_ioremap_resource(&device->dev, lcdc_regs); + if (IS_ERR(da8xx_fb_reg_base)) + return PTR_ERR(da8xx_fb_reg_base); fb_clk = clk_get(&device->dev, "fck"); if (IS_ERR(fb_clk)) { dev_err(&device->dev, "Can not get device clock\n"); - ret = -ENODEV; - goto err_ioremap; + return -ENODEV; } pm_runtime_enable(&device->dev); @@ -1430,8 +1411,8 @@ static int fb_probe(struct platform_device *device) lcdc_irq_handler = lcdc_irq_handler_rev02; } - ret = request_irq(par->irq, lcdc_irq_handler, 0, - DRIVER_NAME, par); + ret = devm_request_irq(&device->dev, par->irq, lcdc_irq_handler, 0, + DRIVER_NAME, par); if (ret) goto irq_freq; return 0; @@ -1460,12 +1441,6 @@ err_pm_runtime_disable: pm_runtime_put_sync(&device->dev); pm_runtime_disable(&device->dev); -err_ioremap: - iounmap(da8xx_fb_reg_base); - -err_request_mem: - release_mem_region(lcdc_regs->start, len); - return ret; }