From patchwork Mon Jun 17 15:20:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2734671 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 677F19F39E for ; Mon, 17 Jun 2013 15:25:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30FDF203EB for ; Mon, 17 Jun 2013 15:25:43 +0000 (UTC) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61DDA203ED for ; Mon, 17 Jun 2013 15:25:38 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5HFORSu021043; Mon, 17 Jun 2013 10:24:27 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5HFOQco016651; Mon, 17 Jun 2013 10:24:26 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Mon, 17 Jun 2013 10:24:26 -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 r5HFOQB1027621; Mon, 17 Jun 2013 10:24:26 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 071DF8062B; Mon, 17 Jun 2013 10:24:26 -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 33F6180628 for ; Mon, 17 Jun 2013 10:21:53 -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 r5HFLron027997 for ; Mon, 17 Jun 2013 10:21:53 -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 r5HFLqpi006335 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Jun 2013 10:21:52 -0500 Received: from [216.82.250.51:51880] by server-7.bemta-12.messagelabs.com id C3/0D-07784-0992FB15; Mon, 17 Jun 2013 15:21:52 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-16.tower-108.messagelabs.com!1371482510!15665207!1 X-Originating-IP: [209.85.192.181] 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 1424 invoked from network); 17 Jun 2013 15:21:51 -0000 Received: from mail-pd0-f181.google.com (HELO mail-pd0-f181.google.com) (209.85.192.181) by server-16.tower-108.messagelabs.com with RC4-SHA encrypted SMTP; 17 Jun 2013 15:21:51 -0000 Received: by mail-pd0-f181.google.com with SMTP id 14so2893048pdj.12 for ; Mon, 17 Jun 2013 08:21:50 -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=CHP6QOe7wEVQya4O23msHgP8r49jskZmOBg0S80tNns=; b=rLSbRAawlSSJyobUhK9G7F7S/alZLqE99TQtie/jGfF1uMwgzVKRzLGgmRcoxzR0kJ /lDetbO0+V8JckDdnS09Q7hRMhfcOO6fsUG8/fDVmu7rRYmDt98OEukG8dwdyOG/nnPq dC8t/5dNJiB3XhpLf1iXnUYNeKWQC/KsPhsrPdXM3EBZPjpAiFMbUitlmihJrPd7Wloa Cbj+RxYJGHmazMxZui9ciqEx2aCLUVZUSb5hKxeY7gV8pLFOoTgS6psA/n9IoBZRqvf/ MIYBc0wA2iD8+PSaK5/xKpWV+2V79dd+EgdjiafcwE7aIXE6TWIC2dmBv+kTgn8TWl6F C7qg== X-Received: by 10.68.130.199 with SMTP id og7mr13536976pbb.132.1371482510194; Mon, 17 Jun 2013 08:21:50 -0700 (PDT) Received: from localhost.localdomain ([1.23.210.59]) by mx.google.com with ESMTPSA id fp2sm14187573pbb.36.2013.06.17.08.21.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Jun 2013 08:21:49 -0700 (PDT) From: Prabhakar Lad To: Mauro Carvalho Chehab , LMML , DLOS , Hans Verkuil , Laurent Pinchart Subject: [PATCH v4 06/11] media: davinci: vpif_capture: Convert to devm_* api Date: Mon, 17 Jun 2013 20:50:46 +0530 Message-ID: <1371482451-18314-7-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_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 | 36 +++++++++---------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 091c7a4..a4e0eab 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -2016,14 +2016,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++; @@ -2040,7 +2040,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 */ @@ -2141,13 +2141,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; } @@ -2160,15 +2156,7 @@ vpif_int_err: static int vpif_remove(struct platform_device *device) { struct channel_obj *ch; - struct resource *res; - int irq_num, i = 0; - - while ((res = platform_get_resource(device, 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);