From patchwork Mon Jun 24 15:51:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2772221 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 97545C0AB1 for ; Mon, 24 Jun 2013 15:53:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5AA3E20278 for ; Mon, 24 Jun 2013 15:53:21 +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 D35F320261 for ; Mon, 24 Jun 2013 15:53:17 +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 r5OFpu5G030542; Mon, 24 Jun 2013 10:51:56 -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 r5OFpu2p008730; Mon, 24 Jun 2013 10:51:56 -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; Mon, 24 Jun 2013 10:51:55 -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 r5OFptPg012783; Mon, 24 Jun 2013 10:51:55 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id BEE0880627; Mon, 24 Jun 2013 10:51:55 -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 2397580626 for ; Mon, 24 Jun 2013 10:51:54 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r5OFprka018656 for ; Mon, 24 Jun 2013 10:51:53 -0500 (CDT) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5OFpraD032526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Jun 2013 10:51:53 -0500 Received: from [216.82.253.147:7636] by server-12.bemta-7.messagelabs.com id A1/E0-28531-91B68C15; Mon, 24 Jun 2013 15:51:53 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-4.tower-165.messagelabs.com!1372089111!12833394!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.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16150 invoked from network); 24 Jun 2013 15:51:52 -0000 Received: from mail-pd0-f179.google.com (HELO mail-pd0-f179.google.com) (209.85.192.179) by server-4.tower-165.messagelabs.com with RC4-SHA encrypted SMTP; 24 Jun 2013 15:51:52 -0000 Received: by mail-pd0-f179.google.com with SMTP id q10so537332pdj.24 for ; Mon, 24 Jun 2013 08:51:51 -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; bh=9Ck3AJo615ojc9OR3lVorSKLK6c9uTO98jsSbpxGHFU=; b=ptTfwTlDJhJDBzTbKQbZ436aeaqL+M8M8pqkQEQkbWcxMqfRjCHlDYCog0sY0BVd7B dAKKmMbh8R68S8rzwv4qp2zESxJcn1slxuclwqVdh2h32Y1GOhW3rLJWcYp5YTUQRQl0 f/yim+3vZkcwQcH/19B0Kk4AnflIKihUE7nlXm+XBwitpP9HDHrS526tIXI4Cl6bmkDI MHmh1GZ1U1NqPTGnImCPpodkrGvtinBpFCrOXy4EGIQbn7gMNQyuDiSfNmYdYLs4mXX7 1k3tScEq70zxCRbSpQtbC5DbR0LgFn1trDgF5AtA+QPZQTrItrxZ11Q04fuLeRzBYV9v hq6w== X-Received: by 10.66.159.66 with SMTP id xa2mr28496881pab.36.1372089111507; Mon, 24 Jun 2013 08:51:51 -0700 (PDT) Received: from localhost.localdomain ([1.23.212.230]) by mx.google.com with ESMTPSA id iq6sm18758289pbc.1.2013.06.24.08.51.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Jun 2013 08:51:50 -0700 (PDT) From: Prabhakar Lad To: Mauro Carvalho Chehab , LMML Subject: [PATCH v2] media: i2c: tvp514x: add support for asynchronous probing Date: Mon, 24 Jun 2013 21:21:39 +0530 Message-ID: <1372089099-26438-1-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 CC: DLOS , LKML , Hans Verkuil , Laurent Pinchart , Sakari Ailus , Guennadi Liakhovetski 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" Both synchronous and asynchronous tvp514x subdevice probing is supported by this patch. This patch also fixes the error path by calling media_entity_cleanup() on failure in probe when CONFIG_MEDIA_CONTROLLER is enabled. Signed-off-by: Prabhakar Lad Cc: Guennadi Liakhovetski Cc: Laurent Pinchart Cc: Hans Verkuil Cc: Sakari Ailus Cc: Mauro Carvalho Chehab --- Changes for v2: 1: Fixed review comments pointed by Hans and Guennadi. drivers/media/i2c/tvp514x.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c index 6578976..b9e621b 100644 --- a/drivers/media/i2c/tvp514x.c +++ b/drivers/media/i2c/tvp514x.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -1175,16 +1176,22 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) sd->ctrl_handler = &decoder->hdl; if (decoder->hdl.error) { ret = decoder->hdl.error; - - v4l2_ctrl_handler_free(&decoder->hdl); - return ret; + goto done; } v4l2_ctrl_handler_setup(&decoder->hdl); - v4l2_info(sd, "%s decoder driver registered !!\n", sd->name); - - return 0; + ret = v4l2_async_register_subdev(&decoder->sd); + if (!ret) + v4l2_info(sd, "%s decoder driver registered !!\n", sd->name); +done: + if (ret < 0) { + v4l2_ctrl_handler_free(&decoder->hdl); +#if defined(CONFIG_MEDIA_CONTROLLER) + media_entity_cleanup(&decoder->sd.entity); +#endif + } + return ret; } /** @@ -1199,6 +1206,7 @@ static int tvp514x_remove(struct i2c_client *client) struct v4l2_subdev *sd = i2c_get_clientdata(client); struct tvp514x_decoder *decoder = to_decoder(sd); + v4l2_async_unregister_subdev(&decoder->sd); v4l2_device_unregister_subdev(sd); #if defined(CONFIG_MEDIA_CONTROLLER) media_entity_cleanup(&decoder->sd.entity);