From patchwork Mon Apr 22 10:17:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2471221 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork2.kernel.org (Postfix) with ESMTP id 8E6C5DF23A for ; Mon, 22 Apr 2013 10:23:15 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r3MAJMeR011353; Mon, 22 Apr 2013 05:19:22 -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 r3MAJMDm015380; Mon, 22 Apr 2013 05:19:22 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Mon, 22 Apr 2013 05:19:21 -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 r3MAJLtP010022; Mon, 22 Apr 2013 05:19:21 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id E72AC80627; Mon, 22 Apr 2013 05:19:21 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id AC05180626 for ; Mon, 22 Apr 2013 05:19:20 -0500 (CDT) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id r3MAJKU5028001 for ; Mon, 22 Apr 2013 05:19:20 -0500 (CDT) Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id r3MAJKvZ022509 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Apr 2013 05:19:20 -0500 Received: from [216.82.250.51:57705] by server-13.bemta-12.messagelabs.com id C5/59-21545-7AE05715; Mon, 22 Apr 2013 10:19:19 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-16.tower-108.messagelabs.com!1366625958!6932997!1 X-Originating-IP: [209.85.192.172] 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 16282 invoked from network); 22 Apr 2013 10:19:19 -0000 Received: from mail-pd0-f172.google.com (HELO mail-pd0-f172.google.com) (209.85.192.172) by server-16.tower-108.messagelabs.com with RC4-SHA encrypted SMTP; 22 Apr 2013 10:19:19 -0000 Received: by mail-pd0-f172.google.com with SMTP id 4so489596pdd.3 for ; Mon, 22 Apr 2013 03:19:18 -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=ZhOSRwe6ufw8J4EdDnS5kbSC1skUIbBa8ggGcgtRcHhuCAD4tmQmZEzwmcEhdnMTq/ U5WTVfihTw8gBywuYWdsgZZz2twsoFzHv/wROkjJkkha/Iq4bH/p+t6Y9jQYiZH/qfNV w/FD/XbTeWIHwmdoTk1KSOgMtJttWDGIYFql3qXB0Tf7HrFovZZ+hPQa8bOggyr/AQXM /RactMkA9JS6vyNcNzXpyuTdKQFasv20ptQ+b7SF10Wbyvinvvz1z+xasRmUkh3TmmtJ K6ENutnpzXaIdIOzv6qidwijmuI7dxBBH5U5wSZPn/QfwIPqAdpFRim4p55znydkAprG XX0w== X-Received: by 10.66.72.3 with SMTP id z3mr27920462pau.125.1366625958144; Mon, 22 Apr 2013 03:19:18 -0700 (PDT) Received: from localhost.localdomain ([122.166.13.141]) by mx.google.com with ESMTPS id lo7sm26551295pab.19.2013.04.22.03.19.12 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Apr 2013 03:19:16 -0700 (PDT) From: Prabhakar Lad To: LMML Subject: [PATCH RFC v2 2/4] media: i2c: tvp514x: add support for asynchronous probing Date: Mon, 22 Apr 2013 15:47:26 +0530 Message-ID: <1366625848-743-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1366625848-743-1-git-send-email-prabhakar.csengg@gmail.com> References: <1366625848-743-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);