Commit 8f23acb5 authored by Lad, Prabhakar's avatar Lad, Prabhakar Committed by Mauro Carvalho Chehab

[media] media: i2c: tvp514x: add support for asynchronous probing

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: default avatarPrabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 25ba2c80
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/v4l2-mediabus.h> #include <linux/v4l2-mediabus.h>
#include <media/v4l2-async.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-mediabus.h> #include <media/v4l2-mediabus.h>
...@@ -1175,16 +1176,22 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1175,16 +1176,22 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
sd->ctrl_handler = &decoder->hdl; sd->ctrl_handler = &decoder->hdl;
if (decoder->hdl.error) { if (decoder->hdl.error) {
ret = decoder->hdl.error; ret = decoder->hdl.error;
goto done;
v4l2_ctrl_handler_free(&decoder->hdl);
return ret;
} }
v4l2_ctrl_handler_setup(&decoder->hdl); v4l2_ctrl_handler_setup(&decoder->hdl);
v4l2_info(sd, "%s decoder driver registered !!\n", sd->name); ret = v4l2_async_register_subdev(&decoder->sd);
if (!ret)
return 0; 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) ...@@ -1199,6 +1206,7 @@ static int tvp514x_remove(struct i2c_client *client)
struct v4l2_subdev *sd = i2c_get_clientdata(client); struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct tvp514x_decoder *decoder = to_decoder(sd); struct tvp514x_decoder *decoder = to_decoder(sd);
v4l2_async_unregister_subdev(&decoder->sd);
v4l2_device_unregister_subdev(sd); v4l2_device_unregister_subdev(sd);
#if defined(CONFIG_MEDIA_CONTROLLER) #if defined(CONFIG_MEDIA_CONTROLLER)
media_entity_cleanup(&decoder->sd.entity); media_entity_cleanup(&decoder->sd.entity);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment