diff options
author | Lad, Prabhakar <prabhakar.csengg@gmail.com> | 2013-06-22 05:07:37 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-07-26 12:15:18 -0400 |
commit | 6555cfc5e7f8080a76edc2f556c709770fc1db57 (patch) | |
tree | 764a0116b255eeed79aea983b75e313766020339 | |
parent | 0fb0f8f5ed9ff1419cd59834e4d1e95d19fb2eef (diff) |
[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 <prabhakar.csengg@gmail.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/i2c/adv7343.c | 15 |
1 files changed, 11 insertions, 4 deletions
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 @@ | |||
27 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | 28 | ||
29 | #include <media/adv7343.h> | 29 | #include <media/adv7343.h> |
30 | #include <media/v4l2-async.h> | ||
30 | #include <media/v4l2-device.h> | 31 | #include <media/v4l2-device.h> |
31 | #include <media/v4l2-ctrls.h> | 32 | #include <media/v4l2-ctrls.h> |
32 | 33 | ||
@@ -445,16 +446,21 @@ static int adv7343_probe(struct i2c_client *client, | |||
445 | ADV7343_GAIN_DEF); | 446 | ADV7343_GAIN_DEF); |
446 | state->sd.ctrl_handler = &state->hdl; | 447 | state->sd.ctrl_handler = &state->hdl; |
447 | if (state->hdl.error) { | 448 | if (state->hdl.error) { |
448 | int err = state->hdl.error; | 449 | err = state->hdl.error; |
449 | 450 | goto done; | |
450 | v4l2_ctrl_handler_free(&state->hdl); | ||
451 | return err; | ||
452 | } | 451 | } |
453 | v4l2_ctrl_handler_setup(&state->hdl); | 452 | v4l2_ctrl_handler_setup(&state->hdl); |
454 | 453 | ||
455 | err = adv7343_initialize(&state->sd); | 454 | err = adv7343_initialize(&state->sd); |
456 | if (err) | 455 | if (err) |
456 | goto done; | ||
457 | |||
458 | err = v4l2_async_register_subdev(&state->sd); | ||
459 | |||
460 | done: | ||
461 | if (err < 0) | ||
457 | v4l2_ctrl_handler_free(&state->hdl); | 462 | v4l2_ctrl_handler_free(&state->hdl); |
463 | |||
458 | return err; | 464 | return err; |
459 | } | 465 | } |
460 | 466 | ||
@@ -463,6 +469,7 @@ static int adv7343_remove(struct i2c_client *client) | |||
463 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 469 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
464 | struct adv7343_state *state = to_state(sd); | 470 | struct adv7343_state *state = to_state(sd); |
465 | 471 | ||
472 | v4l2_async_unregister_subdev(&state->sd); | ||
466 | v4l2_device_unregister_subdev(sd); | 473 | v4l2_device_unregister_subdev(sd); |
467 | v4l2_ctrl_handler_free(&state->hdl); | 474 | v4l2_ctrl_handler_free(&state->hdl); |
468 | 475 | ||