From: Lad, Prabhakar Date: Sat, 22 Jun 2013 09:07:37 +0000 (-0300) Subject: [media] media: i2c: adv7343: add support for asynchronous probing X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6555cfc5e7f8080a76edc2f556c709770fc1db57;p=linux-beck.git [media] media: i2c: adv7343: add support for asynchronous probing Both synchronous and asynchronous adv7343 subdevice probing is supported by this patch. Signed-off-by: Lad, Prabhakar Acked-by: Guennadi Liakhovetski Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c index 7606218ec4a7..8080c2cf1029 100644 --- a/drivers/media/i2c/adv7343.c +++ b/drivers/media/i2c/adv7343.c @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -445,16 +446,21 @@ static int adv7343_probe(struct i2c_client *client, ADV7343_GAIN_DEF); state->sd.ctrl_handler = &state->hdl; if (state->hdl.error) { - int err = state->hdl.error; - - v4l2_ctrl_handler_free(&state->hdl); - return err; + err = state->hdl.error; + goto done; } v4l2_ctrl_handler_setup(&state->hdl); err = adv7343_initialize(&state->sd); if (err) + goto done; + + err = v4l2_async_register_subdev(&state->sd); + +done: + if (err < 0) v4l2_ctrl_handler_free(&state->hdl); + return err; } @@ -463,6 +469,7 @@ static int adv7343_remove(struct i2c_client *client) struct v4l2_subdev *sd = i2c_get_clientdata(client); struct adv7343_state *state = to_state(sd); + v4l2_async_unregister_subdev(&state->sd); v4l2_device_unregister_subdev(sd); v4l2_ctrl_handler_free(&state->hdl);