Skip to contentSkip to conversation

media: i2c: adv7343: add support for asynchronous probing

PATCH In review Prabhakar Lad 2 participants 3 messages Jun 22, 2013 – Jun 23, 2013 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: i2c: adv7343: add support for asynchronous probing

From: "Lad, Prabhakar" <[email protected]>

Both synchronous and asynchronous adv7343 subdevice probing is supported by this patch.

Cc Guennadi Liakhovetski <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/adv7343.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/i2c/adv7343.c +11 -4
index 7606218..8080c2c 100644
@@ -27,6 +27,7 @@
 #include <linux/uaccess.h>
 
 #include <media/adv7343.h>
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
 
@@ -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);
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 28 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

Both synchronous and asynchronous adv7343 subdevice probing is supported by this patch.

Cc Guennadi Liakhovetski <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/adv7343.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/i2c/adv7343.c +1 -0
index 7606218..8080c2c 100644
@@ -27,6 +27,7 @@
 #include <linux/uaccess.h>
 
 #include <media/adv7343.h>
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
 

drivers/media/i2c/adv7343.c static int adv7343_probe(struct i2c_client *client, · line 450

Quoted 9 lines
drivers/media/i2c/adv7343.c +2 -4
@@ -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;

What does this have to do with asynchronous probing? Please, remove.

drivers/media/i2c/adv7343.c static int adv7343_probe(struct i2c_client *client, · line 460

Quoted 10 lines
drivers/media/i2c/adv7343.c +5 -0
 	}
 	v4l2_ctrl_handler_setup(&state->hdl);
 
 	err = adv7343_initialize(&state->sd);
 	if (err)
+		goto done;
+
+	err = v4l2_async_register_subdev(&state->sd);
+
+done:

This label won't be needed then either.

Thanks
Guennadi

Quoted 17 lines
drivers/media/i2c/adv7343.c +3 -0
+	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);
 
Signature · 1 line
1.7.9.5

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#2 lore raw
Quoted 29 lines · Guennadi Liakhovetski
Quoted 27 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

Both synchronous and asynchronous adv7343 subdevice probing is supported by this patch.

Cc Guennadi Liakhovetski <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Hans Verkuil <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/adv7343.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/i2c/adv7343.c +1 -0
index 7606218..8080c2c 100644
@@ -27,6 +27,7 @@
 #include <linux/uaccess.h>
 
 #include <media/adv7343.h>
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
 
Quoted 12 lines

drivers/media/i2c/adv7343.c static int adv7343_probe(struct i2c_client *client, · line 450

Quoted 10 lines
drivers/media/i2c/adv7343.c +2 -4
@@ -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;

What does this have to do with asynchronous probing? Please, remove.

Uhm, sorry, shouldn't review patches after that kind of a weekend :)

Guennadi

Quoted 31 lines

drivers/media/i2c/adv7343.c static int adv7343_probe(struct i2c_client *client, · line 460

Quoted 11 lines
drivers/media/i2c/adv7343.c +5 -0
 	}
 	v4l2_ctrl_handler_setup(&state->hdl);
 
 	err = adv7343_initialize(&state->sd);
 	if (err)
+		goto done;
+
+	err = v4l2_async_register_subdev(&state->sd);
+
+done:

This label won't be needed then either.

Thanks
Guennadi

Quoted 14 lines
drivers/media/i2c/adv7343.c +3 -0
+	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);
 
Quoted 9 lines
Quoted 3 lines
Signature · 1 line
1.7.9.5

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/