diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2014-06-04 16:57:02 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-22 03:52:43 (GMT) |
commit | 94b76ce83de2fb4dd12001bbaef4301dc681700a (patch) | |
tree | 88f417b536907a3ed258794372789c10713a6399 /drivers/media/i2c | |
parent | d8dde6c8dd3916f532b5fd3b1fc377e01ea41e01 (diff) | |
download | linux-94b76ce83de2fb4dd12001bbaef4301dc681700a.tar.xz |
[media] mt9v032: register v4l2 asynchronous subdevice
Add support for registering the sensor subdevice using the v4l2-async API.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/mt9v032.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index 86c3833..c8a4088 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); |