From patchwork Tue May 14 06:47:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2563241 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by patchwork2.kernel.org (Postfix) with ESMTP id 80DB8DF24C for ; Tue, 14 May 2013 06:52:01 +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 r4E6oAiE023437; Tue, 14 May 2013 01:50:10 -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 r4E6oATZ011702; Tue, 14 May 2013 01:50:10 -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; Tue, 14 May 2013 01:50:09 -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 r4E6o9Ct005641; Tue, 14 May 2013 01:50:09 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id C6B4980640; Tue, 14 May 2013 01:50:05 -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 AA42E80634 for ; Tue, 14 May 2013 01:48:04 -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 r4E6m4XZ018891 for ; Tue, 14 May 2013 01:48:04 -0500 (CDT) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4E6m4tY025814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 May 2013 01:48:04 -0500 Received: from [216.82.253.67:12600] by server-8.bemta-7.messagelabs.com id 53/AE-14907-42ED1915; Tue, 14 May 2013 06:48:04 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-3.tower-158.messagelabs.com!1368514083!1193180!1 X-Originating-IP: [209.85.220.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 20888 invoked from network); 14 May 2013 06:48:03 -0000 Received: from mail-pa0-f44.google.com (HELO mail-pa0-f44.google.com) (209.85.220.44) by server-3.tower-158.messagelabs.com with RC4-SHA encrypted SMTP; 14 May 2013 06:48:03 -0000 Received: by mail-pa0-f44.google.com with SMTP id jh10so241140pab.17 for ; Mon, 13 May 2013 23:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=P/oNyqkLxc/Le6wc+pgVbO6Y9+i0dnzzz4vUKeeE1Kc=; b=WdKlHhRtnyRKW15BMPA+VgKBFW6JZXylpMlow8DX+8Fu0RVvzhUQjU4rLgRVAaB6lB vH8Qzmax3iZDWHFaIae0LFWeAZLSg7Nof49YW+wsPt2y/jNQSeDJRIEli3KHTc/EAbmI nbcvrGguh8s8ewzuptLWBORUBTU+pT6ceJZPHPf2xzmfJ0CaKYHpGeDlsJBj0Zy9QDB7 U2wA8uPJeGn6OqICQjs6DvTo9tSQGyYo0xgFoWSW5dgCLaDQrD8lvi8ELRXQ0jyMlZnx nanJcJqeK2ydrt4iK005GOYBTfaknHgQVka3TSG2nzbb34T08LWyvtUeqWSs3oJzC3CC EC2g== X-Received: by 10.66.145.134 with SMTP id su6mr32311668pab.198.1368514082713; Mon, 13 May 2013 23:48:02 -0700 (PDT) Received: from localhost.localdomain ([59.98.240.128]) by mx.google.com with ESMTPSA id lq4sm12114995pab.19.2013.05.13.23.47.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 13 May 2013 23:48:01 -0700 (PDT) From: Lad Prabhakar To: LMML Subject: [PATCH RFC v3 2/4] media: i2c: tvp514x: add support for asynchronous probing Date: Tue, 14 May 2013 12:17:34 +0530 Message-ID: <1368514056-28859-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1368514056-28859-1-git-send-email-prabhakar.csengg@gmail.com> References: <1368514056-28859-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , Mauro Carvalho Chehab , LKML , Sakari Ailus , Laurent Pinchart , 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 From: Lad, Prabhakar Both synchronous and asynchronous tvp514x subdevice probing is supported by this patch. Signed-off-by: Lad, Prabhakar Cc: Guennadi Liakhovetski Cc: Laurent Pinchart Cc: Hans Verkuil Cc: Sakari Ailus Cc: Mauro Carvalho Chehab --- drivers/media/i2c/tvp514x.c | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c index ab8f3fe..887bd93 100644 --- a/drivers/media/i2c/tvp514x.c +++ b/drivers/media/i2c/tvp514x.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -1109,9 +1110,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Register with V4L2 layer as slave device */ sd = &decoder->sd; v4l2_i2c_subdev_init(sd, client, &tvp514x_ops); - strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name)); #if defined(CONFIG_MEDIA_CONTROLLER) + strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name)); decoder->pad.flags = MEDIA_PAD_FL_SOURCE; decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER; @@ -1138,16 +1139,23 @@ 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; + decoder->sd.dev = &client->dev; + 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; } /** @@ -1162,6 +1170,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);