From patchwork Mon Jun 17 15:20:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2734511 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A19BCC0AB1 for ; Mon, 17 Jun 2013 15:23:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E54612039E for ; Mon, 17 Jun 2013 15:23:06 +0000 (UTC) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A211C20200 for ; Mon, 17 Jun 2013 15:23:05 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5HFLaid031957; Mon, 17 Jun 2013 10:21:36 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5HFLag6008051; Mon, 17 Jun 2013 10:21:36 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Mon, 17 Jun 2013 10:21:35 -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 r5HFLZc5028886; Mon, 17 Jun 2013 10:21:35 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 72FEF80627; Mon, 17 Jun 2013 10:21:35 -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 0DE3F80626 for ; Mon, 17 Jun 2013 10:21:34 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r5HFLXAH027830 for ; Mon, 17 Jun 2013 10:21:33 -0500 (CDT) Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5HFLWdh006233 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Jun 2013 10:21:33 -0500 Received: from [216.82.242.131:20593] by server-5.bemta-8.messagelabs.com id 27/7E-07470-9792FB15; Mon, 17 Jun 2013 15:21:29 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-8.tower-76.messagelabs.com!1371482487!32375242!1 X-Originating-IP: [209.85.220.54] X-SpamReason: No, hits=0.2 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, RCVD_ILLEGAL_IP,spamassassin: X-StarScan-Received: X-StarScan-Version: 6.9.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30227 invoked from network); 17 Jun 2013 15:21:28 -0000 Received: from mail-pa0-f54.google.com (HELO mail-pa0-f54.google.com) (209.85.220.54) by server-8.tower-76.messagelabs.com with RC4-SHA encrypted SMTP; 17 Jun 2013 15:21:28 -0000 Received: by mail-pa0-f54.google.com with SMTP id kx10so2966971pab.13 for ; Mon, 17 Jun 2013 08:21:27 -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=nymSBzDIQkTtDcMOd/GR/FfDEf3qoE4vXYfYs+4sZFc=; b=vqYJIQuDi8YoPA82hBUzxk3ax/jrJXkxa6kJlN1tNj9zopS74PRiYoopTgoXA6Tzyb d557e0Z7UWxbn7GZ8ebYcTuy5LsWwCbuABD0bGawrc2KUfs8pEWPejwp9QRLBlIInqcm IaqgiY4x7O2OLdN7kRV6oxXP8XiywA1yrP94BEgpsqmL9IGq927OQlV4z3leJsFPlIJK 1PbZLpnPTUxpraYyV6Q00Tkm5L2EpBWm3ZU8b0wKIV7rD7tfMiJhtx0K816i+vcgQJO6 RvJMCJFWfiaTOcEIXGNw8fk+EVD8/R4Qrzjw82YtEQrOsAd962qxcb0VGPnhL7ziRuRs kUow== X-Received: by 10.66.224.237 with SMTP id rf13mr4506291pac.26.1371482487257; Mon, 17 Jun 2013 08:21:27 -0700 (PDT) Received: from localhost.localdomain ([1.23.210.59]) by mx.google.com with ESMTPSA id fp2sm14187573pbb.36.2013.06.17.08.21.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Jun 2013 08:21:26 -0700 (PDT) From: Prabhakar Lad To: Mauro Carvalho Chehab , LMML , DLOS , Hans Verkuil , Laurent Pinchart Subject: [PATCH v4 02/11] media: davinci: vpif: Convert to devm_* api Date: Mon, 17 Jun 2013 20:50:42 +0530 Message-ID: <1371482451-18314-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1371482451-18314-1-git-send-email-prabhakar.csengg@gmail.com> References: <1371482451-18314-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 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 761c825..164c1b7 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_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); @@ -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; }