Commit 613fb500 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core: remove snd_soc_rtdcom_list

Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.

	struct snd_soc_rtdcom_list {
		struct snd_soc_component *component;
		struct list_head list; /* rtd::component_list */
	};

	struct snd_soc_pcm_runtime {
		...
		struct list_head component_list; /* list of connected components */
		...
	};

The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()

	int snd_soc_add_pcm_runtime(...)
	{
		...
		/* Find CPU from registered CPUs */
		rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
		...
(a)		snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
		...

		/* Find CODEC from registered CODECs */
(b)		for_each_link_codecs(dai_link, i, codec) {
			rtd->codec_dais[i] = snd_soc_find_dai(codec);
			...
(a)			snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
		}
		...

		/* Find PLATFORM from registered PLATFORMs */
(b)		for_each_link_platforms(dai_link, i, platform) {
			for_each_component(component) {
				...
(a)				snd_soc_rtdcom_add(rtd, component);
			}
		}

	}

It shows, it is possible to know how many components will be
connected to rtd by using

	dai_link->num_cpus
	dai_link->num_codecs
	dai_link->num_platforms

If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a84188ec
...@@ -736,19 +736,9 @@ struct snd_soc_compr_ops { ...@@ -736,19 +736,9 @@ struct snd_soc_compr_ops {
int (*trigger)(struct snd_compr_stream *); int (*trigger)(struct snd_compr_stream *);
}; };
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_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_rtd_components(rtd, rtdcom, _component) \
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;
...@@ -1150,12 +1140,18 @@ struct snd_soc_pcm_runtime { ...@@ -1150,12 +1140,18 @@ struct snd_soc_pcm_runtime {
unsigned int num; /* 0-based and monotonic increasing */ unsigned int num; /* 0-based and monotonic increasing */
struct list_head list; /* rtd list of the soc card */ struct list_head list; /* rtd list of the soc card */
struct list_head component_list; /* list of connected components */
/* bit field */ /* bit field */
unsigned int pop_wait:1; unsigned int pop_wait:1;
unsigned int fe_compr:1; /* for Dynamic PCM */ unsigned int fe_compr:1; /* for Dynamic PCM */
int num_components;
struct snd_soc_component *components[0]; /* CPU/Codec/Platform */
}; };
#define for_each_rtd_components(rtd, i, component) \
for ((i) = 0; \
((i) < rtd->num_components) && ((component) = rtd->components[i]);\
(i)++)
#define for_each_rtd_codec_dai(rtd, i, dai)\ #define for_each_rtd_codec_dai(rtd, i, dai)\
for ((i) = 0; \ for ((i) = 0; \
((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \ ((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \
......
...@@ -418,10 +418,10 @@ int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream) ...@@ -418,10 +418,10 @@ int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i;
/* FIXME: use 1st pointer */ /* FIXME: use 1st pointer */
for_each_rtd_components(rtd, rtdcom, component) for_each_rtd_components(rtd, i, component)
if (component->driver->pointer) if (component->driver->pointer)
return component->driver->pointer(component, substream); return component->driver->pointer(component, substream);
...@@ -433,10 +433,10 @@ int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream, ...@@ -433,10 +433,10 @@ int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream,
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i;
/* FIXME: use 1st ioctl */ /* FIXME: use 1st ioctl */
for_each_rtd_components(rtd, rtdcom, component) for_each_rtd_components(rtd, i, component)
if (component->driver->ioctl) if (component->driver->ioctl)
return component->driver->ioctl(component, substream, return component->driver->ioctl(component, substream,
cmd, arg); cmd, arg);
...@@ -448,10 +448,9 @@ int snd_soc_pcm_component_sync_stop(struct snd_pcm_substream *substream) ...@@ -448,10 +448,9 @@ int snd_soc_pcm_component_sync_stop(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i, ret;
int ret;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (component->driver->ioctl) { if (component->driver->ioctl) {
ret = component->driver->sync_stop(component, ret = component->driver->sync_stop(component,
substream); substream);
...@@ -468,11 +467,11 @@ int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream, ...@@ -468,11 +467,11 @@ int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
void __user *buf, unsigned long bytes) void __user *buf, unsigned long bytes)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
int i;
/* FIXME. it returns 1st copy now */ /* FIXME. it returns 1st copy now */
for_each_rtd_components(rtd, rtdcom, component) for_each_rtd_components(rtd, i, component)
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);
...@@ -484,12 +483,12 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream, ...@@ -484,12 +483,12 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
unsigned long offset) unsigned long offset)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
struct page *page; struct page *page;
int i;
/* FIXME. it returns 1st page now */ /* FIXME. it returns 1st page now */
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (component->driver->page) { if (component->driver->page) {
page = component->driver->page(component, page = component->driver->page(component,
substream, offset); substream, offset);
...@@ -505,11 +504,11 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream, ...@@ -505,11 +504,11 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
int i;
/* FIXME. it returns 1st mmap now */ /* FIXME. it returns 1st mmap now */
for_each_rtd_components(rtd, rtdcom, component) for_each_rtd_components(rtd, i, component)
if (component->driver->mmap) if (component->driver->mmap)
return component->driver->mmap(component, return component->driver->mmap(component,
substream, vma); substream, vma);
...@@ -519,11 +518,11 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream, ...@@ -519,11 +518,11 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd) int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
int ret; int ret;
int i;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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)
...@@ -536,13 +535,13 @@ int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd) ...@@ -536,13 +535,13 @@ int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd)
void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd) void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
int i;
if (!rtd->pcm) if (!rtd->pcm)
return; return;
for_each_rtd_components(rtd, rtdcom, component) for_each_rtd_components(rtd, i, component)
if (component->driver->pcm_destruct) if (component->driver->pcm_destruct)
component->driver->pcm_destruct(component, rtd->pcm); component->driver->pcm_destruct(component, rtd->pcm);
} }
...@@ -26,10 +26,9 @@ static int soc_compr_components_open(struct snd_compr_stream *cstream, ...@@ -26,10 +26,9 @@ static int soc_compr_components_open(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i, ret;
int ret;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->open) !component->driver->compr_ops->open)
continue; continue;
...@@ -54,9 +53,9 @@ static int soc_compr_components_free(struct snd_compr_stream *cstream, ...@@ -54,9 +53,9 @@ static int soc_compr_components_free(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (component == last) if (component == last)
break; break;
...@@ -74,11 +73,10 @@ static int soc_compr_open(struct snd_compr_stream *cstream) ...@@ -74,11 +73,10 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component, *save = NULL; struct snd_soc_component *component, *save = NULL;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret; int ret, i;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
ret = pm_runtime_get_sync(component->dev); ret = pm_runtime_get_sync(component->dev);
if (ret < 0 && ret != -EACCES) { if (ret < 0 && ret != -EACCES) {
pm_runtime_put_noidle(component->dev); pm_runtime_put_noidle(component->dev);
...@@ -127,7 +125,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream) ...@@ -127,7 +125,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
out: out:
mutex_unlock(&rtd->card->pcm_mutex); mutex_unlock(&rtd->card->pcm_mutex);
pm_err: pm_err:
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (component == save) if (component == save)
break; break;
pm_runtime_mark_last_busy(component->dev); pm_runtime_mark_last_busy(component->dev);
...@@ -259,10 +257,9 @@ static int soc_compr_free(struct snd_compr_stream *cstream) ...@@ -259,10 +257,9 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
int stream; int stream, i;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -309,7 +306,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream) ...@@ -309,7 +306,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
mutex_unlock(&rtd->card->pcm_mutex); mutex_unlock(&rtd->card->pcm_mutex);
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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);
} }
...@@ -371,10 +368,9 @@ static int soc_compr_components_trigger(struct snd_compr_stream *cstream, ...@@ -371,10 +368,9 @@ static int soc_compr_components_trigger(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i, ret;
int ret;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->trigger) !component->driver->compr_ops->trigger)
continue; continue;
...@@ -474,10 +470,9 @@ static int soc_compr_components_set_params(struct snd_compr_stream *cstream, ...@@ -474,10 +470,9 @@ static int soc_compr_components_set_params(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i, ret;
int ret;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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;
...@@ -606,9 +601,8 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, ...@@ -606,9 +601,8 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret = 0; int i, ret = 0;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -618,7 +612,7 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, ...@@ -618,7 +612,7 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream,
goto err; goto err;
} }
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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;
...@@ -637,12 +631,11 @@ static int soc_compr_get_caps(struct snd_compr_stream *cstream, ...@@ -637,12 +631,11 @@ static int soc_compr_get_caps(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i, ret = 0;
int ret = 0;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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;
...@@ -660,12 +653,11 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream, ...@@ -660,12 +653,11 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i, ret = 0;
int ret = 0;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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;
...@@ -683,9 +675,8 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) ...@@ -683,9 +675,8 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret = 0; int i, ret = 0;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -695,7 +686,7 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) ...@@ -695,7 +686,7 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes)
goto err; goto err;
} }
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->ack) !component->driver->compr_ops->ack)
continue; continue;
...@@ -715,8 +706,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, ...@@ -715,8 +706,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i, ret = 0;
int ret = 0;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -724,7 +714,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, ...@@ -724,7 +714,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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->pointer) !component->driver->compr_ops->pointer)
continue; continue;
...@@ -742,12 +732,11 @@ static int soc_compr_copy(struct snd_compr_stream *cstream, ...@@ -742,12 +732,11 @@ static int soc_compr_copy(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; int i, ret = 0;
int ret = 0;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->copy) !component->driver->compr_ops->copy)
continue; continue;
...@@ -765,9 +754,8 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, ...@@ -765,9 +754,8 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret; int i, ret;
if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_metadata) { if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_metadata) {
ret = cpu_dai->driver->cops->set_metadata(cstream, metadata, cpu_dai); ret = cpu_dai->driver->cops->set_metadata(cstream, metadata, cpu_dai);
...@@ -775,7 +763,7 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, ...@@ -775,7 +763,7 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream,
return ret; return ret;
} }
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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;
...@@ -794,9 +782,8 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, ...@@ -794,9 +782,8 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int ret; int i, ret;
if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_metadata) { if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_metadata) {
ret = cpu_dai->driver->cops->get_metadata(cstream, metadata, cpu_dai); ret = cpu_dai->driver->cops->get_metadata(cstream, metadata, cpu_dai);
...@@ -804,7 +791,7 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, ...@@ -804,7 +791,7 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream,
return ret; return ret;
} }
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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;
...@@ -857,7 +844,6 @@ static struct snd_compr_ops soc_compr_dyn_ops = { ...@@ -857,7 +844,6 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
{ {
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_compr *compr; struct snd_compr *compr;
...@@ -865,6 +851,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -865,6 +851,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
char new_name[64]; char new_name[64];
int ret = 0, direction = 0; int ret = 0, direction = 0;
int playback = 0, capture = 0; int playback = 0, capture = 0;
int i;
if (rtd->num_codecs > 1) { if (rtd->num_codecs > 1) {
dev_err(rtd->card->dev, dev_err(rtd->card->dev,
...@@ -933,7 +920,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -933,7 +920,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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->compr_ops || if (!component->driver->compr_ops ||
!component->driver->compr_ops->copy) !component->driver->compr_ops->copy)
continue; continue;
......
...@@ -261,34 +261,18 @@ static inline void snd_soc_debugfs_exit(void) ...@@ -261,34 +261,18 @@ static inline void snd_soc_debugfs_exit(void)
static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, 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_component *comp; struct snd_soc_component *comp;
int i;
for_each_rtd_components(rtd, rtdcom, comp) { for_each_rtd_components(rtd, i, comp) {
/* already connected */ /* already connected */
if (comp == component) if (comp == component)
return 0; return 0;
} }
/* /* see for_each_rtd_components */
* created rtdcom here will be freed when rtd->dev was freed. rtd->components[rtd->num_components] = component;
* see rtd->num_components++;
* soc_free_pcm_runtime() :: device_unregister(rtd->dev)
*/
rtdcom = devm_kzalloc(rtd->dev, sizeof(*rtdcom), GFP_KERNEL);
if (!rtdcom)
return -ENOMEM;
rtdcom->component = component;
INIT_LIST_HEAD(&rtdcom->list);
/*
* When rtd was freed, created rtdcom here will be
* also freed.
* And we don't need to call list_del(&rtdcom->list)
* when freed, because rtd is also freed.
*/
list_add_tail(&rtdcom->list, &rtd->component_list);
return 0; return 0;
} }
...@@ -296,8 +280,8 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, ...@@ -296,8 +280,8 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, 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_component *component; struct snd_soc_component *component;
int i;
if (!driver_name) if (!driver_name)
return NULL; return NULL;
...@@ -310,7 +294,7 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, ...@@ -310,7 +294,7 @@ 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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
const char *component_name = component->driver->name; const char *component_name = component->driver->name;
if (!component_name) if (!component_name)
...@@ -318,7 +302,7 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, ...@@ -318,7 +302,7 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
if ((component_name == driver_name) || if ((component_name == driver_name) ||
strcmp(component_name, driver_name) == 0) strcmp(component_name, driver_name) == 0)
return rtdcom->component; return component;
} }
return NULL; return NULL;
...@@ -418,6 +402,7 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( ...@@ -418,6 +402,7 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
{ {
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_component *component;
struct device *dev; struct device *dev;
int ret; int ret;
...@@ -443,13 +428,17 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( ...@@ -443,13 +428,17 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
/* /*
* for rtd * for rtd
*/ */
rtd = devm_kzalloc(dev, sizeof(*rtd), GFP_KERNEL); rtd = devm_kzalloc(dev,
sizeof(*rtd) +
sizeof(*component) * (dai_link->num_cpus +
dai_link->num_codecs +
dai_link->num_platforms),
GFP_KERNEL);
if (!rtd) if (!rtd)
goto free_rtd; goto free_rtd;
rtd->dev = dev; rtd->dev = dev;
INIT_LIST_HEAD(&rtd->list); INIT_LIST_HEAD(&rtd->list);
INIT_LIST_HEAD(&rtd->component_list);
INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients);
INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients); INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients);
INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients); INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients);
...@@ -1108,9 +1097,8 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, ...@@ -1108,9 +1097,8 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
{ {
struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai_link *dai_link = rtd->dai_link;
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_component *component; struct snd_soc_component *component;
int ret, num; int ret, num, i;
/* set default power off timeout */ /* set default power off timeout */
rtd->pmdown_time = pmdown_time; rtd->pmdown_time = pmdown_time;
...@@ -1141,7 +1129,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, ...@@ -1141,7 +1129,7 @@ static int soc_init_pcm_runtime(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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (!component->driver->use_dai_pcm_id) if (!component->driver->use_dai_pcm_id)
continue; continue;
...@@ -1406,12 +1394,11 @@ static void soc_remove_link_components(struct snd_soc_card *card) ...@@ -1406,12 +1394,11 @@ static void soc_remove_link_components(struct snd_soc_card *card)
{ {
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_rtdcom_list *rtdcom; int i, order;
int order;
for_each_comp_order(order) { for_each_comp_order(order) {
for_each_card_rtds(card, rtd) { for_each_card_rtds(card, rtd) {
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (component->driver->remove_order != order) if (component->driver->remove_order != order)
continue; continue;
...@@ -1425,12 +1412,11 @@ static int soc_probe_link_components(struct snd_soc_card *card) ...@@ -1425,12 +1412,11 @@ static int soc_probe_link_components(struct snd_soc_card *card)
{ {
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
struct snd_soc_rtdcom_list *rtdcom; int i, ret, order;
int ret, order;
for_each_comp_order(order) { for_each_comp_order(order) {
for_each_card_rtds(card, rtd) { for_each_card_rtds(card, rtd) {
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (component->driver->probe_order != order) if (component->driver->probe_order != order)
continue; continue;
......
...@@ -111,14 +111,14 @@ void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream) ...@@ -111,14 +111,14 @@ void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream)
*/ */
bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd) bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
bool ignore = true; bool ignore = true;
int i;
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_rtd_components(rtd, rtdcom, component) for_each_rtd_components(rtd, i, component)
ignore &= !component->driver->use_pmdown_time; ignore &= !component->driver->use_pmdown_time;
return ignore; return ignore;
...@@ -428,11 +428,10 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream, ...@@ -428,11 +428,10 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream,
struct snd_soc_component **last) struct snd_soc_component **last)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
int ret = 0; int i, ret = 0;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
*last = component; *last = component;
ret = snd_soc_component_module_get_when_open(component); ret = snd_soc_component_module_get_when_open(component);
...@@ -459,11 +458,10 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream, ...@@ -459,11 +458,10 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
struct snd_soc_component *last) struct snd_soc_component *last)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
int ret = 0; int i, ret = 0;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (component == last) if (component == last)
break; break;
...@@ -484,7 +482,6 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -484,7 +482,6 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
const char *codec_dai_name = "multicodec"; const char *codec_dai_name = "multicodec";
...@@ -494,9 +491,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -494,9 +491,8 @@ 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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component)
pm_runtime_get_sync(component->dev); pm_runtime_get_sync(component->dev);
}
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -617,7 +613,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -617,7 +613,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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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);
} }
...@@ -677,7 +673,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) ...@@ -677,7 +673,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
int i; int i;
...@@ -728,7 +723,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) ...@@ -728,7 +723,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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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);
} }
...@@ -752,7 +747,6 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -752,7 +747,6 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
int i, ret = 0; int i, ret = 0;
...@@ -768,7 +762,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -768,7 +762,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
} }
} }
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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,
...@@ -829,11 +823,10 @@ static int soc_pcm_components_hw_free(struct snd_pcm_substream *substream, ...@@ -829,11 +823,10 @@ static int soc_pcm_components_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_component *last) struct snd_soc_component *last)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
int ret = 0; int i, ret = 0;
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
if (component == last) if (component == last)
break; break;
...@@ -853,7 +846,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -853,7 +846,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
int i, ret = 0; int i, ret = 0;
...@@ -932,7 +924,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -932,7 +924,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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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,
...@@ -1033,7 +1025,6 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) ...@@ -1033,7 +1025,6 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
int i, ret; int i, ret;
...@@ -1044,7 +1035,7 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) ...@@ -1044,7 +1035,7 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd)
return ret; return ret;
} }
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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;
...@@ -1067,7 +1058,6 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd) ...@@ -1067,7 +1058,6 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
int i, ret; int i, ret;
...@@ -1082,7 +1072,7 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd) ...@@ -1082,7 +1072,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_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, 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;
...@@ -2897,7 +2887,6 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -2897,7 +2887,6 @@ 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_component *component; struct snd_soc_component *component;
struct snd_pcm *pcm; struct snd_pcm *pcm;
char new_name[64]; char new_name[64];
...@@ -3007,7 +2996,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -3007,7 +2996,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
rtd->ops.pointer = soc_pcm_pointer; rtd->ops.pointer = soc_pcm_pointer;
} }
for_each_rtd_components(rtd, rtdcom, component) { for_each_rtd_components(rtd, i, component) {
const struct snd_soc_component_driver *drv = component->driver; const struct snd_soc_component_driver *drv = component->driver;
if (drv->ioctl) if (drv->ioctl)
......
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