From: Stelian Pop <stelian@popies.net>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH 4/12] meye: do lock properly when waiting for buffers
Date: Thu, 4 Nov 2004 12:14:54 +0100 [thread overview]
Message-ID: <20041104111453.GJ3472@crusoe.alcove-fr> (raw)
In-Reply-To: <20041104111231.GF3472@crusoe.alcove-fr>
===================================================================
ChangeSet@1.2343, 2004-11-02 15:46:59+01:00, stelian@popies.net
meye: do lock properly when waiting for buffers
Signed-off-by: Stelian Pop <stelian@popies.net>
===================================================================
meye.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
===================================================================
diff -Nru a/drivers/media/video/meye.c b/drivers/media/video/meye.c
--- a/drivers/media/video/meye.c 2004-11-04 11:21:51 +01:00
+++ b/drivers/media/video/meye.c 2004-11-04 11:21:52 +01:00
@@ -929,19 +929,25 @@
if (*i < 0 || *i >= gbuffers)
return -EINVAL;
+ down(&meye.lock);
+
switch (meye.grab_buffer[*i].state) {
case MEYE_BUF_UNUSED:
+ up(&meye.lock);
return -EINVAL;
case MEYE_BUF_USING:
if (wait_event_interruptible(meye.proc_list,
- (meye.grab_buffer[*i].state != MEYE_BUF_USING)))
+ (meye.grab_buffer[*i].state != MEYE_BUF_USING))) {
+ up(&meye.lock);
return -EINTR;
+ }
/* fall through */
case MEYE_BUF_DONE:
meye.grab_buffer[*i].state = MEYE_BUF_UNUSED;
kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int));
}
+ up(&meye.lock);
break;
}
@@ -1059,20 +1065,25 @@
if (*i < 0 || *i >= gbuffers)
return -EINVAL;
+ down(&meye.lock);
switch (meye.grab_buffer[*i].state) {
case MEYE_BUF_UNUSED:
+ up(&meye.lock);
return -EINVAL;
case MEYE_BUF_USING:
if (wait_event_interruptible(meye.proc_list,
- (meye.grab_buffer[*i].state != MEYE_BUF_USING)))
+ (meye.grab_buffer[*i].state != MEYE_BUF_USING))) {
+ up(&meye.lock);
return -EINTR;
+ }
/* fall through */
case MEYE_BUF_DONE:
meye.grab_buffer[*i].state = MEYE_BUF_UNUSED;
kfifo_get(meye.doneq, (unsigned char *)&unused, sizeof(int));
}
*i = meye.grab_buffer[*i].size;
+ up(&meye.lock);
break;
}
next prev parent reply other threads:[~2004-11-04 11:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-04 11:12 [PATCH 0/12] meye driver update Stelian Pop
2004-11-04 11:13 ` [PATCH 1/12] meye: module related fixes Stelian Pop
2004-11-04 11:13 ` [PATCH 2/12] meye: replace homebrew queue with kfifo Stelian Pop
2004-11-04 11:14 ` [PATCH 3/12] meye: picture depth is in bits not in bytes Stelian Pop
2004-11-04 11:14 ` Stelian Pop [this message]
2004-11-04 11:15 ` [PATCH 5/12] meye: implement non blocking access using poll() Stelian Pop
2004-11-04 11:15 ` [PATCH 6/12] meye: cleanup init/exit paths Stelian Pop
2004-11-04 11:16 ` [PATCH 7/12] meye: the driver is no longer experimental and depends on PCI Stelian Pop
2004-11-04 11:41 ` Christoph Hellwig
2004-11-04 11:49 ` Stelian Pop
2004-11-04 12:23 ` Arjan van de Ven
2004-11-04 12:32 ` Stelian Pop
2004-11-04 13:16 ` Arjan van de Ven
2004-11-04 14:09 ` Stelian Pop
2004-11-04 11:16 ` [PATCH 8/12] meye: module parameters documentation fixes Stelian Pop
2004-11-04 11:17 ` [PATCH 9/12] meye: add v4l2 support Stelian Pop
2004-11-04 11:17 ` [PATCH 10/12] meye: whitespace and coding style cleanups Stelian Pop
2004-11-04 11:18 ` [PATCH 11/12] meye: bump up the version number Stelian Pop
2004-11-04 11:18 ` [PATCH 12/12] meye: cache the camera settings in the driver Stelian Pop
2004-11-04 12:25 ` [PATCH 0/12] meye driver update Emmanuel Fleury
2004-11-04 12:36 ` Stelian Pop
2004-11-04 21:19 ` meye bug? (was: meye driver update) Roland Mas
2004-11-04 21:42 ` Roland Mas
2004-11-04 21:58 ` Stelian Pop
2004-11-05 11:18 ` meye bug? No Roland Mas
2004-11-05 22:25 ` Stelian Pop
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=20041104111453.GJ3472@crusoe.alcove-fr \
--to=stelian@popies.net \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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
all inboxes | Powered by JetHome®