Commit 2b544dd7 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core: add for_each_rtd_components() and replace

ALSA SoC has for_each_rtdcom() which is link list for
rtd-component which is called as rtdcom. The relationship image is like below

			       rtdcom	   rtdcom      rtdcom
			       component   component   component
	rtd->component_list -> list	-> list	    -> list ...

Here, the pointer get via normal link list is rtdcom,
Thus, current for_each loop is like below, and need to get
component via rtdcom->component

	for_each_rtdcom(rtd, rtdcom) {
		component = rtdcom->component;
		...
	}

but usually, user want to get pointer from for_each_xxx is component
directly, like below.

	for_each_rtd_component(rtd, rtdcom, component) {
		...
	}

This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878spm64m4.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5a4c9f05
...@@ -739,8 +739,12 @@ struct snd_soc_rtdcom_list { ...@@ -739,8 +739,12 @@ struct snd_soc_rtdcom_list {
struct snd_soc_component* struct snd_soc_component*
snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
const char *driver_name); const char *driver_name);
#define for_each_rtdcom(rtd, rtdcom) \ #define for_each_rtd_components(rtd, rtdcom, _component) \
list_for_each_entry(rtdcom, &(rtd)->component_list, list) for (rtdcom = list_first_entry(&(rtd)->component_list, \
typeof(*rtdcom), list); \
(&rtdcom->list != &(rtd)->component_list) && \
(_component = rtdcom->component); \
rtdcom = list_next_entry(rtdcom, list))
struct snd_soc_dai_link_component { struct snd_soc_dai_link_component {
const char *name; const char *name;
......
...@@ -420,13 +420,10 @@ int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream) ...@@ -420,13 +420,10 @@ int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream)
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
for_each_rtdcom(rtd, rtdcom) { /* FIXME: use 1st pointer */
component = rtdcom->component; for_each_rtd_components(rtd, rtdcom, component)
/* FIXME: use 1st pointer */
if (component->driver->pointer) if (component->driver->pointer)
return component->driver->pointer(component, substream); return component->driver->pointer(component, substream);
}
return 0; return 0;
} }
...@@ -438,14 +435,11 @@ int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream, ...@@ -438,14 +435,11 @@ int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream,
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
for_each_rtdcom(rtd, rtdcom) { /* FIXME: use 1st ioctl */
component = rtdcom->component; for_each_rtd_components(rtd, rtdcom, component)
/* FIXME: use 1st ioctl */
if (component->driver->ioctl) if (component->driver->ioctl)
return component->driver->ioctl(component, substream, return component->driver->ioctl(component, substream,
cmd, arg); cmd, arg);
}
return snd_pcm_lib_ioctl(substream, cmd, arg); return snd_pcm_lib_ioctl(substream, cmd, arg);
} }
...@@ -458,14 +452,11 @@ int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream, ...@@ -458,14 +452,11 @@ int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
for_each_rtdcom(rtd, rtdcom) { /* FIXME. it returns 1st copy now */
component = rtdcom->component; for_each_rtd_components(rtd, rtdcom, component)
/* FIXME. it returns 1st copy now */
if (component->driver->copy_user) if (component->driver->copy_user)
return component->driver->copy_user( return component->driver->copy_user(
component, substream, channel, pos, buf, bytes); component, substream, channel, pos, buf, bytes);
}
return -EINVAL; return -EINVAL;
} }
...@@ -478,10 +469,8 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream, ...@@ -478,10 +469,8 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
struct snd_soc_component *component; struct snd_soc_component *component;
struct page *page; struct page *page;
for_each_rtdcom(rtd, rtdcom) { /* FIXME. it returns 1st page now */
component = rtdcom->component; for_each_rtd_components(rtd, rtdcom, component) {
/* FIXME. it returns 1st page now */
if (component->driver->page) { if (component->driver->page) {
page = component->driver->page(component, page = component->driver->page(component,
substream, offset); substream, offset);
...@@ -500,14 +489,11 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream, ...@@ -500,14 +489,11 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
for_each_rtdcom(rtd, rtdcom) { /* FIXME. it returns 1st mmap now */
component = rtdcom->component; for_each_rtd_components(rtd, rtdcom, component)
/* FIXME. it returns 1st mmap now */
if (component->driver->mmap) if (component->driver->mmap)
return component->driver->mmap(component, return component->driver->mmap(component,
substream, vma); substream, vma);
}
return -EINVAL; return -EINVAL;
} }
...@@ -519,9 +505,7 @@ int snd_soc_pcm_component_new(struct snd_pcm *pcm) ...@@ -519,9 +505,7 @@ int snd_soc_pcm_component_new(struct snd_pcm *pcm)
struct snd_soc_component *component; struct snd_soc_component *component;
int ret; int ret;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (component->driver->pcm_construct) { if (component->driver->pcm_construct) {
ret = component->driver->pcm_construct(component, rtd); ret = component->driver->pcm_construct(component, rtd);
if (ret < 0) if (ret < 0)
...@@ -538,10 +522,7 @@ void snd_soc_pcm_component_free(struct snd_pcm *pcm) ...@@ -538,10 +522,7 @@ void snd_soc_pcm_component_free(struct snd_pcm *pcm)
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component)
component = rtdcom->component;
if (component->driver->pcm_destruct) if (component->driver->pcm_destruct)
component->driver->pcm_destruct(component, pcm); component->driver->pcm_destruct(component, pcm);
}
} }
...@@ -28,9 +28,7 @@ static int soc_compr_components_open(struct snd_compr_stream *cstream, ...@@ -28,9 +28,7 @@ static int soc_compr_components_open(struct snd_compr_stream *cstream,
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
int ret; int ret;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->open) !component->driver->compr_ops->open)
continue; continue;
...@@ -57,9 +55,7 @@ static int soc_compr_components_free(struct snd_compr_stream *cstream, ...@@ -57,9 +55,7 @@ static int soc_compr_components_free(struct snd_compr_stream *cstream,
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (component == last) if (component == last)
break; break;
...@@ -353,9 +349,7 @@ static int soc_compr_components_trigger(struct snd_compr_stream *cstream, ...@@ -353,9 +349,7 @@ static int soc_compr_components_trigger(struct snd_compr_stream *cstream,
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
int ret; int ret;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->trigger) !component->driver->compr_ops->trigger)
continue; continue;
...@@ -458,9 +452,7 @@ static int soc_compr_components_set_params(struct snd_compr_stream *cstream, ...@@ -458,9 +452,7 @@ static int soc_compr_components_set_params(struct snd_compr_stream *cstream,
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
int ret; int ret;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->set_params) !component->driver->compr_ops->set_params)
continue; continue;
...@@ -601,9 +593,7 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, ...@@ -601,9 +593,7 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream,
goto err; goto err;
} }
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->get_params) !component->driver->compr_ops->get_params)
continue; continue;
...@@ -627,9 +617,7 @@ static int soc_compr_get_caps(struct snd_compr_stream *cstream, ...@@ -627,9 +617,7 @@ static int soc_compr_get_caps(struct snd_compr_stream *cstream,
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->get_caps) !component->driver->compr_ops->get_caps)
continue; continue;
...@@ -652,9 +640,7 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream, ...@@ -652,9 +640,7 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream,
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->get_codec_caps) !component->driver->compr_ops->get_codec_caps)
continue; continue;
...@@ -684,9 +670,7 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) ...@@ -684,9 +670,7 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes)
goto err; goto err;
} }
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->ack) !component->driver->compr_ops->ack)
continue; continue;
...@@ -715,9 +699,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, ...@@ -715,9 +699,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer) if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer)
cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai); cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai);
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->pointer) !component->driver->compr_ops->pointer)
continue; continue;
...@@ -740,9 +722,7 @@ static int soc_compr_copy(struct snd_compr_stream *cstream, ...@@ -740,9 +722,7 @@ static int soc_compr_copy(struct snd_compr_stream *cstream,
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->copy) !component->driver->compr_ops->copy)
continue; continue;
...@@ -770,9 +750,7 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, ...@@ -770,9 +750,7 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream,
return ret; return ret;
} }
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->set_metadata) !component->driver->compr_ops->set_metadata)
continue; continue;
...@@ -801,9 +779,7 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, ...@@ -801,9 +779,7 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream,
return ret; return ret;
} }
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->get_metadata) !component->driver->compr_ops->get_metadata)
continue; continue;
...@@ -932,9 +908,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -932,9 +908,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops));
} }
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->copy) !component->driver->compr_ops->copy)
continue; continue;
......
...@@ -293,10 +293,11 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, ...@@ -293,10 +293,11 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_component *component) struct snd_soc_component *component)
{ {
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *comp;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, comp) {
/* already connected */ /* already connected */
if (rtdcom->component == component) if (comp == component)
return 0; return 0;
} }
...@@ -327,6 +328,7 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, ...@@ -327,6 +328,7 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
const char *driver_name) const char *driver_name)
{ {
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component;
if (!driver_name) if (!driver_name)
return NULL; return NULL;
...@@ -339,8 +341,8 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, ...@@ -339,8 +341,8 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
* But, if many components which have same driver name are connected * But, if many components which have same driver name are connected
* to 1 rtd, this function will return 1st found component. * to 1 rtd, this function will return 1st found component.
*/ */
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
const char *component_name = rtdcom->component->driver->name; const char *component_name = component->driver->name;
if (!component_name) if (!component_name)
continue; continue;
...@@ -1248,9 +1250,7 @@ static void soc_remove_link_components(struct snd_soc_card *card) ...@@ -1248,9 +1250,7 @@ static void soc_remove_link_components(struct snd_soc_card *card)
for_each_comp_order(order) { for_each_comp_order(order) {
for_each_card_rtds(card, rtd) { for_each_card_rtds(card, rtd) {
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (component->driver->remove_order != order) if (component->driver->remove_order != order)
continue; continue;
...@@ -1269,9 +1269,7 @@ static int soc_probe_link_components(struct snd_soc_card *card) ...@@ -1269,9 +1269,7 @@ static int soc_probe_link_components(struct snd_soc_card *card)
for_each_comp_order(order) { for_each_comp_order(order) {
for_each_card_rtds(card, rtd) { for_each_card_rtds(card, rtd) {
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (component->driver->probe_order != order) if (component->driver->probe_order != order)
continue; continue;
...@@ -1520,9 +1518,7 @@ static int soc_link_init(struct snd_soc_card *card, ...@@ -1520,9 +1518,7 @@ static int soc_link_init(struct snd_soc_card *card,
* topology based drivers can use the DAI link id field to set PCM * topology based drivers can use the DAI link id field to set PCM
* device number and then use rtd + a base offset of the BEs. * device number and then use rtd + a base offset of the BEs.
*/ */
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (!component->driver->use_dai_pcm_id) if (!component->driver->use_dai_pcm_id)
continue; continue;
......
...@@ -118,11 +118,8 @@ bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd) ...@@ -118,11 +118,8 @@ bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd)
if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time) if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time)
return true; return true;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component)
component = rtdcom->component;
ignore &= !component->driver->use_pmdown_time; ignore &= !component->driver->use_pmdown_time;
}
return ignore; return ignore;
} }
...@@ -435,8 +432,7 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream, ...@@ -435,8 +432,7 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream,
struct snd_soc_component *component; struct snd_soc_component *component;
int ret = 0; int ret = 0;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
*last = component; *last = component;
ret = snd_soc_component_module_get_when_open(component); ret = snd_soc_component_module_get_when_open(component);
...@@ -467,9 +463,7 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream, ...@@ -467,9 +463,7 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
struct snd_soc_component *component; struct snd_soc_component *component;
int ret = 0; int ret = 0;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (component == last) if (component == last)
break; break;
...@@ -500,9 +494,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -500,9 +494,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
for_each_rtd_codec_dai(rtd, i, codec_dai) for_each_rtd_codec_dai(rtd, i, codec_dai)
pinctrl_pm_select_default_state(codec_dai->dev); pinctrl_pm_select_default_state(codec_dai->dev);
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
pm_runtime_get_sync(component->dev); pm_runtime_get_sync(component->dev);
} }
...@@ -625,9 +617,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -625,9 +617,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
out: out:
mutex_unlock(&rtd->card->pcm_mutex); mutex_unlock(&rtd->card->pcm_mutex);
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
pm_runtime_mark_last_busy(component->dev); pm_runtime_mark_last_busy(component->dev);
pm_runtime_put_autosuspend(component->dev); pm_runtime_put_autosuspend(component->dev);
} }
...@@ -740,9 +730,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) ...@@ -740,9 +730,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
mutex_unlock(&rtd->card->pcm_mutex); mutex_unlock(&rtd->card->pcm_mutex);
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
pm_runtime_mark_last_busy(component->dev); pm_runtime_mark_last_busy(component->dev);
pm_runtime_put_autosuspend(component->dev); pm_runtime_put_autosuspend(component->dev);
} }
...@@ -782,9 +770,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -782,9 +770,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
} }
} }
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
ret = snd_soc_component_prepare(component, substream); ret = snd_soc_component_prepare(component, substream);
if (ret < 0) { if (ret < 0) {
dev_err(component->dev, dev_err(component->dev,
...@@ -849,9 +835,7 @@ static int soc_pcm_components_hw_free(struct snd_pcm_substream *substream, ...@@ -849,9 +835,7 @@ static int soc_pcm_components_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_component *component; struct snd_soc_component *component;
int ret = 0; int ret = 0;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
if (component == last) if (component == last)
break; break;
...@@ -945,9 +929,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -945,9 +929,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
snd_soc_dapm_update_dai(substream, params, cpu_dai); snd_soc_dapm_update_dai(substream, params, cpu_dai);
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
ret = snd_soc_component_hw_params(component, substream, params); ret = snd_soc_component_hw_params(component, substream, params);
if (ret < 0) { if (ret < 0) {
dev_err(component->dev, dev_err(component->dev,
...@@ -1062,9 +1044,7 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) ...@@ -1062,9 +1044,7 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd)
return ret; return ret;
} }
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
ret = snd_soc_component_trigger(component, substream, cmd); ret = snd_soc_component_trigger(component, substream, cmd);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1102,9 +1082,7 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd) ...@@ -1102,9 +1082,7 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd)
if (ret < 0) if (ret < 0)
return ret; return ret;
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
component = rtdcom->component;
ret = snd_soc_component_trigger(component, substream, cmd); ret = snd_soc_component_trigger(component, substream, cmd);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -2879,6 +2857,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -2879,6 +2857,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component;
struct snd_pcm *pcm; struct snd_pcm *pcm;
char new_name[64]; char new_name[64];
int ret = 0, playback = 0, capture = 0; int ret = 0, playback = 0, capture = 0;
...@@ -2990,8 +2969,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -2990,8 +2969,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
rtd->ops.ioctl = snd_soc_pcm_component_ioctl; rtd->ops.ioctl = snd_soc_pcm_component_ioctl;
} }
for_each_rtdcom(rtd, rtdcom) { for_each_rtd_components(rtd, rtdcom, component) {
const struct snd_soc_component_driver *drv = rtdcom->component->driver; const struct snd_soc_component_driver *drv = component->driver;
if (drv->copy_user) if (drv->copy_user)
rtd->ops.copy_user = snd_soc_pcm_component_copy_user; rtd->ops.copy_user = snd_soc_pcm_component_copy_user;
......
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