From patchwork Thu May 16 12:58:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 2577991 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by patchwork1.kernel.org (Postfix) with ESMTP id 8DB3F3FE1F for ; Thu, 16 May 2013 13:01:34 +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 r4GD0Kdj003891; Thu, 16 May 2013 08:00:20 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r4GD0Ju6008916; Thu, 16 May 2013 08:00:19 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Thu, 16 May 2013 08:00:19 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id r4GD0Jke010507; Thu, 16 May 2013 08:00:19 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 328AE806C6; Thu, 16 May 2013 08:00:10 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 2A4C080628 for ; Thu, 16 May 2013 07:59:23 -0500 (CDT) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id r4GCxMjI014630 for ; Thu, 16 May 2013 07:59:22 -0500 (CDT) Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4GCxMOX026840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 May 2013 07:59:22 -0500 Received: from [216.82.242.131:51553] by server-12.bemta-8.messagelabs.com id 6C/F7-06982-A28D4915; Thu, 16 May 2013 12:59:22 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-3.tower-76.messagelabs.com!1368709160!22352048!1 X-Originating-IP: [209.85.210.46] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.8.6.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4885 invoked from network); 16 May 2013 12:59:21 -0000 Received: from mail-da0-f46.google.com (HELO mail-da0-f46.google.com) (209.85.210.46) by server-3.tower-76.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2013 12:59:21 -0000 Received: by mail-da0-f46.google.com with SMTP id e20so1639216dak.5 for ; Thu, 16 May 2013 05:59:19 -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=lbUuqDOuVvuGGRvFIDtR2C7nSap9xtxrVc5OA6x8g2A=; b=F4UtzetN2UkEJfLLgonnimQyduSElr0loBrP04HDPy0LShJPMv57zArkZ4nRzsJm3s KeGvUAsuvKvoCw/7/Hri3RPu6gEWvURhG+gvngB9BhSFSy8WLZe2Ovnf/kdplUIh1Ntc B9mJkmmFu8Q6Lxx/I1kCqxm7GhJ2Q+rIIfmihEa2spBWOLIV9PCD+JgCBJt0iNZ6juqP kzc9H6KCFfJkKT72sWgOAwEPOmcVeBPWhc9iYnZ1HnID1DbkPjHBGXnbd33gZZ/ptacW duLXtusx+AxeIbrLQyAExBDkr/OwIEyyXC5vvf7BWC056Xaz6LhVQrvxfoi1QOm4aqYI /49w== X-Received: by 10.68.222.74 with SMTP id qk10mr32204529pbc.58.1368709159937; Thu, 16 May 2013 05:59:19 -0700 (PDT) Received: from localhost.localdomain ([122.166.13.141]) by mx.google.com with ESMTPSA id v7sm6705907pbq.32.2013.05.16.05.59.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 16 May 2013 05:59:19 -0700 (PDT) From: Lad Prabhakar To: DLOS , LMML Subject: [PATCH 2/7] media: davinci: vpif: Convert to devm_* api Date: Thu, 16 May 2013 18:28:17 +0530 Message-ID: <1368709102-2854-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1368709102-2854-1-git-send-email-prabhakar.csengg@gmail.com> References: <1368709102-2854-1-git-send-email-prabhakar.csengg@gmail.com> CC: Hans Verkuil , LKML , Laurent Pinchart , Mauro Carvalho Chehab 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 --- 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 d354d50..7d028ca 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c @@ -32,8 +32,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; @@ -416,23 +414,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_ioremap_resource(&pdev->dev, res); + if (IS_ERR(vpif_base)) + return PTR_ERR(vpif_base); pm_runtime_enable(&pdev->dev); pm_runtime_get(&pdev->dev); @@ -440,17 +427,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; }