File: seq_memory.patch

package info (click to toggle)
alsa-driver 1.0.13-5etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 20,108 kB
  • ctags: 50,477
  • sloc: ansic: 319,881; sh: 32,930; makefile: 2,015; python: 1,527; perl: 1,316; xml: 896; awk: 66
file content (37 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- ../../alsa-kernel/core/seq/seq_memory.c	2006-01-10 16:08:55.000000000 +0100
+++ seq_memory.c	2006-01-10 16:08:53.000000000 +0100
@@ -1,3 +1,4 @@
+#define __NO_VERSION__
 /*
  *  ALSA sequencer Memory Manager
  *  Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
@@ -32,6 +33,10 @@
 #include "seq_info.h"
 #include "seq_lock.h"
 
+/* semaphore in struct file record */
+#define semaphore_of(fp)	((fp)->f_dentry->d_inode->i_sem)
+
+
 static inline int snd_seq_pool_available(struct snd_seq_pool *pool)
 {
 	return pool->total_elements - atomic_read(&pool->counter);
@@ -240,7 +245,18 @@
 		set_current_state(TASK_INTERRUPTIBLE);
 		add_wait_queue(&pool->output_sleep, &wait);
 		spin_unlock_irq(&pool->lock);
+#ifdef LINUX_2_2
+		/* change semaphore to allow other clients
+		   to access device file */
+		if (file)
+			up(&semaphore_of(file));
+#endif
 		schedule();
+#ifdef LINUX_2_2
+		/* restore semaphore again */
+		if (file)
+			down(&semaphore_of(file));
+#endif
 		spin_lock_irq(&pool->lock);
 		remove_wait_queue(&pool->output_sleep, &wait);
 		/* interrupted? */