From 93e6958a3674d2fa42e2c24ad5156e65da1d8621 Mon Sep 17 00:00:00 2001 From: Benoit Cousson Date: Tue, 8 Jul 2014 23:19:38 +0200 Subject: ASoC: pcm: Add soc_dai_hw_params helper Add a function helper to factorize the hw_params code. Suggested by Lars-Peter Clausen Signed-off-by: Benoit Cousson Tested-by: Lars-Peter Clausen Reviewed-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'sound/soc/soc-dapm.c') diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 5c63c3b49f3f..9a047f360993 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3214,27 +3214,15 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_PRE_PMU: - if (source->driver->ops && source->driver->ops->hw_params) { - substream.stream = SNDRV_PCM_STREAM_CAPTURE; - ret = source->driver->ops->hw_params(&substream, - params, source); - if (ret != 0) { - dev_err(source->dev, - "ASoC: hw_params() failed: %d\n", ret); - goto out; - } - } + substream.stream = SNDRV_PCM_STREAM_CAPTURE; + ret = soc_dai_hw_params(&substream, params, source); + if (ret < 0) + goto out; - if (sink->driver->ops && sink->driver->ops->hw_params) { - substream.stream = SNDRV_PCM_STREAM_PLAYBACK; - ret = sink->driver->ops->hw_params(&substream, params, - sink); - if (ret != 0) { - dev_err(sink->dev, - "ASoC: hw_params() failed: %d\n", ret); - goto out; - } - } + substream.stream = SNDRV_PCM_STREAM_PLAYBACK; + ret = soc_dai_hw_params(&substream, params, sink); + if (ret < 0) + goto out; break; case SND_SOC_DAPM_POST_PMU: -- cgit v1.2.3-55-g7522