[alsa-devel] [PATCH 17/18] ASoC: cht_bsw_rt5645: Use snd_pcm_hw_constraint_single()

Lars-Peter Clausen lars at metafoo.de
Sun Oct 18 15:39:32 CEST 2015


Use the new snd_pcm_hw_constraint_single() helper function rather than
installing a list constraint with a single value. Since
snd_pcm_hw_constraint_single() sets a static constraint while
snd_pcm_hw_constraint_list() sets a dynamic constraint the former is
slightly more efficient and it also needs less code.

Signed-off-by: Lars-Peter Clausen <lars at metafoo.de>
---
 sound/soc/intel/boards/cht_bsw_rt5645.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 7be8461..38d65a3 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -235,20 +235,10 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
-static unsigned int rates_48000[] = {
-	48000,
-};
-
-static struct snd_pcm_hw_constraint_list constraints_48000 = {
-	.count = ARRAY_SIZE(rates_48000),
-	.list  = rates_48000,
-};
-
 static int cht_aif1_startup(struct snd_pcm_substream *substream)
 {
-	return snd_pcm_hw_constraint_list(substream->runtime, 0,
-			SNDRV_PCM_HW_PARAM_RATE,
-			&constraints_48000);
+	return snd_pcm_hw_constraint_single(substream->runtime,
+			SNDRV_PCM_HW_PARAM_RATE, 48000);
 }
 
 static struct snd_soc_ops cht_aif1_ops = {
-- 
2.1.4



More information about the Alsa-devel mailing list