Commit d6f31e0e authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core: move snd_soc_find_dai_link()

snd_soc_find_dai_link() is soc-topology specific function.
We don't need to have it at soc-core.
This patch moves it to soc-topology.c
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/878snlyq61.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4468189f
...@@ -1327,9 +1327,6 @@ int snd_soc_add_dai_link(struct snd_soc_card *card, ...@@ -1327,9 +1327,6 @@ int snd_soc_add_dai_link(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_link); struct snd_soc_dai_link *dai_link);
void snd_soc_remove_dai_link(struct snd_soc_card *card, void snd_soc_remove_dai_link(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_link); struct snd_soc_dai_link *dai_link);
struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card,
int id, const char *name,
const char *stream_name);
struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv, struct snd_soc_dai_driver *dai_drv,
......
...@@ -901,50 +901,6 @@ struct snd_soc_dai *snd_soc_find_dai( ...@@ -901,50 +901,6 @@ struct snd_soc_dai *snd_soc_find_dai(
} }
EXPORT_SYMBOL_GPL(snd_soc_find_dai); EXPORT_SYMBOL_GPL(snd_soc_find_dai);
/**
* snd_soc_find_dai_link - Find a DAI link
*
* @card: soc card
* @id: DAI link ID to match
* @name: DAI link name to match, optional
* @stream_name: DAI link stream name to match, optional
*
* This function will search all existing DAI links of the soc card to
* find the link of the same ID. Since DAI links may not have their
* unique ID, so name and stream name should also match if being
* specified.
*
* Return: pointer of DAI link, or NULL if not found.
*/
struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card,
int id, const char *name,
const char *stream_name)
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai_link *link;
lockdep_assert_held(&client_mutex);
for_each_card_rtds(card, rtd) {
link = rtd->dai_link;
if (link->id != id)
continue;
if (name && (!link->name || strcmp(name, link->name)))
continue;
if (stream_name && (!link->stream_name
|| strcmp(stream_name, link->stream_name)))
continue;
return link;
}
return NULL;
}
EXPORT_SYMBOL_GPL(snd_soc_find_dai_link);
static int soc_dai_link_sanity_check(struct snd_soc_card *card, static int soc_dai_link_sanity_check(struct snd_soc_card *card,
struct snd_soc_dai_link *link) struct snd_soc_dai_link *link)
{ {
......
...@@ -2207,6 +2207,47 @@ static int link_new_ver(struct soc_tplg *tplg, ...@@ -2207,6 +2207,47 @@ static int link_new_ver(struct soc_tplg *tplg,
return 0; return 0;
} }
/**
* snd_soc_find_dai_link - Find a DAI link
*
* @card: soc card
* @id: DAI link ID to match
* @name: DAI link name to match, optional
* @stream_name: DAI link stream name to match, optional
*
* This function will search all existing DAI links of the soc card to
* find the link of the same ID. Since DAI links may not have their
* unique ID, so name and stream name should also match if being
* specified.
*
* Return: pointer of DAI link, or NULL if not found.
*/
static struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card,
int id, const char *name,
const char *stream_name)
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai_link *link;
for_each_card_rtds(card, rtd) {
link = rtd->dai_link;
if (link->id != id)
continue;
if (name && (!link->name || strcmp(name, link->name)))
continue;
if (stream_name && (!link->stream_name
|| strcmp(stream_name, link->stream_name)))
continue;
return link;
}
return NULL;
}
/* Find and configure an existing physical DAI link */ /* Find and configure an existing physical DAI link */
static int soc_tplg_link_config(struct soc_tplg *tplg, static int soc_tplg_link_config(struct soc_tplg *tplg,
struct snd_soc_tplg_link_config *cfg) struct snd_soc_tplg_link_config *cfg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment