提交 9244b2c3 编写于 作者: J Johannes Berg 提交者: Jaroslav Kysela

[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: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NJaroslav Kysela <perex@suse.cz>
上级 d595ee7e
...@@ -108,7 +108,6 @@ static void snd_ctl_empty_read_queue(struct snd_ctl_file * ctl) ...@@ -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) static int snd_ctl_release(struct inode *inode, struct file *file)
{ {
unsigned long flags; unsigned long flags;
struct list_head *list;
struct snd_card *card; struct snd_card *card;
struct snd_ctl_file *ctl; struct snd_ctl_file *ctl;
struct snd_kcontrol *control; struct snd_kcontrol *control;
...@@ -122,12 +121,10 @@ static int snd_ctl_release(struct inode *inode, struct file *file) ...@@ -122,12 +121,10 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
list_del(&ctl->list); list_del(&ctl->list);
write_unlock_irqrestore(&card->ctl_files_rwlock, flags); write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
down_write(&card->controls_rwsem); down_write(&card->controls_rwsem);
list_for_each(list, &card->controls) { list_for_each_entry(control, &card->controls, list)
control = snd_kcontrol(list);
for (idx = 0; idx < control->count; idx++) for (idx = 0; idx < control->count; idx++)
if (control->vd[idx].owner == ctl) if (control->vd[idx].owner == ctl)
control->vd[idx].owner = NULL; control->vd[idx].owner = NULL;
}
up_write(&card->controls_rwsem); up_write(&card->controls_rwsem);
snd_ctl_empty_read_queue(ctl); snd_ctl_empty_read_queue(ctl);
kfree(ctl); kfree(ctl);
...@@ -140,7 +137,6 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, ...@@ -140,7 +137,6 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask,
struct snd_ctl_elem_id *id) struct snd_ctl_elem_id *id)
{ {
unsigned long flags; unsigned long flags;
struct list_head *flist;
struct snd_ctl_file *ctl; struct snd_ctl_file *ctl;
struct snd_kctl_event *ev; struct snd_kctl_event *ev;
...@@ -149,14 +145,11 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, ...@@ -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) #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
card->mixer_oss_change_count++; card->mixer_oss_change_count++;
#endif #endif
list_for_each(flist, &card->ctl_files) { list_for_each_entry(ctl, &card->ctl_files, list) {
struct list_head *elist;
ctl = snd_ctl_file(flist);
if (!ctl->subscribed) if (!ctl->subscribed)
continue; continue;
spin_lock_irqsave(&ctl->read_lock, flags); spin_lock_irqsave(&ctl->read_lock, flags);
list_for_each(elist, &ctl->events) { list_for_each_entry(ev, &ctl->events, list) {
ev = snd_kctl_event(elist);
if (ev->id.numid == id->numid) { if (ev->id.numid == id->numid) {
ev->mask |= mask; ev->mask |= mask;
goto _found; goto _found;
...@@ -277,11 +270,9 @@ EXPORT_SYMBOL(snd_ctl_free_one); ...@@ -277,11 +270,9 @@ EXPORT_SYMBOL(snd_ctl_free_one);
static unsigned int snd_ctl_hole_check(struct snd_card *card, static unsigned int snd_ctl_hole_check(struct snd_card *card,
unsigned int count) unsigned int count)
{ {
struct list_head *list;
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
list_for_each(list, &card->controls) { list_for_each_entry(kctl, &card->controls, list) {
kctl = snd_kcontrol(list);
if ((kctl->id.numid <= card->last_numid && if ((kctl->id.numid <= card->last_numid &&
kctl->id.numid + kctl->count > card->last_numid) || kctl->id.numid + kctl->count > card->last_numid) ||
(kctl->id.numid <= card->last_numid + count - 1 && (kctl->id.numid <= card->last_numid + count - 1 &&
...@@ -498,12 +489,10 @@ EXPORT_SYMBOL(snd_ctl_rename_id); ...@@ -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 snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numid)
{ {
struct list_head *list;
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
snd_assert(card != NULL && numid != 0, return NULL); snd_assert(card != NULL && numid != 0, return NULL);
list_for_each(list, &card->controls) { list_for_each_entry(kctl, &card->controls, list) {
kctl = snd_kcontrol(list);
if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid) if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid)
return kctl; return kctl;
} }
...@@ -527,14 +516,12 @@ EXPORT_SYMBOL(snd_ctl_find_numid); ...@@ -527,14 +516,12 @@ EXPORT_SYMBOL(snd_ctl_find_numid);
struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card,
struct snd_ctl_elem_id *id) struct snd_ctl_elem_id *id)
{ {
struct list_head *list;
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
snd_assert(card != NULL && id != NULL, return NULL); snd_assert(card != NULL && id != NULL, return NULL);
if (id->numid != 0) if (id->numid != 0)
return snd_ctl_find_numid(card, id->numid); return snd_ctl_find_numid(card, id->numid);
list_for_each(list, &card->controls) { list_for_each_entry(kctl, &card->controls, list) {
kctl = snd_kcontrol(list);
if (kctl->id.iface != id->iface) if (kctl->id.iface != id->iface)
continue; continue;
if (kctl->id.device != id->device) if (kctl->id.device != id->device)
...@@ -1182,7 +1169,6 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -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_ctl_file *ctl;
struct snd_card *card; struct snd_card *card;
struct list_head *list;
struct snd_kctl_ioctl *p; struct snd_kctl_ioctl *p;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int __user *ip = argp; int __user *ip = argp;
...@@ -1232,8 +1218,7 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg ...@@ -1232,8 +1218,7 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg
#endif #endif
} }
down_read(&snd_ioctl_rwsem); down_read(&snd_ioctl_rwsem);
list_for_each(list, &snd_control_ioctls) { list_for_each_entry(p, &snd_control_ioctls, list) {
p = list_entry(list, struct snd_kctl_ioctl, list);
err = p->fioctl(card, ctl, cmd, arg); err = p->fioctl(card, ctl, cmd, arg);
if (err != -ENOIOCTLCMD) { if (err != -ENOIOCTLCMD) {
up_read(&snd_ioctl_rwsem); up_read(&snd_ioctl_rwsem);
...@@ -1357,13 +1342,11 @@ EXPORT_SYMBOL(snd_ctl_register_ioctl_compat); ...@@ -1357,13 +1342,11 @@ EXPORT_SYMBOL(snd_ctl_register_ioctl_compat);
static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn,
struct list_head *lists) struct list_head *lists)
{ {
struct list_head *list;
struct snd_kctl_ioctl *p; struct snd_kctl_ioctl *p;
snd_assert(fcn != NULL, return -EINVAL); snd_assert(fcn != NULL, return -EINVAL);
down_write(&snd_ioctl_rwsem); down_write(&snd_ioctl_rwsem);
list_for_each(list, lists) { list_for_each_entry(p, lists, list) {
p = list_entry(list, struct snd_kctl_ioctl, list);
if (p->fioctl == fcn) { if (p->fioctl == fcn) {
list_del(&p->list); list_del(&p->list);
up_write(&snd_ioctl_rwsem); up_write(&snd_ioctl_rwsem);
...@@ -1453,7 +1436,6 @@ static int snd_ctl_dev_register(struct snd_device *device) ...@@ -1453,7 +1436,6 @@ static int snd_ctl_dev_register(struct snd_device *device)
static int snd_ctl_dev_disconnect(struct snd_device *device) static int snd_ctl_dev_disconnect(struct snd_device *device)
{ {
struct snd_card *card = device->device_data; struct snd_card *card = device->device_data;
struct list_head *flist;
struct snd_ctl_file *ctl; struct snd_ctl_file *ctl;
int err, cardnum; int err, cardnum;
...@@ -1462,8 +1444,7 @@ static int snd_ctl_dev_disconnect(struct snd_device *device) ...@@ -1462,8 +1444,7 @@ static int snd_ctl_dev_disconnect(struct snd_device *device)
snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO); snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO);
down_read(&card->controls_rwsem); down_read(&card->controls_rwsem);
list_for_each(flist, &card->ctl_files) { list_for_each_entry(ctl, &card->ctl_files, list) {
ctl = snd_ctl_file(flist);
wake_up(&ctl->change_sleep); wake_up(&ctl->change_sleep);
kill_fasync(&ctl->fasync, SIGIO, POLL_ERR); kill_fasync(&ctl->fasync, SIGIO, POLL_ERR);
} }
......
...@@ -392,7 +392,7 @@ enum { ...@@ -392,7 +392,7 @@ enum {
static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct snd_ctl_file *ctl; struct snd_ctl_file *ctl;
struct list_head *list; struct snd_kctl_ioctl *p;
void __user *argp = compat_ptr(arg); void __user *argp = compat_ptr(arg);
int err; int err;
...@@ -427,8 +427,7 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns ...@@ -427,8 +427,7 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns
} }
down_read(&snd_ioctl_rwsem); down_read(&snd_ioctl_rwsem);
list_for_each(list, &snd_control_compat_ioctls) { list_for_each_entry(p, &snd_control_compat_ioctls, list) {
struct snd_kctl_ioctl *p = list_entry(list, struct snd_kctl_ioctl, list);
if (p->fioctl) { if (p->fioctl) {
err = p->fioctl(ctl->card, ctl, cmd, arg); err = p->fioctl(ctl->card, ctl, cmd, arg);
if (err != -ENOIOCTLCMD) { if (err != -ENOIOCTLCMD) {
......
...@@ -79,13 +79,11 @@ EXPORT_SYMBOL(snd_device_new); ...@@ -79,13 +79,11 @@ EXPORT_SYMBOL(snd_device_new);
*/ */
int snd_device_free(struct snd_card *card, void *device_data) int snd_device_free(struct snd_card *card, void *device_data)
{ {
struct list_head *list;
struct snd_device *dev; struct snd_device *dev;
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
snd_assert(device_data != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO);
list_for_each(list, &card->devices) { list_for_each_entry(dev, &card->devices, list) {
dev = snd_device(list);
if (dev->device_data != device_data) if (dev->device_data != device_data)
continue; continue;
/* unlink */ /* unlink */
...@@ -124,13 +122,11 @@ EXPORT_SYMBOL(snd_device_free); ...@@ -124,13 +122,11 @@ EXPORT_SYMBOL(snd_device_free);
*/ */
int snd_device_disconnect(struct snd_card *card, void *device_data) int snd_device_disconnect(struct snd_card *card, void *device_data)
{ {
struct list_head *list;
struct snd_device *dev; struct snd_device *dev;
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
snd_assert(device_data != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO);
list_for_each(list, &card->devices) { list_for_each_entry(dev, &card->devices, list) {
dev = snd_device(list);
if (dev->device_data != device_data) if (dev->device_data != device_data)
continue; continue;
if (dev->state == SNDRV_DEV_REGISTERED && if (dev->state == SNDRV_DEV_REGISTERED &&
...@@ -161,14 +157,12 @@ int snd_device_disconnect(struct snd_card *card, void *device_data) ...@@ -161,14 +157,12 @@ int snd_device_disconnect(struct snd_card *card, void *device_data)
*/ */
int snd_device_register(struct snd_card *card, void *device_data) int snd_device_register(struct snd_card *card, void *device_data)
{ {
struct list_head *list;
struct snd_device *dev; struct snd_device *dev;
int err; int err;
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
snd_assert(device_data != NULL, return -ENXIO); snd_assert(device_data != NULL, return -ENXIO);
list_for_each(list, &card->devices) { list_for_each_entry(dev, &card->devices, list) {
dev = snd_device(list);
if (dev->device_data != device_data) if (dev->device_data != device_data)
continue; continue;
if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) {
...@@ -192,13 +186,11 @@ EXPORT_SYMBOL(snd_device_register); ...@@ -192,13 +186,11 @@ EXPORT_SYMBOL(snd_device_register);
*/ */
int snd_device_register_all(struct snd_card *card) int snd_device_register_all(struct snd_card *card)
{ {
struct list_head *list;
struct snd_device *dev; struct snd_device *dev;
int err; int err;
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
list_for_each(list, &card->devices) { list_for_each_entry(dev, &card->devices, list) {
dev = snd_device(list);
if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) { if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) {
if ((err = dev->ops->dev_register(dev)) < 0) if ((err = dev->ops->dev_register(dev)) < 0)
return err; return err;
...@@ -215,12 +207,10 @@ int snd_device_register_all(struct snd_card *card) ...@@ -215,12 +207,10 @@ int snd_device_register_all(struct snd_card *card)
int snd_device_disconnect_all(struct snd_card *card) int snd_device_disconnect_all(struct snd_card *card)
{ {
struct snd_device *dev; struct snd_device *dev;
struct list_head *list;
int err = 0; int err = 0;
snd_assert(card != NULL, return -ENXIO); snd_assert(card != NULL, return -ENXIO);
list_for_each(list, &card->devices) { list_for_each_entry(dev, &card->devices, list) {
dev = snd_device(list);
if (snd_device_disconnect(card, dev->device_data) < 0) if (snd_device_disconnect(card, dev->device_data) < 0)
err = -ENXIO; err = -ENXIO;
} }
...@@ -234,7 +224,6 @@ int snd_device_disconnect_all(struct snd_card *card) ...@@ -234,7 +224,6 @@ int snd_device_disconnect_all(struct snd_card *card)
int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd) int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd)
{ {
struct snd_device *dev; struct snd_device *dev;
struct list_head *list;
int err; int err;
unsigned int range_low, range_high; unsigned int range_low, range_high;
...@@ -242,8 +231,7 @@ int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd) ...@@ -242,8 +231,7 @@ int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd)
range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE; range_low = cmd * SNDRV_DEV_TYPE_RANGE_SIZE;
range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1;
__again: __again:
list_for_each(list, &card->devices) { list_for_each_entry(dev, &card->devices, list) {
dev = snd_device(list);
if (dev->type >= range_low && dev->type <= range_high) { if (dev->type >= range_low && dev->type <= range_high) {
if ((err = snd_device_free(card, dev->device_data)) < 0) if ((err = snd_device_free(card, dev->device_data)) < 0)
return err; return err;
......
...@@ -47,14 +47,11 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device); ...@@ -47,14 +47,11 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device);
static struct snd_hwdep *snd_hwdep_search(struct snd_card *card, int device) static struct snd_hwdep *snd_hwdep_search(struct snd_card *card, int device)
{ {
struct list_head *p;
struct snd_hwdep *hwdep; struct snd_hwdep *hwdep;
list_for_each(p, &snd_hwdep_devices) { list_for_each_entry(hwdep, &snd_hwdep_devices, list)
hwdep = list_entry(p, struct snd_hwdep, list);
if (hwdep->card == card && hwdep->device == device) if (hwdep->card == card && hwdep->device == device)
return hwdep; return hwdep;
}
return NULL; return NULL;
} }
...@@ -468,15 +465,12 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device) ...@@ -468,15 +465,12 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device)
static void snd_hwdep_proc_read(struct snd_info_entry *entry, static void snd_hwdep_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer) struct snd_info_buffer *buffer)
{ {
struct list_head *p;
struct snd_hwdep *hwdep; struct snd_hwdep *hwdep;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
list_for_each(p, &snd_hwdep_devices) { list_for_each_entry(hwdep, &snd_hwdep_devices, list)
hwdep = list_entry(p, struct snd_hwdep, list);
snd_iprintf(buffer, "%02i-%02i: %s\n", snd_iprintf(buffer, "%02i-%02i: %s\n",
hwdep->card->number, hwdep->device, hwdep->name); hwdep->card->number, hwdep->device, hwdep->name);
}
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
} }
......
...@@ -406,19 +406,17 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab) ...@@ -406,19 +406,17 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab)
*/ */
size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id) size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id)
{ {
struct list_head *p;
struct snd_mem_list *mem; struct snd_mem_list *mem;
snd_assert(dmab, return 0); snd_assert(dmab, return 0);
mutex_lock(&list_mutex); mutex_lock(&list_mutex);
list_for_each(p, &mem_list_head) { list_for_each_entry(mem, &mem_list_head, list) {
mem = list_entry(p, struct snd_mem_list, list);
if (mem->id == id && if (mem->id == id &&
(mem->buffer.dev.dev == NULL || dmab->dev.dev == NULL || (mem->buffer.dev.dev == NULL || dmab->dev.dev == NULL ||
! memcmp(&mem->buffer.dev, &dmab->dev, sizeof(dmab->dev)))) { ! memcmp(&mem->buffer.dev, &dmab->dev, sizeof(dmab->dev)))) {
struct device *dev = dmab->dev.dev; struct device *dev = dmab->dev.dev;
list_del(p); list_del(&mem->list);
*dmab = mem->buffer; *dmab = mem->buffer;
if (dmab->dev.dev == NULL) if (dmab->dev.dev == NULL)
dmab->dev.dev = dev; dmab->dev.dev = dev;
...@@ -488,7 +486,6 @@ static int snd_mem_proc_read(char *page, char **start, off_t off, ...@@ -488,7 +486,6 @@ static int snd_mem_proc_read(char *page, char **start, off_t off,
{ {
int len = 0; int len = 0;
long pages = snd_allocated_pages >> (PAGE_SHIFT-12); long pages = snd_allocated_pages >> (PAGE_SHIFT-12);
struct list_head *p;
struct snd_mem_list *mem; struct snd_mem_list *mem;
int devno; int devno;
static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" };
...@@ -498,8 +495,7 @@ static int snd_mem_proc_read(char *page, char **start, off_t off, ...@@ -498,8 +495,7 @@ static int snd_mem_proc_read(char *page, char **start, off_t off,
"pages : %li bytes (%li pages per %likB)\n", "pages : %li bytes (%li pages per %likB)\n",
pages * PAGE_SIZE, pages, PAGE_SIZE / 1024); pages * PAGE_SIZE, pages, PAGE_SIZE / 1024);
devno = 0; devno = 0;
list_for_each(p, &mem_list_head) { list_for_each_entry(mem, &mem_list_head, list) {
mem = list_entry(p, struct snd_mem_list, list);
devno++; devno++;
len += snprintf(page + len, count - len, len += snprintf(page + len, count - len,
"buffer %d : ID %08x : type %s\n", "buffer %d : ID %08x : type %s\n",
......
...@@ -45,11 +45,9 @@ static int snd_pcm_dev_disconnect(struct snd_device *device); ...@@ -45,11 +45,9 @@ static int snd_pcm_dev_disconnect(struct snd_device *device);
static struct snd_pcm *snd_pcm_search(struct snd_card *card, int device) static struct snd_pcm *snd_pcm_search(struct snd_card *card, int device)
{ {
struct list_head *p;
struct snd_pcm *pcm; struct snd_pcm *pcm;
list_for_each(p, &snd_pcm_devices) { list_for_each_entry(pcm, &snd_pcm_devices, list) {
pcm = list_entry(p, struct snd_pcm, list);
if (pcm->card == card && pcm->device == device) if (pcm->card == card && pcm->device == device)
return pcm; return pcm;
} }
...@@ -782,7 +780,6 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, ...@@ -782,7 +780,6 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
struct snd_pcm_runtime *runtime; struct snd_pcm_runtime *runtime;
struct snd_ctl_file *kctl; struct snd_ctl_file *kctl;
struct snd_card *card; struct snd_card *card;
struct list_head *list;
int prefer_subdevice = -1; int prefer_subdevice = -1;
size_t size; size_t size;
...@@ -795,8 +792,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, ...@@ -795,8 +792,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
card = pcm->card; card = pcm->card;
down_read(&card->controls_rwsem); down_read(&card->controls_rwsem);
list_for_each(list, &card->ctl_files) { list_for_each_entry(kctl, &card->ctl_files, list) {
kctl = snd_ctl_file(list);
if (kctl->pid == current->pid) { if (kctl->pid == current->pid) {
prefer_subdevice = kctl->prefer_pcm_subdevice; prefer_subdevice = kctl->prefer_pcm_subdevice;
if (prefer_subdevice != -1) if (prefer_subdevice != -1)
...@@ -941,7 +937,7 @@ static int snd_pcm_dev_register(struct snd_device *device) ...@@ -941,7 +937,7 @@ static int snd_pcm_dev_register(struct snd_device *device)
{ {
int cidx, err; int cidx, err;
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
struct list_head *list; struct snd_pcm_notify *notify;
char str[16]; char str[16];
struct snd_pcm *pcm = device->device_data; struct snd_pcm *pcm = device->device_data;
struct device *dev; struct device *dev;
...@@ -988,11 +984,10 @@ static int snd_pcm_dev_register(struct snd_device *device) ...@@ -988,11 +984,10 @@ static int snd_pcm_dev_register(struct snd_device *device)
for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
snd_pcm_timer_init(substream); snd_pcm_timer_init(substream);
} }
list_for_each(list, &snd_pcm_notify_list) {
struct snd_pcm_notify *notify; list_for_each_entry(notify, &snd_pcm_notify_list, list)
notify = list_entry(list, struct snd_pcm_notify, list);
notify->n_register(pcm); notify->n_register(pcm);
}
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return 0; return 0;
} }
...@@ -1035,7 +1030,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) ...@@ -1035,7 +1030,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree)
{ {
struct list_head *p; struct snd_pcm *pcm;
snd_assert(notify != NULL && snd_assert(notify != NULL &&
notify->n_register != NULL && notify->n_register != NULL &&
...@@ -1044,13 +1039,12 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) ...@@ -1044,13 +1039,12 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree)
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
if (nfree) { if (nfree) {
list_del(&notify->list); list_del(&notify->list);
list_for_each(p, &snd_pcm_devices) list_for_each_entry(pcm, &snd_pcm_devices, list)
notify->n_unregister(list_entry(p, notify->n_unregister(pcm);
struct snd_pcm, list));
} else { } else {
list_add_tail(&notify->list, &snd_pcm_notify_list); list_add_tail(&notify->list, &snd_pcm_notify_list);
list_for_each(p, &snd_pcm_devices) list_for_each_entry(pcm, &snd_pcm_devices, list)
notify->n_register(list_entry(p, struct snd_pcm, list)); notify->n_register(pcm);
} }
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return 0; return 0;
...@@ -1066,12 +1060,10 @@ EXPORT_SYMBOL(snd_pcm_notify); ...@@ -1066,12 +1060,10 @@ EXPORT_SYMBOL(snd_pcm_notify);
static void snd_pcm_proc_read(struct snd_info_entry *entry, static void snd_pcm_proc_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer) struct snd_info_buffer *buffer)
{ {
struct list_head *p;
struct snd_pcm *pcm; struct snd_pcm *pcm;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
list_for_each(p, &snd_pcm_devices) { list_for_each_entry(pcm, &snd_pcm_devices, list) {
pcm = list_entry(p, struct snd_pcm, list);
snd_iprintf(buffer, "%02i-%02i: %s : %s", snd_iprintf(buffer, "%02i-%02i: %s : %s",
pcm->card->number, pcm->device, pcm->id, pcm->name); pcm->card->number, pcm->device, pcm->id, pcm->name);
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
......
...@@ -61,14 +61,11 @@ static DEFINE_MUTEX(register_mutex); ...@@ -61,14 +61,11 @@ static DEFINE_MUTEX(register_mutex);
static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device) static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device)
{ {
struct list_head *p;
struct snd_rawmidi *rawmidi; struct snd_rawmidi *rawmidi;
list_for_each(p, &snd_rawmidi_devices) { list_for_each_entry(rawmidi, &snd_rawmidi_devices, list)
rawmidi = list_entry(p, struct snd_rawmidi, list);
if (rawmidi->card == card && rawmidi->device == device) if (rawmidi->card == card && rawmidi->device == device)
return rawmidi; return rawmidi;
}
return NULL; return NULL;
} }
...@@ -389,7 +386,6 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -389,7 +386,6 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
struct snd_rawmidi_file *rawmidi_file; struct snd_rawmidi_file *rawmidi_file;
wait_queue_t wait; wait_queue_t wait;
struct list_head *list;
struct snd_ctl_file *kctl; struct snd_ctl_file *kctl;
if (maj == snd_major) { if (maj == snd_major) {
...@@ -426,8 +422,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) ...@@ -426,8 +422,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
while (1) { while (1) {
subdevice = -1; subdevice = -1;
down_read(&card->controls_rwsem); down_read(&card->controls_rwsem);
list_for_each(list, &card->ctl_files) { list_for_each_entry(kctl, &card->ctl_files, list) {
kctl = snd_ctl_file(list);
if (kctl->pid == current->pid) { if (kctl->pid == current->pid) {
subdevice = kctl->prefer_rawmidi_subdevice; subdevice = kctl->prefer_rawmidi_subdevice;
if (subdevice != -1) if (subdevice != -1)
...@@ -575,7 +570,6 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info ...@@ -575,7 +570,6 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
struct snd_rawmidi_str *pstr; struct snd_rawmidi_str *pstr;
struct snd_rawmidi_substream *substream; struct snd_rawmidi_substream *substream;
struct list_head *list;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
rmidi = snd_rawmidi_search(card, info->device); rmidi = snd_rawmidi_search(card, info->device);
...@@ -589,8 +583,7 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info ...@@ -589,8 +583,7 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info
return -ENOENT; return -ENOENT;
if (info->subdevice >= pstr->substream_count) if (info->subdevice >= pstr->substream_count)
return -ENXIO; return -ENXIO;
list_for_each(list, &pstr->substreams) { list_for_each_entry(substream, &pstr->substreams, list) {
substream = list_entry(list, struct snd_rawmidi_substream, list);
if ((unsigned int)substream->number == info->subdevice) if ((unsigned int)substream->number == info->subdevice)
return snd_rawmidi_info(substream, info); return snd_rawmidi_info(substream, info);
} }
...@@ -1313,14 +1306,14 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry, ...@@ -1313,14 +1306,14 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
struct snd_rawmidi_substream *substream; struct snd_rawmidi_substream *substream;
struct snd_rawmidi_runtime *runtime; struct snd_rawmidi_runtime *runtime;
struct list_head *list;
rmidi = entry->private_data; rmidi = entry->private_data;
snd_iprintf(buffer, "%s\n\n", rmidi->name); snd_iprintf(buffer, "%s\n\n", rmidi->name);
mutex_lock(&rmidi->open_mutex); mutex_lock(&rmidi->open_mutex);
if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) { if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) {
list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { list_for_each_entry(substream,
substream = list_entry(list, struct snd_rawmidi_substream, list); &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams,
list) {
snd_iprintf(buffer, snd_iprintf(buffer,
"Output %d\n" "Output %d\n"
" Tx bytes : %lu\n", " Tx bytes : %lu\n",
...@@ -1339,8 +1332,9 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry, ...@@ -1339,8 +1332,9 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
} }
} }
if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) { if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) {
list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) { list_for_each_entry(substream,
substream = list_entry(list, struct snd_rawmidi_substream, list); &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams,
list) {
snd_iprintf(buffer, snd_iprintf(buffer,
"Input %d\n" "Input %d\n"
" Rx bytes : %lu\n", " Rx bytes : %lu\n",
...@@ -1625,13 +1619,10 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device) ...@@ -1625,13 +1619,10 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device)
void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream, void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
struct snd_rawmidi_ops *ops) struct snd_rawmidi_ops *ops)
{ {
struct list_head *list;
struct snd_rawmidi_substream *substream; struct snd_rawmidi_substream *substream;
list_for_each(list, &rmidi->streams[stream].substreams) { list_for_each_entry(substream, &rmidi->streams[stream].substreams, list)
substream = list_entry(list, struct snd_rawmidi_substream, list);
substream->ops = ops; substream->ops = ops;
}
} }
/* /*
......
...@@ -659,7 +659,6 @@ static int deliver_to_subscribers(struct snd_seq_client *client, ...@@ -659,7 +659,6 @@ static int deliver_to_subscribers(struct snd_seq_client *client,
int err = 0, num_ev = 0; int err = 0, num_ev = 0;
struct snd_seq_event event_saved; struct snd_seq_event event_saved;
struct snd_seq_client_port *src_port; struct snd_seq_client_port *src_port;
struct list_head *p;
struct snd_seq_port_subs_info *grp; struct snd_seq_port_subs_info *grp;
src_port = snd_seq_port_use_ptr(client, event->source.port); src_port = snd_seq_port_use_ptr(client, event->source.port);
...@@ -674,8 +673,7 @@ static int deliver_to_subscribers(struct snd_seq_client *client, ...@@ -674,8 +673,7 @@ static int deliver_to_subscribers(struct snd_seq_client *client,
read_lock(&grp->list_lock); read_lock(&grp->list_lock);
else else
down_read(&grp->list_mutex); down_read(&grp->list_mutex);
list_for_each(p, &grp->list_head) { list_for_each_entry(subs, &grp->list_head, src_list) {
subs = list_entry(p, struct snd_seq_subscribers, src_list);
event->dest = subs->info.dest; event->dest = subs->info.dest;
if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP)
/* convert time according to flag with subscription */ /* convert time according to flag with subscription */
...@@ -709,15 +707,14 @@ static int port_broadcast_event(struct snd_seq_client *client, ...@@ -709,15 +707,14 @@ static int port_broadcast_event(struct snd_seq_client *client,
{ {
int num_ev = 0, err = 0; int num_ev = 0, err = 0;
struct snd_seq_client *dest_client; struct snd_seq_client *dest_client;
struct list_head *p; struct snd_seq_client_port *port;
dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST); dest_client = get_event_dest_client(event, SNDRV_SEQ_FILTER_BROADCAST);
if (dest_client == NULL) if (dest_client == NULL)
return 0; /* no matching destination */ return 0; /* no matching destination */
read_lock(&dest_client->ports_lock); read_lock(&dest_client->ports_lock);
list_for_each(p, &dest_client->ports_list_head) { list_for_each_entry(port, &dest_client->ports_list_head, list) {
struct snd_seq_client_port *port = list_entry(p, struct snd_seq_client_port, list);
event->dest.port = port->addr.port; event->dest.port = port->addr.port;
/* pass NULL as source client to avoid error bounce */ /* pass NULL as source client to avoid error bounce */
err = snd_seq_deliver_single_event(NULL, event, err = snd_seq_deliver_single_event(NULL, event,
...@@ -2473,11 +2470,10 @@ static void snd_seq_info_dump_subscribers(struct snd_info_buffer *buffer, ...@@ -2473,11 +2470,10 @@ static void snd_seq_info_dump_subscribers(struct snd_info_buffer *buffer,
static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer, static void snd_seq_info_dump_ports(struct snd_info_buffer *buffer,
struct snd_seq_client *client) struct snd_seq_client *client)
{ {
struct list_head *l; struct snd_seq_client_port *p;
mutex_lock(&client->ports_mutex); mutex_lock(&client->ports_mutex);
list_for_each(l, &client->ports_list_head) { list_for_each_entry(p, &client->ports_list_head, list) {
struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n", snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n",
p->addr.port, p->name, p->addr.port, p->name,
FLAG_PERM_RD(p->capability), FLAG_PERM_RD(p->capability),
......
...@@ -106,11 +106,10 @@ static void remove_drivers(void); ...@@ -106,11 +106,10 @@ static void remove_drivers(void);
static void snd_seq_device_info(struct snd_info_entry *entry, static void snd_seq_device_info(struct snd_info_entry *entry,
struct snd_info_buffer *buffer) struct snd_info_buffer *buffer)
{ {
struct list_head *head; struct ops_list *ops;
mutex_lock(&ops_mutex); mutex_lock(&ops_mutex);
list_for_each(head, &opslist) { list_for_each_entry(ops, &opslist, list) {
struct ops_list *ops = list_entry(head, struct ops_list, list);
snd_iprintf(buffer, "snd-%s%s%s%s,%d\n", snd_iprintf(buffer, "snd-%s%s%s%s,%d\n",
ops->id, ops->id,
ops->driver & DRIVER_LOADED ? ",loaded" : (ops->driver == DRIVER_EMPTY ? ",empty" : ""), ops->driver & DRIVER_LOADED ? ",loaded" : (ops->driver == DRIVER_EMPTY ? ",empty" : ""),
...@@ -143,7 +142,7 @@ void snd_seq_autoload_unlock(void) ...@@ -143,7 +142,7 @@ void snd_seq_autoload_unlock(void)
void snd_seq_device_load_drivers(void) void snd_seq_device_load_drivers(void)
{ {
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
struct list_head *head; struct ops_list *ops;
/* Calling request_module during module_init() /* Calling request_module during module_init()
* may cause blocking. * may cause blocking.
...@@ -155,8 +154,7 @@ void snd_seq_device_load_drivers(void) ...@@ -155,8 +154,7 @@ void snd_seq_device_load_drivers(void)
return; return;
mutex_lock(&ops_mutex); mutex_lock(&ops_mutex);
list_for_each(head, &opslist) { list_for_each_entry(ops, &opslist, list) {
struct ops_list *ops = list_entry(head, struct ops_list, list);
if (! (ops->driver & DRIVER_LOADED) && if (! (ops->driver & DRIVER_LOADED) &&
! (ops->driver & DRIVER_REQUESTED)) { ! (ops->driver & DRIVER_REQUESTED)) {
ops->used++; ops->used++;
...@@ -314,8 +312,8 @@ static int snd_seq_device_dev_disconnect(struct snd_device *device) ...@@ -314,8 +312,8 @@ static int snd_seq_device_dev_disconnect(struct snd_device *device)
int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry,
int argsize) int argsize)
{ {
struct list_head *head;
struct ops_list *ops; struct ops_list *ops;
struct snd_seq_device *dev;
if (id == NULL || entry == NULL || if (id == NULL || entry == NULL ||
entry->init_device == NULL || entry->free_device == NULL) entry->init_device == NULL || entry->free_device == NULL)
...@@ -341,8 +339,7 @@ int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, ...@@ -341,8 +339,7 @@ int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry,
ops->argsize = argsize; ops->argsize = argsize;
/* initialize existing devices if necessary */ /* initialize existing devices if necessary */
list_for_each(head, &ops->dev_list) { list_for_each_entry(dev, &ops->dev_list, list) {
struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list);
init_device(dev, ops); init_device(dev, ops);
} }
mutex_unlock(&ops->reg_mutex); mutex_unlock(&ops->reg_mutex);
...@@ -394,8 +391,8 @@ static struct ops_list * create_driver(char *id) ...@@ -394,8 +391,8 @@ static struct ops_list * create_driver(char *id)
*/ */
int snd_seq_device_unregister_driver(char *id) int snd_seq_device_unregister_driver(char *id)
{ {
struct list_head *head;
struct ops_list *ops; struct ops_list *ops;
struct snd_seq_device *dev;
ops = find_driver(id, 0); ops = find_driver(id, 0);
if (ops == NULL) if (ops == NULL)
...@@ -411,8 +408,7 @@ int snd_seq_device_unregister_driver(char *id) ...@@ -411,8 +408,7 @@ int snd_seq_device_unregister_driver(char *id)
/* close and release all devices associated with this driver */ /* close and release all devices associated with this driver */
mutex_lock(&ops->reg_mutex); mutex_lock(&ops->reg_mutex);
ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */ ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */
list_for_each(head, &ops->dev_list) { list_for_each_entry(dev, &ops->dev_list, list) {
struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list);
free_device(dev, ops); free_device(dev, ops);
} }
...@@ -512,11 +508,10 @@ static int free_device(struct snd_seq_device *dev, struct ops_list *ops) ...@@ -512,11 +508,10 @@ static int free_device(struct snd_seq_device *dev, struct ops_list *ops)
*/ */
static struct ops_list * find_driver(char *id, int create_if_empty) static struct ops_list * find_driver(char *id, int create_if_empty)
{ {
struct list_head *head; struct ops_list *ops;
mutex_lock(&ops_mutex); mutex_lock(&ops_mutex);
list_for_each(head, &opslist) { list_for_each_entry(ops, &opslist, list) {
struct ops_list *ops = list_entry(head, struct ops_list, list);
if (strcmp(ops->id, id) == 0) { if (strcmp(ops->id, id) == 0) {
ops->used++; ops->used++;
mutex_unlock(&ops_mutex); mutex_unlock(&ops_mutex);
......
...@@ -59,14 +59,12 @@ much elements are in array. ...@@ -59,14 +59,12 @@ much elements are in array.
struct snd_seq_client_port *snd_seq_port_use_ptr(struct snd_seq_client *client, struct snd_seq_client_port *snd_seq_port_use_ptr(struct snd_seq_client *client,
int num) int num)
{ {
struct list_head *p;
struct snd_seq_client_port *port; struct snd_seq_client_port *port;
if (client == NULL) if (client == NULL)
return NULL; return NULL;
read_lock(&client->ports_lock); read_lock(&client->ports_lock);
list_for_each(p, &client->ports_list_head) { list_for_each_entry(port, &client->ports_list_head, list) {
port = list_entry(p, struct snd_seq_client_port, list);
if (port->addr.port == num) { if (port->addr.port == num) {
if (port->closing) if (port->closing)
break; /* deleting now */ break; /* deleting now */
...@@ -85,14 +83,12 @@ struct snd_seq_client_port *snd_seq_port_query_nearest(struct snd_seq_client *cl ...@@ -85,14 +83,12 @@ struct snd_seq_client_port *snd_seq_port_query_nearest(struct snd_seq_client *cl
struct snd_seq_port_info *pinfo) struct snd_seq_port_info *pinfo)
{ {
int num; int num;
struct list_head *p;
struct snd_seq_client_port *port, *found; struct snd_seq_client_port *port, *found;
num = pinfo->addr.port; num = pinfo->addr.port;
found = NULL; found = NULL;
read_lock(&client->ports_lock); read_lock(&client->ports_lock);
list_for_each(p, &client->ports_list_head) { list_for_each_entry(port, &client->ports_list_head, list) {
port = list_entry(p, struct snd_seq_client_port, list);
if (port->addr.port < num) if (port->addr.port < num)
continue; continue;
if (port->addr.port == num) { if (port->addr.port == num) {
...@@ -131,8 +127,7 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, ...@@ -131,8 +127,7 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
int port) int port)
{ {
unsigned long flags; unsigned long flags;
struct snd_seq_client_port *new_port; struct snd_seq_client_port *new_port, *p;
struct list_head *l;
int num = -1; int num = -1;
/* sanity check */ /* sanity check */
...@@ -161,15 +156,14 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, ...@@ -161,15 +156,14 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
num = port >= 0 ? port : 0; num = port >= 0 ? port : 0;
mutex_lock(&client->ports_mutex); mutex_lock(&client->ports_mutex);
write_lock_irqsave(&client->ports_lock, flags); write_lock_irqsave(&client->ports_lock, flags);
list_for_each(l, &client->ports_list_head) { list_for_each_entry(p, &client->ports_list_head, list) {
struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
if (p->addr.port > num) if (p->addr.port > num)
break; break;
if (port < 0) /* auto-probe mode */ if (port < 0) /* auto-probe mode */
num = p->addr.port + 1; num = p->addr.port + 1;
} }
/* insert the new port */ /* insert the new port */
list_add_tail(&new_port->list, l); list_add_tail(&new_port->list, &p->list);
client->num_ports++; client->num_ports++;
new_port->addr.port = num; /* store the port number in the port */ new_port->addr.port = num; /* store the port number in the port */
write_unlock_irqrestore(&client->ports_lock, flags); write_unlock_irqrestore(&client->ports_lock, flags);
...@@ -287,16 +281,14 @@ static int port_delete(struct snd_seq_client *client, ...@@ -287,16 +281,14 @@ static int port_delete(struct snd_seq_client *client,
int snd_seq_delete_port(struct snd_seq_client *client, int port) int snd_seq_delete_port(struct snd_seq_client *client, int port)
{ {
unsigned long flags; unsigned long flags;
struct list_head *l; struct snd_seq_client_port *found = NULL, *p;
struct snd_seq_client_port *found = NULL;
mutex_lock(&client->ports_mutex); mutex_lock(&client->ports_mutex);
write_lock_irqsave(&client->ports_lock, flags); write_lock_irqsave(&client->ports_lock, flags);
list_for_each(l, &client->ports_list_head) { list_for_each_entry(p, &client->ports_list_head, list) {
struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
if (p->addr.port == port) { if (p->addr.port == port) {
/* ok found. delete from the list at first */ /* ok found. delete from the list at first */
list_del(l); list_del(&p->list);
client->num_ports--; client->num_ports--;
found = p; found = p;
break; break;
...@@ -314,7 +306,8 @@ int snd_seq_delete_port(struct snd_seq_client *client, int port) ...@@ -314,7 +306,8 @@ int snd_seq_delete_port(struct snd_seq_client *client, int port)
int snd_seq_delete_all_ports(struct snd_seq_client *client) int snd_seq_delete_all_ports(struct snd_seq_client *client)
{ {
unsigned long flags; unsigned long flags;
struct list_head deleted_list, *p, *n; struct list_head deleted_list;
struct snd_seq_client_port *port, *tmp;
/* move the port list to deleted_list, and /* move the port list to deleted_list, and
* clear the port list in the client data. * clear the port list in the client data.
...@@ -331,9 +324,8 @@ int snd_seq_delete_all_ports(struct snd_seq_client *client) ...@@ -331,9 +324,8 @@ int snd_seq_delete_all_ports(struct snd_seq_client *client)
write_unlock_irqrestore(&client->ports_lock, flags); write_unlock_irqrestore(&client->ports_lock, flags);
/* remove each port in deleted_list */ /* remove each port in deleted_list */
list_for_each_safe(p, n, &deleted_list) { list_for_each_entry_safe(port, tmp, &deleted_list, list) {
struct snd_seq_client_port *port = list_entry(p, struct snd_seq_client_port, list); list_del(&port->list);
list_del(p);
snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port); snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port);
port_delete(client, port); port_delete(client, port);
} }
...@@ -500,8 +492,7 @@ int snd_seq_port_connect(struct snd_seq_client *connector, ...@@ -500,8 +492,7 @@ int snd_seq_port_connect(struct snd_seq_client *connector,
{ {
struct snd_seq_port_subs_info *src = &src_port->c_src; struct snd_seq_port_subs_info *src = &src_port->c_src;
struct snd_seq_port_subs_info *dest = &dest_port->c_dest; struct snd_seq_port_subs_info *dest = &dest_port->c_dest;
struct snd_seq_subscribers *subs; struct snd_seq_subscribers *subs, *s;
struct list_head *p;
int err, src_called = 0; int err, src_called = 0;
unsigned long flags; unsigned long flags;
int exclusive; int exclusive;
...@@ -525,13 +516,11 @@ int snd_seq_port_connect(struct snd_seq_client *connector, ...@@ -525,13 +516,11 @@ int snd_seq_port_connect(struct snd_seq_client *connector,
if (src->exclusive || dest->exclusive) if (src->exclusive || dest->exclusive)
goto __error; goto __error;
/* check whether already exists */ /* check whether already exists */
list_for_each(p, &src->list_head) { list_for_each_entry(s, &src->list_head, src_list) {
struct snd_seq_subscribers *s = list_entry(p, struct snd_seq_subscribers, src_list);
if (match_subs_info(info, &s->info)) if (match_subs_info(info, &s->info))
goto __error; goto __error;
} }
list_for_each(p, &dest->list_head) { list_for_each_entry(s, &dest->list_head, dest_list) {
struct snd_seq_subscribers *s = list_entry(p, struct snd_seq_subscribers, dest_list);
if (match_subs_info(info, &s->info)) if (match_subs_info(info, &s->info))
goto __error; goto __error;
} }
...@@ -582,7 +571,6 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, ...@@ -582,7 +571,6 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector,
struct snd_seq_port_subs_info *src = &src_port->c_src; struct snd_seq_port_subs_info *src = &src_port->c_src;
struct snd_seq_port_subs_info *dest = &dest_port->c_dest; struct snd_seq_port_subs_info *dest = &dest_port->c_dest;
struct snd_seq_subscribers *subs; struct snd_seq_subscribers *subs;
struct list_head *p;
int err = -ENOENT; int err = -ENOENT;
unsigned long flags; unsigned long flags;
...@@ -590,8 +578,7 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, ...@@ -590,8 +578,7 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector,
down_write_nested(&dest->list_mutex, SINGLE_DEPTH_NESTING); down_write_nested(&dest->list_mutex, SINGLE_DEPTH_NESTING);
/* look for the connection */ /* look for the connection */
list_for_each(p, &src->list_head) { list_for_each_entry(subs, &src->list_head, src_list) {
subs = list_entry(p, struct snd_seq_subscribers, src_list);
if (match_subs_info(info, &subs->info)) { if (match_subs_info(info, &subs->info)) {
write_lock_irqsave(&src->list_lock, flags); write_lock_irqsave(&src->list_lock, flags);
// write_lock(&dest->list_lock); // no lock yet // write_lock(&dest->list_lock); // no lock yet
...@@ -620,12 +607,10 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, ...@@ -620,12 +607,10 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector,
struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp, struct snd_seq_subscribers *snd_seq_port_get_subscription(struct snd_seq_port_subs_info *src_grp,
struct snd_seq_addr *dest_addr) struct snd_seq_addr *dest_addr)
{ {
struct list_head *p;
struct snd_seq_subscribers *s, *found = NULL; struct snd_seq_subscribers *s, *found = NULL;
down_read(&src_grp->list_mutex); down_read(&src_grp->list_mutex);
list_for_each(p, &src_grp->list_head) { list_for_each_entry(s, &src_grp->list_head, src_list) {
s = list_entry(p, struct snd_seq_subscribers, src_list);
if (addr_match(dest_addr, &s->info.dest)) { if (addr_match(dest_addr, &s->info.dest)) {
found = s; found = s;
break; break;
......
...@@ -81,13 +81,11 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, ...@@ -81,13 +81,11 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,
struct snd_seq_event *ev) struct snd_seq_event *ev)
{ {
struct snd_virmidi *vmidi; struct snd_virmidi *vmidi;
struct list_head *list;
unsigned char msg[4]; unsigned char msg[4];
int len; int len;
read_lock(&rdev->filelist_lock); read_lock(&rdev->filelist_lock);
list_for_each(list, &rdev->filelist) { list_for_each_entry(vmidi, &rdev->filelist, list) {
vmidi = list_entry(list, struct snd_virmidi, list);
if (!vmidi->trigger) if (!vmidi->trigger)
continue; continue;
if (ev->type == SNDRV_SEQ_EVENT_SYSEX) { if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
......
...@@ -130,11 +130,8 @@ static struct snd_timer_instance *snd_timer_instance_new(char *owner, ...@@ -130,11 +130,8 @@ static struct snd_timer_instance *snd_timer_instance_new(char *owner,
static struct snd_timer *snd_timer_find(struct snd_timer_id *tid) static struct snd_timer *snd_timer_find(struct snd_timer_id *tid)
{ {
struct snd_timer *timer = NULL; struct snd_timer *timer = NULL;
struct list_head *p;
list_for_each(p, &snd_timer_list) {
timer = list_entry(p, struct snd_timer, device_list);
list_for_each_entry(timer, &snd_timer_list, device_list) {
if (timer->tmr_class != tid->dev_class) if (timer->tmr_class != tid->dev_class)
continue; continue;
if ((timer->tmr_class == SNDRV_TIMER_CLASS_CARD || if ((timer->tmr_class == SNDRV_TIMER_CLASS_CARD ||
...@@ -184,13 +181,10 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave) ...@@ -184,13 +181,10 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave)
{ {
struct snd_timer *timer; struct snd_timer *timer;
struct snd_timer_instance *master; struct snd_timer_instance *master;
struct list_head *p, *q;
/* FIXME: it's really dumb to look up all entries.. */ /* FIXME: it's really dumb to look up all entries.. */
list_for_each(p, &snd_timer_list) { list_for_each_entry(timer, &snd_timer_list, device_list) {
timer = list_entry(p, struct snd_timer, device_list); list_for_each_entry(master, &timer->open_list_head, open_list) {
list_for_each(q, &timer->open_list_head) {
master = list_entry(q, struct snd_timer_instance, open_list);
if (slave->slave_class == master->slave_class && if (slave->slave_class == master->slave_class &&
slave->slave_id == master->slave_id) { slave->slave_id == master->slave_id) {
list_del(&slave->open_list); list_del(&slave->open_list);
...@@ -214,16 +208,13 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave) ...@@ -214,16 +208,13 @@ static void snd_timer_check_slave(struct snd_timer_instance *slave)
*/ */
static void snd_timer_check_master(struct snd_timer_instance *master) static void snd_timer_check_master(struct snd_timer_instance *master)
{ {
struct snd_timer_instance *slave; struct snd_timer_instance *slave, *tmp;
struct list_head *p, *n;
/* check all pending slaves */ /* check all pending slaves */
list_for_each_safe(p, n, &snd_timer_slave_list) { list_for_each_entry_safe(slave, tmp, &snd_timer_slave_list, open_list) {
slave = list_entry(p, struct snd_timer_instance, open_list);
if (slave->slave_class == master->slave_class && if (slave->slave_class == master->slave_class &&
slave->slave_id == master->slave_id) { slave->slave_id == master->slave_id) {
list_del(p); list_move_tail(&slave->open_list, &master->slave_list_head);
list_add_tail(p, &master->slave_list_head);
spin_lock_irq(&slave_active_lock); spin_lock_irq(&slave_active_lock);
slave->master = master; slave->master = master;
slave->timer = master->timer; slave->timer = master->timer;
...@@ -317,8 +308,7 @@ static int _snd_timer_stop(struct snd_timer_instance *timeri, ...@@ -317,8 +308,7 @@ static int _snd_timer_stop(struct snd_timer_instance *timeri,
int snd_timer_close(struct snd_timer_instance *timeri) int snd_timer_close(struct snd_timer_instance *timeri)
{ {
struct snd_timer *timer = NULL; struct snd_timer *timer = NULL;
struct list_head *p, *n; struct snd_timer_instance *slave, *tmp;
struct snd_timer_instance *slave;
snd_assert(timeri != NULL, return -ENXIO); snd_assert(timeri != NULL, return -ENXIO);
...@@ -353,12 +343,11 @@ int snd_timer_close(struct snd_timer_instance *timeri) ...@@ -353,12 +343,11 @@ int snd_timer_close(struct snd_timer_instance *timeri)
timer->hw.close) timer->hw.close)
timer->hw.close(timer); timer->hw.close(timer);
/* remove slave links */ /* remove slave links */
list_for_each_safe(p, n, &timeri->slave_list_head) { list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,
slave = list_entry(p, struct snd_timer_instance, open_list); open_list) {
spin_lock_irq(&slave_active_lock); spin_lock_irq(&slave_active_lock);
_snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION); _snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION);
list_del(p); list_move_tail(&slave->open_list, &snd_timer_slave_list);
list_add_tail(p, &snd_timer_slave_list);
slave->master = NULL; slave->master = NULL;
slave->timer = NULL; slave->timer = NULL;
spin_unlock_irq(&slave_active_lock); spin_unlock_irq(&slave_active_lock);
...@@ -394,7 +383,6 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) ...@@ -394,7 +383,6 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
unsigned long flags; unsigned long flags;
unsigned long resolution = 0; unsigned long resolution = 0;
struct snd_timer_instance *ts; struct snd_timer_instance *ts;
struct list_head *n;
struct timespec tstamp; struct timespec tstamp;
getnstimeofday(&tstamp); getnstimeofday(&tstamp);
...@@ -413,11 +401,9 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) ...@@ -413,11 +401,9 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
return; return;
spin_lock_irqsave(&timer->lock, flags); spin_lock_irqsave(&timer->lock, flags);
list_for_each(n, &ti->slave_active_head) { list_for_each_entry(ts, &ti->slave_active_head, active_list)
ts = list_entry(n, struct snd_timer_instance, active_list);
if (ts->ccallback) if (ts->ccallback)
ts->ccallback(ti, event + 100, &tstamp, resolution); ts->ccallback(ti, event + 100, &tstamp, resolution);
}
spin_unlock_irqrestore(&timer->lock, flags); spin_unlock_irqrestore(&timer->lock, flags);
} }
...@@ -593,10 +579,8 @@ static void snd_timer_reschedule(struct snd_timer * timer, unsigned long ticks_l ...@@ -593,10 +579,8 @@ static void snd_timer_reschedule(struct snd_timer * timer, unsigned long ticks_l
{ {
struct snd_timer_instance *ti; struct snd_timer_instance *ti;
unsigned long ticks = ~0UL; unsigned long ticks = ~0UL;
struct list_head *p;
list_for_each(p, &timer->active_list_head) { list_for_each_entry(ti, &timer->active_list_head, active_list) {
ti = list_entry(p, struct snd_timer_instance, active_list);
if (ti->flags & SNDRV_TIMER_IFLG_START) { if (ti->flags & SNDRV_TIMER_IFLG_START) {
ti->flags &= ~SNDRV_TIMER_IFLG_START; ti->flags &= ~SNDRV_TIMER_IFLG_START;
ti->flags |= SNDRV_TIMER_IFLG_RUNNING; ti->flags |= SNDRV_TIMER_IFLG_RUNNING;
...@@ -661,9 +645,9 @@ static void snd_timer_tasklet(unsigned long arg) ...@@ -661,9 +645,9 @@ static void snd_timer_tasklet(unsigned long arg)
*/ */
void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
{ {
struct snd_timer_instance *ti, *ts; struct snd_timer_instance *ti, *ts, *tmp;
unsigned long resolution, ticks; unsigned long resolution, ticks;
struct list_head *p, *q, *n, *ack_list_head; struct list_head *p, *ack_list_head;
unsigned long flags; unsigned long flags;
int use_tasklet = 0; int use_tasklet = 0;
...@@ -679,12 +663,12 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) ...@@ -679,12 +663,12 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
resolution = timer->hw.resolution; resolution = timer->hw.resolution;
/* loop for all active instances /* loop for all active instances
* Here we cannot use list_for_each because the active_list of a * Here we cannot use list_for_each_entry because the active_list of a
* processed instance is relinked to done_list_head before the callback * processed instance is relinked to done_list_head before the callback
* is called. * is called.
*/ */
list_for_each_safe(p, n, &timer->active_list_head) { list_for_each_entry_safe(ti, tmp, &timer->active_list_head,
ti = list_entry(p, struct snd_timer_instance, active_list); active_list) {
if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING)) if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING))
continue; continue;
ti->pticks += ticks_left; ti->pticks += ticks_left;
...@@ -700,7 +684,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) ...@@ -700,7 +684,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
} else { } else {
ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING; ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
if (--timer->running) if (--timer->running)
list_del(p); list_del(&ti->active_list);
} }
if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) || if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) ||
(ti->flags & SNDRV_TIMER_IFLG_FAST)) (ti->flags & SNDRV_TIMER_IFLG_FAST))
...@@ -709,8 +693,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) ...@@ -709,8 +693,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
ack_list_head = &timer->sack_list_head; ack_list_head = &timer->sack_list_head;
if (list_empty(&ti->ack_list)) if (list_empty(&ti->ack_list))
list_add_tail(&ti->ack_list, ack_list_head); list_add_tail(&ti->ack_list, ack_list_head);
list_for_each(q, &ti->slave_active_head) { list_for_each_entry(ts, &ti->slave_active_head, active_list) {
ts = list_entry(q, struct snd_timer_instance, active_list);
ts->pticks = ti->pticks; ts->pticks = ti->pticks;
ts->resolution = resolution; ts->resolution = resolution;
if (list_empty(&ts->ack_list)) if (list_empty(&ts->ack_list))
...@@ -844,7 +827,6 @@ static int snd_timer_dev_register(struct snd_device *dev) ...@@ -844,7 +827,6 @@ static int snd_timer_dev_register(struct snd_device *dev)
{ {
struct snd_timer *timer = dev->device_data; struct snd_timer *timer = dev->device_data;
struct snd_timer *timer1; struct snd_timer *timer1;
struct list_head *p;
snd_assert(timer != NULL && timer->hw.start != NULL && snd_assert(timer != NULL && timer->hw.start != NULL &&
timer->hw.stop != NULL, return -ENXIO); timer->hw.stop != NULL, return -ENXIO);
...@@ -853,8 +835,7 @@ static int snd_timer_dev_register(struct snd_device *dev) ...@@ -853,8 +835,7 @@ static int snd_timer_dev_register(struct snd_device *dev)
return -EINVAL; return -EINVAL;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
list_for_each(p, &snd_timer_list) { list_for_each_entry(timer1, &snd_timer_list, device_list) {
timer1 = list_entry(p, struct snd_timer, device_list);
if (timer1->tmr_class > timer->tmr_class) if (timer1->tmr_class > timer->tmr_class)
break; break;
if (timer1->tmr_class < timer->tmr_class) if (timer1->tmr_class < timer->tmr_class)
...@@ -877,7 +858,7 @@ static int snd_timer_dev_register(struct snd_device *dev) ...@@ -877,7 +858,7 @@ static int snd_timer_dev_register(struct snd_device *dev)
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return -EBUSY; return -EBUSY;
} }
list_add_tail(&timer->device_list, p); list_add_tail(&timer->device_list, &timer1->device_list);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
return 0; return 0;
} }
...@@ -896,7 +877,6 @@ void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstam ...@@ -896,7 +877,6 @@ void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstam
unsigned long flags; unsigned long flags;
unsigned long resolution = 0; unsigned long resolution = 0;
struct snd_timer_instance *ti, *ts; struct snd_timer_instance *ti, *ts;
struct list_head *p, *n;
if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)) if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE))
return; return;
...@@ -911,15 +891,12 @@ void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstam ...@@ -911,15 +891,12 @@ void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstam
else else
resolution = timer->hw.resolution; resolution = timer->hw.resolution;
} }
list_for_each(p, &timer->active_list_head) { list_for_each_entry(ti, &timer->active_list_head, active_list) {
ti = list_entry(p, struct snd_timer_instance, active_list);
if (ti->ccallback) if (ti->ccallback)
ti->ccallback(ti, event, tstamp, resolution); ti->ccallback(ti, event, tstamp, resolution);
list_for_each(n, &ti->slave_active_head) { list_for_each_entry(ts, &ti->slave_active_head, active_list)
ts = list_entry(n, struct snd_timer_instance, active_list);
if (ts->ccallback) if (ts->ccallback)
ts->ccallback(ts, event, tstamp, resolution); ts->ccallback(ts, event, tstamp, resolution);
}
} }
spin_unlock_irqrestore(&timer->lock, flags); spin_unlock_irqrestore(&timer->lock, flags);
} }
...@@ -1057,11 +1034,9 @@ static void snd_timer_proc_read(struct snd_info_entry *entry, ...@@ -1057,11 +1034,9 @@ static void snd_timer_proc_read(struct snd_info_entry *entry,
{ {
struct snd_timer *timer; struct snd_timer *timer;
struct snd_timer_instance *ti; struct snd_timer_instance *ti;
struct list_head *p, *q;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
list_for_each(p, &snd_timer_list) { list_for_each_entry(timer, &snd_timer_list, device_list) {
timer = list_entry(p, struct snd_timer, device_list);
switch (timer->tmr_class) { switch (timer->tmr_class) {
case SNDRV_TIMER_CLASS_GLOBAL: case SNDRV_TIMER_CLASS_GLOBAL:
snd_iprintf(buffer, "G%i: ", timer->tmr_device); snd_iprintf(buffer, "G%i: ", timer->tmr_device);
...@@ -1088,14 +1063,12 @@ static void snd_timer_proc_read(struct snd_info_entry *entry, ...@@ -1088,14 +1063,12 @@ static void snd_timer_proc_read(struct snd_info_entry *entry,
if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
snd_iprintf(buffer, " SLAVE"); snd_iprintf(buffer, " SLAVE");
snd_iprintf(buffer, "\n"); snd_iprintf(buffer, "\n");
list_for_each(q, &timer->open_list_head) { list_for_each_entry(ti, &timer->open_list_head, open_list)
ti = list_entry(q, struct snd_timer_instance, open_list);
snd_iprintf(buffer, " Client %s : %s\n", snd_iprintf(buffer, " Client %s : %s\n",
ti->owner ? ti->owner : "unknown", ti->owner ? ti->owner : "unknown",
ti->flags & (SNDRV_TIMER_IFLG_START | ti->flags & (SNDRV_TIMER_IFLG_START |
SNDRV_TIMER_IFLG_RUNNING) SNDRV_TIMER_IFLG_RUNNING)
? "running" : "stopped"); ? "running" : "stopped");
}
} }
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册