Skip to content

Commit

Permalink
ASoC: soc-pcm: add soc_rtd_hw_free()
Browse files Browse the repository at this point in the history
Add soc_rtd_hw_free() to make the code easier to read

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8736c8mi9n.wl-kuninori.morimoto.gx@renesas.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Jan 23, 2020
1 parent de9ad99 commit 49f020e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd,
return 0;
}

static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_substream *substream)
{
if (rtd->dai_link->ops &&
rtd->dai_link->ops->hw_free)
rtd->dai_link->ops->hw_free(substream);
}

/**
* snd_soc_runtime_activate() - Increment active count for PCM runtime components
* @rtd: ASoC PCM runtime that is activated
Expand Down Expand Up @@ -935,8 +943,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
codec_dai->rate = 0;
}

if (rtd->dai_link->ops->hw_free)
rtd->dai_link->ops->hw_free(substream);
soc_rtd_hw_free(rtd, substream);

mutex_unlock(&rtd->card->pcm_mutex);
return ret;
Expand Down Expand Up @@ -979,8 +986,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
}

/* free any machine hw params */
if (rtd->dai_link->ops->hw_free)
rtd->dai_link->ops->hw_free(substream);
soc_rtd_hw_free(rtd, substream);

/* free any component resources */
soc_pcm_components_hw_free(substream, NULL);
Expand Down

0 comments on commit 49f020e

Please sign in to comment.