[alsa-devel] Unregister a card from userspace?

Ricard Wanderlof ricard.wanderlof at axis.com
Tue Nov 10 08:55:48 CET 2015


On Mon, 9 Nov 2015, Felipe Ferreri Tonello wrote:

> > 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.
> 
> You have to unregister that card upon freeing your module.

But that is precisely the problem. The framework that manages the 
insertion and deletion of modules notes that my module has a usage count 
that is > 0 (in my case it is 2, which I'm convinced is because the card 
has been registered with ALSA), and refuses to free the module. So there 
is now way any unregister_card call can be made when my module is freed, 
as due to the usage count it would never even be attempted.

I suppose one way would be to have a specific call into the module which 
unregisters the card, and the module could then be freed as usual 
afterwards, but it seems like a bit of a hack.

/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