Skip to contentSkip to conversation

media: i2c: tvp514x: add support for asynchronous probing

PATCH Superseded Prabhakar Lad 3 participants 8 messages Jun 22, 2013 – Jun 24, 2013 Media (V4L/DVB)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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

Both synchronous and asynchronous tvp514x 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/tvp514x.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/i2c/tvp514x.c +15 -7
index 864eb14..d090caf 100644
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-mediabus.h>
 
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-mediabus.h>
@@ -1148,9 +1149,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	/* Register with V4L2 layer as slave device */
 	sd = &decoder->sd;
 	v4l2_i2c_subdev_init(sd, client, &tvp514x_ops);
-	strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
+	strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 	decoder->pad.flags = MEDIA_PAD_FL_SOURCE;
 	decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
@@ -1176,16 +1177,22 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	sd->ctrl_handler = &decoder->hdl;
 	if (decoder->hdl.error) {
 		ret = decoder->hdl.error;
-
-		v4l2_ctrl_handler_free(&decoder->hdl);
-		return ret;
+		goto done;
 	}
 	v4l2_ctrl_handler_setup(&decoder->hdl);
 
-	v4l2_info(sd, "%s decoder driver registered !!\n", sd->name);
-
-	return 0;
+	ret = v4l2_async_register_subdev(&decoder->sd);
+	if (!ret)
+		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;
 }
 
 /**
@@ -1200,6 +1207,7 @@ static int tvp514x_remove(struct i2c_client *client)
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
 	struct tvp514x_decoder *decoder = to_decoder(sd);
 
+	v4l2_async_unregister_subdev(&decoder->sd);
 	v4l2_device_unregister_subdev(sd);
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	media_entity_cleanup(&decoder->sd.entity);
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 20 lines · Prabhakar Lad

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

Both synchronous and asynchronous tvp514x 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/tvp514x.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/i2c/tvp514x.c +0 -0
index 864eb14..d090caf 100644

drivers/media/i2c/tvp514x.c line 42

Quoted 7 lines
drivers/media/i2c/tvp514x.c +1 -0
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-mediabus.h>
 
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-mediabus.h>

Ok, but this one really does too many things in one patch:

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1154

Quoted 8 lines
drivers/media/i2c/tvp514x.c +1 -1
@@ -1148,9 +1149,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	/* Register with V4L2 layer as slave device */
 	sd = &decoder->sd;
 	v4l2_i2c_subdev_init(sd, client, &tvp514x_ops);
-	strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
+	strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));

This is unrelated

Quoted 16 lines
drivers/media/i2c/tvp514x.c +1 -5
 	decoder->pad.flags = MEDIA_PAD_FL_SOURCE;
 	decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
@@ -1176,16 +1177,22 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	sd->ctrl_handler = &decoder->hdl;
 	if (decoder->hdl.error) {
 		ret = decoder->hdl.error;
-
-		v4l2_ctrl_handler_free(&decoder->hdl);
-		return ret;
+		goto done;
 	}
 	v4l2_ctrl_handler_setup(&decoder->hdl);
 
-	v4l2_info(sd, "%s decoder driver registered !!\n", sd->name);
-

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1192

Quoted 10 lines
drivers/media/i2c/tvp514x.c +8 -1
-	return 0;
+	ret = v4l2_async_register_subdev(&decoder->sd);
+	if (!ret)
+		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);

So is this - it wasn't called before in the "if (decoder->hdl.error)" case above.

Thanks
Guennadi

Quoted 17 lines
drivers/media/i2c/tvp514x.c +4 -0
+#endif
+	}
+	return ret;
 }
 
 /**
@@ -1200,6 +1207,7 @@ static int tvp514x_remove(struct i2c_client *client)
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
 	struct tvp514x_decoder *decoder = to_decoder(sd);
 
+	v4l2_async_unregister_subdev(&decoder->sd);
 	v4l2_device_unregister_subdev(sd);
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	media_entity_cleanup(&decoder->sd.entity);
Signature · 1 line
1.7.9.5

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

#2 lore raw

Hi Guennadi,

Thanks for the review.

Quoted 38 lines · Guennadi Liakhovetski
Quoted 20 lines · Prabhakar Lad

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

Both synchronous and asynchronous tvp514x 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/tvp514x.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/i2c/tvp514x.c +0 -0
index 864eb14..d090caf 100644

drivers/media/i2c/tvp514x.c line 42

Quoted 7 lines
drivers/media/i2c/tvp514x.c +1 -0
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-mediabus.h>
 
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-mediabus.h>

Ok, but this one really does too many things in one patch:

Quoted 6 lines
drivers/media/i2c/tvp514x.c +0 -1
@@ -1148,9 +1149,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
      /* Register with V4L2 layer as slave device */
      sd = &decoder->sd;
      v4l2_i2c_subdev_init(sd, client, &tvp514x_ops);
