diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-04-15 11:23:44 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-04-15 11:23:44 +0200 |
commit | ff0c68d03b77ecb3a682137c42e947a4dc33e9b3 (patch) | |
tree | eb9b5103513692c10fa48a4a8cbae9a1efa12663 /sound/pci/hda/patch_conexant.c | |
parent | bfb53037c61ddf7c16a40297ad16f2bcbde534dc (diff) | |
parent | 95c0909961bc5ff18c78b2ab0d093cddc0a8b0b5 (diff) |
Merge branch 'topic/jack-free-fix' into topic/hda
* topic/jack-free-fix:
ALSA: hda - Avoid call of snd_jack_report at release
ALSA: add private_data to struct snd_jack
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 1f2ad76ca94..56ce19e68cb 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -350,12 +350,20 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, } #ifdef CONFIG_SND_JACK +static void conexant_free_jack_priv(struct snd_jack *jack) +{ + struct conexant_jack *jacks = jack->private_data; + jacks->nid = 0; + jacks->jack = NULL; +} + static int conexant_add_jack(struct hda_codec *codec, hda_nid_t nid, int type) { struct conexant_spec *spec; struct conexant_jack *jack; const char *name; + int err; spec = codec->spec; snd_array_init(&spec->jacks, sizeof(*jack), 32); @@ -368,7 +376,12 @@ static int conexant_add_jack(struct hda_codec *codec, jack->nid = nid; jack->type = type; - return snd_jack_new(codec->bus->card, name, type, &jack->jack); + err = snd_jack_new(codec->bus->card, name, type, &jack->jack); + if (err < 0) + return err; + jack->jack->private_data = jack; + jack->jack->private_free = conexant_free_jack_priv; + return 0; } static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) @@ -455,8 +468,10 @@ static void conexant_free(struct hda_codec *codec) if (spec->jacks.list) { struct conexant_jack *jacks = spec->jacks.list; int i; - for (i = 0; i < spec->jacks.used; i++) - snd_device_free(codec->bus->card, &jacks[i].jack); + for (i = 0; i < spec->jacks.used; i++, jacks++) { + if (jacks->jack) + snd_device_free(codec->bus->card, jacks->jack); + } snd_array_free(&spec->jacks); } #endif |