On Fri, Jan 03, 2003 at 01:24:08PM +0100, Richard Stevens wrote:
> and put them in my rc.local script. That does the job as a workaround. I'll 
> also try the patch later. Hopefully it works with my 2.4.20 kernel. Jaroslav, 
> do you know if the patch got rejected completely or only delayed? Any 
> information from the kernel masters about the subject?


I just tried the patch and I use vanilla 2.4.20 kernel. Only the fourth chunk
is not appliable, bacause it seems sort of applied already. The function
register_sound_special that is in the kernel looks a lot like the alsa patch
wants it to look like. The part that is not applied is the shortcut with the
unknown devices - the kernel source prefers a long switch statement, rather
than using goto.

There is also the part with the switch statement.

The kernel source has changed like
-       switch (unit & 15) {
+       switch (unit) {

and the alsa patch suggests

-       switch (unit & 15) {
+       switch (chain) {

where chain is assigned a value of unit % SOUND_STEP a few lines before that. 
The name of the device with minor 2 became hardcoded as midi00 (again rejection
of a part of the alsa patch).

That's about it. The rest of the fourth chunk is applied (more or less) and the
rest of the patch is not applied at all.

I applied the patch almost manually, and for the curious, here is my diff.
You'd need to patch -R, but do read until the end first.

--- /usr/src/linux/drivers/sound/sound_core.c.bak       2003-01-03 20:48:46.000000000 
+0900
+++ /usr/src/linux/drivers/sound/sound_core.c   2003-01-03 21:47:59.000000000 +0900
@@ -173,10 +173,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);
@@ -217,7 +217,7 @@
  *     15      *16             unused
  */
 
-static struct sound_unit *chains[16];
+static struct sound_unit *chains[SOUND_STEP];
 
 /**
  *     register_sound_special - register a special sound node
@@ -233,7 +233,7 @@
 {
        char *name;
 
-       switch (unit) {
+       switch (unit & 15) {
            case 0:
                name = "mixer";
                break;
@@ -382,7 +382,7 @@
 
 void unregister_sound_special(int unit)
 {
-       sound_remove_unit(&chains[unit&15], unit);
+       sound_remove_unit(&chains[unit % SOUND_STEP], unit);
 }
  
 EXPORT_SYMBOL(unregister_sound_special);
@@ -480,7 +480,7 @@
 int soundcore_open(struct inode *inode, struct file *file)
 {
        int chain;
-       int unit=MINOR(inode->i_rdev);
+       int unit = MINOR(inode->i_rdev);
        struct sound_unit *s;
        struct file_operations *new_fops = NULL;
 

The /dev/sound devices are created as expected with this patch.
I could do "modprobe -r snd-pcm-oss", but once I decided to do
"modprobe -r snd-cmipci" next I got a segfault, and "modprobe -r snd-emu10k1"
(right after that) froze the modprobe process.

# lsmod  | grep ^snd
snd-cmipci                 0   0  (deleted)
snd-opl3-lib            6628   0  [snd-cmipci]
snd-mpu401-uart         3120   0  [snd-cmipci]
snd-emu10k1                0   0  (deleted)
snd-ac97-codec         30436   0  [snd-emu10k1]
snd-pcm                60576   0  [snd-cmipci snd-emu10k1]
snd-timer              11080   0  [snd-opl3-lib snd-pcm]
snd-rawmidi            13824   0  [snd-mpu401-uart snd-emu10k1]
snd-util-mem            1392   0  [snd-emu10k1]
snd-hwdep               4256   0  [snd-opl3-lib snd-emu10k1]
snd-seq-device          4268   0  [snd-opl3-lib snd-emu10k1 snd-rawmidi]
snd                    27980   0  [snd-cmipci snd-opl3-lib snd-mpu401-uart snd-emu10k1 
snd-ac97-codec snd-pcm snd-timer snd-rawmidi snd-util-mem snd-hwdep snd-seq-device]

The directory /dev/sound has disappeared already.

I hope someone posts a more soffisticated patch soon. This was simply my
attempt to "make it compile" but it obviously doesn't work :(


-- 
 /^^^^^^^^^^^^^^^^^^^^^^^^^^^\/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\
/ Georgi Georgiev    (-<     / It was a brave man that ate the  \
\ [EMAIL PROTECTED]  /\   .o)\ first oyster.                    /
/ +81(90)6266-1163  V_/_ |(/)/                                  \
\___________________________/\__________________________________/


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to