diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 05:07:49 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:17:22 -0500 |
commit | 9f146bb6e68610ab2b62c76e7485900545515613 (patch) | |
tree | d19bcc56619d52f13ccde73061b0e0832abc37da /sound/pci/hda/hda_codec.c | |
parent | d2a6d7dc757da6b57d77bd8b460cf4faa9fd152d (diff) |
[ALSA] hda-codec - Prepare unsol workqueue on demand
Modules: HDA Codec driver
Prepare unsol workqueue only when a codec really supports.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 14a6f5463277..cfd50b56187b 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -288,6 +288,9 @@ static int init_unsol_queue(struct hda_bus *bus) | |||
288 | { | 288 | { |
289 | struct hda_bus_unsolicited *unsol; | 289 | struct hda_bus_unsolicited *unsol; |
290 | 290 | ||
291 | if (bus->unsol) /* already initialized */ | ||
292 | return 0; | ||
293 | |||
291 | unsol = kzalloc(sizeof(*unsol), GFP_KERNEL); | 294 | unsol = kzalloc(sizeof(*unsol), GFP_KERNEL); |
292 | if (! unsol) { | 295 | if (! unsol) { |
293 | snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n"); | 296 | snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n"); |
@@ -373,8 +376,6 @@ int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp, | |||
373 | init_MUTEX(&bus->cmd_mutex); | 376 | init_MUTEX(&bus->cmd_mutex); |
374 | INIT_LIST_HEAD(&bus->codec_list); | 377 | INIT_LIST_HEAD(&bus->codec_list); |
375 | 378 | ||
376 | init_unsol_queue(bus); | ||
377 | |||
378 | if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) { | 379 | if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) { |
379 | snd_hda_bus_free(bus); | 380 | snd_hda_bus_free(bus); |
380 | return err; | 381 | return err; |
@@ -540,6 +541,9 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | |||
540 | return err; | 541 | return err; |
541 | } | 542 | } |
542 | 543 | ||
544 | if (codec->patch_ops.unsol_event) | ||
545 | init_unsol_queue(bus); | ||
546 | |||
543 | snd_hda_codec_proc_new(codec); | 547 | snd_hda_codec_proc_new(codec); |
544 | 548 | ||
545 | sprintf(component, "HDA:%08x", codec->vendor_id); | 549 | sprintf(component, "HDA:%08x", codec->vendor_id); |