-     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 
Quoted 5 lines

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1154

Quoted 2 lines
drivers/media/i2c/tvp514x.c +1 -0
 #if defined(CONFIG_MEDIA_CONTROLLER)
+     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));

This is unrelated

OK I'll split the patch or may be a line in a commit message can do ?

Quoted 21 lines
Quoted 21 lines
drivers/media/i2c/tvp514x.c +4 -6
      decoder->pad.flags = MEDIA_PAD_FL_SOURCE;
      decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
      decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
@@ -1176,16 +1177,22 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
      sd->ctrl_handler = &decoder->hdl;
      if (decoder->hdl.error) {
              ret = decoder->hdl.error;
-
-             v4l2_ctrl_handler_free(&decoder->hdl);
-             return ret;
+             goto done;
      }
      v4l2_ctrl_handler_setup(&decoder->hdl);
 
-     v4l2_info(sd, "%s decoder driver registered !!\n", sd->name);
-
-     return 0;
+     ret = v4l2_async_register_subdev(&decoder->sd);
+     if (!ret)
+             v4l2_info(sd, "%s decoder driver registered !!\n", sd->name);
 
Quoted 9 lines

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1192

Quoted 5 lines
drivers/media/i2c/tvp514x.c +5 -0
+done:
+     if (ret < 0) {
+             v4l2_ctrl_handler_free(&decoder->hdl);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+             media_entity_cleanup(&decoder->sd.entity);

So is this - it wasn't called before in the "if (decoder->hdl.error)" case above.

Yes so fixed it up here.

Regards,
--Prabhakar Lad

#3 lore raw
Quoted 44 lines · On Sun June 23 2013 17:48:20 Prabhakar Lad wrote:

Hi Guennadi,

Thanks for the review.

Quoted 38 lines · Guennadi Liakhovetski
Quoted 20 lines · Prabhakar Lad

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

Both synchronous and asynchronous tvp514x 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/tvp514x.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/i2c/tvp514x.c +0 -0
index 864eb14..d090caf 100644

drivers/media/i2c/tvp514x.c line 42

Quoted 7 lines
drivers/media/i2c/tvp514x.c +1 -0
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-mediabus.h>
 
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-mediabus.h>

Ok, but this one really does too many things in one patch:

Quoted 6 lines
drivers/media/i2c/tvp514x.c +0 -1
@@ -1148,9 +1149,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
      /* Register with V4L2 layer as slave device */
      sd = &decoder->sd;
      v4l2_i2c_subdev_init(sd, client, &tvp514x_ops);
-     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 
Quoted 6 lines
Quoted 5 lines

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1154

Quoted 2 lines
drivers/media/i2c/tvp514x.c +1 -0
 #if defined(CONFIG_MEDIA_CONTROLLER)
+     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));

This is unrelated

OK I'll split the patch or may be a line in a commit message can do ?

Please split it up in two patches.

Why is sd->name set anyway? And why is it moved under CONFIG_MEDIA_CONTROLLER? It's not obvious to me.

The remainder of the patch makes sense.

Regards,

Hans

Quoted 40 lines
Quoted 22 lines
Quoted 22 lines
drivers/media/i2c/tvp514x.c +4 -6
      decoder->pad.flags = MEDIA_PAD_FL_SOURCE;
      decoder->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
      decoder->sd.entity.flags |= MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
@@ -1176,16 +1177,22 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
      sd->ctrl_handler = &decoder->hdl;
      if (decoder->hdl.error) {
              ret = decoder->hdl.error;
-
-             v4l2_ctrl_handler_free(&decoder->hdl);
-             return ret;
+             goto done;
      }
      v4l2_ctrl_handler_setup(&decoder->hdl);
 
-     v4l2_info(sd, "%s decoder driver registered !!\n", sd->name);
-
-     return 0;
+     ret = v4l2_async_register_subdev(&decoder->sd);
+     if (!ret)
+             v4l2_info(sd, "%s decoder driver registered !!\n", sd->name);
 
Quoted 9 lines

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1192

