aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-15 09:11:11 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-15 09:11:11 -0700
commit3ee8da87ba6151ec91b2b8bbd27633bb248ea0d5 (patch)
treea348efdfe8f607583dd61bf75e1b5d077c92a4a0 /sound/pci/hda/patch_sigmatel.c
parenta2c252ebdeaab28c9b400570594d576dae295958 (diff)
parent9dd175f7d2db1826c891855d3d150da3a5792e94 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: ALSA: hda - Fix the cmd cache keys for amp verbs ALSA: add missing definitions(letters) to HD-Audio.txt ALSA: hda - Add quirk mask for Fujitsu Amilo laptops with ALC883 [ALSA] intel8x0: add one retry to the ac97_clock measurement routine [ALSA] intel8x0: fix wrong conditions in ac97_clock measure routine ALSA: hda - Avoid call of snd_jack_report at release ALSA: add private_data to struct snd_jack ALSA: snd-usb-caiaq: rename files to remove redundant information in file pathes ALSA: snd-usb-caiaq: clean up header includes ALSA: sound/pci: use memdup_user() ALSA: sound/usb: use memdup_user() ALSA: sound/isa: use memdup_user() ALSA: sound/core: use memdup_user() [ALSA] intel8x0: do not use zero value from PICB register [ALSA] intel8x0: an attempt to make ac97_clock measurement more reliable [ALSA] pcm-midlevel: Add more strict buffer position checks based on jiffies [ALSA] hda_intel: fix unexpected ring buffer positions ASoC: Disable S3C64xx support in Kconfig ASoC: magician: remove un-necessary #include of pxa-regs.h and hardware.h
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 61996a2f45d..ce30b459aee 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3851,6 +3851,15 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
}
+#ifdef CONFIG_SND_JACK
+static void stac92xx_free_jack_priv(struct snd_jack *jack)
+{
+ struct sigmatel_jack *jacks = jack->private_data;
+ jacks->nid = 0;
+ jacks->jack = NULL;
+}
+#endif
+
static int stac92xx_add_jack(struct hda_codec *codec,
hda_nid_t nid, int type)
{
@@ -3860,6 +3869,7 @@ static int stac92xx_add_jack(struct hda_codec *codec,
int def_conf = snd_hda_codec_get_pincfg(codec, nid);
int connectivity = get_defcfg_connect(def_conf);
char name[32];
+ int err;
if (connectivity && connectivity != AC_JACK_PORT_FIXED)
return 0;
@@ -3876,10 +3886,15 @@ static int stac92xx_add_jack(struct hda_codec *codec,
snd_hda_get_jack_connectivity(def_conf),
snd_hda_get_jack_location(def_conf));
- return snd_jack_new(codec->bus->card, name, type, &jack->jack);
-#else
- return 0;
+ err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
+ if (err < 0) {
+ jack->nid = 0;
+ return err;
+ }
+ jack->jack->private_data = jack;
+ jack->jack->private_free = stac92xx_free_jack_priv;
#endif
+ return 0;
}
static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid,
@@ -4138,8 +4153,10 @@ static void stac92xx_free_jacks(struct hda_codec *codec)
if (!codec->bus->shutdown && spec->jacks.list) {
struct sigmatel_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