From patchwork Sat May 25 16:36:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2613711 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 2AECE3FE81 for ; Sat, 25 May 2013 16:39:52 +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 r4PGcXuQ001284; Sat, 25 May 2013 11:38:33 -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 r4PGcXJH002976; Sat, 25 May 2013 11:38:33 -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; Sat, 25 May 2013 11:38:33 -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 r4PGcXVF024723; Sat, 25 May 2013 11:38:33 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 24BBE80627; Sat, 25 May 2013 11:38:33 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 377AC80626 for ; Sat, 25 May 2013 11:38:31 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id r4PGcVQ9016969 for ; Sat, 25 May 2013 11:38:31 -0500 (CDT) Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4PGcUrk003387 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 25 May 2013 11:38:30 -0500 Received: from [216.82.250.51:32614] by server-4.bemta-12.messagelabs.com id 0C/64-00956-609E0A15; Sat, 25 May 2013 16:38:30 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-12.tower-108.messagelabs.com!1369499908!13064947!1 X-Originating-IP: [209.85.160.44] 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 24176 invoked from network); 25 May 2013 16:38:29 -0000 Received: from mail-pb0-f44.google.com (HELO mail-pb0-f44.google.com) (209.85.160.44) by server-12.tower-108.messagelabs.com with RC4-SHA encrypted SMTP; 25 May 2013 16:38:29 -0000 Received: by mail-pb0-f44.google.com with SMTP id wz12so5336707pbc.31 for ; Sat, 25 May 2013 09:38:28 -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=AhUii//4YCcFcYPRCrLMJcvVgCLjl416y4rK90LJCp8=; b=FYOA/ttcADDP/y50DPEdXZVlzLQxG0pDQXEMMBkQaAGyBxUcbf5m4pL3+bntUxMF0o clFjThmbCPq1HcZiKLw8udUtntQrugiRP7kpjveO6rxosHZxLsbSPl5L83sInJ4h+Dh7 sWDRy8ZgYjtbtlfTkRujum0qYT68yxV68YFhWLyQ+XZebZv1Vm+pi2Nzj8j0e97ypqK7 /sOFOlXopaDWAF4zcU0jh/LN0rz3KYr1qxE5n68JEgOn3VDZZN+enM7WL3T+VH/82xVG ihqKgXTTRKHnt1sRYYdvUf9qQ1cuqbsZW4Kqv9cXGUoo339QiKn17/zR8/z3hbmrCYmQ j+/g== X-Received: by 10.66.121.169 with SMTP id ll9mr22984015pab.126.1369499908439; Sat, 25 May 2013 09:38:28 -0700 (PDT) Received: from localhost.localdomain ([112.79.40.180]) by mx.google.com with ESMTPSA id kv2sm21040398pbc.28.2013.05.25.09.38.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 25 May 2013 09:38:27 -0700 (PDT) From: Prabhakar Lad To: Hans Verkuil , Mauro Carvalho Chehab , LMML , Laurent Pinchart Subject: [PATCH v2 2/5] media: davinci: vpif: Convert to devm_* api Date: Sat, 25 May 2013 22:06:33 +0530 Message-ID: <1369499796-18762-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1369499796-18762-1-git-send-email-prabhakar.csengg@gmail.com> References: <1369499796-18762-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..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; }