Quoted 5 lines
drivers/media/i2c/tvp514x.c +5 -0
+done:
+     if (ret < 0) {
+             v4l2_ctrl_handler_free(&decoder->hdl);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+             media_entity_cleanup(&decoder->sd.entity);

So is this - it wasn't called before in the "if (decoder->hdl.error)" case above.

Yes so fixed it up here.

Regards,
--Prabhakar Lad
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hi Hans,

Quoted 50 lines · Hans Verkuil
Quoted 49 lines · On Sun June 23 2013 17:48:20 Prabhakar Lad wrote:

Hi Guennadi,

Thanks for the review.

Quoted 43 lines · Guennadi Liakhovetski
Quoted 20 lines · Prabhakar Lad

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

Both synchronous and asynchronous tvp514x 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/tvp514x.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/i2c/tvp514x.c +0 -0
index 864eb14..d090caf 100644

drivers/media/i2c/tvp514x.c line 42

Quoted 7 lines
drivers/media/i2c/tvp514x.c +1 -0
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-mediabus.h>
 
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-mediabus.h>

Ok, but this one really does too many things in one patch:

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1154

Quoted 8 lines
drivers/media/i2c/tvp514x.c +1 -1
@@ -1148,9 +1149,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
      /* Register with V4L2 layer as slave device */
      sd = &decoder->sd;
      v4l2_i2c_subdev_init(sd, client, &tvp514x_ops);
-     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
+     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));

This is unrelated

Quoted 7 lines
Quoted 1 line

OK I'll split the patch or may be a line in a commit message can do ?

Please split it up in two patches.

Why is sd->name set anyway? And why is it moved under CONFIG_MEDIA_CONTROLLER? It's not obvious to me.

while using tvp514x subdev with media controller based drivers, when we enumerate entities (MEDIA_IOC_ENUM_ENTITIES) to get the index id of the entity we compare the entity name with "tvp514x", So I moved it under CONFIG_MEDIA_CONTROLLER config. I hope you are OK with moving this in a separate patch.

Regards,
--Prabhakar Lad

#5 lore raw
Quoted 57 lines · On Mon June 24 2013 10:24:02 Prabhakar Lad wrote:

Hi Hans,

Quoted 54 lines · Hans Verkuil
Quoted 44 lines · On Sun June 23 2013 17:48:20 Prabhakar Lad wrote:

Hi Guennadi,

Thanks for the review.

Quoted 38 lines · Guennadi Liakhovetski
Quoted 20 lines · Prabhakar Lad

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

Both synchronous and asynchronous tvp514x 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/tvp514x.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/i2c/tvp514x.c +0 -0
index 864eb14..d090caf 100644

drivers/media/i2c/tvp514x.c line 42

Quoted 7 lines
drivers/media/i2c/tvp514x.c +1 -0
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-mediabus.h>
 
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-mediabus.h>

Ok, but this one really does too many things in one patch:

Quoted 6 lines
drivers/media/i2c/tvp514x.c +0 -1
@@ -1148,9 +1149,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
      /* Register with V4L2 layer as slave device */
      sd = &decoder->sd;
      v4l2_i2c_subdev_init(sd, client, &tvp514x_ops);
-     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 
Quoted 6 lines
Quoted 5 lines

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1154

Quoted 2 lines
drivers/media/i2c/tvp514x.c +1 -0
 #if defined(CONFIG_MEDIA_CONTROLLER)
+     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));

This is unrelated

OK I'll split the patch or may be a line in a commit message can do ?

Please split it up in two patches.

Quoted 8 lines
Quoted 3 lines

Why is sd->name set anyway? And why is it moved under CONFIG_MEDIA_CONTROLLER? It's not obvious to me.

while using tvp514x subdev with media controller based drivers, when we enumerate entities (MEDIA_IOC_ENUM_ENTITIES) to get the index id of the entity we compare the entity name with "tvp514x", So I moved it under CONFIG_MEDIA_CONTROLLER config. I hope you are OK with moving this in a separate patch.

Sorry, but this approach is wrong. sd->name must be a unique name, so manually setting sd->name will fail if you have two tvp514x devices.

There is no reason to override sd->name here, and it is actually a bug. I see that tvp7002 has the same problem (and a bunch of others as well).

When trying to find a tvp514x you can just use strstr() in your application. That will work all the time as long as there is only one tvp514x.

Regards,

Hans

#6 lore raw

Hi Hans,

Quoted 67 lines · Hans Verkuil
Quoted 57 lines · On Mon June 24 2013 10:24:02 Prabhakar Lad wrote:

Hi Hans,

Quoted 54 lines · Hans Verkuil
Quoted 44 lines · On Sun June 23 2013 17:48:20 Prabhakar Lad wrote:

Hi Guennadi,

Thanks for the review.

Quoted 38 lines · Guennadi Liakhovetski
Quoted 20 lines · Prabhakar Lad

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

Both synchronous and asynchronous tvp514x 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/tvp514x.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/i2c/tvp514x.c +0 -0
index 864eb14..d090caf 100644

drivers/media/i2c/tvp514x.c line 42

