diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-03-09 17:34:05 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-03 04:35:21 +0200 |
commit | 650e629bf7a782ce3c646f12a0ec381147b2c9b9 (patch) | |
tree | fea0033c9e0b11079415ba90a55014a8625b2a0f /drivers/media/platform/m2m-deinterlace.c | |
parent | [media] meye: embed video_device (diff) | |
download | linux-650e629bf7a782ce3c646f12a0ec381147b2c9b9.tar.xz linux-650e629bf7a782ce3c646f12a0ec381147b2c9b9.zip |
[media] m2m-deinterlace: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/m2m-deinterlace.c')
-rw-r--r-- | drivers/media/platform/m2m-deinterlace.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index b70c1aecca37..92d954973ccf 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -127,7 +127,7 @@ static struct deinterlace_fmt *find_format(struct v4l2_format *f) struct deinterlace_dev { struct v4l2_device v4l2_dev; - struct video_device *vfd; + struct video_device vfd; atomic_t busy; struct mutex dev_mutex; @@ -983,7 +983,7 @@ static struct video_device deinterlace_videodev = { .fops = &deinterlace_fops, .ioctl_ops = &deinterlace_ioctl_ops, .minor = -1, - .release = video_device_release, + .release = video_device_release_empty, .vfl_dir = VFL_DIR_M2M, }; @@ -1026,13 +1026,7 @@ static int deinterlace_probe(struct platform_device *pdev) atomic_set(&pcdev->busy, 0); mutex_init(&pcdev->dev_mutex); - vfd = video_device_alloc(); - if (!vfd) { - v4l2_err(&pcdev->v4l2_dev, "Failed to allocate video device\n"); - ret = -ENOMEM; - goto unreg_dev; - } - + vfd = &pcdev->vfd; *vfd = deinterlace_videodev; vfd->lock = &pcdev->dev_mutex; vfd->v4l2_dev = &pcdev->v4l2_dev; @@ -1040,12 +1034,11 @@ static int deinterlace_probe(struct platform_device *pdev) ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); if (ret) { v4l2_err(&pcdev->v4l2_dev, "Failed to register video device\n"); - goto rel_vdev; + goto unreg_dev; } video_set_drvdata(vfd, pcdev); snprintf(vfd->name, sizeof(vfd->name), "%s", deinterlace_videodev.name); - pcdev->vfd = vfd; v4l2_info(&pcdev->v4l2_dev, MEM2MEM_TEST_MODULE_NAME " Device registered as /dev/video%d\n", vfd->num); @@ -1069,11 +1062,9 @@ static int deinterlace_probe(struct platform_device *pdev) v4l2_m2m_release(pcdev->m2m_dev); err_m2m: - video_unregister_device(pcdev->vfd); + video_unregister_device(&pcdev->vfd); err_ctx: vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); -rel_vdev: - video_device_release(vfd); unreg_dev: v4l2_device_unregister(&pcdev->v4l2_dev); rel_dma: @@ -1088,7 +1079,7 @@ static int deinterlace_remove(struct platform_device *pdev) v4l2_info(&pcdev->v4l2_dev, "Removing " MEM2MEM_TEST_MODULE_NAME); v4l2_m2m_release(pcdev->m2m_dev); - video_unregister_device(pcdev->vfd); + video_unregister_device(&pcdev->vfd); v4l2_device_unregister(&pcdev->v4l2_dev); vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); dma_release_channel(pcdev->dma_chan); |