[alsa-devel] [PATCH 1/3] ASoC: soc-core: add component remove/unregister_exp/lookup functions
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Wed Aug 2 13:35:38 CEST 2017
Hi Mark
> > ALSA SoC platform/codec will be replaced to component soon.
> > This means 1 device might have multiple components. But current
> > unregister component function only checks "dev" to find it.
> > This means, unexpected component might be unregistered by current
> > function.
> > But, it is no problem if driver registered only 1 component.
>
> Isn't this just a convenience for drivers though? It means they can
> just clean things up with one call and I'm having a hard time thinking
> of any use cases for only unregistering some components.
This means like this
OK case
register_component(dev, driver_A);
unregister_component(dev); /* driver_A will be unregister */
not OK case
register_component(dev, driver_A);
register_component(dev, driver_B);
unregister_component(dev); /* it can't specify driver_A */
unregister_component(dev); /* it can't specify driver_B */
or do we want to have like this ?
register_component(dev, driver_A);
register_component(dev, driver_B);
unregister_component(dev); /* unregister both driver_A/driver_B */
> > To avoid this issue, this patch adds new component
> > unregister_exp/lookup/remove functions. "lookup" function finds
> > component by "dev" and "driver name", and "remove" function removes it.
> > "unregister_exp" will use these functions.
>
> The exp name here seems a bit confusing... perhaps just _internal() or
> something?
OK, will fix in v2
> > +#define snd_soc_unregister_component(dev) snd_soc_unregister_component_exp(dev, NULL)
>
> A static inline is better, it's got better type safety.
OK, will do
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list