From patchwork Sun May 26 12:00:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 2615141 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by patchwork2.kernel.org (Postfix) with ESMTP id 10D85DFF69 for ; Sun, 26 May 2013 12:04:12 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4QC2djR027689; Sun, 26 May 2013 07:02:39 -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 r4QC2dLZ001521; Sun, 26 May 2013 07:02:39 -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; Sun, 26 May 2013 07:02:39 -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 r4QC2dVv017071; Sun, 26 May 2013 07:02:39 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 56B008062C; Sun, 26 May 2013 07:02:39 -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 16CBF8062B for ; Sun, 26 May 2013 07:02:08 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r4QC27B7003220 for ; Sun, 26 May 2013 07:02:07 -0500 (CDT) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4QC27K3018402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 26 May 2013 07:02:07 -0500 Received: from [216.82.253.163:25750] by server-16.bemta-7.messagelabs.com id B3/E8-22461-FB9F1A15; Sun, 26 May 2013 12:02:07 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-9.tower-166.messagelabs.com!1369569726!7340934!1 X-Originating-IP: [209.85.192.182] 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 5020 invoked from network); 26 May 2013 12:02:06 -0000 Received: from mail-pd0-f182.google.com (HELO mail-pd0-f182.google.com) (209.85.192.182) by server-9.tower-166.messagelabs.com with RC4-SHA encrypted SMTP; 26 May 2013 12:02:06 -0000 Received: by mail-pd0-f182.google.com with SMTP id g10so5652767pdj.41 for ; Sun, 26 May 2013 05:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=SDBvme0GLFUu8VC0lWUDTY65PqeFXpN8V1kVXI/9EK8=; b=PkV8WgETwa1ytPOGDRxZE0JvYqb8aE5TBBIF8Zoym/WyRCBfxucmgfsXyUoj5+SFt8 dLIxtp50ZZsJM6v5a97VcB5C1uHzZzLpWnxpnqbZMF/sOnofsxpQAxi0XzgLD1Zi1R1R Jjf+PDpcJlxFc4QwpcI8jsbJjN/Zm5Rp3/Wwm1AGl/osH0RJ4UI93chWfFY0rnMz7VCa W9mDDRTSqy9D1I5PxEJoXVsACrpqJs3l6PLm+0lx1fFbsq0Hw3eWDcB1IceUH1w9LFBd C6U3YdgsU+SMJifJGqWCXwChaOXqrq3PH0YfPCaJR2NEKdBIgliqRfFH8aI4CkZXFFuZ taKQ== X-Received: by 10.66.21.38 with SMTP id s6mr25432651pae.103.1369569725920; Sun, 26 May 2013 05:02:05 -0700 (PDT) Received: from localhost.localdomain ([112.79.41.196]) by mx.google.com with ESMTPSA id ri8sm24237417pbc.3.2013.05.26.05.01.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 26 May 2013 05:02:05 -0700 (PDT) From: Prabhakar Lad To: Hans Verkuil , Mauro Carvalho Chehab , LMML , Laurent Pinchart Subject: [PATCH v3 2/9] media: davinci: vpif: Convert to devm_* api Date: Sun, 26 May 2013 17:30:05 +0530 Message-ID: <1369569612-30915-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1369569612-30915-1-git-send-email-prabhakar.csengg@gmail.com> References: <1369569612-30915-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , 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(). This ensures more consistent error values and simplifies error paths. Signed-off-by: Lad, Prabhakar Acked-by: Laurent Pinchart --- drivers/media/platform/davinci/vpif.c | 27 ++++----------------------- 1 files changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 761c825..f857d8f 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c @@ -37,8 +37,6 @@ MODULE_LICENSE("GPL"); #define VPIF_CH2_MAX_MODES (15) #define VPIF_CH3_MAX_MODES (02) -static resource_size_t res_len; -static struct resource *res; spinlock_t vpif_lock; void __iomem *vpif_base; @@ -421,23 +419,12 @@ EXPORT_SYMBOL(vpif_channel_getfid); static int vpif_probe(struct platform_device *pdev) { - int status = 0; + static struct resource *res; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENOENT; - - res_len = resource_size(res); - - res = request_mem_region(res->start, res_len, res->name); - if (!res) - return -EBUSY; - - vpif_base = ioremap(res->start, res_len); - if (!vpif_base) { - status = -EBUSY; - goto fail; - } + vpif_base = devm_request_and_ioremap(&pdev->dev, res); + if (IS_ERR(vpif_base)) + return PTR_ERR(vpif_base); pm_runtime_enable(&pdev->dev); pm_runtime_get(&pdev->dev); @@ -445,17 +432,11 @@ static int vpif_probe(struct platform_device *pdev) spin_lock_init(&vpif_lock); dev_info(&pdev->dev, "vpif probe success\n"); return 0; - -fail: - release_mem_region(res->start, res_len); - return status; } static int vpif_remove(struct platform_device *pdev) { pm_runtime_disable(&pdev->dev); - iounmap(vpif_base); - release_mem_region(res->start, res_len); return 0; }