Commit 14381c26771f1a7d6acc57e4c944a9813596e6cf

Authored by Hans Verkuil
Committed by Mauro Carvalho Chehab
1 parent 9e882e3bc9

[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: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 2 changed files with 5 additions and 4 deletions Side-by-side Diff

drivers/media/platform/soc_camera/soc_camera.c
... ... @@ -524,7 +524,7 @@
524 524 return -ENODEV;
525 525 }
526 526  
527   - icd = dev_get_drvdata(vdev->parent);
  527 + icd = video_get_drvdata(vdev);
528 528 ici = to_soc_camera_host(icd->parent);
529 529  
530 530 ret = try_module_get(ici->ops->owner) ? 0 : -ENODEV;
... ... @@ -1477,7 +1477,7 @@
1477 1477  
1478 1478 strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name));
1479 1479  
1480   - vdev->parent = icd->pdev;
  1480 + vdev->v4l2_dev = &ici->v4l2_dev;
1481 1481 vdev->fops = &soc_camera_fops;
1482 1482 vdev->ioctl_ops = &soc_camera_ioctl_ops;
1483 1483 vdev->release = video_device_release;
... ... @@ -1500,6 +1500,7 @@
1500 1500 if (!icd->parent)
1501 1501 return -ENODEV;
1502 1502  
  1503 + video_set_drvdata(icd->vdev, icd);
1503 1504 ret = video_register_device(icd->vdev, VFL_TYPE_GRABBER, -1);
1504 1505 if (ret < 0) {
1505 1506 dev_err(icd->pdev, "video_register_device failed: %d\n", ret);
include/media/soc_camera.h
... ... @@ -346,9 +346,9 @@
346 346 return client->dev.platform_data;
347 347 }
348 348  
349   -static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_device *vdev)
  349 +static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(struct video_device *vdev)
350 350 {
351   - struct soc_camera_device *icd = dev_get_drvdata(vdev->parent);
  351 + struct soc_camera_device *icd = video_get_drvdata(vdev);
352 352 return soc_camera_to_subdev(icd);
353 353 }
354 354