aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/rawmidi.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2006-10-05 10:02:22 -0400
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:00:10 -0500
commit9244b2c3079faac79b3b961116bd548c45087e2c (patch)
tree1a9e2ead054ed58efcad3fd43fb2aedeb6731baa /sound/core/rawmidi.c
parentd595ee7e0162ae66faa8c4c7d8c2069b40d64fed (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/rawmidi.c')
-rw-r--r--sound/core/rawmidi.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 0f055bfcbdac..7e6ceec738d5 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -61,14 +61,11 @@ static DEFINE_MUTEX(register_mutex);
61 61
62static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device) 62static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device)
63{ 63{
64 struct list_head *p;
65 struct snd_rawmidi *rawmidi; 64 struct snd_rawmidi *rawmidi;
66 65
67 list_for_each(p, &snd_rawmidi_devices) { 66 list_for_each_entry(rawmidi, &snd_rawmidi_devices, list)
68 rawmidi = list_entry(p, struct snd_rawmidi, list);
69 if (rawmidi->card == card && rawmidi->device == device) 67 if (rawmidi->card == card && rawmidi->device == device)
70 return rawmidi; 68 return rawmidi;
71 }
72 return NULL; 69 return NULL;
73} 70}
74 71
@@ -389,7 +386,6 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
389 struct snd_rawmidi *rmidi; 386 struct snd_rawmidi *rmidi;
390 struct snd_rawmidi_file *rawmidi_file; 387 struct snd_rawmidi_file *rawmidi_file;
391 wait_queue_t wait; 388 wait_queue_t wait;
392 struct list_head *list;
393 struct snd_ctl_file *kctl; 389 struct snd_ctl_file *kctl;
394 390
395 if (maj == snd_major) { 391 if (maj == snd_major) {
@@ -426,8 +422,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
426 while (1) { 422 while (1) {
427 subdevice = -1; 423 subdevice = -1;
428 down_read(&card->controls_rwsem); 424 down_read(&card->controls_rwsem);
429 list_for_each(list, &card->ctl_files) { 425 list_for_each_entry(kctl, &card->ctl_files, list) {
430 kctl = snd_ctl_file(list);
431 if (kctl->pid == current->pid) { 426 if (kctl->pid == current->pid) {
432 subdevice = kctl->prefer_rawmidi_subdevice; 427 subdevice = kctl->prefer_rawmidi_subdevice;
433 if (subdevice != -1) 428 if (subdevice != -1)
@@ -575,7 +570,6 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info
575 struct snd_rawmidi *rmidi; 570 struct snd_rawmidi *rmidi;
576 struct snd_rawmidi_str *pstr; 571 struct snd_rawmidi_str *pstr;
577 struct snd_rawmidi_substream *substream; 572 struct snd_rawmidi_substream *substream;
578 struct list_head *list;
579 573
580 mutex_lock(&register_mutex); 574 mutex_lock(&register_mutex);
581 rmidi = snd_rawmidi_search(card, info->device); 575 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 return -ENOENT; 583 return -ENOENT;
590 if (info->subdevice >= pstr->substream_count) 584 if (info->subdevice >= pstr->substream_count)
591 return -ENXIO; 585 return -ENXIO;
592 list_for_each(list, &pstr->substreams) { 586 list_for_each_entry(substream, &pstr->substreams, list) {
593 substream = list_entry(list, struct snd_rawmidi_substream, list);
594 if ((unsigned int)substream->number == info->subdevice) 587 if ((unsigned int)substream->number == info->subdevice)
595 return snd_rawmidi_info(substream, info); 588 return snd_rawmidi_info(substream, info);
596 } 589 }
@@ -1313,14 +1306,14 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
1313 struct snd_rawmidi *rmidi; 1306 struct snd_rawmidi *rmidi;
1314 struct snd_rawmidi_substream *substream; 1307 struct snd_rawmidi_substream *substream;
1315 struct snd_rawmidi_runtime *runtime; 1308 struct snd_rawmidi_runtime *runtime;
1316 struct list_head *list;
1317 1309
1318 rmidi = entry->private_data; 1310 rmidi = entry->private_data;
1319 snd_iprintf(buffer, "%s\n\n", rmidi->name); 1311 snd_iprintf(buffer, "%s\n\n", rmidi->name);
1320 mutex_lock(&rmidi->open_mutex); 1312 mutex_lock(&rmidi->open_mutex);
1321 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) { 1313 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) {
1322 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { 1314 list_for_each_entry(substream,
1323 substream = list_entry(list, struct snd_rawmidi_substream, list); 1315 &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams,
1316 list) {
1324 snd_iprintf(buffer, 1317 snd_iprintf(buffer,
1325 "Output %d\n" 1318 "Output %d\n"
1326 " Tx bytes : %lu\n", 1319 " Tx bytes : %lu\n",
@@ -1339,8 +1332,9 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry,
1339 } 1332 }
1340 } 1333 }
1341 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) { 1334 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) {
1342 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) { 1335 list_for_each_entry(substream,
1343 substream = list_entry(list, struct snd_rawmidi_substream, list); 1336 &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams,
1337 list) {
1344 snd_iprintf(buffer, 1338 snd_iprintf(buffer,
1345 "Input %d\n" 1339 "Input %d\n"
1346 " Rx bytes : %lu\n", 1340 " Rx bytes : %lu\n",
@@ -1625,13 +1619,10 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device)
1625void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream, 1619void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
1626 struct snd_rawmidi_ops *ops) 1620 struct snd_rawmidi_ops *ops)
1627{ 1621{
1628 struct list_head *list;
1629 struct snd_rawmidi_substream *substream; 1622 struct snd_rawmidi_substream *substream;
1630 1623
1631 list_for_each(list, &rmidi->streams[stream].substreams) { 1624 list_for_each_entry(substream, &rmidi->streams[stream].substreams, list)
1632 substream = list_entry(list, struct snd_rawmidi_substream, list);
1633 substream->ops = ops; 1625 substream->ops = ops;
1634 }
1635} 1626}
1636 1627
1637/* 1628/*