diff options
author | Lad, Prabhakar <prabhakar.csengg@gmail.com> | 2015-03-09 18:10:51 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-02 22:55:50 -0400 |
commit | d079f99f00f75065feb0c33cd7c7b8e4d224d3c9 (patch) | |
tree | 1e7aa00f4123c7a9e885138e4945e98cee03158b /drivers/media/platform/sh_vou.c | |
parent | afd270d1a45043cef14341bcceff62ed50e8dc9a (diff) |
[media] media: sh_vou: 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: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/sh_vou.c')
-rw-r--r-- | drivers/media/platform/sh_vou.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 6d1959d1ad02..dde1ccc730be 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c | |||
@@ -62,7 +62,7 @@ enum sh_vou_status { | |||
62 | 62 | ||
63 | struct sh_vou_device { | 63 | struct sh_vou_device { |
64 | struct v4l2_device v4l2_dev; | 64 | struct v4l2_device v4l2_dev; |
65 | struct video_device *vdev; | 65 | struct video_device vdev; |
66 | atomic_t use_count; | 66 | atomic_t use_count; |
67 | struct sh_vou_pdata *pdata; | 67 | struct sh_vou_pdata *pdata; |
68 | spinlock_t lock; | 68 | spinlock_t lock; |
@@ -890,7 +890,7 @@ static int sh_vou_s_std(struct file *file, void *priv, v4l2_std_id std_id) | |||
890 | 890 | ||
891 | dev_dbg(vou_dev->v4l2_dev.dev, "%s(): 0x%llx\n", __func__, std_id); | 891 | dev_dbg(vou_dev->v4l2_dev.dev, "%s(): 0x%llx\n", __func__, std_id); |
892 | 892 | ||
893 | if (std_id & ~vou_dev->vdev->tvnorms) | 893 | if (std_id & ~vou_dev->vdev.tvnorms) |
894 | return -EINVAL; | 894 | return -EINVAL; |
895 | 895 | ||
896 | ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, video, | 896 | ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, video, |
@@ -1193,7 +1193,7 @@ static int sh_vou_open(struct file *file) | |||
1193 | V4L2_BUF_TYPE_VIDEO_OUTPUT, | 1193 | V4L2_BUF_TYPE_VIDEO_OUTPUT, |
1194 | V4L2_FIELD_NONE, | 1194 | V4L2_FIELD_NONE, |
1195 | sizeof(struct videobuf_buffer), | 1195 | sizeof(struct videobuf_buffer), |
1196 | vou_dev->vdev, &vou_dev->fop_lock); | 1196 | &vou_dev->vdev, &vou_dev->fop_lock); |
1197 | mutex_unlock(&vou_dev->fop_lock); | 1197 | mutex_unlock(&vou_dev->fop_lock); |
1198 | 1198 | ||
1199 | file->private_data = vou_file; | 1199 | file->private_data = vou_file; |
@@ -1361,21 +1361,14 @@ static int sh_vou_probe(struct platform_device *pdev) | |||
1361 | goto ev4l2devreg; | 1361 | goto ev4l2devreg; |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | /* Allocate memory for video device */ | 1364 | vdev = &vou_dev->vdev; |
1365 | vdev = video_device_alloc(); | ||
1366 | if (vdev == NULL) { | ||
1367 | ret = -ENOMEM; | ||
1368 | goto evdevalloc; | ||
1369 | } | ||
1370 | |||
1371 | *vdev = sh_vou_video_template; | 1365 | *vdev = sh_vou_video_template; |
1372 | if (vou_pdata->bus_fmt == SH_VOU_BUS_8BIT) | 1366 | if (vou_pdata->bus_fmt == SH_VOU_BUS_8BIT) |
1373 | vdev->tvnorms |= V4L2_STD_PAL; | 1367 | vdev->tvnorms |= V4L2_STD_PAL; |
1374 | vdev->v4l2_dev = &vou_dev->v4l2_dev; | 1368 | vdev->v4l2_dev = &vou_dev->v4l2_dev; |
1375 | vdev->release = video_device_release; | 1369 | vdev->release = video_device_release_empty; |
1376 | vdev->lock = &vou_dev->fop_lock; | 1370 | vdev->lock = &vou_dev->fop_lock; |
1377 | 1371 | ||
1378 | vou_dev->vdev = vdev; | ||
1379 | video_set_drvdata(vdev, vou_dev); | 1372 | video_set_drvdata(vdev, vou_dev); |
1380 | 1373 | ||
1381 | pm_runtime_enable(&pdev->dev); | 1374 | pm_runtime_enable(&pdev->dev); |
@@ -1409,9 +1402,7 @@ ei2cnd: | |||
1409 | ereset: | 1402 | ereset: |
1410 | i2c_put_adapter(i2c_adap); | 1403 | i2c_put_adapter(i2c_adap); |
1411 | ei2cgadap: | 1404 | ei2cgadap: |
1412 | video_device_release(vdev); | ||
1413 | pm_runtime_disable(&pdev->dev); | 1405 | pm_runtime_disable(&pdev->dev); |
1414 | evdevalloc: | ||
1415 | v4l2_device_unregister(&vou_dev->v4l2_dev); | 1406 | v4l2_device_unregister(&vou_dev->v4l2_dev); |
1416 | ev4l2devreg: | 1407 | ev4l2devreg: |
1417 | free_irq(irq, vou_dev); | 1408 | free_irq(irq, vou_dev); |
@@ -1438,7 +1429,7 @@ static int sh_vou_remove(struct platform_device *pdev) | |||
1438 | if (irq > 0) | 1429 | if (irq > 0) |
1439 | free_irq(irq, vou_dev); | 1430 | free_irq(irq, vou_dev); |
1440 | pm_runtime_disable(&pdev->dev); | 1431 | pm_runtime_disable(&pdev->dev); |
1441 | video_unregister_device(vou_dev->vdev); | 1432 | video_unregister_device(&vou_dev->vdev); |
1442 | i2c_put_adapter(client->adapter); | 1433 | i2c_put_adapter(client->adapter); |
1443 | v4l2_device_unregister(&vou_dev->v4l2_dev); | 1434 | v4l2_device_unregister(&vou_dev->v4l2_dev); |
1444 | iounmap(vou_dev->base); | 1435 | iounmap(vou_dev->base); |