diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-29 23:19:38 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-29 23:19:38 +0000 |
commit | ed518b0f12ebcaed430a8d60da4ff0b09269bd10 (patch) | |
tree | b77e2b69ce33043607f7acb6cc5404b8a5d4e8a3 | |
parent | 371e9cd5d73f498038bb2dacf7c5d052c66e73a8 (diff) | |
download | mediapointer-dvb-s2-ed518b0f12ebcaed430a8d60da4ff0b09269bd10.tar.gz mediapointer-dvb-s2-ed518b0f12ebcaed430a8d60da4ff0b09269bd10.tar.bz2 |
2-dev.c: return 0 for NULL open and release callbacks
From: Hans Verkuil <hverkuil@xs4all.nl>
Patch allows v4l2_open and v4l2_release functions return 0 if open and
release driver callbacks set to NULL. This will be used in radio
drivers.
--
Priority: normal
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | linux/drivers/media/video/v4l2-dev.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/linux/drivers/media/video/v4l2-dev.c b/linux/drivers/media/video/v4l2-dev.c index 2c4d38979..f7e128729 100644 --- a/linux/drivers/media/video/v4l2-dev.c +++ b/linux/drivers/media/video/v4l2-dev.c @@ -267,7 +267,7 @@ static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) static int v4l2_open(struct inode *inode, struct file *filp) { struct video_device *vdev; - int ret; + int ret = 0; /* Check if the video device is available */ mutex_lock(&videodev_lock); @@ -281,7 +281,9 @@ static int v4l2_open(struct inode *inode, struct file *filp) /* and increase the device refcount */ video_get(vdev); mutex_unlock(&videodev_lock); - ret = vdev->fops->open(filp); + if (vdev->fops->open) + ret = vdev->fops->open(filp); + /* decrease the refcount in case of an error */ if (ret) video_put(vdev); @@ -292,7 +294,10 @@ static int v4l2_open(struct inode *inode, struct file *filp) static int v4l2_release(struct inode *inode, struct file *filp) { struct video_device *vdev = video_devdata(filp); - int ret = vdev->fops->release(filp); + int ret = 0; + + if (vdev->fops->release) + vdev->fops->release(filp); /* decrease the refcount unconditionally since the release() return value is ignored. */ |