Re: Bug in MAD16 sound, not unloading properly (fixed)

Andrew J Skalski (askalski@cs.Buffalo.EDU)
Wed, 15 Jul 1998 09:27:40 -0400 (EDT)


Anders Melchiorsen wrote:
> since the new sound stuff got integrated I have had a hard time
> configuring kmod to properly use my Opti 931. Basically, the soundcore
> module would not unload and when reloading the mad16 module, the mixer
> would not work.
>
> I have fixed this by making the unload_mad16() function look just like
> the unload_ms_sound() function in ad1848.c -- for some reason the
> mixer unloading part was left out.

This actually affects several of the sound drivers (for example,
I have a cs4232.) Since the mixer device gets installed in
ad1848_init(), I would unload it in ad1848_unload() rather than
unload_ms_sound().

Here is a diff against pre-2.1.109-2 that provides a more complete fix.

andy

--- linux-2.1.109-2/drivers/sound/ad1848.c Wed Jul 15 09:08:00 1998
+++ linux/drivers/sound/ad1848.c Wed Jul 15 09:02:46 1998
@@ -1914,7 +1914,7 @@

void ad1848_unload(int io_base, int irq, int dma_playback, int dma_capture, int share_dma)
{
- int i, dev = 0;
+ int i, mixer, dev = 0;
ad1848_info *devc = NULL;

for (i = 0; devc == NULL && i < nr_ad1848_devs; i++)
@@ -1942,6 +1942,10 @@
if (audio_devs[dev]->dmap_in->dma != audio_devs[dev]->dmap_out->dma)
sound_free_dma(audio_devs[dev]->dmap_in->dma);
}
+
+ mixer = audio_devs[devc->dev_no]->mixer_dev;
+ if(mixer>=0)
+ sound_unload_mixerdev(mixer);
}
else
printk(KERN_ERR "ad1848: Can't find device to be unloaded. Base=%x\n", io_base);
@@ -2398,13 +2402,10 @@

void unload_ms_sound(struct address_info *hw_config)
{
- int mixer = audio_devs[hw_config->slots[0]]->mixer_dev;
ad1848_unload(hw_config->io_base + 4,
hw_config->irq,
hw_config->dma,
hw_config->dma, 0);
- if(mixer>=0)
- sound_unload_mixerdev(mixer);
sound_unload_audiodev(hw_config->slots[0]);
release_region(hw_config->io_base, 4);
}
--- linux-2.1.109-2/drivers/sound/mad16.c Wed Jul 15 09:08:04 1998
+++ linux/drivers/sound/mad16.c Wed Jul 15 09:01:27 1998
@@ -834,16 +834,12 @@

void unload_mad16(struct address_info *hw_config)
{
- int mixer = audio_devs[hw_config->slots[0]]->mixer_dev;
ad1848_unload(hw_config->io_base + 4,
hw_config->irq,
hw_config->dma,
hw_config->dma2, 0);
release_region(hw_config->io_base, 4);
- if(mixer>=0)
- sound_unload_mixerdev(mixer);
sound_unload_audiodev(hw_config->slots[0]);
-
}

void

-
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.altern.org/andrebalsa/doc/lkml-faq.html