From patchwork Sun May 26 12:00:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2615201 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork1.kernel.org (Postfix) with ESMTP id EE3FB3FD4E for ; Sun, 26 May 2013 12:06:52 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4QC5SrR022622; Sun, 26 May 2013 07:05:28 -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 r4QC5SVb008162; Sun, 26 May 2013 07:05:28 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Sun, 26 May 2013 07:05:28 -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 r4QC5Sr2023344; Sun, 26 May 2013 07:05:28 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id DBC6880628; Sun, 26 May 2013 07:05:27 -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 6A4B580631 for ; Sun, 26 May 2013 07:02:59 -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 r4QC2x2W006969 for ; Sun, 26 May 2013 07:02:59 -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 r4QC2w6u022672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 26 May 2013 07:02:58 -0500 Received: from [216.82.242.147:29817] by server-4.bemta-8.messagelabs.com id 40/2A-09999-2F9F1A15; Sun, 26 May 2013 12:02:58 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-8.tower-95.messagelabs.com!1369569776!20300529!1 X-Originating-IP: [209.85.220.52] 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 30544 invoked from network); 26 May 2013 12:02:57 -0000 Received: from mail-pa0-f52.google.com (HELO mail-pa0-f52.google.com) (209.85.220.52) by server-8.tower-95.messagelabs.com with RC4-SHA encrypted SMTP; 26 May 2013 12:02:57 -0000 Received: by mail-pa0-f52.google.com with SMTP id bg2so5914175pad.39 for ; Sun, 26 May 2013 05:02:56 -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=JTutoOkRyVNvLEhVu7gYcZ4zFM0nzovGoUuMfPUO3to=; b=r4gWbDjIJGva9lWaFLPhZuTeC8q+G/7QCH94WBgk1QrSNF+8KGxZ6pNhD3SD5W822J o+jo0tf1jQR4vuvxYNfKfs0YwOPh37K5Hxj/ex6wJQh5m+sFHLZiPAyRLvhfeBDKvC8g m23qIXJekTSNrillnLPY/wPWipliPNg1IErUsxnUpkiaJUOKsLXJ9lDz8pPJDXjBzWh/ tN2Fk01HtSafFJZH+s8xJ589GE4XX81/Wq/adNEQuTYBCUqdR+J761tXoHjjn963fmFf QOIsflxMsXYHWW6+b2Ok6robEi8oJJI7Vqsfwf94gqwNXty6jQ4/JoFE6SLJcjT5kFDC Zw9A== X-Received: by 10.68.105.131 with SMTP id gm3mr25545231pbb.168.1369569776278; Sun, 26 May 2013 05:02:56 -0700 (PDT) Received: from localhost.localdomain ([112.79.41.196]) by mx.google.com with ESMTPSA id ri8sm24237417pbc.3.2013.05.26.05.02.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 26 May 2013 05:02:55 -0700 (PDT) From: Prabhakar Lad To: Hans Verkuil , Mauro Carvalho Chehab , LMML , Laurent Pinchart Subject: [PATCH v3 6/9] media: davinci: vpif_capture: Convert to devm_* api Date: Sun, 26 May 2013 17:30:09 +0530 Message-ID: <1369569612-30915-7-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_request_irq() instead of request_irq(). This ensures more consistent error values and simplifies error paths. Signed-off-by: Lad, Prabhakar Acked-by: Laurent Pinchart --- drivers/media/platform/davinci/vpif_capture.c | 38 ++++++++----------------- 1 files changed, 12 insertions(+), 26 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 38c1fba..5e1e5f6 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -2082,14 +2082,14 @@ static __init int vpif_probe(struct platform_device *pdev) while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) { for (i = res->start; i <= res->end; i++) { - if (request_irq(i, vpif_channel_isr, IRQF_SHARED, - "VPIF_Capture", (void *) - (&vpif_obj.dev[res_idx]->channel_id))) { - err = -EBUSY; - for (j = 0; j < i; j++) - free_irq(j, (void *) - (&vpif_obj.dev[res_idx]->channel_id)); - goto vpif_int_err; + err = devm_request_irq(&pdev->dev, i, vpif_channel_isr, + IRQF_SHARED, "VPIF_Capture", + (void *)(&vpif_obj.dev[res_idx]-> + channel_id)); + if (err) { + err = -EINVAL; + goto vpif_unregister; + } } res_idx++; @@ -2106,7 +2106,7 @@ static __init int vpif_probe(struct platform_device *pdev) video_device_release(ch->video_dev); } err = -ENOMEM; - goto vpif_int_err; + goto vpif_unregister; } /* Initialize field of video device */ @@ -2207,13 +2207,9 @@ vpif_sd_error: /* Note: does nothing if ch->video_dev == NULL */ video_device_release(ch->video_dev); } -vpif_int_err: +vpif_unregister: v4l2_device_unregister(&vpif_obj.v4l2_dev); - for (i = 0; i < res_idx; i++) { - res = platform_get_resource(pdev, IORESOURCE_IRQ, i); - for (j = res->start; j <= res->end; j++) - free_irq(j, (void *)(&vpif_obj.dev[i]->channel_id)); - } + return err; } @@ -2225,18 +2221,8 @@ vpif_int_err: */ static int vpif_remove(struct platform_device *device) { - struct platform_device *pdev; struct channel_obj *ch; - struct resource *res; - int irq_num, i = 0; - - pdev = container_of(vpif_dev, struct platform_device, dev); - while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, i))) { - for (irq_num = res->start; irq_num <= res->end; irq_num++) - free_irq(irq_num, - (void *)(&vpif_obj.dev[i]->channel_id)); - i++; - } + int i; v4l2_device_unregister(&vpif_obj.v4l2_dev);