Message ID | 87h7vvy3ag.wl-kuninori.morimoto.gx@renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ASoC: soc-component: collect component functions | expand |
On Mon, 2020-06-01 at 10:37 +0900, Kuninori Morimoto wrote: > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > component related function should be implemented at > soc-component.c. > This patch adds snd_soc_component_compr_get_metadata(). > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > --- > include/sound/soc-component.h | 2 ++ > sound/soc/soc-component.c | 18 ++++++++++++++++++ > sound/soc/soc-compress.c | 14 +++----------- > 3 files changed, 23 insertions(+), 11 deletions(-) > > diff --git a/include/sound/soc-component.h b/include/sound/soc- > component.h > index ce1df96bb274..5b8a4d847089 100644 > --- a/include/sound/soc-component.h > +++ b/include/sound/soc-component.h > @@ -456,6 +456,8 @@ int snd_soc_component_compr_copy(struct > snd_compr_stream *cstream, > char __user *buf, size_t count); > int snd_soc_component_compr_set_metadata(struct snd_compr_stream > *cstream, > struct snd_compr_metadata > *metadata); > +int snd_soc_component_compr_get_metadata(struct snd_compr_stream > *cstream, > + struct snd_compr_metadata > *metadata); > > int snd_soc_pcm_component_pointer(struct snd_pcm_substream > *substream); > int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream, > diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c > index 1ac353cf48c5..45a5c496454a 100644 > --- a/sound/soc/soc-component.c > +++ b/sound/soc/soc-component.c > @@ -612,6 +612,24 @@ int snd_soc_component_compr_set_metadata(struct > snd_compr_stream *cstream, > } > EXPORT_SYMBOL_GPL(snd_soc_component_compr_set_metadata); > > +int snd_soc_component_compr_get_metadata(struct snd_compr_stream > *cstream, > + struct snd_compr_metadata > *metadata) > +{ > + struct snd_soc_pcm_runtime *rtd = cstream->private_data; > + struct snd_soc_component *component; > + int i; > + > + for_each_rtd_components(rtd, i, component) { > + if (component->driver->compress_ops && > + component->driver->compress_ops->get_metadata) > + return component->driver->compress_ops- > >get_metadata( > + component, cstream, metadata); > + } > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(snd_soc_component_compr_get_metadata); > + > int snd_soc_pcm_component_pointer(struct snd_pcm_substream > *substream) > { > struct snd_soc_pcm_runtime *rtd = substream->private_data; > diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c > index 62925adb1042..475722adb2a5 100644 > --- a/sound/soc/soc-compress.c > +++ b/sound/soc/soc-compress.c > @@ -546,24 +546,16 @@ static int soc_compr_get_metadata(struct > snd_compr_stream *cstream, > struct snd_compr_metadata *metadata) > { > struct snd_soc_pcm_runtime *rtd = cstream->private_data; > - struct snd_soc_component *component; > struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); > - int i, ret; > + int ret; > > ret = snd_soc_dai_compr_get_metadata(cpu_dai, cstream, > metadata); > if (ret < 0) > return ret; > > - for_each_rtd_components(rtd, i, component) { > - if (!component->driver->compress_ops || > - !component->driver->compress_ops->get_metadata) > - continue; > + ret = snd_soc_component_compr_get_metadata(cstream, metadata); > > - return component->driver->compress_ops->get_metadata( > - component, cstream, metadata); > - } > - > - return 0; > + return ret; same here. return snd_soc_component_compr_get_metadata(cstream, metadata);? Thanks, Ranjani
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index ce1df96bb274..5b8a4d847089 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -456,6 +456,8 @@ int snd_soc_component_compr_copy(struct snd_compr_stream *cstream, char __user *buf, size_t count); int snd_soc_component_compr_set_metadata(struct snd_compr_stream *cstream, struct snd_compr_metadata *metadata); +int snd_soc_component_compr_get_metadata(struct snd_compr_stream *cstream, + struct snd_compr_metadata *metadata); int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream); int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream, diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index 1ac353cf48c5..45a5c496454a 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -612,6 +612,24 @@ int snd_soc_component_compr_set_metadata(struct snd_compr_stream *cstream, } EXPORT_SYMBOL_GPL(snd_soc_component_compr_set_metadata); +int snd_soc_component_compr_get_metadata(struct snd_compr_stream *cstream, + struct snd_compr_metadata *metadata) +{ + struct snd_soc_pcm_runtime *rtd = cstream->private_data; + struct snd_soc_component *component; + int i; + + for_each_rtd_components(rtd, i, component) { + if (component->driver->compress_ops && + component->driver->compress_ops->get_metadata) + return component->driver->compress_ops->get_metadata( + component, cstream, metadata); + } + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_component_compr_get_metadata); + int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 62925adb1042..475722adb2a5 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -546,24 +546,16 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, struct snd_compr_metadata *metadata) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_component *component; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); - int i, ret; + int ret; ret = snd_soc_dai_compr_get_metadata(cpu_dai, cstream, metadata); if (ret < 0) return ret; - for_each_rtd_components(rtd, i, component) { - if (!component->driver->compress_ops || - !component->driver->compress_ops->get_metadata) - continue; + ret = snd_soc_component_compr_get_metadata(cstream, metadata); - return component->driver->compress_ops->get_metadata( - component, cstream, metadata); - } - - return 0; + return ret; } /* ASoC Compress operations */