public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] [media] mt9v032: register v4l2 asynchronous subdevice
@ 2014-06-04 16:57 Philipp Zabel
  2014-06-04 16:57 ` [PATCH v3 2/2] [media] mt9v032: use regmap Philipp Zabel
  2014-06-05  0:01 ` [PATCH v3 1/2] [media] mt9v032: register v4l2 asynchronous subdevice Laurent Pinchart
  0 siblings, 2 replies; 4+ messages in thread
From: Philipp Zabel @ 2014-06-04 16:57 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Mauro Carvalho Chehab, linux-media, kernel, Philipp Zabel

Add support for registering the sensor subdevice using the v4l2-async API.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
Changes since v1:
 - Simplified error path, call media_entity_cleanup even
   if media_entity_init failed.
---
 drivers/media/i2c/mt9v032.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 6c97dc1..cbd3546 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -1010,10 +1010,19 @@ static int mt9v032_probe(struct i2c_client *client,
 
 	mt9v032->pad.flags = MEDIA_PAD_FL_SOURCE;
 	ret = media_entity_init(&mt9v032->subdev.entity, 1, &mt9v032->pad, 0);
+	if (ret < 0)
+		goto err;
 
+	mt9v032->subdev.dev = &client->dev;
+	ret = v4l2_async_register_subdev(&mt9v032->subdev);
 	if (ret < 0)
-		v4l2_ctrl_handler_free(&mt9v032->ctrls);
+		goto err;
+
+	return 0;
 
+err:
+	media_entity_cleanup(&mt9v032->subdev.entity);
+	v4l2_ctrl_handler_free(&mt9v032->ctrls);
 	return ret;
 }
 
@@ -1022,6 +1031,7 @@ static int mt9v032_remove(struct i2c_client *client)
 	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
 	struct mt9v032 *mt9v032 = to_mt9v032(subdev);
 
+	v4l2_async_unregister_subdev(subdev);
 	v4l2_ctrl_handler_free(&mt9v032->ctrls);
 	v4l2_device_unregister_subdev(subdev);
 	media_entity_cleanup(&subdev->entity);
-- 
2.0.0.rc2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-05  0:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-04 16:57 [PATCH v3 1/2] [media] mt9v032: register v4l2 asynchronous subdevice Philipp Zabel
2014-06-04 16:57 ` [PATCH v3 2/2] [media] mt9v032: use regmap Philipp Zabel
2014-06-05  0:07   ` Laurent Pinchart
2014-06-05  0:01 ` [PATCH v3 1/2] [media] mt9v032: register v4l2 asynchronous subdevice Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox