Commit 9f146bb6 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] hda-codec - Prepare unsol workqueue on demand

Modules: HDA Codec driver

Prepare unsol workqueue only when a codec really supports.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d2a6d7dc
...@@ -288,6 +288,9 @@ static int init_unsol_queue(struct hda_bus *bus) ...@@ -288,6 +288,9 @@ static int init_unsol_queue(struct hda_bus *bus)
{ {
struct hda_bus_unsolicited *unsol; struct hda_bus_unsolicited *unsol;
if (bus->unsol) /* already initialized */
return 0;
unsol = kzalloc(sizeof(*unsol), GFP_KERNEL); unsol = kzalloc(sizeof(*unsol), GFP_KERNEL);
if (! unsol) { if (! unsol) {
snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n"); 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,8 +376,6 @@ int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp,
init_MUTEX(&bus->cmd_mutex); init_MUTEX(&bus->cmd_mutex);
INIT_LIST_HEAD(&bus->codec_list); INIT_LIST_HEAD(&bus->codec_list);
init_unsol_queue(bus);
if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) { if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) {
snd_hda_bus_free(bus); snd_hda_bus_free(bus);
return err; return err;
...@@ -540,6 +541,9 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, ...@@ -540,6 +541,9 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
return err; return err;
} }
if (codec->patch_ops.unsol_event)
init_unsol_queue(bus);
snd_hda_codec_proc_new(codec); snd_hda_codec_proc_new(codec);
sprintf(component, "HDA:%08x", codec->vendor_id); sprintf(component, "HDA:%08x", codec->vendor_id);
......
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