File: info.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 (141 lines) | stat: -rw-r--r-- 3,329 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
--- ../alsa-kernel/core/info.c	2006-08-04 19:08:04.000000000 +0200
+++ info.c	2006-08-07 18:25:02.000000000 +0200
@@ -1,3 +1,4 @@
+#include "info.inc"
 /*
  *  Information interface for ALSA driver
  *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
@@ -20,6 +21,8 @@
  */
 
 #include <sound/driver.h>
+#include <linux/version.h>
+#include <linux/utsrelease.h>
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/smp_lock.h>
@@ -151,6 +154,7 @@
 struct snd_info_entry *snd_oss_root;
 #endif
 
+#ifndef LINUX_2_2
 static inline void snd_info_entry_prepare(struct proc_dir_entry *de)
 {
 	de->owner = THIS_MODULE;
@@ -162,6 +166,7 @@
 	if (de)
 		remove_proc_entry(de->name, parent);
 }
+#endif
 
 static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig)
 {
@@ -171,7 +176,9 @@
 
 	data = file->private_data;
 	entry = data->entry;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 3)
 	lock_kernel();
+#endif
 	switch (entry->content) {
 	case SNDRV_INFO_CONTENT_TEXT:
 		switch (orig) {
@@ -200,7 +207,9 @@
 	}
 	ret = -ENXIO;
 out:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 3)
 	unlock_kernel();
+#endif
 	return ret;
 }
 
@@ -483,6 +492,19 @@
 	return -ENOTTY;
 }
 
+#ifndef CONFIG_SND_HAVE_NEW_IOCTL
+/* need to unlock BKL to allow preemption */
+static int snd_info_entry_ioctl_old(struct inode *inode, struct file * file,
+				    unsigned int cmd, unsigned long arg)
+{
+	int err;
+	unlock_kernel();
+	err = snd_info_entry_ioctl(file, cmd, arg);
+	lock_kernel();
+	return err;
+}
+#endif
+
 static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct inode *inode = file->f_dentry->d_inode;
@@ -506,17 +528,30 @@
 
 static struct file_operations snd_info_entry_operations =
 {
+#ifndef LINUX_2_2
 	.owner =		THIS_MODULE,
+#endif
 	.llseek =		snd_info_entry_llseek,
 	.read =			snd_info_entry_read,
 	.write =		snd_info_entry_write,
 	.poll =			snd_info_entry_poll,
+#ifdef CONFIG_SND_HAVE_NEW_IOCTL
 	.unlocked_ioctl =	snd_info_entry_ioctl,
+#else
+	.ioctl =		snd_info_entry_ioctl_old,
+#endif
 	.mmap =			snd_info_entry_mmap,
 	.open =			snd_info_entry_open,
 	.release =		snd_info_entry_release,
 };
 
+#ifdef LINUX_2_2
+static struct inode_operations snd_info_entry_inode_operations =
+{
+	&snd_info_entry_operations,     /* default sound info directory file-ops */
+};
+#endif
+
 /**
  * snd_create_proc_entry - create a procfs entry
  * @name: the name of the proc file
@@ -952,9 +987,16 @@
 		mutex_unlock(&info_mutex);
 		return -ENOMEM;
 	}
+#ifndef LINUX_2_2
 	p->owner = entry->module;
-	if (!S_ISDIR(entry->mode))
+#endif
+	if (!S_ISDIR(entry->mode)) {
+#ifndef LINUX_2_2
 		p->proc_fops = &snd_info_entry_operations;
+#else
+		p->ops = &snd_info_entry_inode_operations;
+#endif
+	}
 	p->size = entry->size;
 	p->data = entry;
 	entry->p = p;
@@ -974,9 +1016,19 @@
 
 static void snd_info_version_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
 {
+	static char *kernel_version = UTS_RELEASE;
+
 	snd_iprintf(buffer,
 		    "Advanced Linux Sound Architecture Driver Version "
 		    CONFIG_SND_VERSION CONFIG_SND_DATE ".\n"
+		    "Compiled on " __DATE__ " for kernel %s"
+#ifdef CONFIG_SMP
+		    " (SMP)"
+#endif
+#ifdef MODVERSIONS
+		    " with versioned symbols"
+#endif
+		    ".\n", kernel_version
 		   );
 }