diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-09-17 08:40:04 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 10:50:42 -0400 |
commit | 33206e862edb930615a586f5156c2760ddb4bac0 (patch) | |
tree | 6032705619187a785d2cbc459b49ca78fc922e4a /sound/pci/hda/hda_generic.c | |
parent | 50f47ff1b9295f126a1256d607e5b6e951d6f34e (diff) |
[ALSA] Intel HD Audio: Use list_for_each_entry(_safe)
Intel HD Audio: Use list_for_each_entry(_safe) instead of
list_for_each(_safe)
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/hda_generic.c')
-rw-r--r-- | sound/pci/hda/hda_generic.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 819c804a579f..c957eb58de5c 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -95,13 +95,12 @@ struct hda_gspec { | |||
95 | static void snd_hda_generic_free(struct hda_codec *codec) | 95 | static void snd_hda_generic_free(struct hda_codec *codec) |
96 | { | 96 | { |
97 | struct hda_gspec *spec = codec->spec; | 97 | struct hda_gspec *spec = codec->spec; |
98 | struct list_head *p, *n; | 98 | struct hda_gnode *node, *n; |
99 | 99 | ||
100 | if (! spec) | 100 | if (! spec) |
101 | return; | 101 | return; |
102 | /* free all widgets */ | 102 | /* free all widgets */ |
103 | list_for_each_safe(p, n, &spec->nid_list) { | 103 | list_for_each_entry_safe(node, n, &spec->nid_list, list) { |
104 | struct hda_gnode *node = list_entry(p, struct hda_gnode, list); | ||
105 | if (node->conn_list != node->slist) | 104 | if (node->conn_list != node->slist) |
106 | kfree(node->conn_list); | 105 | kfree(node->conn_list); |
107 | kfree(node); | 106 | kfree(node); |
@@ -203,11 +202,9 @@ static int build_afg_tree(struct hda_codec *codec) | |||
203 | /* FIXME: should avoid the braindead linear search */ | 202 | /* FIXME: should avoid the braindead linear search */ |
204 | static struct hda_gnode *hda_get_node(struct hda_gspec *spec, hda_nid_t nid) | 203 | static struct hda_gnode *hda_get_node(struct hda_gspec *spec, hda_nid_t nid) |
205 | { | 204 | { |
206 | struct list_head *p; | ||
207 | struct hda_gnode *node; | 205 | struct hda_gnode *node; |
208 | 206 | ||
209 | list_for_each(p, &spec->nid_list) { | 207 | list_for_each_entry(node, &spec->nid_list, list) { |
210 | node = list_entry(p, struct hda_gnode, list); | ||
211 | if (node->nid == nid) | 208 | if (node->nid == nid) |
212 | return node; | 209 | return node; |
213 | } | 210 | } |
@@ -260,11 +257,9 @@ static int select_input_connection(struct hda_codec *codec, struct hda_gnode *no | |||
260 | */ | 257 | */ |
261 | static void clear_check_flags(struct hda_gspec *spec) | 258 | static void clear_check_flags(struct hda_gspec *spec) |
262 | { | 259 | { |
263 | struct list_head *p; | ||
264 | struct hda_gnode *node; | 260 | struct hda_gnode *node; |
265 | 261 | ||
266 | list_for_each(p, &spec->nid_list) { | 262 | list_for_each_entry(node, &spec->nid_list, list) { |
267 | node = list_entry(p, struct hda_gnode, list); | ||
268 | node->checked = 0; | 263 | node->checked = 0; |
269 | } | 264 | } |
270 | } | 265 | } |
@@ -347,12 +342,10 @@ static struct hda_gnode *parse_output_jack(struct hda_codec *codec, | |||
347 | struct hda_gspec *spec, | 342 | struct hda_gspec *spec, |
348 | int jack_type) | 343 | int jack_type) |
349 | { | 344 | { |
350 | struct list_head *p; | ||
351 | struct hda_gnode *node; | 345 | struct hda_gnode *node; |
352 | int err; | 346 | int err; |
353 | 347 | ||
354 | list_for_each(p, &spec->nid_list) { | 348 | list_for_each_entry(node, &spec->nid_list, list) { |
355 | node = list_entry(p, struct hda_gnode, list); | ||
356 | if (node->type != AC_WID_PIN) | 349 | if (node->type != AC_WID_PIN) |
357 | continue; | 350 | continue; |
358 | /* output capable? */ | 351 | /* output capable? */ |
@@ -664,7 +657,6 @@ static int parse_input_path(struct hda_codec *codec, struct hda_gnode *adc_node) | |||
664 | static int parse_input(struct hda_codec *codec) | 657 | static int parse_input(struct hda_codec *codec) |
665 | { | 658 | { |
666 | struct hda_gspec *spec = codec->spec; | 659 | struct hda_gspec *spec = codec->spec; |
667 | struct list_head *p; | ||
668 | struct hda_gnode *node; | 660 | struct hda_gnode *node; |
669 | int err; | 661 | int err; |
670 | 662 | ||
@@ -673,8 +665,7 @@ static int parse_input(struct hda_codec *codec) | |||
673 | * If it reaches to certain input PINs, we take it as the | 665 | * If it reaches to certain input PINs, we take it as the |
674 | * input path. | 666 | * input path. |
675 | */ | 667 | */ |
676 | list_for_each(p, &spec->nid_list) { | 668 | list_for_each_entry(node, &spec->nid_list, list) { |
677 | node = list_entry(p, struct hda_gnode, list); | ||
678 | if (node->wid_caps & AC_WCAP_DIGITAL) | 669 | if (node->wid_caps & AC_WCAP_DIGITAL) |
679 | continue; /* skip SPDIF */ | 670 | continue; /* skip SPDIF */ |
680 | if (node->type == AC_WID_AUD_IN) { | 671 | if (node->type == AC_WID_AUD_IN) { |
@@ -943,7 +934,6 @@ static int parse_loopback_path(struct hda_codec *codec, struct hda_gspec *spec, | |||
943 | static int build_loopback_controls(struct hda_codec *codec) | 934 | static int build_loopback_controls(struct hda_codec *codec) |
944 | { | 935 | { |
945 | struct hda_gspec *spec = codec->spec; | 936 | struct hda_gspec *spec = codec->spec; |
946 | struct list_head *p; | ||
947 | struct hda_gnode *node; | 937 | struct hda_gnode *node; |
948 | int err; | 938 | int err; |
949 | const char *type; | 939 | const char *type; |
@@ -951,8 +941,7 @@ static int build_loopback_controls(struct hda_codec *codec) | |||
951 | if (! spec->out_pin_node[0]) | 941 | if (! spec->out_pin_node[0]) |
952 | return 0; | 942 | return 0; |
953 | 943 | ||
954 | list_for_each(p, &spec->nid_list) { | 944 | list_for_each_entry(node, &spec->nid_list, list) { |
955 | node = list_entry(p, struct hda_gnode, list); | ||
956 | if (node->type != AC_WID_PIN) | 945 | if (node->type != AC_WID_PIN) |
957 | continue; | 946 | continue; |
958 | /* input capable? */ | 947 | /* input capable? */ |