Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752499Ab3FXPvx (ORCPT ); Mon, 24 Jun 2013 11:51:53 -0400 Received: from mail-pb0-f53.google.com ([209.85.160.53]:49506 "EHLO mail-pb0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750875Ab3FXPvw (ORCPT ); Mon, 24 Jun 2013 11:51:52 -0400 From: Prabhakar Lad To: Mauro Carvalho Chehab , LMML Cc: DLOS , LKML , Laurent Pinchart , Hans Verkuil , "Lad, Prabhakar" , Guennadi Liakhovetski , Hans Verkuil , Sakari Ailus 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2441 Lines: 78 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); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/