From patchwork Sat Jul 13 08:50:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 2827143 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 35AFBC0AB2 for ; Sat, 13 Jul 2013 08:54:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3FE162012E for ; Sat, 13 Jul 2013 08:54:32 +0000 (UTC) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3D9B420127 for ; Sat, 13 Jul 2013 08:54:31 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r6D8qS8d032018; Sat, 13 Jul 2013 03:52:28 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r6D8qSnO000998; Sat, 13 Jul 2013 03:52:28 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Sat, 13 Jul 2013 03:52: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 r6D8qSmF011431; Sat, 13 Jul 2013 03:52:28 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 635E180626; Sat, 13 Jul 2013 03:52: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 9BC238062B for ; Sat, 13 Jul 2013 03:51:42 -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 r6D8pggW017140 for ; Sat, 13 Jul 2013 03:51:42 -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 r6D8pf0q006528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 13 Jul 2013 03:51:42 -0500 Received: from [216.82.242.147:14601] by server-9.bemta-8.messagelabs.com id 0F/FE-17428-D1511E15; Sat, 13 Jul 2013 08:51:41 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-10.tower-95.messagelabs.com!1373705499!33061636!1 X-Originating-IP: [209.85.192.179] 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.9; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24924 invoked from network); 13 Jul 2013 08:51:40 -0000 Received: from mail-pd0-f179.google.com (HELO mail-pd0-f179.google.com) (209.85.192.179) by server-10.tower-95.messagelabs.com with RC4-SHA encrypted SMTP; 13 Jul 2013 08:51:40 -0000 Received: by mail-pd0-f179.google.com with SMTP id q10so9249089pdj.38 for ; Sat, 13 Jul 2013 01:51:39 -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=JEKy+d9vneM6Ibe2rXgY9NNExuY80qh/7vQy1kARXTs=; b=JxVYZjtTJNy3ojjLvy7VjSJdpBJ/e6YtYdBP8y+zeGI782f1+18qheycC7Q8eS+2EZ kl/9SUtFwMMuYZ4Qq5Arz18Hp4PlwE5koTGMjOY15exo3F2+TwJ6XyleN0mvdVGxka+D uk1d9jIgvOX2G0UOWzSdcXPfd5pIM81td9w4DFy/WvERLPcCO9GLby0nrt8iRaH0Mcz/ 8kTZgphRLVY+1G9I07YaBogY89sF0OyUTC3i6c/atDDhZgTLHOqEJ+oSJGGYwTbS0Pf1 fHSb91gK+q+ob1gfEyVOu14lWW6D90c/9TmBmHhfduqP100+P5dM0e96hqUtUH7qA43o miwg== X-Received: by 10.66.147.65 with SMTP id ti1mr45689080pab.36.1373705499709; Sat, 13 Jul 2013 01:51:39 -0700 (PDT) Received: from localhost.localdomain ([1.23.213.247]) by mx.google.com with ESMTPSA id ne6sm45224222pbc.28.2013.07.13.01.51.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 13 Jul 2013 01:51:38 -0700 (PDT) From: Prabhakar Lad To: LMML Subject: [PATCH 3/5] media: davinci: vpbe_display: convert to devm* api Date: Sat, 13 Jul 2013 14:20:29 +0530 Message-ID: <1373705431-11500-4-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1373705431-11500-1-git-send-email-prabhakar.csengg@gmail.com> References: <1373705431-11500-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 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" Replace existing resource handling in the driver with managed device resource, this ensures more consistent error values and simplifies error paths. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpbe_display.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index e180ff7..04609cc6 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -1743,11 +1743,10 @@ static int vpbe_display_probe(struct platform_device *pdev) printk(KERN_DEBUG "vpbe_display_probe\n"); /* Allocate memory for vpbe_display */ - disp_dev = kzalloc(sizeof(struct vpbe_display), GFP_KERNEL); - if (!disp_dev) { - printk(KERN_ERR "ran out of memory\n"); + disp_dev = devm_kzalloc(&pdev->dev, sizeof(struct vpbe_display), + GFP_KERNEL); + if (!disp_dev) return -ENOMEM; - } spin_lock_init(&disp_dev->dma_queue_lock); /* @@ -1786,26 +1785,24 @@ static int vpbe_display_probe(struct platform_device *pdev) } irq = res->start; - if (request_irq(irq, venc_isr, IRQF_DISABLED, VPBE_DISPLAY_DRIVER, - disp_dev)) { + err = devm_request_irq(&pdev->dev, irq, venc_isr, IRQF_DISABLED, + VPBE_DISPLAY_DRIVER, disp_dev); + if (err) { v4l2_err(&disp_dev->vpbe_dev->v4l2_dev, "Unable to request interrupt\n"); - err = -ENODEV; goto probe_out; } for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { if (register_device(disp_dev->dev[i], disp_dev, pdev)) { err = -ENODEV; - goto probe_out_irq; + goto probe_out; } } printk(KERN_DEBUG "Successfully completed the probing of vpbe v4l2 device\n"); return 0; -probe_out_irq: - free_irq(res->start, disp_dev); probe_out: for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) { /* Get the pointer to the layer object */ @@ -1817,7 +1814,6 @@ probe_out: kfree(disp_dev->dev[k]); } } - kfree(disp_dev); return err; } @@ -1830,15 +1826,10 @@ static int vpbe_display_remove(struct platform_device *pdev) struct vpbe_layer *vpbe_display_layer; struct vpbe_display *disp_dev = platform_get_drvdata(pdev); struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev; - struct resource *res; int i; v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_remove\n"); - /* unregister irq */ - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - free_irq(res->start, disp_dev); - /* deinitialize the vpbe display controller */ if (NULL != vpbe_dev->ops.deinitialize) vpbe_dev->ops.deinitialize(&pdev->dev, vpbe_dev);