Skip to content

Commit

Permalink
ASoC: soc-core: snd_soc_unregister_component() unregister all component
Browse files Browse the repository at this point in the history
Current snd_soc_unregister_component() unregisters first found
component only which was specified by dev.
This style can't specify concrete component if system registered some
component with same dev. And system need to call this function many
times.
This patch unregister all related component by 1 call.

Signed-off-by: Kuninori Morimoto <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
morimoto authored and broonie committed Aug 16, 2017
1 parent 9b56741 commit 2eccea8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3365,11 +3365,12 @@ int snd_soc_register_component(struct device *dev,
EXPORT_SYMBOL_GPL(snd_soc_register_component);

/**
* snd_soc_unregister_component - Unregister a component from the ASoC core
* snd_soc_unregister_component - Unregister all related component
* from the ASoC core
*
* @dev: The device to unregister
*/
void snd_soc_unregister_component(struct device *dev)
static int __snd_soc_unregister_component(struct device *dev)
{
struct snd_soc_component *component;
int found = 0;
Expand All @@ -3391,6 +3392,13 @@ void snd_soc_unregister_component(struct device *dev)
snd_soc_component_cleanup(component);
kfree(component);
}

return found;
}

void snd_soc_unregister_component(struct device *dev)
{
while (__snd_soc_unregister_component(dev));
}
EXPORT_SYMBOL_GPL(snd_soc_unregister_component);

Expand Down

0 comments on commit 2eccea8

Please sign in to comment.