Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abd31b32 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown
Browse files

ASoC: Use card field to indicate whether a component is bound



Use the card field of a component to indicate whether it is bound or not.
This makes a certain sense given that the field contains the card the
component is bound to and a component can only be bound to one card at a
time. And it also requires to unset the card field when the component is
unbound from the card.

This makes the probded flag redundant and it can be removed.

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1b7c1231
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -758,7 +758,6 @@ struct snd_soc_component {


	unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
	unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
	unsigned int registered_as_component:1;
	unsigned int registered_as_component:1;
	unsigned int probed:1;


	struct list_head list;
	struct list_head list;


+8 −8
Original line number Original line Diff line number Diff line
@@ -978,7 +978,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)


static void soc_remove_component(struct snd_soc_component *component)
static void soc_remove_component(struct snd_soc_component *component)
{
{
	if (!component->probed)
	if (!component->card)
		return;
		return;


	/* This is a HACK and will be removed soon */
	/* This is a HACK and will be removed soon */
@@ -991,7 +991,7 @@ static void soc_remove_component(struct snd_soc_component *component)
	snd_soc_dapm_free(snd_soc_component_get_dapm(component));
	snd_soc_dapm_free(snd_soc_component_get_dapm(component));


	soc_cleanup_component_debugfs(component);
	soc_cleanup_component_debugfs(component);
	component->probed = 0;
	component->card = NULL;
	module_put(component->dev->driver->owner);
	module_put(component->dev->driver->owner);
}
}


@@ -1105,7 +1105,7 @@ static int soc_probe_component(struct snd_soc_card *card,
	if (!strcmp(component->name, "snd-soc-dummy"))
	if (!strcmp(component->name, "snd-soc-dummy"))
		return 0;
		return 0;


	if (component->probed) {
	if (component->card) {
		if (component->card != card) {
		if (component->card != card) {
			dev_err(component->dev,
			dev_err(component->dev,
				"Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n",
				"Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n",
@@ -1115,13 +1115,13 @@ static int soc_probe_component(struct snd_soc_card *card,
		return 0;
		return 0;
	}
	}


	if (!try_module_get(component->dev->driver->owner))
		return -ENODEV;

	component->card = card;
	component->card = card;
	dapm->card = card;
	dapm->card = card;
	soc_set_name_prefix(card, component);
	soc_set_name_prefix(card, component);


	if (!try_module_get(component->dev->driver->owner))
		return -ENODEV;

	soc_init_component_debugfs(component);
	soc_init_component_debugfs(component);


	if (component->dapm_widgets) {
	if (component->dapm_widgets) {
@@ -1165,7 +1165,6 @@ static int soc_probe_component(struct snd_soc_card *card,
		snd_soc_dapm_add_routes(dapm, component->dapm_routes,
		snd_soc_dapm_add_routes(dapm, component->dapm_routes,
					component->num_dapm_routes);
					component->num_dapm_routes);


	component->probed = 1;
	list_add(&dapm->list, &card->dapm_list);
	list_add(&dapm->list, &card->dapm_list);


	/* This is a HACK and will be removed soon */
	/* This is a HACK and will be removed soon */
@@ -1176,6 +1175,7 @@ static int soc_probe_component(struct snd_soc_card *card,


err_probe:
err_probe:
	soc_cleanup_component_debugfs(component);
	soc_cleanup_component_debugfs(component);
	component->card = NULL;
	module_put(component->dev->driver->owner);
	module_put(component->dev->driver->owner);


	return ret;
	return ret;
@@ -1459,7 +1459,7 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
		rtd->dev_registered = 0;
		rtd->dev_registered = 0;
	}
	}


	if (component && component->probed)
	if (component)
		soc_remove_component(component);
		soc_remove_component(component);
}
}