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>
read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \
} while (0)
-#define snd_pcm_group_for_each(pos, substream) \
- list_for_each(pos, &substream->group->substreams)
-
-#define snd_pcm_group_substream_entry(pos) \
- list_entry(pos, struct snd_pcm_substream, link_list)
+#define snd_pcm_group_for_each_entry(s, substream) \
+ list_for_each_entry(s, &substream->group->substreams, link_list)
static inline int snd_pcm_running(struct snd_pcm_substream *substream)
{
struct snd_pcm_substream *substream,
int state, int do_lock)
{
- struct list_head *pos;
struct snd_pcm_substream *s = NULL;
struct snd_pcm_substream *s1;
int res = 0;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (do_lock && s != substream)
spin_lock(&s->self_group.lock);
res = ops->pre_action(s, state);
if (res < 0)
goto _unlock;
}
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
res = ops->do_action(s, state);
if (res < 0) {
if (ops->undo_action) {
- snd_pcm_group_for_each(pos, substream) {
- s1 = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s1, substream) {
if (s1 == s) /* failed stream */
break;
ops->undo_action(s1, state);
goto _unlock;
}
}
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
ops->post_action(s, state);
}
_unlock:
if (do_lock) {
/* unlock streams */
- snd_pcm_group_for_each(pos, substream) {
- s1 = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s1, substream) {
if (s1 != substream)
spin_unlock(&s1->self_group.lock);
if (s1 == s) /* end */
{
struct snd_card *card;
struct snd_pcm_runtime *runtime;
- struct list_head *pos;
+ struct snd_pcm_substream *s;
int result = 0;
int i, num_drecs;
struct drain_rec *drec, drec_tmp, *d;
/* count only playback streams */
num_drecs = 0;
- snd_pcm_group_for_each(pos, substream) {
- struct snd_pcm_substream *s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
runtime = s->runtime;
if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
d = &drec[num_drecs++];
static int snd_pcm_unlink(struct snd_pcm_substream *substream)
{
- struct list_head *pos;
+ struct snd_pcm_substream *s;
int res = 0;
down_write(&snd_pcm_link_rwsem);
list_del(&substream->link_list);
substream->group->count--;
if (substream->group->count == 1) { /* detach the last stream, too */
- snd_pcm_group_for_each(pos, substream) {
- relink_to_local(snd_pcm_group_substream_entry(pos));
+ snd_pcm_group_for_each_entry(s, substream) {
+ relink_to_local(s);
break;
}
kfree(substream->group);
struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
int result = 0;
unsigned int what;
- struct list_head *pos;
struct snd_pcm_substream *s;
int do_start;
}
what = 0;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == chip->playback_substream) {
what |= CS4231_PLAYBACK_ENABLE;
snd_pcm_trigger_done(s, substream);
case SNDRV_PCM_TRIGGER_STOP:
{
unsigned int what = 0;
- struct list_head *pos;
struct snd_pcm_substream *s;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == chip->playback_substream) {
what |= OPTi93X_PLAYBACK_ENABLE;
snd_pcm_trigger_done(s, substream);
{
struct snd_ali *codec = snd_pcm_substream_chip(substream);
- struct list_head *pos;
struct snd_pcm_substream *s;
unsigned int what, whati, capture_flag;
struct snd_ali_voice *pvoice = NULL, *evoice = NULL;
}
what = whati = capture_flag = 0;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if ((struct snd_ali *) snd_pcm_substream_chip(s) == codec) {
pvoice = s->runtime->private_data;
evoice = pvoice->extra;
struct snd_ca0106_pcm *epcm;
int channel;
int result = 0;
- struct list_head *pos;
struct snd_pcm_substream *s;
u32 basic = 0;
u32 extended = 0;
running=0;
break;
}
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
runtime = s->runtime;
epcm = runtime->private_data;
channel = epcm->channel_id;
struct audiopipe *pipe = runtime->private_data;
int i, err;
u32 channelmask = 0;
- struct list_head *pos;
struct snd_pcm_substream *s;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
for (i = 0; i < DSP_MAXPIPES; i++) {
if (s == chip->substream[i]) {
channelmask |= 1 << i;
struct snd_emu10k1_pcm *epcm;
int channel;
int result = 0;
- struct list_head *pos;
struct snd_pcm_substream *s;
u32 basic = 0;
u32 inte = 0;
running = 0;
break;
}
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
runtime = s->runtime;
epcm = runtime->private_data;
channel = substream->pcm->device-emu->p16v_device_offset;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
{
unsigned int what = 0;
- struct list_head *pos;
struct snd_pcm_substream *s;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == ensoniq->playback1_substream) {
what |= ES_P1_PAUSE;
snd_pcm_trigger_done(s, substream);
case SNDRV_PCM_TRIGGER_STOP:
{
unsigned int what = 0;
- struct list_head *pos;
struct snd_pcm_substream *s;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == ensoniq->playback1_substream) {
what |= ES_DAC1_EN;
snd_pcm_trigger_done(s, substream);
{
unsigned int what = 0;
unsigned int old;
- struct list_head *pos;
struct snd_pcm_substream *s;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == ice->playback_pro_substream) {
what |= ICE1712_PLAYBACK_START;
snd_pcm_trigger_done(s, substream);
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
unsigned char what;
unsigned char old;
- struct list_head *pos;
struct snd_pcm_substream *s;
what = 0;
- snd_pcm_group_for_each(pos, substream) {
+ snd_pcm_group_for_each_entry(s, substream) {
const struct vt1724_pcm_reg *reg;
- s = snd_pcm_group_substream_entry(pos);
reg = s->runtime->private_data;
what |= reg->start;
snd_pcm_trigger_done(s, substream);
static int pcxhr_trigger(struct snd_pcm_substream *subs, int cmd)
{
struct pcxhr_stream *stream;
- struct list_head *pos;
struct snd_pcm_substream *s;
int i;
case SNDRV_PCM_TRIGGER_START:
snd_printdd("SNDRV_PCM_TRIGGER_START\n");
i = 0;
- snd_pcm_group_for_each(pos, subs) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, subs) {
stream = s->runtime->private_data;
stream->status = PCXHR_STREAM_STATUS_SCHEDULE_RUN;
snd_pcm_trigger_done(s, subs);
break;
case SNDRV_PCM_TRIGGER_STOP:
snd_printdd("SNDRV_PCM_TRIGGER_STOP\n");
- snd_pcm_group_for_each(pos, subs) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, subs) {
stream = s->runtime->private_data;
stream->status = PCXHR_STREAM_STATUS_SCHEDULE_STOP;
if (pcxhr_set_stream_state(stream))
snd_rme32_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct rme32 *rme32 = snd_pcm_substream_chip(substream);
- struct list_head *pos;
struct snd_pcm_substream *s;
spin_lock(&rme32->lock);
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s != rme32->playback_substream &&
s != rme32->capture_substream)
continue;
/* prefill playback buffer */
if (cmd == SNDRV_PCM_TRIGGER_START && rme32->fullduplex_mode) {
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == rme32->playback_substream) {
s->ops->ack(s);
break;
else
runtime->status->hw_ptr = 0;
if (other) {
- struct list_head *pos;
struct snd_pcm_substream *s;
struct snd_pcm_runtime *oruntime = other->runtime;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == other) {
oruntime->status->hw_ptr = runtime->status->hw_ptr;
break;
other = hdsp->playback_substream;
if (other) {
- struct list_head *pos;
struct snd_pcm_substream *s;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == other) {
snd_pcm_trigger_done(s, substream);
if (cmd == SNDRV_PCM_TRIGGER_START)
else
runtime->status->hw_ptr = 0;
if (other) {
- struct list_head *pos;
struct snd_pcm_substream *s;
struct snd_pcm_runtime *oruntime = other->runtime;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == other) {
oruntime->status->hw_ptr =
runtime->status->hw_ptr;
other = hdspm->playback_substream;
if (other) {
- struct list_head *pos;
struct snd_pcm_substream *s;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == other) {
snd_pcm_trigger_done(s, substream);
if (cmd == SNDRV_PCM_TRIGGER_START)
else
runtime->status->hw_ptr = 0;
if (other) {
- struct list_head *pos;
struct snd_pcm_substream *s;
struct snd_pcm_runtime *oruntime = other->runtime;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == other) {
oruntime->status->hw_ptr = runtime->status->hw_ptr;
break;
other = rme9652->playback_substream;
if (other) {
- struct list_head *pos;
struct snd_pcm_substream *s;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if (s == other) {
snd_pcm_trigger_done(s, substream);
if (cmd == SNDRV_PCM_TRIGGER_START)
{
struct snd_trident *trident = snd_pcm_substream_chip(substream);
- struct list_head *pos;
struct snd_pcm_substream *s;
unsigned int what, whati, capture_flag, spdif_flag;
struct snd_trident_voice *voice, *evoice;
what = whati = capture_flag = spdif_flag = 0;
spin_lock(&trident->reg_lock);
val = inl(TRID_REG(trident, T4D_STIMER)) & 0x00ffffff;
- snd_pcm_group_for_each(pos, substream) {
- s = snd_pcm_group_substream_entry(pos);
+ snd_pcm_group_for_each_entry(s, substream) {
if ((struct snd_trident *) snd_pcm_substream_chip(s) == trident) {
voice = s->runtime->private_data;
evoice = voice->extra;
{
unsigned int what = 0;
struct snd_pcm_substream *s;
- struct list_head *pos;
unsigned long flags;
- snd_pcm_group_for_each(pos, substream) {
+ snd_pcm_group_for_each_entry(s, substream) {
s = snd_pcm_group_substream_entry(pos);
if (s == chip->playback_substream) {
what |= CS4231_PLAYBACK_ENABLE;