Re: soundcore not unloading (Was: Re: Show stoppers)

Daniel J. Rodriksson (djr@dit.upm.es)
Tue, 13 Oct 1998 13:21:23 +0200


Rafael Reilova wrote:
>
> On Mon, 12 Oct 1998, Petko Manolov wrote:
>
> > Alex Buell wrote:
> > >
> > > One of the show stoppers is the inability for the soundcore module to
> > > unload itself from memory when not in use. Just ran into this one just
> >
> > ;-) As Alan said - fixed ages ago! But still not applied by
> > Linus (i wrote to Linus and vger but there was not responce).
>
> Are you sure this is a fix? I my system it seems the problem lies in the
> use count for the sound modules being wrong after loading. So I don't
> think it is at module unload time but that at load time the use count is
> not kept right.
>
> tempest# modprobe sb ; lsmod
> Module Size Used by
> sb 22780 0 (unused)
> uart401 5584 0 [sb]
> sound 55452 0 [sb uart401]
> soundcore 1840 6 [sb sound]
>
> and then it breaks further when removing it,
>
> tempest# modprobe -r sb
> soundcore: Device or resource busy
> tempest# lsmod
> Module Size Used by
> soundcore 1840 2
>
> BTW, this is 2.1.125, and modutils 2.1.121. If I reload the modules as
> above (modprobe sb), then the usage count goes up to 8 and so on. Also
> note that the sound module should have a use count of 2, but has zero, and
> uart401 should have 1. It would seem all the usage counts are charged to
> soundcore.
>
> Anyone with some spare debugging time?, it can't be that hard ;-)
Not spare time but I was trying new things with the 2.1.125 sound code
and hit the same wall with the soundcore module. I then noticed that
when
I wanted to reload my sb module I had no access to the mixer.

Some little debugging ( thanks god yesterday was the spanish national
day
and I had real spare time ), showed that sb_common.c will only unload
the
mixer if the 'mixer device' allocated is greater than zero. But the
first
time the mixer is loaded it does always get zero, so it will never
unload.

I'm not sure if this happens with other cards but this small fix cures
the
problem at least with soundblaster

-CUT-HERE------------------------------------------------------
diff -u -r
linux-2.1.125.orig/drivers/sound/sb_common.clinux-2.1.125/drivers/sound/sb_common.c
--- linux-2.1.125.orig/drivers/sound/sb_common.c Fri Sep 11
01:37:26 1998+++ linux-2.1.125/drivers/sound/sb_common.c Tue Oct 13
13:10:06 1998@@ -954,7 +954,7 @@
if (!(devc->caps & SB_NO_AUDIO && devc->caps &
SB_NO_MIDI) && devc->irq > 0)
{
free_irq(devc->irq, devc);
- if (devc->my_mixerdev)
+ if (devc->my_mixerdev != -1)

sound_unload_mixerdev(devc->my_mixerdev);
/* We don't have to do this bit any more the
UART401 is its own master -- Krzysztof
Halasa */
-END-CUT-HERE--------------------------------------------------

I believe it has no other side effects so I'm sending this
also to Alan.

Cheers

-- 
-------------------------------------------------------------|
|         Remember Scotch: 'THERE CAN BE ONLY ONE'           |
-------------------------------------------------------------|
| Daniel J. Rodriksson       | C-220,ETSI Telecomunicaciones |
| djr@dit.upm.es             | Avda Paraninfo S/N            |
| http://www.dit.upm.es/~djr | 28040 Madrid                  |
| +34-1-3367366 + ext 469    | SPAIN                         |
|------------------------------------------------------------|

- 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/