Commit 14381c26 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] soc_camera: replace vdev->parent by vdev->v4l2_dev

The parent field will eventually disappear to be replaced by v4l2_dev.
soc_camera does provide a v4l2_device struct but did not point to it in
struct video_device. This is now fixed.
Now the video nodes can be found under the correct platform bus, and
the advanced debug ioctls work correctly as well (the core implementation
of those ioctls requires that v4l2_dev is set correctly).
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9e882e3b
...@@ -524,7 +524,7 @@ static int soc_camera_open(struct file *file) ...@@ -524,7 +524,7 @@ static int soc_camera_open(struct file *file)
return -ENODEV; return -ENODEV;
} }
icd = dev_get_drvdata(vdev->parent); icd = video_get_drvdata(vdev);
ici = to_soc_camera_host(icd->parent); ici = to_soc_camera_host(icd->parent);
ret = try_module_get(ici->ops->owner) ? 0 : -ENODEV; ret = try_module_get(ici->ops->owner) ? 0 : -ENODEV;
...@@ -1477,7 +1477,7 @@ static int video_dev_create(struct soc_camera_device *icd) ...@@ -1477,7 +1477,7 @@ static int video_dev_create(struct soc_camera_device *icd)
strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name));
vdev->parent = icd->pdev; vdev->v4l2_dev = &ici->v4l2_dev;
vdev->fops = &soc_camera_fops; vdev->fops = &soc_camera_fops;
vdev->ioctl_ops = &soc_camera_ioctl_ops; vdev->ioctl_ops = &soc_camera_ioctl_ops;
vdev->release = video_device_release; vdev->release = video_device_release;
...@@ -1500,6 +1500,7 @@ static int soc_camera_video_start(struct soc_camera_device *icd) ...@@ -1500,6 +1500,7 @@ static int soc_camera_video_start(struct soc_camera_device *icd)
if (!icd->parent) if (!icd->parent)
return -ENODEV; return -ENODEV;
video_set_drvdata(icd->vdev, icd);
ret = video_register_device(icd->vdev, VFL_TYPE_GRABBER, -1); ret = video_register_device(icd->vdev, VFL_TYPE_GRABBER, -1);
if (ret < 0) { if (ret < 0) {
dev_err(icd->pdev, "video_register_device failed: %d\n", ret); dev_err(icd->pdev, "video_register_device failed: %d\n", ret);
......
...@@ -346,9 +346,9 @@ static inline struct soc_camera_subdev_desc *soc_camera_i2c_to_desc(const struct ...@@ -346,9 +346,9 @@ static inline struct soc_camera_subdev_desc *soc_camera_i2c_to_desc(const struct
return client->dev.platform_data; return client->dev.platform_data;
} }
static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_device *vdev) static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(struct video_device *vdev)
{ {
struct soc_camera_device *icd = dev_get_drvdata(vdev->parent); struct soc_camera_device *icd = video_get_drvdata(vdev);
return soc_camera_to_subdev(icd); return soc_camera_to_subdev(icd);
} }
......
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