public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: Re: [PATCH 05/24] ASoC: soc-component: add snd_soc_pcm_component_prepare()
Date: Mon, 01 Jun 2020 11:22:00 -0700	[thread overview]
Message-ID: <b5420b0e0f33a8bfa1b9b625afa0b429d97fa9c5.camel@linux.intel.com> (raw)
In-Reply-To: <87367fzhwx.wl-kuninori.morimoto.gx@renesas.com>

On Mon, 2020-06-01 at 10:36 +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> We have 2 type of component functions
> snd_soc_component_xxx()     is focusing to component itself,
> snd_soc_pcm_component_xxx() is focusing to rtd related component.
> 
> Now we can update snd_soc_component_prepare() to
> snd_soc_pcm_component_prepare(). This patch do it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  include/sound/soc-component.h |  3 +--
>  sound/soc/soc-component.c     | 28 +++++++++++++++++-----------
>  sound/soc/soc-pcm.c           | 13 +++++--------
>  3 files changed, 23 insertions(+), 21 deletions(-)
> 
> diff --git a/include/sound/soc-component.h b/include/sound/soc-
> component.h
> index cb0d34fa77c6..fc287e910240 100644
> --- a/include/sound/soc-component.h
> +++ b/include/sound/soc-component.h
> @@ -426,8 +426,6 @@ int snd_soc_component_open(struct
> snd_soc_component *component,
>  			   struct snd_pcm_substream *substream);
>  int snd_soc_component_close(struct snd_soc_component *component,
>  			    struct snd_pcm_substream *substream);
> -int snd_soc_component_prepare(struct snd_soc_component *component,
> -			      struct snd_pcm_substream *substream);
>  int snd_soc_component_hw_params(struct snd_soc_component *component,
>  				struct snd_pcm_substream *substream,
>  				struct snd_pcm_hw_params *params);
> @@ -460,5 +458,6 @@ int snd_soc_pcm_component_mmap(struct
> snd_pcm_substream *substream,
>  			       struct vm_area_struct *vma);
>  int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd);
>  void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd);
> +int snd_soc_pcm_component_prepare(struct snd_pcm_substream
> *substream);
>  
>  #endif /* __SOC_COMPONENT_H */
> diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
> index 6d29c2de3b24..1bc155bc8e5e 100644
> --- a/sound/soc/soc-component.c
> +++ b/sound/soc/soc-component.c
> @@ -275,17 +275,6 @@ int snd_soc_component_close(struct
> snd_soc_component *component,
>  	return soc_component_ret(component, ret);
>  }
>  
> -int snd_soc_component_prepare(struct snd_soc_component *component,
> -			      struct snd_pcm_substream *substream)
> -{
> -	int ret = 0;
> -
> -	if (component->driver->prepare)
> -		ret = component->driver->prepare(component, substream);
> -
> -	return soc_component_ret(component, ret);
> -}
> -
>  int snd_soc_component_hw_params(struct snd_soc_component *component,
>  				struct snd_pcm_substream *substream,
>  				struct snd_pcm_hw_params *params)
> @@ -569,3 +558,20 @@ void snd_soc_pcm_component_free(struct
> snd_soc_pcm_runtime *rtd)
>  		if (component->driver->pcm_destruct)
>  			component->driver->pcm_destruct(component, rtd-
> >pcm);
>  }
> +
> +int snd_soc_pcm_component_prepare(struct snd_pcm_substream
> *substream)
> +{
> +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> +	struct snd_soc_component *component;
> +	int i, ret;
> +
> +	for_each_rtd_components(rtd, i, component) {
> +		if (component->driver->prepare) {
> +			ret = component->driver->prepare(component,
> substream);
> +			if (ret < 0)
> +				return soc_component_ret(component,
> ret);
> +		}
> +	}
> +
> +	return 0;
> +}
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 276505fb9d50..e61e7a56d95e 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -850,7 +850,6 @@ static void codec2codec_close_delayed_work(struct
> snd_soc_pcm_runtime *rtd)
>  static int soc_pcm_prepare(struct snd_pcm_substream *substream)
>  {
>  	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> -	struct snd_soc_component *component;
>  	struct snd_soc_dai *dai;
>  	int i, ret = 0;
>  
> @@ -860,13 +859,11 @@ static int soc_pcm_prepare(struct
> snd_pcm_substream *substream)
>  	if (ret < 0)
>  		goto out;
>  
> -	for_each_rtd_components(rtd, i, component) {
> -		ret = snd_soc_component_prepare(component, substream);
> -		if (ret < 0) {
> -			dev_err(component->dev,
> -				"ASoC: platform prepare error: %d\n",
> ret);
> -			goto out;
> -		}
> +	ret = snd_soc_pcm_component_prepare(substream);
> +	if (ret < 0) {
> +		dev_err(rtd->dev,
> +			"ASoC: platform prepare error: %d\n", ret);
Morimoto-san,
We should remove this. This will be a duplicate error message as
snd_soc_pcm_component_prepare() would already print the error before
returning.

Thanks,
Ranjani


  reply	other threads:[~2020-06-01 18:23 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01  1:35 [PATCH 00/24] ASoC: soc-component: collect component functions Kuninori Morimoto
2020-06-01  1:35 ` [PATCH 01/24] ASoC: soc-component: add soc_component_pin() and share code Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 02/24] ASoC: soc-component: move snd_soc_component_xxx_regmap() to soc-component Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 03/24] ASoC: soc-component: move snd_soc_component_initialize() to soc-component.c Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 04/24] ASoC: soc-component: add soc_component_err() Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 05/24] ASoC: soc-component: add snd_soc_pcm_component_prepare() Kuninori Morimoto
2020-06-01 18:22   ` Ranjani Sridharan [this message]
2020-06-01 23:12     ` Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 06/24] ASoC: soc-component: add snd_soc_pcm_component_hw_params() Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 07/24] ASoC: soc-component: add snd_soc_pcm_component_hw_free() Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 08/24] ASoC: soc-component: add snd_soc_pcm_component_trigger() Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 09/24] ASoC: soc-component: add snd_soc_component_compr_open() Kuninori Morimoto
2020-06-01 19:01   ` Ranjani Sridharan
2020-06-01 23:16     ` Kuninori Morimoto
2020-06-03 10:40       ` Mark Brown
2020-06-04  0:52         ` Kuninori Morimoto
2020-06-04  4:23           ` Kuninori Morimoto
2020-06-03 16:55   ` Ranjani Sridharan
2020-06-01  1:36 ` [PATCH 10/24] ASoC: soc-component: add snd_soc_component_compr_free() Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 11/24] ASoC: soc-component: add snd_soc_component_compr_trigger() Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 12/24] ASoC: soc-component: add snd_soc_component_compr_set_params() Kuninori Morimoto
2020-06-01  1:36 ` [PATCH 13/24] ASoC: soc-component: add snd_soc_component_compr_get_params() Kuninori Morimoto
2020-06-01  1:37 ` [PATCH 14/24] ASoC: soc-component: add snd_soc_component_compr_get_caps() Kuninori Morimoto
2020-06-01  1:37 ` [PATCH 15/24] ASoC: soc-component: add snd_soc_component_compr_get_codec_caps() Kuninori Morimoto
2020-06-01  1:37 ` [PATCH 16/24] ASoC: soc-component: add snd_soc_component_compr_ack() Kuninori Morimoto
2020-06-01  1:37 ` [PATCH 17/24] ASoC: soc-component: add snd_soc_component_compr_pointer() Kuninori Morimoto
2020-06-03 17:35   ` Ranjani Sridharan
2020-06-01  1:37 ` [PATCH 18/24] ASoC: soc-component: add snd_soc_component_compr_copy() Kuninori Morimoto
2020-06-03 17:39   ` Ranjani Sridharan
2020-06-01  1:37 ` [PATCH 19/24] ASoC: soc-component: add snd_soc_component_compr_set_metadata() Kuninori Morimoto
2020-06-03 17:40   ` Ranjani Sridharan
2020-06-01  1:37 ` [PATCH 20/24] ASoC: soc-component: add snd_soc_component_compr_get_metadata() Kuninori Morimoto
2020-06-03 17:41   ` Ranjani Sridharan
2020-06-01  1:37 ` [PATCH 21/24] ASoC: soc-component: add snd_soc_component_init() Kuninori Morimoto
2020-06-01  1:37 ` [PATCH 22/24] ASoC: soc-component: merge soc-io.c into soc-component.c Kuninori Morimoto
2020-06-01  1:37 ` [PATCH 23/24] ASoC: soc-component: merge soc_pcm_trigger_start/stop() Kuninori Morimoto
2020-06-01  1:37 ` [PATCH 24/24] ASoC: soc-component: tidyup Copyright Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5420b0e0f33a8bfa1b9b625afa0b429d97fa9c5.camel@linux.intel.com \
    --to=ranjani.sridharan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox