678 snd_pcm_gettime(runtime, &runtime->trigger_tstamp);
679 } else {
680 snd_pcm_trigger_tstamp(runtime->trigger_master);
681 runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp;
682 }
683 runtime->trigger_master = NULL;
684}
685
686struct action_ops {
687 int (*pre_action)(struct snd_pcm_substream *substream, int state);
688 int (*do_action)(struct snd_pcm_substream *substream, int state);
689 void (*undo_action)(struct snd_pcm_substream *substream, int state);
690 void (*post_action)(struct snd_pcm_substream *substream, int state);
691};
692
693
694
695
696
697
698static int snd_pcm_action_group(struct action_ops *ops,
699 struct snd_pcm_substream *substream,
700 int state, int do_lock)
701{
702 struct snd_pcm_substream *s = NULL;
703 struct snd_pcm_substream *s1;
704 int res = 0;
705
706 snd_pcm_group_for_each_entry(s, substream) {
707 if (do_lock && s != substream)
708 spin_lock_nested(&s->self_group.lock,
709 SINGLE_DEPTH_NESTING);
710 res = ops->pre_action(s, state);
711 if (res < 0)
712 goto _unlock;
713 }
714 snd_pcm_group_for_each_entry(s, substream) {
715 res = ops->do_action(s, state);
716 if (res < 0) {
717 if (ops->undo_action) {
718 snd_pcm_group_for_each_entry(s1, substream) {