aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-02-22 06:52:53 -0500
committerJaroslav Kysela <perex@suse.cz>2007-05-11 10:55:42 -0400
commitef991b95aa1351a5782cfaccb9aefba76ca8b990 (patch)
tree129762745099142652615dbe1c4c29725cca51c8
parent5e24c1c1c496c4603395d6e9cc320f85008fc891 (diff)
[ALSA] Add snd_pcm_group_for_each_entry() for code cleanup
Added a new macro snd_pcm_group_for_each_entry() just for code cleanup. Old macros, snd_pcm_group_for_each() and snd_pcm_group_substream_entry(), are removed. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--include/sound/pcm.h7
-rw-r--r--sound/core/pcm_native.c27
-rw-r--r--sound/isa/cs423x/cs4231_lib.c4
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c4
-rw-r--r--sound/pci/ali5451/ali5451.c4
-rw-r--r--sound/pci/ca0106/ca0106_main.c4
-rw-r--r--sound/pci/echoaudio/echoaudio.c4
-rw-r--r--sound/pci/emu10k1/p16v.c4
-rw-r--r--sound/pci/ens1370.c8
-rw-r--r--sound/pci/ice1712/ice1712.c4
-rw-r--r--sound/pci/ice1712/ice1724.c4
-rw-r--r--sound/pci/pcxhr/pcxhr.c7
-rw-r--r--sound/pci/rme32.c7
-rw-r--r--sound/pci/rme9652/hdsp.c8
-rw-r--r--sound/pci/rme9652/hdspm.c8
-rw-r--r--sound/pci/rme9652/rme9652.c8
-rw-r--r--sound/pci/trident/trident_main.c4
-rw-r--r--sound/sparc/cs4231.c3
18 files changed, 34 insertions, 85 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index deff5a92efa6..73334e0f823f 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -603,11 +603,8 @@ do { \
603 read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \ 603 read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \
604} while (0) 604} while (0)
605 605
606#define snd_pcm_group_for_each(pos, substream) \ 606#define snd_pcm_group_for_each_entry(s, substream) \
607 list_for_each(pos, &substream->group->substreams) 607 list_for_each_entry(s, &substream->group->substreams, link_list)
608
609#define snd_pcm_group_substream_entry(pos) \
610 list_entry(pos, struct snd_pcm_substream, link_list)
611 608
612static inline int snd_pcm_running(struct snd_pcm_substream *substream) 609static inline int snd_pcm_running(struct snd_pcm_substream *substream)
613{ 610{
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 905234817c89..42a039cc50a8 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -712,26 +712,22 @@ static int snd_pcm_action_group(struct action_ops *ops,
712 struct snd_pcm_substream *substream, 712 struct snd_pcm_substream *substream,
713 int state, int do_lock) 713 int state, int do_lock)
714{ 714{
715 struct list_head *pos;
716 struct snd_pcm_substream *s = NULL; 715 struct snd_pcm_substream *s = NULL;
717 struct snd_pcm_substream *s1; 716 struct snd_pcm_substream *s1;
718 int res = 0; 717 int res = 0;
719 718
720 snd_pcm_group_for_each(pos, substream) { 719 snd_pcm_group_for_each_entry(s, substream) {
721 s = snd_pcm_group_substream_entry(pos);
722 if (do_lock && s != substream) 720 if (do_lock && s != substream)
723 spin_lock(&s->self_group.lock); 721 spin_lock(&s->self_group.lock);
724 res = ops->pre_action(s, state); 722 res = ops->pre_action(s, state);
725 if (res < 0) 723 if (res < 0)
726 goto _unlock; 724 goto _unlock;
727 } 725 }
728 snd_pcm_group_for_each(pos, substream) { 726 snd_pcm_group_for_each_entry(s, substream) {
729 s = snd_pcm_group_substream_entry(pos);
730 res = ops->do_action(s, state); 727 res = ops->do_action(s, state);
731 if (res < 0) { 728 if (res < 0) {
732 if (ops->undo_action) { 729 if (ops->undo_action) {
733 snd_pcm_group_for_each(pos, substream) { 730 snd_pcm_group_for_each_entry(s1, substream) {
734 s1 = snd_pcm_group_substream_entry(pos);
735 if (s1 == s) /* failed stream */ 731 if (s1 == s) /* failed stream */
736 break; 732 break;
737 ops->undo_action(s1, state); 733 ops->undo_action(s1, state);
@@ -741,15 +737,13 @@ static int snd_pcm_action_group(struct action_ops *ops,
741 goto _unlock; 737 goto _unlock;
742 } 738 }
743 } 739 }
744 snd_pcm_group_for_each(pos, substream) { 740 snd_pcm_group_for_each_entry(s, substream) {
745 s = snd_pcm_group_substream_entry(pos);
746 ops->post_action(s, state); 741 ops->post_action(s, state);
747 } 742 }
748 _unlock: 743 _unlock:
749 if (do_lock) { 744 if (do_lock) {
750 /* unlock streams */ 745 /* unlock streams */
751 snd_pcm_group_for_each(pos, substream) { 746 snd_pcm_group_for_each_entry(s1, substream) {
752 s1 = snd_pcm_group_substream_entry(pos);
753 if (s1 != substream) 747 if (s1 != substream)
754 spin_unlock(&s1->self_group.lock); 748 spin_unlock(&s1->self_group.lock);
755 if (s1 == s) /* end */ 749 if (s1 == s) /* end */
@@ -1438,7 +1432,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream)
1438{ 1432{
1439 struct snd_card *card; 1433 struct snd_card *card;
1440 struct snd_pcm_runtime *runtime; 1434 struct snd_pcm_runtime *runtime;
1441 struct list_head *pos; 1435 struct snd_pcm_substream *s;
1442 int result = 0; 1436 int result = 0;
1443 int i, num_drecs; 1437 int i, num_drecs;
1444 struct drain_rec *drec, drec_tmp, *d; 1438 struct drain_rec *drec, drec_tmp, *d;
@@ -1473,8 +1467,7 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream)
1473 1467
1474 /* count only playback streams */ 1468 /* count only playback streams */
1475 num_drecs = 0; 1469 num_drecs = 0;
1476 snd_pcm_group_for_each(pos, substream) { 1470 snd_pcm_group_for_each_entry(s, substream) {
1477 struct snd_pcm_substream *s = snd_pcm_group_substream_entry(pos);
1478 runtime = s->runtime; 1471 runtime = s->runtime;
1479 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { 1472 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1480 d = &drec[num_drecs++]; 1473 d = &drec[num_drecs++];
@@ -1674,7 +1667,7 @@ static void relink_to_local(struct snd_pcm_substream *substream)
1674 1667
1675static int snd_pcm_unlink(struct snd_pcm_substream *substream) 1668static int snd_pcm_unlink(struct snd_pcm_substream *substream)
1676{ 1669{
1677 struct list_head *pos; 1670 struct snd_pcm_substream *s;
1678 int res = 0; 1671 int res = 0;
1679 1672
1680 down_write(&snd_pcm_link_rwsem); 1673 down_write(&snd_pcm_link_rwsem);
@@ -1686,8 +1679,8 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream)
1686 list_del(&substream->link_list); 1679 list_del(&substream->link_list);
1687 substream->group->count--; 1680 substream->group->count--;
1688 if (substream->group->count == 1) { /* detach the last stream, too */ 1681 if (substream->group->count == 1) { /* detach the last stream, too */
1689 snd_pcm_group_for_each(pos, substream) { 1682 snd_pcm_group_for_each_entry(s, substream) {
1690 relink_to_local(snd_pcm_group_substream_entry(pos)); 1683 relink_to_local(s);
1691 break; 1684 break;
1692 } 1685 }
1693 kfree(substream->group); 1686 kfree(substream->group);
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
index 75c7c5f01989..914d77b61b0c 100644
--- a/sound/isa/cs423x/cs4231_lib.c
+++ b/sound/isa/cs423x/cs4231_lib.c
@@ -405,7 +405,6 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream,
405 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); 405 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
406 int result = 0; 406 int result = 0;
407 unsigned int what; 407 unsigned int what;
408 struct list_head *pos;
409 struct snd_pcm_substream *s; 408 struct snd_pcm_substream *s;
410 int do_start; 409 int do_start;
411 410
@@ -425,8 +424,7 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream,
425 } 424 }
426 425
427 what = 0; 426 what = 0;
428 snd_pcm_group_for_each(pos, substream) { 427 snd_pcm_group_for_each_entry(s, substream) {
429 s = snd_pcm_group_substream_entry(pos);
430 if (s == chip->playback_substream) { 428 if (s == chip->playback_substream) {
431 what |= CS4231_PLAYBACK_ENABLE; 429 what |= CS4231_PLAYBACK_ENABLE;
432 snd_pcm_trigger_done(s, substream); 430 snd_pcm_trigger_done(s, substream);
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 1c390580bd50..95d0ab124d5b 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -934,10 +934,8 @@ static int snd_opti93x_trigger(struct snd_pcm_substream *substream,
934 case SNDRV_PCM_TRIGGER_STOP: 934 case SNDRV_PCM_TRIGGER_STOP:
935 { 935 {
936 unsigned int what = 0; 936 unsigned int what = 0;
937 struct list_head *pos;
938 struct snd_pcm_substream *s; 937 struct snd_pcm_substream *s;
939 snd_pcm_group_for_each(pos, substream) { 938 snd_pcm_group_for_each_entry(s, substream) {
940 s = snd_pcm_group_substream_entry(pos);
941 if (s == chip->playback_substream) { 939 if (s == chip->playback_substream) {
942 what |= OPTi93X_PLAYBACK_ENABLE; 940 what |= OPTi93X_PLAYBACK_ENABLE;
943 snd_pcm_trigger_done(s, substream); 941 snd_pcm_trigger_done(s, substream);
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index ba7fa22b285d..cd2fe374744c 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -1224,7 +1224,6 @@ static int snd_ali_trigger(struct snd_pcm_substream *substream,
1224 1224
1225{ 1225{
1226 struct snd_ali *codec = snd_pcm_substream_chip(substream); 1226 struct snd_ali *codec = snd_pcm_substream_chip(substream);
1227 struct list_head *pos;
1228 struct snd_pcm_substream *s; 1227 struct snd_pcm_substream *s;
1229 unsigned int what, whati, capture_flag; 1228 unsigned int what, whati, capture_flag;
1230 struct snd_ali_voice *pvoice = NULL, *evoice = NULL; 1229 struct snd_ali_voice *pvoice = NULL, *evoice = NULL;
@@ -1243,8 +1242,7 @@ static int snd_ali_trigger(struct snd_pcm_substream *substream,
1243 } 1242 }
1244 1243
1245 what = whati = capture_flag = 0; 1244 what = whati = capture_flag = 0;
1246 snd_pcm_group_for_each(pos, substream) { 1245 snd_pcm_group_for_each_entry(s, substream) {
1247 s = snd_pcm_group_substream_entry(pos);
1248 if ((struct snd_ali *) snd_pcm_substream_chip(s) == codec) { 1246 if ((struct snd_ali *) snd_pcm_substream_chip(s) == codec) {
1249 pvoice = s->runtime->private_data; 1247 pvoice = s->runtime->private_data;
1250 evoice = pvoice->extra; 1248 evoice = pvoice->extra;
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index ea6712b63c9f..48f3f17c5170 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -775,7 +775,6 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
775 struct snd_ca0106_pcm *epcm; 775 struct snd_ca0106_pcm *epcm;
776 int channel; 776 int channel;
777 int result = 0; 777 int result = 0;
778 struct list_head *pos;
779 struct snd_pcm_substream *s; 778 struct snd_pcm_substream *s;
780 u32 basic = 0; 779 u32 basic = 0;
781 u32 extended = 0; 780 u32 extended = 0;
@@ -790,8 +789,7 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
790 running=0; 789 running=0;
791 break; 790 break;
792 } 791 }
793 snd_pcm_group_for_each(pos, substream) { 792 snd_pcm_group_for_each_entry(s, substream) {
794 s = snd_pcm_group_substream_entry(pos);
795 runtime = s->runtime; 793 runtime = s->runtime;
796 epcm = runtime->private_data; 794 epcm = runtime->private_data;
797 channel = epcm->channel_id; 795 channel = epcm->channel_id;
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index e413da00759b..f27b6a733b96 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -705,11 +705,9 @@ static int pcm_trigger(struct snd_pcm_substream *substream, int cmd)
705 struct audiopipe *pipe = runtime->private_data; 705 struct audiopipe *pipe = runtime->private_data;
706 int i, err; 706 int i, err;
707 u32 channelmask = 0; 707 u32 channelmask = 0;
708 struct list_head *pos;
709 struct snd_pcm_substream *s; 708 struct snd_pcm_substream *s;
710 709
711 snd_pcm_group_for_each(pos, substream) { 710 snd_pcm_group_for_each_entry(s, substream) {
712 s = snd_pcm_group_substream_entry(pos);
713 for (i = 0; i < DSP_MAXPIPES; i++) { 711 for (i = 0; i < DSP_MAXPIPES; i++) {
714 if (s == chip->substream[i]) { 712 if (s == chip->substream[i]) {
715 channelmask |= 1 << i; 713 channelmask |= 1 << i;
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 465f8d505329..7ee19c63c2c8 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -433,7 +433,6 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
433 struct snd_emu10k1_pcm *epcm; 433 struct snd_emu10k1_pcm *epcm;
434 int channel; 434 int channel;
435 int result = 0; 435 int result = 0;
436 struct list_head *pos;
437 struct snd_pcm_substream *s; 436 struct snd_pcm_substream *s;
438 u32 basic = 0; 437 u32 basic = 0;
439 u32 inte = 0; 438 u32 inte = 0;
@@ -448,8 +447,7 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
448 running = 0; 447 running = 0;
449 break; 448 break;
450 } 449 }
451 snd_pcm_group_for_each(pos, substream) { 450 snd_pcm_group_for_each_entry(s, substream) {
452 s = snd_pcm_group_substream_entry(pos);
453 runtime = s->runtime; 451 runtime = s->runtime;
454 epcm = runtime->private_data; 452 epcm = runtime->private_data;
455 channel = substream->pcm->device-emu->p16v_device_offset; 453 channel = substream->pcm->device-emu->p16v_device_offset;
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 425b167522d5..6a0ddcf00884 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -798,10 +798,8 @@ static int snd_ensoniq_trigger(struct snd_pcm_substream *substream, int cmd)
798 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 798 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
799 { 799 {
800 unsigned int what = 0; 800 unsigned int what = 0;
801 struct list_head *pos;
802 struct snd_pcm_substream *s; 801 struct snd_pcm_substream *s;
803 snd_pcm_group_for_each(pos, substream) { 802 snd_pcm_group_for_each_entry(s, substream) {
804 s = snd_pcm_group_substream_entry(pos);
805 if (s == ensoniq->playback1_substream) { 803 if (s == ensoniq->playback1_substream) {
806 what |= ES_P1_PAUSE; 804 what |= ES_P1_PAUSE;
807 snd_pcm_trigger_done(s, substream); 805 snd_pcm_trigger_done(s, substream);
@@ -824,10 +822,8 @@ static int snd_ensoniq_trigger(struct snd_pcm_substream *substream, int cmd)
824 case SNDRV_PCM_TRIGGER_STOP: 822 case SNDRV_PCM_TRIGGER_STOP:
825 { 823 {
826 unsigned int what = 0; 824 unsigned int what = 0;
827 struct list_head *pos;
828 struct snd_pcm_substream *s; 825 struct snd_pcm_substream *s;
829 snd_pcm_group_for_each(pos, substream) { 826 snd_pcm_group_for_each_entry(s, substream) {
830 s = snd_pcm_group_substream_entry(pos);
831 if (s == ensoniq->playback1_substream) { 827 if (s == ensoniq->playback1_substream) {
832 what |= ES_DAC1_EN; 828 what |= ES_DAC1_EN;
833 snd_pcm_trigger_done(s, substream); 829 snd_pcm_trigger_done(s, substream);
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 830a1bbd7110..e880469beb4f 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -977,11 +977,9 @@ static int snd_ice1712_pro_trigger(struct snd_pcm_substream *substream,
977 { 977 {
978 unsigned int what = 0; 978 unsigned int what = 0;
979 unsigned int old; 979 unsigned int old;
980 struct list_head *pos;
981 struct snd_pcm_substream *s; 980 struct snd_pcm_substream *s;
982 981
983 snd_pcm_group_for_each(pos, substream) { 982 snd_pcm_group_for_each_entry(s, substream) {
984 s = snd_pcm_group_substream_entry(pos);
985 if (s == ice->playback_pro_substream) { 983 if (s == ice->playback_pro_substream) {
986 what |= ICE1712_PLAYBACK_START; 984 what |= ICE1712_PLAYBACK_START;
987 snd_pcm_trigger_done(s, substream); 985 snd_pcm_trigger_done(s, substream);
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 1127ebdf5fec..3f2aca20a625 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -337,13 +337,11 @@ static int snd_vt1724_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
337 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); 337 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
338 unsigned char what; 338 unsigned char what;
339 unsigned char old; 339 unsigned char old;
340 struct list_head *pos;
341 struct snd_pcm_substream *s; 340 struct snd_pcm_substream *s;
342 341
343 what = 0; 342 what = 0;
344 snd_pcm_group_for_each(pos, substream) { 343 snd_pcm_group_for_each_entry(s, substream) {
345 const struct vt1724_pcm_reg *reg; 344 const struct vt1724_pcm_reg *reg;
346 s = snd_pcm_group_substream_entry(pos);
347 reg = s->runtime->private_data; 345 reg = s->runtime->private_data;
348 what |= reg->start; 346 what |= reg->start;
349 snd_pcm_trigger_done(s, substream); 347 snd_pcm_trigger_done(s, substream);
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index d97413484ae9..e1bdeed3a465 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -638,7 +638,6 @@ static void pcxhr_trigger_tasklet(unsigned long arg)
638static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd) 638static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd)
639{ 639{
640 struct pcxhr_stream *stream; 640 struct pcxhr_stream *stream;
641 struct list_head *pos;
642 struct snd_pcm_substream *s; 641 struct snd_pcm_substream *s;
643 int i; 642 int i;
644 643
@@ -646,8 +645,7 @@ static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd)
646 case SNDRV_PCM_TRIGGER_START: 645 case SNDRV_PCM_TRIGGER_START:
647 snd_printdd("SNDRV_PCM_TRIGGER_START\n"); 646 snd_printdd("SNDRV_PCM_TRIGGER_START\n");
648 i = 0; 647 i = 0;
649 snd_pcm_group_for_each(pos, subs) { 648 snd_pcm_group_for_each_entry(s, subs) {
650 s = snd_pcm_group_substream_entry(pos);
651 stream = s->runtime->private_data; 649 stream = s->runtime->private_data;
652 stream->status = PCXHR_STREAM_STATUS_SCHEDULE_RUN; 650 stream->status = PCXHR_STREAM_STATUS_SCHEDULE_RUN;
653 snd_pcm_trigger_done(s, subs); 651 snd_pcm_trigger_done(s, subs);
@@ -672,8 +670,7 @@ static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd)
672 break; 670 break;
673 case SNDRV_PCM_TRIGGER_STOP: 671 case SNDRV_PCM_TRIGGER_STOP:
674 snd_printdd("SNDRV_PCM_TRIGGER_STOP\n"); 672 snd_printdd("SNDRV_PCM_TRIGGER_STOP\n");
675 snd_pcm_group_for_each(pos, subs) { 673 snd_pcm_group_for_each_entry(s, subs) {
676 s = snd_pcm_group_substream_entry(pos);
677 stream = s->runtime->private_data; 674 stream = s->runtime->private_data;
678 stream->status = PCXHR_STREAM_STATUS_SCHEDULE_STOP; 675 stream->status = PCXHR_STREAM_STATUS_SCHEDULE_STOP;
679 if (pcxhr_set_stream_state(stream)) 676 if (pcxhr_set_stream_state(stream))
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 6bb7ac650ec4..618653e22561 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1078,12 +1078,10 @@ static int
1078snd_rme32_pcm_trigger(struct snd_pcm_substream *substream, int cmd) 1078snd_rme32_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1079{ 1079{
1080 struct rme32 *rme32 = snd_pcm_substream_chip(substream); 1080 struct rme32 *rme32 = snd_pcm_substream_chip(substream);
1081 struct list_head *pos;
1082 struct snd_pcm_substream *s; 1081 struct snd_pcm_substream *s;
1083 1082
1084 spin_lock(&rme32->lock); 1083 spin_lock(&rme32->lock);
1085 snd_pcm_group_for_each(pos, substream) { 1084 snd_pcm_group_for_each_entry(s, substream) {
1086 s = snd_pcm_group_substream_entry(pos);
1087 if (s != rme32->playback_substream && 1085 if (s != rme32->playback_substream &&
1088 s != rme32->capture_substream) 1086 s != rme32->capture_substream)
1089 continue; 1087 continue;
@@ -1110,8 +1108,7 @@ snd_rme32_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1110 1108
1111 /* prefill playback buffer */ 1109 /* prefill playback buffer */
1112 if (cmd == SNDRV_PCM_TRIGGER_START && rme32->fullduplex_mode) { 1110 if (cmd == SNDRV_PCM_TRIGGER_START && rme32->fullduplex_mode) {
1113 snd_pcm_group_for_each(pos, substream) { 1111 snd_pcm_group_for_each_entry(s, substream) {
1114 s = snd_pcm_group_substream_entry(pos);
1115 if (s == rme32->playback_substream) { 1112 if (s == rme32->playback_substream) {
1116 s->ops->ack(s); 1113 s->ops->ack(s);
1117 break; 1114 break;
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 89b3c7ff5037..6540037a11e4 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -3780,11 +3780,9 @@ static int snd_hdsp_reset(struct snd_pcm_substream *substream)
3780 else 3780 else
3781 runtime->status->hw_ptr = 0; 3781 runtime->status->hw_ptr = 0;
3782 if (other) { 3782 if (other) {
3783 struct list_head *pos;
3784 struct snd_pcm_substream *s; 3783 struct snd_pcm_substream *s;
3785 struct snd_pcm_runtime *oruntime = other->runtime; 3784 struct snd_pcm_runtime *oruntime = other->runtime;
3786 snd_pcm_group_for_each(pos, substream) { 3785 snd_pcm_group_for_each_entry(s, substream) {
3787 s = snd_pcm_group_substream_entry(pos);
3788 if (s == other) { 3786 if (s == other) {
3789 oruntime->status->hw_ptr = runtime->status->hw_ptr; 3787 oruntime->status->hw_ptr = runtime->status->hw_ptr;
3790 break; 3788 break;
@@ -3933,10 +3931,8 @@ static int snd_hdsp_trigger(struct snd_pcm_substream *substream, int cmd)
3933 other = hdsp->playback_substream; 3931 other = hdsp->playback_substream;
3934 3932
3935 if (other) { 3933 if (other) {
3936 struct list_head *pos;
3937 struct snd_pcm_substream *s; 3934 struct snd_pcm_substream *s;
3938 snd_pcm_group_for_each(pos, substream) { 3935 snd_pcm_group_for_each_entry(s, substream) {
3939 s = snd_pcm_group_substream_entry(pos);
3940 if (s == other) { 3936 if (s == other) {
3941 snd_pcm_trigger_done(s, substream); 3937 snd_pcm_trigger_done(s, substream);
3942 if (cmd == SNDRV_PCM_TRIGGER_START) 3938 if (cmd == SNDRV_PCM_TRIGGER_START)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 6e95857e4e67..d2ae6380943e 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -3575,11 +3575,9 @@ static int snd_hdspm_reset(struct snd_pcm_substream *substream)
3575 else 3575 else
3576 runtime->status->hw_ptr = 0; 3576 runtime->status->hw_ptr = 0;
3577 if (other) { 3577 if (other) {
3578 struct list_head *pos;
3579 struct snd_pcm_substream *s; 3578 struct snd_pcm_substream *s;
3580 struct snd_pcm_runtime *oruntime = other->runtime; 3579 struct snd_pcm_runtime *oruntime = other->runtime;
3581 snd_pcm_group_for_each(pos, substream) { 3580 snd_pcm_group_for_each_entry(s, substream) {
3582 s = snd_pcm_group_substream_entry(pos);
3583 if (s == other) { 3581 if (s == other) {
3584 oruntime->status->hw_ptr = 3582 oruntime->status->hw_ptr =
3585 runtime->status->hw_ptr; 3583 runtime->status->hw_ptr;
@@ -3791,10 +3789,8 @@ static int snd_hdspm_trigger(struct snd_pcm_substream *substream, int cmd)
3791 other = hdspm->playback_substream; 3789 other = hdspm->playback_substream;
3792 3790
3793 if (other) { 3791 if (other) {
3794 struct list_head *pos;
3795 struct snd_pcm_substream *s; 3792 struct snd_pcm_substream *s;
3796 snd_pcm_group_for_each(pos, substream) { 3793 snd_pcm_group_for_each_entry(s, substream) {
3797 s = snd_pcm_group_substream_entry(pos);
3798 if (s == other) { 3794 if (s == other) {
3799 snd_pcm_trigger_done(s, substream); 3795 snd_pcm_trigger_done(s, substream);
3800 if (cmd == SNDRV_PCM_TRIGGER_START) 3796 if (cmd == SNDRV_PCM_TRIGGER_START)
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index cc3bdececce7..bd7dbd267ed1 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -1992,11 +1992,9 @@ static int snd_rme9652_reset(struct snd_pcm_substream *substream)
1992 else 1992 else
1993 runtime->status->hw_ptr = 0; 1993 runtime->status->hw_ptr = 0;
1994 if (other) { 1994 if (other) {
1995 struct list_head *pos;
1996 struct snd_pcm_substream *s; 1995 struct snd_pcm_substream *s;
1997 struct snd_pcm_runtime *oruntime = other->runtime; 1996 struct snd_pcm_runtime *oruntime = other->runtime;
1998 snd_pcm_group_for_each(pos, substream) { 1997 snd_pcm_group_for_each_entry(s, substream) {
1999 s = snd_pcm_group_substream_entry(pos);
2000 if (s == other) { 1998 if (s == other) {
2001 oruntime->status->hw_ptr = runtime->status->hw_ptr; 1999 oruntime->status->hw_ptr = runtime->status->hw_ptr;
2002 break; 2000 break;
@@ -2140,10 +2138,8 @@ static int snd_rme9652_trigger(struct snd_pcm_substream *substream,
2140 other = rme9652->playback_substream; 2138 other = rme9652->playback_substream;
2141 2139
2142 if (other) { 2140 if (other) {
2143 struct list_head *pos;
2144 struct snd_pcm_substream *s; 2141 struct snd_pcm_substream *s;
2145 snd_pcm_group_for_each(pos, substream) { 2142 snd_pcm_group_for_each_entry(s, substream) {
2146 s = snd_pcm_group_substream_entry(pos);
2147 if (s == other) { 2143 if (s == other) {
2148 snd_pcm_trigger_done(s, substream); 2144 snd_pcm_trigger_done(s, substream);
2149 if (cmd == SNDRV_PCM_TRIGGER_START) 2145 if (cmd == SNDRV_PCM_TRIGGER_START)
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 3bff32167f66..7ca606272460 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -1540,7 +1540,6 @@ static int snd_trident_trigger(struct snd_pcm_substream *substream,
1540 1540
1541{ 1541{
1542 struct snd_trident *trident = snd_pcm_substream_chip(substream); 1542 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1543 struct list_head *pos;
1544 struct snd_pcm_substream *s; 1543 struct snd_pcm_substream *s;
1545 unsigned int what, whati, capture_flag, spdif_flag; 1544 unsigned int what, whati, capture_flag, spdif_flag;
1546 struct snd_trident_voice *voice, *evoice; 1545 struct snd_trident_voice *voice, *evoice;
@@ -1563,8 +1562,7 @@ static int snd_trident_trigger(struct snd_pcm_substream *substream,
1563 what = whati = capture_flag = spdif_flag = 0; 1562 what = whati = capture_flag = spdif_flag = 0;
1564 spin_lock(&trident->reg_lock); 1563 spin_lock(&trident->reg_lock);
1565 val = inl(TRID_REG(trident, T4D_STIMER)) & 0x00ffffff; 1564 val = inl(TRID_REG(trident, T4D_STIMER)) & 0x00ffffff;
1566 snd_pcm_group_for_each(pos, substream) { 1565 snd_pcm_group_for_each_entry(s, substream) {
1567 s = snd_pcm_group_substream_entry(pos);
1568 if ((struct snd_trident *) snd_pcm_substream_chip(s) == trident) { 1566 if ((struct snd_trident *) snd_pcm_substream_chip(s) == trident) {
1569 voice = s->runtime->private_data; 1567 voice = s->runtime->private_data;
1570 evoice = voice->extra; 1568 evoice = voice->extra;
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 900a00de35fd..96d51abcb73a 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -661,10 +661,9 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream, int cmd)
661 { 661 {
662 unsigned int what = 0; 662 unsigned int what = 0;
663 struct snd_pcm_substream *s; 663 struct snd_pcm_substream *s;
664 struct list_head *pos;
665 unsigned long flags; 664 unsigned long flags;
666 665
667 snd_pcm_group_for_each(pos, substream) { 666 snd_pcm_group_for_each_entry(s, substream) {
668 s = snd_pcm_group_substream_entry(pos); 667 s = snd_pcm_group_substream_entry(pos);
669 if (s == chip->playback_substream) { 668 if (s == chip->playback_substream) {
670 what |= CS4231_PLAYBACK_ENABLE; 669 what |= CS4231_PLAYBACK_ENABLE;