diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-06-17 03:33:52 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-06-24 05:52:59 -0400 |
commit | a1e21c9078fb8005e5accb921696ec9e2f38176e (patch) | |
tree | 53b6495d7d60354688031b28aa331d7e58286d6e /sound/pci/hda/hda_intel.c | |
parent | 8c8145b8734028f6deb487f7d64748da4c6c39ac (diff) |
ALSA: hda - Don't call snd_hda_codec_configure in snd_hda_codec_new()
The codec setup call via snd_hda_codec_configure() isn't necessarily
called in snd_hda_codec_new(). For the later added feature, it's better
to change the code flow like:
- create all codec instances
- configure each codec
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4e9ea7080270..da58f2ca9151 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1286,8 +1286,7 @@ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { | |||
1286 | [AZX_DRIVER_TERA] = 1, | 1286 | [AZX_DRIVER_TERA] = 1, |
1287 | }; | 1287 | }; |
1288 | 1288 | ||
1289 | static int __devinit azx_codec_create(struct azx *chip, const char *model, | 1289 | static int __devinit azx_codec_create(struct azx *chip, const char *model) |
1290 | int no_init) | ||
1291 | { | 1290 | { |
1292 | struct hda_bus_template bus_temp; | 1291 | struct hda_bus_template bus_temp; |
1293 | int c, codecs, err; | 1292 | int c, codecs, err; |
@@ -1346,7 +1345,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1346 | for (c = 0; c < max_slots; c++) { | 1345 | for (c = 0; c < max_slots; c++) { |
1347 | if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { | 1346 | if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { |
1348 | struct hda_codec *codec; | 1347 | struct hda_codec *codec; |
1349 | err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); | 1348 | err = snd_hda_codec_new(chip->bus, c, &codec); |
1350 | if (err < 0) | 1349 | if (err < 0) |
1351 | continue; | 1350 | continue; |
1352 | codecs++; | 1351 | codecs++; |
@@ -1356,7 +1355,16 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1356 | snd_printk(KERN_ERR SFX "no codecs initialized\n"); | 1355 | snd_printk(KERN_ERR SFX "no codecs initialized\n"); |
1357 | return -ENXIO; | 1356 | return -ENXIO; |
1358 | } | 1357 | } |
1358 | return 0; | ||
1359 | } | ||
1359 | 1360 | ||
1361 | /* configure each codec instance */ | ||
1362 | static int __devinit azx_codec_configure(struct azx *chip) | ||
1363 | { | ||
1364 | struct hda_codec *codec; | ||
1365 | list_for_each_entry(codec, &chip->bus->codec_list, list) { | ||
1366 | snd_hda_codec_configure(codec); | ||
1367 | } | ||
1360 | return 0; | 1368 | return 0; |
1361 | } | 1369 | } |
1362 | 1370 | ||
@@ -2466,9 +2474,14 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2466 | card->private_data = chip; | 2474 | card->private_data = chip; |
2467 | 2475 | ||
2468 | /* create codec instances */ | 2476 | /* create codec instances */ |
2469 | err = azx_codec_create(chip, model[dev], probe_only[dev]); | 2477 | err = azx_codec_create(chip, model[dev]); |
2470 | if (err < 0) | 2478 | if (err < 0) |
2471 | goto out_free; | 2479 | goto out_free; |
2480 | if (!probe_only[dev]) { | ||
2481 | err = azx_codec_configure(chip); | ||
2482 | if (err < 0) | ||
2483 | goto out_free; | ||
2484 | } | ||
2472 | 2485 | ||
2473 | /* create PCM streams */ | 2486 | /* create PCM streams */ |
2474 | err = snd_hda_build_pcms(chip->bus); | 2487 | err = snd_hda_build_pcms(chip->bus); |