[alsa-devel] Unregister a card from userspace?

Ricard Wanderlof ricard.wanderlof at axis.com
Thu Nov 12 14:07:41 CET 2015


On Wed, 4 Nov 2015, Clemens Ladisch wrote:

> Ricard Wanderlof wrote:
> > My use case is that I have a card driver I'm working on as a module, and
> > while insmodding it works fine, I can't rmmod it because once
> > snd_soc_register_card() has been called, it has a usage count of 2 and
> > thus cannot be rmmod:ed.
> 
> soc_probe_component() adds a reference to each component's driver's
> module.  Maybe putting each component into its own module would help.

I'd rather not as there's no real gain from it (the constituent drivers 
cannot be used separately or in any other combination), but perhaps that 
is the only way to go.

> Anyway, you should be able to unbind the driver:
> <https://lwn.net/Articles/143397/>

Yes, that works. After unbinding the driver, the usage count drops to 0, 
and I can successfully rmmod it. So at least that's a workable solution.

It just seems to me that there's something I must have missed, as there 
should be a mechanism to do this automatically when a module containing a 
driver is rmmod'ed.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30


More information about the Alsa-devel mailing list