Commit 33206e86 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Jaroslav Kysela

[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: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 50f47ff1
...@@ -95,13 +95,12 @@ struct hda_gspec { ...@@ -95,13 +95,12 @@ struct hda_gspec {
static void snd_hda_generic_free(struct hda_codec *codec) static void snd_hda_generic_free(struct hda_codec *codec)
{ {
struct hda_gspec *spec = codec->spec; struct hda_gspec *spec = codec->spec;
struct list_head *p, *n; struct hda_gnode *node, *n;
if (! spec) if (! spec)
return; return;
/* free all widgets */ /* free all widgets */
list_for_each_safe(p, n, &spec->nid_list) { list_for_each_entry_safe(node, n, &spec->nid_list, list) {
struct hda_gnode *node = list_entry(p, struct hda_gnode, list);
if (node->conn_list != node->slist) if (node->conn_list != node->slist)
kfree(node->conn_list); kfree(node->conn_list);
kfree(node); kfree(node);
...@@ -203,11 +202,9 @@ static int build_afg_tree(struct hda_codec *codec) ...@@ -203,11 +202,9 @@ static int build_afg_tree(struct hda_codec *codec)
/* FIXME: should avoid the braindead linear search */ /* FIXME: should avoid the braindead linear search */
static struct hda_gnode *hda_get_node(struct hda_gspec *spec, hda_nid_t nid) static struct hda_gnode *hda_get_node(struct hda_gspec *spec, hda_nid_t nid)
{ {
struct list_head *p;
struct hda_gnode *node; struct hda_gnode *node;
list_for_each(p, &spec->nid_list) { list_for_each_entry(node, &spec->nid_list, list) {
node = list_entry(p, struct hda_gnode, list);
if (node->nid == nid) if (node->nid == nid)
return node; return node;
} }
...@@ -260,11 +257,9 @@ static int select_input_connection(struct hda_codec *codec, struct hda_gnode *no ...@@ -260,11 +257,9 @@ static int select_input_connection(struct hda_codec *codec, struct hda_gnode *no
*/ */
static void clear_check_flags(struct hda_gspec *spec) static void clear_check_flags(struct hda_gspec *spec)
{ {
struct list_head *p;
struct hda_gnode *node; struct hda_gnode *node;
list_for_each(p, &spec->nid_list) { list_for_each_entry(node, &spec->nid_list, list) {
node = list_entry(p, struct hda_gnode, list);
node->checked = 0; node->checked = 0;
} }
} }
...@@ -347,12 +342,10 @@ static struct hda_gnode *parse_output_jack(struct hda_codec *codec, ...@@ -347,12 +342,10 @@ static struct hda_gnode *parse_output_jack(struct hda_codec *codec,
struct hda_gspec *spec, struct hda_gspec *spec,
int jack_type) int jack_type)
{ {
struct list_head *p;
struct hda_gnode *node; struct hda_gnode *node;
int err; int err;
list_for_each(p, &spec->nid_list) { list_for_each_entry(node, &spec->nid_list, list) {
node = list_entry(p, struct hda_gnode, list);
if (node->type != AC_WID_PIN) if (node->type != AC_WID_PIN)
continue; continue;
/* output capable? */ /* output capable? */
...@@ -664,7 +657,6 @@ static int parse_input_path(struct hda_codec *codec, struct hda_gnode *adc_node) ...@@ -664,7 +657,6 @@ static int parse_input_path(struct hda_codec *codec, struct hda_gnode *adc_node)
static int parse_input(struct hda_codec *codec) static int parse_input(struct hda_codec *codec)
{ {
struct hda_gspec *spec = codec->spec; struct hda_gspec *spec = codec->spec;
struct list_head *p;
struct hda_gnode *node; struct hda_gnode *node;
int err; int err;
...@@ -673,8 +665,7 @@ static int parse_input(struct hda_codec *codec) ...@@ -673,8 +665,7 @@ static int parse_input(struct hda_codec *codec)
* If it reaches to certain input PINs, we take it as the * If it reaches to certain input PINs, we take it as the
* input path. * input path.
*/ */
list_for_each(p, &spec->nid_list) { list_for_each_entry(node, &spec->nid_list, list) {
node = list_entry(p, struct hda_gnode, list);
if (node->wid_caps & AC_WCAP_DIGITAL) if (node->wid_caps & AC_WCAP_DIGITAL)
continue; /* skip SPDIF */ continue; /* skip SPDIF */
if (node->type == AC_WID_AUD_IN) { 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,7 +934,6 @@ static int parse_loopback_path(struct hda_codec *codec, struct hda_gspec *spec,
static int build_loopback_controls(struct hda_codec *codec) static int build_loopback_controls(struct hda_codec *codec)
{ {
struct hda_gspec *spec = codec->spec; struct hda_gspec *spec = codec->spec;
struct list_head *p;
struct hda_gnode *node; struct hda_gnode *node;
int err; int err;
const char *type; const char *type;
...@@ -951,8 +941,7 @@ static int build_loopback_controls(struct hda_codec *codec) ...@@ -951,8 +941,7 @@ static int build_loopback_controls(struct hda_codec *codec)
if (! spec->out_pin_node[0]) if (! spec->out_pin_node[0])
return 0; return 0;
list_for_each(p, &spec->nid_list) { list_for_each_entry(node, &spec->nid_list, list) {
node = list_entry(p, struct hda_gnode, list);
if (node->type != AC_WID_PIN) if (node->type != AC_WID_PIN)
continue; continue;
/* input capable? */ /* input capable? */
......
...@@ -1393,7 +1393,6 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec, ...@@ -1393,7 +1393,6 @@ static int __devinit create_codec_pcm(struct azx *chip, struct hda_codec *codec,
static int __devinit azx_pcm_create(struct azx *chip) static int __devinit azx_pcm_create(struct azx *chip)
{ {
struct list_head *p;
struct hda_codec *codec; struct hda_codec *codec;
int c, err; int c, err;
int pcm_dev; int pcm_dev;
...@@ -1404,8 +1403,7 @@ static int __devinit azx_pcm_create(struct azx *chip) ...@@ -1404,8 +1403,7 @@ static int __devinit azx_pcm_create(struct azx *chip)
/* create audio PCMs */ /* create audio PCMs */
pcm_dev = 0; pcm_dev = 0;
list_for_each(p, &chip->bus->codec_list) { list_for_each_entry(codec, &chip->bus->codec_list, list) {
codec = list_entry(p, struct hda_codec, list);
for (c = 0; c < codec->num_pcms; c++) { for (c = 0; c < codec->num_pcms; c++) {
if (codec->pcm_info[c].is_modem) if (codec->pcm_info[c].is_modem)
continue; /* create later */ continue; /* create later */
...@@ -1424,8 +1422,7 @@ static int __devinit azx_pcm_create(struct azx *chip) ...@@ -1424,8 +1422,7 @@ static int __devinit azx_pcm_create(struct azx *chip)
/* create modem PCMs */ /* create modem PCMs */
pcm_dev = AZX_MAX_AUDIO_PCMS; pcm_dev = AZX_MAX_AUDIO_PCMS;
list_for_each(p, &chip->bus->codec_list) { list_for_each_entry(codec, &chip->bus->codec_list, list) {
codec = list_entry(p, struct hda_codec, list);
for (c = 0; c < codec->num_pcms; c++) { for (c = 0; c < codec->num_pcms; c++) {
if (!codec->pcm_info[c].is_modem) if (!codec->pcm_info[c].is_modem)
continue; /* already created */ continue; /* already created */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment