[alsa-devel] Unregister a card from userspace?

Ricard Wanderlof ricard.wanderlof at axis.com
Thu Nov 12 16:38:27 CET 2015


On Thu, 12 Nov 2015, Lars-Peter Clausen wrote:

> The way it works is that the reference count for the modules of the
> individual components is incremented when they are bound to the card to
> ensure that they are not removed when still in use. This usually does not
> affect the reference count on the module of the card and you can still rmmod
> the module of the card which will unregister the card. This again drops the
> reference count on the components and you can remove those modules as well.
> 
> In your case the components and the card are in the same module and you end
> up with a cyclic dependency. The card ensures that the reference count of
> the module for the components is incremented, which in this case is also the
> cards module, so the cards module reference count is non 0 and you can't
> rmmod the card module, which means the card won't be unregistered which
> means the references to the module wont be dropped.

Thanks Lars-Peter for that description. It seems that the solution (which 
is what Clemens and Felipe were actually suggesting) would then be to have 
two separate modules, one for the low level parts (codec, dai and PCM 
drivers) and one for the machine driver (containing the card 
registration).

/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