From: Alexey Klimov <klimov.linux@gmail.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>,
Hans Verkuil <hverkuil@xs4all.nl>
Cc: Douglas Schilling Landgraf <dougsland@gmail.com>,
linux-media@vger.kernel.org
Subject: [patch 1/2] v4l2-dev.c: return 0 for NULL open and release callbacks
Date: Mon, 30 Mar 2009 03:19:38 +0400 [thread overview]
Message-ID: <1238368778.21620.35.camel@tux.localhost> (raw)
Hello, all
This is two patches that removes empty open and release functions in
pci/isa radio drivers. To handle that we change v4l2-dev.c file.
I'm not sure, but it's probably that small note about it should be added
in docs. If i did something wrong, please correct.
---
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>
--
diff -r df7a51ffa2ba linux/drivers/media/video/v4l2-dev.c
--- a/linux/drivers/media/video/v4l2-dev.c Sun Mar 29 05:58:58 2009 -0300
+++ b/linux/drivers/media/video/v4l2-dev.c Mon Mar 30 01:13:59 2009 +0400
@@ -267,7 +267,7 @@
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 @@
/* 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_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. */
--
Best regards, Klimov Alexey
reply other threads:[~2009-03-29 23:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1238368778.21620.35.camel@tux.localhost \
--to=klimov.linux@gmail.com \
--cc=dougsland@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox