ALSA: pcm: use helper functions to check whether parameters are determined
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Thu, 8 Jun 2017 21:37:05 +0000 (06:37 +0900)
committerTakashi Iwai <tiwai@suse.de>
Thu, 8 Jun 2017 21:40:37 +0000 (23:40 +0200)
A commit 8bea869c5e56 ("ALSA: PCM midlevel: improve fifo_size handling")
allows drivers to implement calculation of fifo size in parameter
structure. This calculation runs only when two of the other parameters
have single value.

In ALSA PCM core, there're some helper functions for the case. This commit
applies the functions instead of value comparison.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_native.c

index 40560e579d33faa7f788e992a8bb0724db3aceed..80275aa0bccac88c2452c8450c3b80f1272cf625 100644 (file)
@@ -443,8 +443,7 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
        if (!params->fifo_size) {
                m = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
                i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
-               if (snd_mask_min(m) == snd_mask_max(m) &&
-                    snd_interval_min(i) == snd_interval_max(i)) {
+               if (snd_mask_single(m) && snd_interval_single(i)) {
                        err = substream->ops->ioctl(substream,
                                        SNDRV_PCM_IOCTL1_FIFO_SIZE, params);
                        if (err < 0)