media: don't clear V4L2_SUBDEV_FL_IS_I2C
Subsystems (5)
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(-)
Signature · 1 line
2.7.4
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.
--- drivers/media/i2c/adv7180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/adv7180.c +1 -1
@@ -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
PATCH 2/4 media: max2175: don't clear V4L2_SUBDEV_FL_IS_I2C
In reply to Akinobu MitaThe 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.
--- drivers/media/i2c/max2175.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/max2175.c +1 -1
@@ -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
PATCH 3/4 media: ov2640: don't clear V4L2_SUBDEV_FL_IS_I2C
In reply to Akinobu MitaThe 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.
--- drivers/media/i2c/ov2640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov2640.c +1 -1
@@ -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
PATCH 4/4 media: ov5640: don't clear V4L2_SUBDEV_FL_IS_I2C
In reply to Akinobu MitaThe 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.
--- drivers/media/i2c/ov5640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov5640.c +1 -1
@@ -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
Quoted 10 lines · Akinobu Mita
The
v4l2_i2c_subdev_init()setsV4L2_SUBDEV_FL_IS_I2Cflag in thesubdev->flags. But some drivers overwritesubdev->flagsimmediately after callingv4l2_i2c_subdev_init(). SoV4L2_SUBDEV_FL_IS_I2Cis 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]
RE: [PATCH 2/4] media: max2175: don't clear V4L2_SUBDEV_FL_IS_I2C
In reply to Akinobu MitaHi Mita-san,
Thank you for fixing this.
Quoted 10 lines
Subject: [PATCH 2/4] media: max2175: don't clear
V4L2_SUBDEV_FL_IS_I2CThe
v4l2_i2c_subdev_init()setsV4L2_SUBDEV_FL_IS_I2Cflag in thesubdev->flags. But this driver overwritessubdev->flagsimmediatelysubdev->after
callingv4l2_i2c_subdev_init(). SoV4L2_SUBDEV_FL_IS_I2Cis not set after all.This stops breaking
subdev->flagsand preservesV4L2_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]>Signed-off-by Akinobu Mita <[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@@ -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