[alsa-devel] [PATCH 5/7] ASoC: soc-pcm: goto error after trying all component open
Sridharan, Ranjani
ranjani.sridharan at intel.com
Mon Jan 27 19:34:36 CET 2020
On Sun, Jan 26, 2020 at 5:54 PM Kuninori Morimoto <
kuninori.morimoto.gx at renesas.com> wrote:
>
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
>
> soc_pcm_components_open() might goto error process *during* opening
> component loop.
> In such case, fallback process need to care about operated/non-operated
> component.
>
> But, if it goto error process *after* loop even though error happen
> during loop, it don't need to care about operated/non-operated.
> In such case code can be more simple.
> This patch do it. And this is prepare for soc_snd_open() cleanup
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> ---
> sound/soc/soc-pcm.c | 41 +++++++++++++----------------------------
> 1 file changed, 13 insertions(+), 28 deletions(-)
>
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 57d2f00..1e370ef 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -463,47 +463,32 @@ static void soc_pcm_init_runtime_hw(struct
> snd_pcm_substream *substream)
> hw->rate_max = min_not_zero(hw->rate_max, rate_max);
> }
>
> -static int soc_pcm_components_open(struct snd_pcm_substream *substream,
> - struct snd_soc_component **last)
> +static int soc_pcm_components_open(struct snd_pcm_substream *substream)
> {
> struct snd_soc_pcm_runtime *rtd = substream->private_data;
> struct snd_soc_component *component;
> int i, ret = 0;
>
> for_each_rtd_components(rtd, i, component) {
> - *last = component;
> + ret |= snd_soc_component_module_get_when_open(component);
> + ret |= snd_soc_component_open(component, substream);
> + }
>
> - ret = snd_soc_component_module_get_when_open(component);
> - if (ret < 0) {
> - dev_err(component->dev,
> - "ASoC: can't get module %s\n",
> - component->name);
> - return ret;
> - }
> + if (ret < 0)
> + dev_err(component->dev,
> + "ASoC: error happen during open component %s:
> %d\n",
> + component->name, ret);
>
Hi Morimoto-san,
Wouldn't the component here always be the last component in the list of rtd
components? Should this error log be moved inside
the for_each_rtd_components() {} above?
Thanks,
Ranjani
More information about the Alsa-devel
mailing list