ASoC: soc-dai: add snd_soc_dai_{to/from}_list()

DAI parameter will be capsuled soon, will be not enable to access from
each drivers. Add snd_soc_dai_{to/from}_list() to use for_each macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
Link: https://patch.msgid.link/87ik43jpvk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2026-09-18 01:43:27 +00:00 committed by Mark Brown
parent e90c022007
commit f54b3dd4aa
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
3 changed files with 24 additions and 4 deletions

View File

@ -258,10 +258,16 @@ struct snd_soc_component {
void *priv;
};
#define for_each_component_dais(component, dai)\
list_for_each_entry(dai, &(component)->dai_list, list)
#define for_each_component_dais_safe(component, dai, _dai)\
list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list)
#define for_each_component_dais(component, dai) \
for (dai = snd_soc_dai_from_list((component)->dai_list.next); \
snd_soc_dai_to_list(dai) != &(component)->dai_list; \
dai = snd_soc_dai_from_list(snd_soc_dai_to_list(dai)->next))
#define for_each_component_dais_safe(component, dai, _dai) \
for (dai = snd_soc_dai_from_list((component)->dai_list.next), \
_dai = snd_soc_dai_from_list(snd_soc_dai_to_list(dai)->next); \
snd_soc_dai_to_list(dai) != &(component)->dai_list; \
dai = _dai, _dai = snd_soc_dai_from_list(snd_soc_dai_to_list(_dai)->next))
/**
* snd_soc_component_to_dapm() - Returns the DAPM context associated with a

View File

@ -561,6 +561,8 @@ struct snd_soc_dai *snd_soc_dai_register(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv,
bool legacy_dai_naming);
void snd_soc_dai_unregister(struct snd_soc_dai *dai);
struct snd_soc_dai *snd_soc_dai_from_list(struct list_head *list);
struct list_head *snd_soc_dai_to_list(struct snd_soc_dai *dai);
/* REMOVE ME */
#define snd_soc_dai_get_pcm_stream snd_soc_dai_pcm_stream_get

View File

@ -32,6 +32,18 @@ struct snd_soc_dai_driver *snd_soc_dai_to_driver(const struct snd_soc_dai *dai)
}
EXPORT_SYMBOL_GPL(snd_soc_dai_to_driver);
struct snd_soc_dai *snd_soc_dai_from_list(struct list_head *list)
{
return list_entry(list, struct snd_soc_dai, list);
}
EXPORT_SYMBOL_GPL(snd_soc_dai_from_list);
struct list_head *snd_soc_dai_to_list(struct snd_soc_dai *dai)
{
return &dai->list;
}
EXPORT_SYMBOL_GPL(snd_soc_dai_to_list);
/*
* We might want to check substream by using list.
* In such case, we can update these macros.