Skip to contentSkip to conversation

media: don't clear V4L2_SUBDEV_FL_IS_I2C

PATCH In review Akinobu Mita 3 participants 7 messages Oct 19, 2017 – Oct 20, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover media: don't clear V4L2_SUBDEV_FL_IS_I2C

The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the subdev->flags. But some drivers overwrite subdev->flags immediately after calling v4l2_i2c_subdev_init(). So V4L2_SUBDEV_FL_IS_I2C is not set after all.

This patch series fixes the problem for each driver.

Side note: According to the comment in v4l2_device_unregister(), this is problematic only if the device is platform bus device. Device tree or ACPI based devices are not affected.

Akinobu Mita (4):
media: adv7180: don't clear V4L2_SUBDEV_FL_IS_I2C
media: max2175: don't clear V4L2_SUBDEV_FL_IS_I2C
media: ov2640: don't clear V4L2_SUBDEV_FL_IS_I2C
media: ov5640: don't clear V4L2_SUBDEV_FL_IS_I2C

 drivers/media/i2c/adv7180.c | 2 +-
 drivers/media/i2c/max2175.c | 2 +-
 drivers/media/i2c/ov2640.c  | 2 +-
 drivers/media/i2c/ov5640.c  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
Cc Lars-Peter Clausen <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Ramesh Shanmugasundaram <[email protected]>
Cc Sakari Ailus <[email protected]>
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 media: adv7180: don't clear V4L2_SUBDEV_FL_IS_I2C

The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the subdev->flags. But this driver overwrites subdev->flags immediately after calling v4l2_i2c_subdev_init(). So V4L2_SUBDEV_FL_IS_I2C is not set after all.

This stops breaking subdev->flags and preserves V4L2_SUBDEV_FL_IS_I2C.

Side note: According to the comment in v4l2_device_unregister(), this is problematic only if the device is platform bus device. Device tree or ACPI based devices are not affected.

Cc Lars-Peter Clausen <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/adv7180.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv7180.c +1 -1
index 3df28f2..6fb818a 100644
@@ -1328,7 +1328,7 @@ static int adv7180_probe(struct i2c_client *client,
 	state->input = 0;
 	sd = &state->sd;
 	v4l2_i2c_subdev_init(sd, client, &adv7180_ops);
-	sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
 
 	ret = adv7180_init_controls(state);
 	if (ret)
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 media: max2175: don't clear V4L2_SUBDEV_FL_IS_I2C

In reply to Akinobu Mita

The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the subdev->flags. But this driver overwrites subdev->flags immediately after calling v4l2_i2c_subdev_init(). So V4L2_SUBDEV_FL_IS_I2C is not set after all.

This stops breaking subdev->flags and preserves V4L2_SUBDEV_FL_IS_I2C.

Side note: According to the comment in v4l2_device_unregister(), this is problematic only if the device is platform bus device. Device tree or ACPI based devices are not affected.

Cc Ramesh Shanmugasundaram <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/max2175.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/max2175.c +1 -1
index bf0e821..2f1966b 100644
@@ -1345,7 +1345,7 @@ static int max2175_probe(struct i2c_client *client,
 	v4l2_i2c_subdev_init(sd, client, &max2175_ops);
 	ctx->client = client;
 
-	sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
 	/* Controls */
 	hdl = &ctx->ctrl_hdl;
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/4 media: ov2640: don't clear V4L2_SUBDEV_FL_IS_I2C

In reply to Akinobu Mita

The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the subdev->flags. But this driver overwrites subdev->flags immediately after calling v4l2_i2c_subdev_init(). So V4L2_SUBDEV_FL_IS_I2C is not set after all.

This stops breaking subdev->flags and preserves V4L2_SUBDEV_FL_IS_I2C.

Side note: According to the comment in v4l2_device_unregister(), this is problematic only if the device is platform bus device. Device tree or ACPI based devices are not affected.

Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/ov2640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov2640.c +1 -1
index e6d0c1f..5b035d1 100644
@@ -1116,7 +1116,7 @@ static int ov2640_probe(struct i2c_client *client,
 		goto err_clk;
 
 	v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
-	priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
+	priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	v4l2_ctrl_handler_init(&priv->hdl, 2);
 	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
 			V4L2_CID_VFLIP, 0, 1, 1, 0);
Signature · 1 line
2.7.4
#5 lore raw

PATCH 4/4 media: ov5640: don't clear V4L2_SUBDEV_FL_IS_I2C

In reply to Akinobu Mita

The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the subdev->flags. But this driver overwrites subdev->flags immediately after calling v4l2_i2c_subdev_init(). So V4L2_SUBDEV_FL_IS_I2C is not set after all.

This stops breaking subdev->flags and preserves V4L2_SUBDEV_FL_IS_I2C.

Side note: According to the comment in v4l2_device_unregister(), this is problematic only if the device is platform bus device. Device tree or ACPI based devices are not affected.

Cc Sakari Ailus <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
---
 drivers/media/i2c/ov5640.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov5640.c +1 -1
index 39a2269..c89ed66 100644
@@ -2271,7 +2271,7 @@ static int ov5640_probe(struct i2c_client *client,
 
 	v4l2_i2c_subdev_init(&sensor->sd, client, &ov5640_subdev_ops);
 
-	sensor->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
+	sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
 	sensor->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 	ret = media_entity_pads_init(&sensor->sd.entity, 1, &sensor->pad);
Signature · 1 line
2.7.4
#6 lore raw
In reply to Akinobu Mita
Quoted 10 lines · Akinobu Mita

The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the subdev->flags. But some drivers overwrite subdev->flags immediately after calling v4l2_i2c_subdev_init(). So V4L2_SUBDEV_FL_IS_I2C is not set after all.

This patch series fixes the problem for each driver.

Side note: According to the comment in v4l2_device_unregister(), this is problematic only if the device is platform bus device. Device tree or ACPI based devices are not affected.

Good catch, thanks!

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]
Acked-by on v1 2/4
#3 lore raw

RE: [PATCH 2/4] media: max2175: don't clear V4L2_SUBDEV_FL_IS_I2C

In reply to Akinobu Mita

Hi Mita-san,

Thank you for fixing this.

Quoted 10 lines

Subject: [PATCH 2/4] media: max2175: don't clear V4L2_SUBDEV_FL_IS_I2C

The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the subdev->flags. But this driver overwrites subdev->flags immediately subdev->after
calling v4l2_i2c_subdev_init(). So V4L2_SUBDEV_FL_IS_I2C is not set after all.

This stops breaking subdev->flags and preserves V4L2_SUBDEV_FL_IS_I2C.

Quoted 7 lines

Side note: According to the comment in v4l2_device_unregister(), this is problematic only if the device is platform bus device. Device tree or ACPI based devices are not affected.

Cc Ramesh Shanmugasundaram <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>

Thanks,
Ramesh

Quoted 19 lines
---
 drivers/media/i2c/max2175.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/max2175.c +1 -2
index bf0e821..2f1966b 100644
@@ -1345,7 +1345,7 @@ static int max2175_probe(struct i2c_client *client,
 	v4l2_i2c_subdev_init(sd, client, &max2175_ops);
 	ctx->client = client;
 
-	sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 
 	/* Controls */
 	hdl = &ctx->ctrl_hdl;
--

2.7.4