From patchwork Sat Jun 22 10:16:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2765591 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 EB4759F39E for ; Sat, 22 Jun 2013 10:17:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A81D20103 for ; Sat, 22 Jun 2013 10:17:02 +0000 (UTC) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2864120109 for ; Sat, 22 Jun 2013 10:16:59 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r5MAGweu024299 for ; Sat, 22 Jun 2013 05:16:58 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r5MAGwwk002333 for ; Sat, 22 Jun 2013 05:16:58 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Sat, 22 Jun 2013 05:16:58 -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 r5MAGwDM027037 for ; Sat, 22 Jun 2013 05:16:58 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 2B8F180627 for ; Sat, 22 Jun 2013 05:16:58 -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 CDAB280626 for ; Sat, 22 Jun 2013 05:16:49 -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 r5MAGnk0002478 for ; Sat, 22 Jun 2013 05:16:49 -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 r5MAGnAk029569 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 22 Jun 2013 05:16:49 -0500 Received: from [216.82.253.147:36499] by server-13.bemta-7.messagelabs.com id 0C/79-01729-19975C15; Sat, 22 Jun 2013 10:16:49 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-11.tower-165.messagelabs.com!1371896207!18578362!1 X-Originating-IP: [209.85.220.42] 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 5807 invoked from network); 22 Jun 2013 10:16:48 -0000 Received: from mail-pa0-f42.google.com (HELO mail-pa0-f42.google.com) (209.85.220.42) by server-11.tower-165.messagelabs.com with RC4-SHA encrypted SMTP; 22 Jun 2013 10:16:48 -0000 Received: by mail-pa0-f42.google.com with SMTP id rl6so8926609pac.29 for ; Sat, 22 Jun 2013 03:16:47 -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=Qb6i5dEhigHMoxOJhq5mvH7ZInP4R2+F3PLS4b/nwfo=; b=xCK9QTqSGHJHZBIXgqQ9kyVBpQkgn/yV6Qr/x9sPqNZWok9Y39zg6QRhXa3/cswJS5 1lDX7LsfNx3jk1t3JWEVFio5A8wkvsouh16UgHkP2qzoyyy8itlwolMHZYLqJy2PnSLf UmiBXaM/O8oc48VNMD/VM+3SBOAHCLlqkDATAqE7SO+UmyHmPi9Or7OL9UuLRaXTNt87 7xA/i9m6nMevXASWIdgSlNyuILRX8UqtqYx0iOFj2qQwVYpwPVmB/QYw6j1cDPCkSD1P clO6o/TO6DsRqQvxHrDTGuo+iLK2N9W/LTODLTcB708toH64NfEV/GmD6oTJvQ7SI+Q0 szwQ== X-Received: by 10.68.220.201 with SMTP id py9mr15839050pbc.60.1371896207539; Sat, 22 Jun 2013 03:16:47 -0700 (PDT) Received: from localhost.localdomain ([1.23.214.121]) by mx.google.com with ESMTPSA id tq8sm8725889pbc.30.2013.06.22.03.16.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Jun 2013 03:16:46 -0700 (PDT) From: Prabhakar Lad To: Mauro Carvalho Chehab , LMML , Hans Verkuil , Laurent Pinchart Subject: [PATCH] media: i2c: tvp514x: add support for asynchronous probing Date: Sat, 22 Jun 2013 15:46:29 +0530 Message-ID: <1371896189-5475-1-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 CC: DLOS , LKML , 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+patchwork-davinci=patchwork.kernel.org@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. Signed-off-by: Prabhakar Lad Cc: Guennadi Liakhovetski Cc: Laurent Pinchart Cc: Hans Verkuil Cc: Sakari Ailus Cc: Mauro Carvalho Chehab --- drivers/media/i2c/tvp514x.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c index 864eb14..d090caf 100644 --- a/drivers/media/i2c/tvp514x.c +++ b/drivers/media/i2c/tvp514x.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -1148,9 +1149,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; @@ -1176,16 +1177,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; } /** @@ -1200,6 +1207,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);