Commit 55b2a312 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] radio-si4713: use V4L2 core lock

Simplify locking by using the V4L2 core lock mechanism. This allows us to
remove all locking from the i2c module. This will also simplify the upcoming
conversion to the control framework.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarEduardo Valentin <edubezval@gmail.com>
Tested-by: default avatarEduardo Valentin <edubezval@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a58841d0
...@@ -49,6 +49,7 @@ MODULE_ALIAS("platform:radio-si4713"); ...@@ -49,6 +49,7 @@ MODULE_ALIAS("platform:radio-si4713");
struct radio_si4713_device { struct radio_si4713_device {
struct v4l2_device v4l2_dev; struct v4l2_device v4l2_dev;
struct video_device radio_dev; struct video_device radio_dev;
struct mutex lock;
}; };
/* radio_si4713_fops - file operations interface */ /* radio_si4713_fops - file operations interface */
...@@ -247,6 +248,7 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev) ...@@ -247,6 +248,7 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev)
rval = -ENOMEM; rval = -ENOMEM;
goto exit; goto exit;
} }
mutex_init(&rsdev->lock);
rval = v4l2_device_register(&pdev->dev, &rsdev->v4l2_dev); rval = v4l2_device_register(&pdev->dev, &rsdev->v4l2_dev);
if (rval) { if (rval) {
...@@ -272,6 +274,8 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev) ...@@ -272,6 +274,8 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev)
rsdev->radio_dev = radio_si4713_vdev_template; rsdev->radio_dev = radio_si4713_vdev_template;
rsdev->radio_dev.v4l2_dev = &rsdev->v4l2_dev; rsdev->radio_dev.v4l2_dev = &rsdev->v4l2_dev;
/* Serialize all access to the si4713 */
rsdev->radio_dev.lock = &rsdev->lock;
video_set_drvdata(&rsdev->radio_dev, rsdev); video_set_drvdata(&rsdev->radio_dev, rsdev);
if (video_register_device(&rsdev->radio_dev, VFL_TYPE_RADIO, radio_nr)) { if (video_register_device(&rsdev->radio_dev, VFL_TYPE_RADIO, radio_nr)) {
dev_err(&pdev->dev, "Could not register video device.\n"); dev_err(&pdev->dev, "Could not register video device.\n");
......
This diff is collapsed.
...@@ -220,7 +220,6 @@ struct si4713_device { ...@@ -220,7 +220,6 @@ struct si4713_device {
/* v4l2_subdev and i2c reference (v4l2_subdev priv data) */ /* v4l2_subdev and i2c reference (v4l2_subdev priv data) */
struct v4l2_subdev sd; struct v4l2_subdev sd;
/* private data structures */ /* private data structures */
struct mutex mutex;
struct completion work; struct completion work;
struct rds_info rds_info; struct rds_info rds_info;
struct limiter_info limiter_info; struct limiter_info limiter_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment