On 3/4/10, Ozan Çağlayan <ozan@xxxxxxxxxxxxx> wrote: > Jon Masters wrote: >> On Thu, 2010-03-04 at 20:28 +0200, Ozan Çağlayan wrote: >>> Alan Jenkins wrote: >>> >>>>> That's what I'm doing actually from shell. >>>> Try "modprobe -r" :-). >>> I already tried it several times but wasn't successful at all. Will look >>> at it again :) >> >> Can you provide more information? For example, are you trying to remove >> a driver from a system configured without module unloading support? >> Where the module is in use? etc.? > > No of course not on a system without module unloading support. When > debugging alsa-driver related > stuff I generally need to simulate a clean boot where udev probes the > sound-card related drivers so I > want to remove all the linked-in snd-* modules and call: > > modprobe snd-hda-intel > > to try the new module(s). But I never succeeded to remove the pulled-in > dependencies of snd-hda-intel > with -r even after killing the apps which are currently using the related > device nodes. > > So every time I manually remove the snd-* modules by looking at lsmod output > (instead of writing a script:)) > by starting from the ones with *0 used by* column. By removing them one by > one, other snd-* modules' reference counts > slowly drops to 0 and at the end I'm done: $(lsmod | grep snd) is empty. > > I googled a bit and find out the init script for alsasound (whether it's > necessary or not is arguable) which does > exactly what I tried to explain: > > http://bugs.gentoo.org/attachment.cgi?id=189127&action=view > > Shortly I think that m-i-t should track this pulled-in dependency chain and > could be able to prune them all upon > unloading. According to the manpage of modprobe, -r seems to handle this if > the dependencies are not used too. Maybe > it's just a missed use-case where the dependencies have refcount >= 0 and > not refcount == 0. Ah. After trying this myself, I see how annoying this could be. There's not really any better way to do this without kernel modifications, sorry. When snd-hda-intel is initialized, it inspects the hardware and requests an appropriate codec module (e.g. snd-hda-codec-realtek). This is one of the cases Jon was talking about earlier. But all the kernel shows is Module / Used by / Reference count snd_hda_codec_realtek / / 1 so you'd have to modify the kernel to show us _which_ module is depending on snd_hda_codec. Hopefully "modprobe -r snd-hda-intel" would then be able to do the right thing. There's also the issue of the OSS compat modules. The systems I've seen appear to define "install" commands to auto-load them, but no "remove" commands. But that problem should go away when you use softdeps :). Regards Alan -- To unsubscribe from this list: send the line "unsubscribe linux-modules" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html