Commit 7802fb52 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: pcm: move fixup of info flag after selecting single parameters

When drivers register no flags about information of PCM hardware, ALSA
PCM core fixups it roughly. Currently, this operation places in a
function snd_pcm_hw_refine(). It can be moved to a function
fixup_unreferenced_params() because it doesn't affects operations
between these two functions.

This idea is better to bundle codes with similar purposes and this commit
achieves it.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f9a076bf
...@@ -472,13 +472,21 @@ static int fixup_unreferenced_params(struct snd_pcm_substream *substream, ...@@ -472,13 +472,21 @@ static int fixup_unreferenced_params(struct snd_pcm_substream *substream,
} }
} }
if (!params->info) {
params->info = substream->runtime->hw.info;
params->info &= ~(SNDRV_PCM_INFO_FIFO_IN_FRAMES |
SNDRV_PCM_INFO_DRAIN_TRIGGER);
if (!hw_support_mmap(substream))
params->info &= ~(SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID);
}
return 0; return 0;
} }
int snd_pcm_hw_refine(struct snd_pcm_substream *substream, int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_pcm_hardware *hw;
int err; int err;
params->info = 0; params->info = 0;
...@@ -502,16 +510,8 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, ...@@ -502,16 +510,8 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
if (err < 0) if (err < 0)
return err; return err;
hw = &substream->runtime->hw;
if (!params->info) {
params->info = hw->info & ~(SNDRV_PCM_INFO_FIFO_IN_FRAMES |
SNDRV_PCM_INFO_DRAIN_TRIGGER);
if (!hw_support_mmap(substream))
params->info &= ~(SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID);
}
params->rmask = 0; params->rmask = 0;
return 0; return 0;
} }
EXPORT_SYMBOL(snd_pcm_hw_refine); EXPORT_SYMBOL(snd_pcm_hw_refine);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment