static int snd_pcm_prepare(struct snd_pcm_substream *substream,
			   struct file *file)
{
	int f_flags;

	if (file)
		f_flags = file->f_flags;
	else
		f_flags = substream->f_flags;

	snd_pcm_stream_lock_irq(substream);
	switch (substream->runtime->status->state) {
	case SNDRV_PCM_STATE_PAUSED:
		snd_pcm_pause(substream, false);
		fallthrough;
	case SNDRV_PCM_STATE_SUSPENDED:
		snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
		break;
	}
	snd_pcm_stream_unlock_irq(substream);

	return snd_pcm_action_nonatomic(&snd_pcm_action_prepare,
					substream,
					(__force snd_pcm_state_t)f_flags);
}
static int snd_pcm_prepare(struct snd_pcm_substream *substream,
			   struct file *file)
{
	int f_flags;

	if (file)
		f_flags = file->f_flags;
	else
		f_flags = substream->f_flags;

	snd_pcm_stream_lock_irq(substream);
	switch (substream->runtime->status->state) {
	case SNDRV_PCM_STATE_PAUSED:
		snd_pcm_pause(substream, false);
		fallthrough;
	case SNDRV_PCM_STATE_SUSPENDED:
		snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
		break;
	}
	snd_pcm_stream_unlock_irq(substream);

	return snd_pcm_action_nonatomic(&snd_pcm_action_prepare,
					substream,
					(__force snd_pcm_state_t)f_flags);
}