diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-03-09 19:33:57 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-03 05:29:01 +0300 |
commit | 3ae863e0db47ae7815f9e52975e1fddfca59520a (patch) | |
tree | f6b8076f90b5311a8e3335fa6a750f8676a6ecde /drivers/media/common | |
parent | 093654201e209b2a1aa59bd6c0bc1e33c1f6c4d2 (diff) | |
download | linux-3ae863e0db47ae7815f9e52975e1fddfca59520a.tar.xz |
[media] saa7146: 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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/saa7146/saa7146_fops.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c index b7d63933dae6..df1e8c975cd8 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c @@ -587,26 +587,20 @@ int saa7146_vv_release(struct saa7146_dev* dev) } EXPORT_SYMBOL_GPL(saa7146_vv_release); -int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, +int saa7146_register_device(struct video_device *vfd, struct saa7146_dev *dev, char *name, int type) { - struct video_device *vfd; int err; int i; DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type); - // released by vfd->release - vfd = video_device_alloc(); - if (vfd == NULL) - return -ENOMEM; - vfd->fops = &video_fops; if (type == VFL_TYPE_GRABBER) vfd->ioctl_ops = &dev->ext_vv_data->vid_ops; else vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops; - vfd->release = video_device_release; + vfd->release = video_device_release_empty; vfd->lock = &dev->v4l2_lock; vfd->v4l2_dev = &dev->v4l2_dev; vfd->tvnorms = 0; @@ -618,25 +612,20 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, err = video_register_device(vfd, type, -1); if (err < 0) { ERR("cannot register v4l2 device. skipping.\n"); - video_device_release(vfd); return err; } pr_info("%s: registered device %s [v4l2]\n", dev->name, video_device_node_name(vfd)); - - *vid = vfd; return 0; } EXPORT_SYMBOL_GPL(saa7146_register_device); -int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) +int saa7146_unregister_device(struct video_device *vfd, struct saa7146_dev *dev) { DEB_EE("dev:%p\n", dev); - video_unregister_device(*vid); - *vid = NULL; - + video_unregister_device(vfd); return 0; } EXPORT_SYMBOL_GPL(saa7146_unregister_device); |