Sound timer unloading

Meelis Roos (mroos@tartu.cyber.ee)
Sun, 22 Nov 1998 20:27:02 +0200 (EET)


I recently found out that when unloading softoss2 module the corresponding
timer entry doesn't disappear from /proc/sound. I reported it but noone
seemed to notice. So I looked at it a little further.

This is axcerpt from softoos.c: (taken from 129ac3)

void attach_softsyn_card(struct address_info *hw_config)
{
voice_alloc = &softsyn_operations.alloc;
synth_devs[devc->synthdev = num_synths++] = &softsyn_operations;
sequencer_init();
sound_timer_init(&soft_tmr, "SoftOSS");
devc->timerdev = num_sound_timers;
softsynthp = softsynth_hook;

#ifndef POLLED_MODE
#endif
}

Note the line devc->timerdev = num_sound_timers; - this is a mistake.
sound_timer_init calls sound_alloc_timerdev which returns the slot number
where the entry was put. And _if it needs_ it also increases
num_sound_timers. So assigning the new value of num_sound_timers to our
timerdev slot number is incorrect. And it's off by one too _if_ we assume
that softoss is the last one. But we can't assume that.

So the return value needs to be gotten back from sound_timer_init. But
sound_timer_init only returns void.

There are 2 other calls to sound_timer_init in the sound subdirectory.
One is gus.c where the sound_timer_init call is surreonded by a warning
and the other is ad1848 which seems buggy too at first glance but I can't
verify it with a simple test.

There are no sound_timer_init calls in the lowlevel subdirectory.

So, should the sound_timer_init be fixed to return the needed slot
number to allow unloading of timers?

---
Meelis Roos (mroos@tartu.cyber.ee)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/