summaryrefslogtreecommitdiff
blob: 3a0b26fc39e0e17b0d6045e7a80be6be65d6fc6b (plain)
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
--- linux-2.4.20-gentoo-r7/drivers/sound/sound_core.c.orig 2003-10-10 17:30:07.000000000 +0000
+++ linux-2.4.20-gentoo-r7/drivers/sound/sound_core.c 2003-10-10 17:33:23.000000000 +0000
@@ -17,8 +17,9 @@
  *	plug into this. The fact they dont all go via OSS doesn't mean
  *	they don't have to implement the OSS API. There is a lot of logic
  *	to keeping much of the OSS weight out of the code in a compatibility
- *	module, but its up to the driver to rember to load it...
+ *	module, but it's up to the driver to remember to load it...
  *
+
  *	The code provides a set of functions for registration of devices
  *	by type. This is done rather than providing a single call so that
  *	we can hide any future changes in the internals (eg when we go to
@@ -174,10 +174,10 @@
 		return r;
 	}
 	
-	if (r == low)
+	if (r < SOUND_STEP)
 		sprintf (name_buf, "%s", name);
 	else
-		sprintf (name_buf, "%s%d", name, (r - low) / SOUND_STEP);
+		sprintf (name_buf, "%s%d", name, (r / SOUND_STEP));
 	s->de = devfs_register (devfs_handle, name_buf,
 				DEVFS_FL_NONE, SOUND_MAJOR, s->unit_minor,
 				S_IFCHR | mode, fops, NULL);
@@ -232,17 +233,20 @@

 int register_sound_special(struct file_operations *fops, int unit)
 {
-	char *name;
+	const int chain = (unit & 0x0F);
+	int max_unit = chain + 128;
+	const char *name;

-	switch (unit) {
+	switch (chain) {
	    case 0:
		name = "mixer";
		break;
	    case 1:
		name = "sequencer";
+		max_unit = unit + 1;
		break;
	    case 2:
-		name = "midi00";
+		name = "midi";
		break;
	    case 3:
		name = "dsp";
@@ -261,6 +265,7 @@
		break;
	    case 8:
		name = "sequencer2";
+		max_unit = unit + 1;
		break;
	    case 9:
		name = "dmmidi";
@@ -281,10 +286,10 @@
		name = "admmidi";
		break;
	    default:
-		name = "unknown";
+		name = "unknownX";
		break;
	}
-	return sound_insert_unit(&chains[unit&15], fops, -1, unit, unit+1,
+	return sound_insert_unit(&chains[chain], fops, -1, unit, max_unit,
				 name, S_IRUSR | S_IWUSR);
 }