Quoted 7 lines
drivers/media/i2c/tvp514x.c +1 -0
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-mediabus.h>
 
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-mediabus.h>

Ok, but this one really does too many things in one patch:

Quoted 6 lines
drivers/media/i2c/tvp514x.c +0 -1
@@ -1148,9 +1149,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
      /* Register with V4L2 layer as slave device */
      sd = &decoder->sd;
      v4l2_i2c_subdev_init(sd, client, &tvp514x_ops);
-     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 
Quoted 6 lines
Quoted 5 lines

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1154

Quoted 2 lines
drivers/media/i2c/tvp514x.c +1 -0
 #if defined(CONFIG_MEDIA_CONTROLLER)
+     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));

This is unrelated

OK I'll split the patch or may be a line in a commit message can do ?

Please split it up in two patches.

Quoted 8 lines
Quoted 3 lines

Why is sd->name set anyway? And why is it moved under CONFIG_MEDIA_CONTROLLER? It's not obvious to me.

while using tvp514x subdev with media controller based drivers, when we enumerate entities (MEDIA_IOC_ENUM_ENTITIES) to get the index id of the entity we compare the entity name with "tvp514x", So I moved it under CONFIG_MEDIA_CONTROLLER config. I hope you are OK with moving this in a separate patch.

Quoted 8 lines

Sorry, but this approach is wrong. sd->name must be a unique name, so manually setting sd->name will fail if you have two tvp514x devices.

There is no reason to override sd->name here, and it is actually a bug. I see that tvp7002 has the same problem (and a bunch of others as well).

When trying to find a tvp514x you can just use strstr() in your application. That will work all the time as long as there is only one tvp514x.

OK, then I will send out a cleanup patch removing sd->name from this driver and others too.

Regards,
--Prabhakar Lad

#7 lore raw
Quoted 73 lines · On Mon June 24 2013 10:53:37 Prabhakar Lad wrote:

Hi Hans,

Quoted 70 lines · Hans Verkuil
Quoted 57 lines · On Mon June 24 2013 10:24:02 Prabhakar Lad wrote:

Hi Hans,

Quoted 54 lines · Hans Verkuil
Quoted 44 lines · On Sun June 23 2013 17:48:20 Prabhakar Lad wrote:

Hi Guennadi,

Thanks for the review.

Quoted 38 lines · Guennadi Liakhovetski
Quoted 20 lines · Prabhakar Lad

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

Both synchronous and asynchronous tvp514x 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/tvp514x.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/media/i2c/tvp514x.c +0 -0
index 864eb14..d090caf 100644

drivers/media/i2c/tvp514x.c line 42

Quoted 7 lines
drivers/media/i2c/tvp514x.c +1 -0
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-mediabus.h>
 
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-mediabus.h>

Ok, but this one really does too many things in one patch:

Quoted 6 lines
drivers/media/i2c/tvp514x.c +0 -1
@@ -1148,9 +1149,9 @@ tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id)
      /* Register with V4L2 layer as slave device */
      sd = &decoder->sd;
      v4l2_i2c_subdev_init(sd, client, &tvp514x_ops);
-     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));
 
Quoted 6 lines
Quoted 5 lines

drivers/media/i2c/tvp514x.c tvp514x_probe(struct i2c_client *client, const struct i2c_device_id *id) · line 1154

Quoted 2 lines
drivers/media/i2c/tvp514x.c +1 -0
 #if defined(CONFIG_MEDIA_CONTROLLER)
+     strlcpy(sd->name, TVP514X_MODULE_NAME, sizeof(sd->name));

This is unrelated

OK I'll split the patch or may be a line in a commit message can do ?

Please split it up in two patches.

Quoted 8 lines
Quoted 3 lines

Why is sd->name set anyway? And why is it moved under CONFIG_MEDIA_CONTROLLER? It's not obvious to me.

while using tvp514x subdev with media controller based drivers, when we enumerate entities (MEDIA_IOC_ENUM_ENTITIES) to get the index id of the entity we compare the entity name with "tvp514x", So I moved it under CONFIG_MEDIA_CONTROLLER config. I hope you are OK with moving this in a separate patch.

Sorry, but this approach is wrong. sd->name must be a unique name, so manually setting sd->name will fail if you have two tvp514x devices.

Quoted 8 lines
Quoted 5 lines

There is no reason to override sd->name here, and it is actually a bug. I see that tvp7002 has the same problem (and a bunch of others as well).

When trying to find a tvp514x you can just use strstr() in your application. That will work all the time as long as there is only one tvp514x.

OK, then I will send out a cleanup patch removing sd->name from this driver and others too.

Thanks. I see that it is in tvp7002 as well. Also ov9650 and some Samsung devices, but I will deal with those.

Hans