diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2006-10-05 16:02:22 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-02-09 09:00:10 +0100 |
commit | 9244b2c3079faac79b3b961116bd548c45087e2c (patch) | |
tree | 1a9e2ead054ed58efcad3fd43fb2aedeb6731baa /sound/core/control.c | |
parent | d595ee7e0162ae66faa8c4c7d8c2069b40d64fed (diff) |
[ALSA] alsa core: convert to list_for_each_entry*
This patch converts most uses of list_for_each to list_for_each_entry all
across alsa. In some place apparently an item can be on a list with
different pointers so of course that isn't compatible with list_for_each, I
therefore didn't touch those places.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r-- | sound/core/control.c | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 0c7bcd62e5b2..67f09b8f85e4 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -108,7 +108,6 @@ static void snd_ctl_empty_read_queue(struct snd_ctl_file * ctl) static int snd_ctl_release(struct inode *inode, struct file *file) { unsigned long flags; - struct list_head *list; struct snd_card *card; struct snd_ctl_file *ctl; struct snd_kcontrol *control; @@ -122,12 +121,10 @@ static int snd_ctl_release(struct inode *inode, struct file *file) list_del(&ctl->list); write_unlock_irqrestore(&card->ctl_files_rwlock, flags); down_write(&card->controls_rwsem); - list_for_each(list, &card->controls) { - control = snd_kcontrol(list); + list_for_each_entry(control, &card->controls, list) for (idx = 0; idx < control->count; idx++) if (control->vd[idx].owner == ctl) control->vd[idx].owner = NULL; - } up_write(&card->controls_rwsem); snd_ctl_empty_read_queue(ctl); kfree(ctl); @@ -140,7 +137,6 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, struct snd_ctl_elem_id *id) { unsigned long flags; - struct list_head *flist; struct snd_ctl_file *ctl; struct snd_kctl_event *ev; @@ -149,14 +145,11 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) card->mixer_oss_change_count++; #endif - list_for_each(flist, &card->ctl_files) { - struct list_head *elist; - ctl = snd_ctl_file(flist); + list_for_each_entry(ctl, &card->ctl_files, list) { if (!ctl->subscribed) continue; spin_lock_irqsave(&ctl->read_lock, flags); - list_for_each(elist, &ctl->events) { - ev = snd_kctl_event(elist); + list_for_each_entry(ev, &ctl->events, list) { if (ev->id.numid == id->numid) { ev->mask |= mask; goto _found; @@ -277,11 +270,9 @@ EXPORT_SYMBOL(snd_ctl_free_one); static unsigned int snd_ctl_hole_check(struct snd_card *card, unsigned int count) { - struct list_head *list; struct snd_kcontrol *kctl; - list_for_each(list, &card->controls) { - kctl = snd_kcontrol(list); + list_for_each_entry(kctl, &card->controls, list) { if ((kctl->id.numid <= card->last_numid && kctl->id.numid + kctl->count > card->last_numid) || (kctl->id.numid <= card->last_numid + count - 1 && @@ -498,12 +489,10 @@ EXPORT_SYMBOL(snd_ctl_rename_id); */ struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numid) { - struct list_head *list; struct snd_kcontrol *kctl; snd_assert(card != NULL && numid != 0, return NULL); - list_for_each(list, &card->controls) { - kctl = snd_kcontrol(list); + list_for_each_entry(kctl, &card->controls, list) { if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid) return kctl; } @@ -527,14 +516,12 @@ EXPORT_SYMBOL(snd_ctl_find_numid); struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, struct snd_ctl_elem_id *id) { - struct list_head *list; struct snd_kcontrol *kctl; snd_assert(card != NULL && id != NULL, return NULL); if (id->numid != 0) return snd_ctl_find_numid(card, id->numid); - list_for_each(list, &card->controls) { - kctl = snd_kcontrol(list); + list_for_each_entry(kctl, &card->controls, list) { if (kctl->id.iface != id->iface) continue; if (kctl->id.device != id->device) @@ -1182,7 +1169,6 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg { struct snd_ctl_file *ctl; struct snd_card *card; - struct list_head *list; struct snd_kctl_ioctl *p; void __user *argp = (void __user *)arg; int __user *ip = argp; @@ -1232,8 +1218,7 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg #endif } down_read(&snd_ioctl_rwsem); - list_for_each(list, &snd_control_ioctls) { - p = list_entry(list, struct snd_kctl_ioctl, list); + list_for_each_entry(p, &snd_control_ioctls, list) { err = p->fioctl(card, ctl, cmd, arg); if (err != -ENOIOCTLCMD) { up_read(&snd_ioctl_rwsem); @@ -1357,13 +1342,11 @@ EXPORT_SYMBOL(snd_ctl_register_ioctl_compat); static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *lists) { - struct list_head *list; struct snd_kctl_ioctl *p; snd_assert(fcn != NULL, return -EINVAL); down_write(&snd_ioctl_rwsem); - list_for_each(list, lists) { - p = list_entry(list, struct snd_kctl_ioctl, list); + list_for_each_entry(p, lists, list) { if (p->fioctl == fcn) { list_del(&p->list); up_write(&snd_ioctl_rwsem); @@ -1453,7 +1436,6 @@ static int snd_ctl_dev_register(struct snd_device *device) static int snd_ctl_dev_disconnect(struct snd_device *device) { struct snd_card *card = device->device_data; - struct list_head *flist; struct snd_ctl_file *ctl; int err, cardnum; @@ -1462,8 +1444,7 @@ static int snd_ctl_dev_disconnect(struct snd_device *device) snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO); down_read(&card->controls_rwsem); - list_for_each(flist, &card->ctl_files) { - ctl = snd_ctl_file(flist); + list_for_each_entry(ctl, &card->ctl_files, list) { wake_up(&ctl->change_sleep); kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); } |