diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-16 10:34:20 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 04:25:29 -0500 |
commit | 62932df8fb20ba2fb53a95fa52445eba22e821fe (patch) | |
tree | 335178d7438395a68a453a9c23624b3e9fc5ec40 /sound/pci/hda | |
parent | 8b7547f95cbe8a5940df62ed730646fdfcba5fda (diff) |
[ALSA] semaphore -> mutex (PCI part)
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 51 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 4 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 17 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 28 |
4 files changed, 52 insertions, 48 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 4a6dd97deba6..208a3341ec20 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
28 | #include <linux/mutex.h> | ||
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
30 | #include <sound/asoundef.h> | 31 | #include <sound/asoundef.h> |
@@ -76,12 +77,12 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, int dire | |||
76 | unsigned int verb, unsigned int parm) | 77 | unsigned int verb, unsigned int parm) |
77 | { | 78 | { |
78 | unsigned int res; | 79 | unsigned int res; |
79 | down(&codec->bus->cmd_mutex); | 80 | mutex_lock(&codec->bus->cmd_mutex); |
80 | if (! codec->bus->ops.command(codec, nid, direct, verb, parm)) | 81 | if (! codec->bus->ops.command(codec, nid, direct, verb, parm)) |
81 | res = codec->bus->ops.get_response(codec); | 82 | res = codec->bus->ops.get_response(codec); |
82 | else | 83 | else |
83 | res = (unsigned int)-1; | 84 | res = (unsigned int)-1; |
84 | up(&codec->bus->cmd_mutex); | 85 | mutex_unlock(&codec->bus->cmd_mutex); |
85 | return res; | 86 | return res; |
86 | } | 87 | } |
87 | 88 | ||
@@ -101,9 +102,9 @@ int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct, | |||
101 | unsigned int verb, unsigned int parm) | 102 | unsigned int verb, unsigned int parm) |
102 | { | 103 | { |
103 | int err; | 104 | int err; |
104 | down(&codec->bus->cmd_mutex); | 105 | mutex_lock(&codec->bus->cmd_mutex); |
105 | err = codec->bus->ops.command(codec, nid, direct, verb, parm); | 106 | err = codec->bus->ops.command(codec, nid, direct, verb, parm); |
106 | up(&codec->bus->cmd_mutex); | 107 | mutex_unlock(&codec->bus->cmd_mutex); |
107 | return err; | 108 | return err; |
108 | } | 109 | } |
109 | 110 | ||
@@ -371,7 +372,7 @@ int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp, | |||
371 | bus->modelname = temp->modelname; | 372 | bus->modelname = temp->modelname; |
372 | bus->ops = temp->ops; | 373 | bus->ops = temp->ops; |
373 | 374 | ||
374 | init_MUTEX(&bus->cmd_mutex); | 375 | mutex_init(&bus->cmd_mutex); |
375 | INIT_LIST_HEAD(&bus->codec_list); | 376 | INIT_LIST_HEAD(&bus->codec_list); |
376 | 377 | ||
377 | if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) { | 378 | if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) { |
@@ -523,7 +524,7 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | |||
523 | 524 | ||
524 | codec->bus = bus; | 525 | codec->bus = bus; |
525 | codec->addr = codec_addr; | 526 | codec->addr = codec_addr; |
526 | init_MUTEX(&codec->spdif_mutex); | 527 | mutex_init(&codec->spdif_mutex); |
527 | init_amp_hash(codec); | 528 | init_amp_hash(codec); |
528 | 529 | ||
529 | list_add_tail(&codec->list, &bus->codec_list); | 530 | list_add_tail(&codec->list, &bus->codec_list); |
@@ -881,12 +882,12 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
881 | unsigned long pval; | 882 | unsigned long pval; |
882 | int err; | 883 | int err; |
883 | 884 | ||
884 | down(&codec->spdif_mutex); /* reuse spdif_mutex */ | 885 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
885 | pval = kcontrol->private_value; | 886 | pval = kcontrol->private_value; |
886 | kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ | 887 | kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ |
887 | err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); | 888 | err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); |
888 | kcontrol->private_value = pval; | 889 | kcontrol->private_value = pval; |
889 | up(&codec->spdif_mutex); | 890 | mutex_unlock(&codec->spdif_mutex); |
890 | return err; | 891 | return err; |
891 | } | 892 | } |
892 | 893 | ||
@@ -896,7 +897,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
896 | unsigned long pval; | 897 | unsigned long pval; |
897 | int i, indices, err = 0, change = 0; | 898 | int i, indices, err = 0, change = 0; |
898 | 899 | ||
899 | down(&codec->spdif_mutex); /* reuse spdif_mutex */ | 900 | mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ |
900 | pval = kcontrol->private_value; | 901 | pval = kcontrol->private_value; |
901 | indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; | 902 | indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; |
902 | for (i = 0; i < indices; i++) { | 903 | for (i = 0; i < indices; i++) { |
@@ -907,7 +908,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
907 | change |= err; | 908 | change |= err; |
908 | } | 909 | } |
909 | kcontrol->private_value = pval; | 910 | kcontrol->private_value = pval; |
910 | up(&codec->spdif_mutex); | 911 | mutex_unlock(&codec->spdif_mutex); |
911 | return err < 0 ? err : change; | 912 | return err < 0 ? err : change; |
912 | } | 913 | } |
913 | 914 | ||
@@ -1011,7 +1012,7 @@ static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_c | |||
1011 | unsigned short val; | 1012 | unsigned short val; |
1012 | int change; | 1013 | int change; |
1013 | 1014 | ||
1014 | down(&codec->spdif_mutex); | 1015 | mutex_lock(&codec->spdif_mutex); |
1015 | codec->spdif_status = ucontrol->value.iec958.status[0] | | 1016 | codec->spdif_status = ucontrol->value.iec958.status[0] | |
1016 | ((unsigned int)ucontrol->value.iec958.status[1] << 8) | | 1017 | ((unsigned int)ucontrol->value.iec958.status[1] << 8) | |
1017 | ((unsigned int)ucontrol->value.iec958.status[2] << 16) | | 1018 | ((unsigned int)ucontrol->value.iec958.status[2] << 16) | |
@@ -1026,7 +1027,7 @@ static int snd_hda_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_c | |||
1026 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_2, val >> 8); | 1027 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_2, val >> 8); |
1027 | } | 1028 | } |
1028 | 1029 | ||
1029 | up(&codec->spdif_mutex); | 1030 | mutex_unlock(&codec->spdif_mutex); |
1030 | return change; | 1031 | return change; |
1031 | } | 1032 | } |
1032 | 1033 | ||
@@ -1054,7 +1055,7 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol, struct sn | |||
1054 | unsigned short val; | 1055 | unsigned short val; |
1055 | int change; | 1056 | int change; |
1056 | 1057 | ||
1057 | down(&codec->spdif_mutex); | 1058 | mutex_lock(&codec->spdif_mutex); |
1058 | val = codec->spdif_ctls & ~1; | 1059 | val = codec->spdif_ctls & ~1; |
1059 | if (ucontrol->value.integer.value[0]) | 1060 | if (ucontrol->value.integer.value[0]) |
1060 | val |= 1; | 1061 | val |= 1; |
@@ -1066,7 +1067,7 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol, struct sn | |||
1066 | AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | | 1067 | AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | |
1067 | AC_AMP_SET_OUTPUT | ((val & 1) ? 0 : 0x80)); | 1068 | AC_AMP_SET_OUTPUT | ((val & 1) ? 0 : 0x80)); |
1068 | } | 1069 | } |
1069 | up(&codec->spdif_mutex); | 1070 | mutex_unlock(&codec->spdif_mutex); |
1070 | return change; | 1071 | return change; |
1071 | } | 1072 | } |
1072 | 1073 | ||
@@ -1150,13 +1151,13 @@ static int snd_hda_spdif_in_switch_put(struct snd_kcontrol *kcontrol, struct snd | |||
1150 | unsigned int val = !!ucontrol->value.integer.value[0]; | 1151 | unsigned int val = !!ucontrol->value.integer.value[0]; |
1151 | int change; | 1152 | int change; |
1152 | 1153 | ||
1153 | down(&codec->spdif_mutex); | 1154 | mutex_lock(&codec->spdif_mutex); |
1154 | change = codec->spdif_in_enable != val; | 1155 | change = codec->spdif_in_enable != val; |
1155 | if (change || codec->in_resume) { | 1156 | if (change || codec->in_resume) { |
1156 | codec->spdif_in_enable = val; | 1157 | codec->spdif_in_enable = val; |
1157 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, val); | 1158 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, val); |
1158 | } | 1159 | } |
1159 | up(&codec->spdif_mutex); | 1160 | mutex_unlock(&codec->spdif_mutex); |
1160 | return change; | 1161 | return change; |
1161 | } | 1162 | } |
1162 | 1163 | ||
@@ -1824,13 +1825,13 @@ int snd_hda_input_mux_put(struct hda_codec *codec, const struct hda_input_mux *i | |||
1824 | */ | 1825 | */ |
1825 | int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mout) | 1826 | int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mout) |
1826 | { | 1827 | { |
1827 | down(&codec->spdif_mutex); | 1828 | mutex_lock(&codec->spdif_mutex); |
1828 | if (mout->dig_out_used) { | 1829 | if (mout->dig_out_used) { |
1829 | up(&codec->spdif_mutex); | 1830 | mutex_unlock(&codec->spdif_mutex); |
1830 | return -EBUSY; /* already being used */ | 1831 | return -EBUSY; /* already being used */ |
1831 | } | 1832 | } |
1832 | mout->dig_out_used = HDA_DIG_EXCLUSIVE; | 1833 | mout->dig_out_used = HDA_DIG_EXCLUSIVE; |
1833 | up(&codec->spdif_mutex); | 1834 | mutex_unlock(&codec->spdif_mutex); |
1834 | return 0; | 1835 | return 0; |
1835 | } | 1836 | } |
1836 | 1837 | ||
@@ -1839,9 +1840,9 @@ int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mo | |||
1839 | */ | 1840 | */ |
1840 | int snd_hda_multi_out_dig_close(struct hda_codec *codec, struct hda_multi_out *mout) | 1841 | int snd_hda_multi_out_dig_close(struct hda_codec *codec, struct hda_multi_out *mout) |
1841 | { | 1842 | { |
1842 | down(&codec->spdif_mutex); | 1843 | mutex_lock(&codec->spdif_mutex); |
1843 | mout->dig_out_used = 0; | 1844 | mout->dig_out_used = 0; |
1844 | up(&codec->spdif_mutex); | 1845 | mutex_unlock(&codec->spdif_mutex); |
1845 | return 0; | 1846 | return 0; |
1846 | } | 1847 | } |
1847 | 1848 | ||
@@ -1869,7 +1870,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, struct hda_multi_o | |||
1869 | int chs = substream->runtime->channels; | 1870 | int chs = substream->runtime->channels; |
1870 | int i; | 1871 | int i; |
1871 | 1872 | ||
1872 | down(&codec->spdif_mutex); | 1873 | mutex_lock(&codec->spdif_mutex); |
1873 | if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { | 1874 | if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { |
1874 | if (chs == 2 && | 1875 | if (chs == 2 && |
1875 | snd_hda_is_supported_format(codec, mout->dig_out_nid, format) && | 1876 | snd_hda_is_supported_format(codec, mout->dig_out_nid, format) && |
@@ -1883,7 +1884,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, struct hda_multi_o | |||
1883 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); | 1884 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); |
1884 | } | 1885 | } |
1885 | } | 1886 | } |
1886 | up(&codec->spdif_mutex); | 1887 | mutex_unlock(&codec->spdif_mutex); |
1887 | 1888 | ||
1888 | /* front */ | 1889 | /* front */ |
1889 | snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 0, format); | 1890 | snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 0, format); |
@@ -1914,12 +1915,12 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, struct hda_multi_o | |||
1914 | snd_hda_codec_setup_stream(codec, nids[i], 0, 0, 0); | 1915 | snd_hda_codec_setup_stream(codec, nids[i], 0, 0, 0); |
1915 | if (mout->hp_nid) | 1916 | if (mout->hp_nid) |
1916 | snd_hda_codec_setup_stream(codec, mout->hp_nid, 0, 0, 0); | 1917 | snd_hda_codec_setup_stream(codec, mout->hp_nid, 0, 0, 0); |
1917 | down(&codec->spdif_mutex); | 1918 | mutex_lock(&codec->spdif_mutex); |
1918 | if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { | 1919 | if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { |
1919 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); | 1920 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); |
1920 | mout->dig_out_used = 0; | 1921 | mout->dig_out_used = 0; |
1921 | } | 1922 | } |
1922 | up(&codec->spdif_mutex); | 1923 | mutex_unlock(&codec->spdif_mutex); |
1923 | return 0; | 1924 | return 0; |
1924 | } | 1925 | } |
1925 | 1926 | ||
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 63e26c7a2b7a..40520e9d5a4b 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -438,7 +438,7 @@ struct hda_bus { | |||
438 | struct list_head codec_list; | 438 | struct list_head codec_list; |
439 | struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1]; /* caddr -> codec */ | 439 | struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1]; /* caddr -> codec */ |
440 | 440 | ||
441 | struct semaphore cmd_mutex; | 441 | struct mutex cmd_mutex; |
442 | 442 | ||
443 | /* unsolicited event queue */ | 443 | /* unsolicited event queue */ |
444 | struct hda_bus_unsolicited *unsol; | 444 | struct hda_bus_unsolicited *unsol; |
@@ -559,7 +559,7 @@ struct hda_codec { | |||
559 | int amp_info_size; | 559 | int amp_info_size; |
560 | struct hda_amp_info *amp_info; | 560 | struct hda_amp_info *amp_info; |
561 | 561 | ||
562 | struct semaphore spdif_mutex; | 562 | struct mutex spdif_mutex; |
563 | unsigned int spdif_status; /* IEC958 status bits */ | 563 | unsigned int spdif_status; /* IEC958 status bits */ |
564 | unsigned short spdif_ctls; /* SPDIF control bits */ | 564 | unsigned short spdif_ctls; /* SPDIF control bits */ |
565 | unsigned int spdif_in_enable; /* SPDIF input enable? */ | 565 | unsigned int spdif_in_enable; /* SPDIF input enable? */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index b3f37e7b33c0..dbed2644a192 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
46 | #include <linux/mutex.h> | ||
46 | #include <sound/core.h> | 47 | #include <sound/core.h> |
47 | #include <sound/initval.h> | 48 | #include <sound/initval.h> |
48 | #include "hda_codec.h" | 49 | #include "hda_codec.h" |
@@ -297,7 +298,7 @@ struct azx { | |||
297 | 298 | ||
298 | /* locks */ | 299 | /* locks */ |
299 | spinlock_t reg_lock; | 300 | spinlock_t reg_lock; |
300 | struct semaphore open_mutex; | 301 | struct mutex open_mutex; |
301 | 302 | ||
302 | /* streams (x num_streams) */ | 303 | /* streams (x num_streams) */ |
303 | struct azx_dev *azx_dev; | 304 | struct azx_dev *azx_dev; |
@@ -993,10 +994,10 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
993 | unsigned long flags; | 994 | unsigned long flags; |
994 | int err; | 995 | int err; |
995 | 996 | ||
996 | down(&chip->open_mutex); | 997 | mutex_lock(&chip->open_mutex); |
997 | azx_dev = azx_assign_device(chip, substream->stream); | 998 | azx_dev = azx_assign_device(chip, substream->stream); |
998 | if (azx_dev == NULL) { | 999 | if (azx_dev == NULL) { |
999 | up(&chip->open_mutex); | 1000 | mutex_unlock(&chip->open_mutex); |
1000 | return -EBUSY; | 1001 | return -EBUSY; |
1001 | } | 1002 | } |
1002 | runtime->hw = azx_pcm_hw; | 1003 | runtime->hw = azx_pcm_hw; |
@@ -1008,7 +1009,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1008 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); | 1009 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
1009 | if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) { | 1010 | if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) { |
1010 | azx_release_device(azx_dev); | 1011 | azx_release_device(azx_dev); |
1011 | up(&chip->open_mutex); | 1012 | mutex_unlock(&chip->open_mutex); |
1012 | return err; | 1013 | return err; |
1013 | } | 1014 | } |
1014 | spin_lock_irqsave(&chip->reg_lock, flags); | 1015 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -1017,7 +1018,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1017 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1018 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1018 | 1019 | ||
1019 | runtime->private_data = azx_dev; | 1020 | runtime->private_data = azx_dev; |
1020 | up(&chip->open_mutex); | 1021 | mutex_unlock(&chip->open_mutex); |
1021 | return 0; | 1022 | return 0; |
1022 | } | 1023 | } |
1023 | 1024 | ||
@@ -1029,14 +1030,14 @@ static int azx_pcm_close(struct snd_pcm_substream *substream) | |||
1029 | struct azx_dev *azx_dev = get_azx_dev(substream); | 1030 | struct azx_dev *azx_dev = get_azx_dev(substream); |
1030 | unsigned long flags; | 1031 | unsigned long flags; |
1031 | 1032 | ||
1032 | down(&chip->open_mutex); | 1033 | mutex_lock(&chip->open_mutex); |
1033 | spin_lock_irqsave(&chip->reg_lock, flags); | 1034 | spin_lock_irqsave(&chip->reg_lock, flags); |
1034 | azx_dev->substream = NULL; | 1035 | azx_dev->substream = NULL; |
1035 | azx_dev->running = 0; | 1036 | azx_dev->running = 0; |
1036 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1037 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1037 | azx_release_device(azx_dev); | 1038 | azx_release_device(azx_dev); |
1038 | hinfo->ops.close(hinfo, apcm->codec, substream); | 1039 | hinfo->ops.close(hinfo, apcm->codec, substream); |
1039 | up(&chip->open_mutex); | 1040 | mutex_unlock(&chip->open_mutex); |
1040 | return 0; | 1041 | return 0; |
1041 | } | 1042 | } |
1042 | 1043 | ||
@@ -1408,7 +1409,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1408 | } | 1409 | } |
1409 | 1410 | ||
1410 | spin_lock_init(&chip->reg_lock); | 1411 | spin_lock_init(&chip->reg_lock); |
1411 | init_MUTEX(&chip->open_mutex); | 1412 | mutex_init(&chip->open_mutex); |
1412 | chip->card = card; | 1413 | chip->card = card; |
1413 | chip->pci = pci; | 1414 | chip->pci = pci; |
1414 | chip->irq = -1; | 1415 | chip->irq = -1; |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 1ada1b075c9a..5a3821ae93a8 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/mutex.h> | ||
27 | |||
26 | #include <sound/core.h> | 28 | #include <sound/core.h> |
27 | #include "hda_codec.h" | 29 | #include "hda_codec.h" |
28 | #include "hda_local.h" | 30 | #include "hda_local.h" |
@@ -60,7 +62,7 @@ struct ad198x_spec { | |||
60 | /* PCM information */ | 62 | /* PCM information */ |
61 | struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ | 63 | struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ |
62 | 64 | ||
63 | struct semaphore amp_mutex; /* PCM volume/mute control mutex */ | 65 | struct mutex amp_mutex; /* PCM volume/mute control mutex */ |
64 | unsigned int spdif_route; | 66 | unsigned int spdif_route; |
65 | 67 | ||
66 | /* dynamic controls, init_verbs and input_mux */ | 68 | /* dynamic controls, init_verbs and input_mux */ |
@@ -371,9 +373,9 @@ static int ad1986a_pcm_amp_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl | |||
371 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 373 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
372 | struct ad198x_spec *ad = codec->spec; | 374 | struct ad198x_spec *ad = codec->spec; |
373 | 375 | ||
374 | down(&ad->amp_mutex); | 376 | mutex_lock(&ad->amp_mutex); |
375 | snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); | 377 | snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); |
376 | up(&ad->amp_mutex); | 378 | mutex_unlock(&ad->amp_mutex); |
377 | return 0; | 379 | return 0; |
378 | } | 380 | } |
379 | 381 | ||
@@ -383,13 +385,13 @@ static int ad1986a_pcm_amp_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl | |||
383 | struct ad198x_spec *ad = codec->spec; | 385 | struct ad198x_spec *ad = codec->spec; |
384 | int i, change = 0; | 386 | int i, change = 0; |
385 | 387 | ||
386 | down(&ad->amp_mutex); | 388 | mutex_lock(&ad->amp_mutex); |
387 | for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) { | 389 | for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) { |
388 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT); | 390 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT); |
389 | change |= snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); | 391 | change |= snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); |
390 | } | 392 | } |
391 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT); | 393 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT); |
392 | up(&ad->amp_mutex); | 394 | mutex_unlock(&ad->amp_mutex); |
393 | return change; | 395 | return change; |
394 | } | 396 | } |
395 | 397 | ||
@@ -400,9 +402,9 @@ static int ad1986a_pcm_amp_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
400 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 402 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
401 | struct ad198x_spec *ad = codec->spec; | 403 | struct ad198x_spec *ad = codec->spec; |
402 | 404 | ||
403 | down(&ad->amp_mutex); | 405 | mutex_lock(&ad->amp_mutex); |
404 | snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); | 406 | snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); |
405 | up(&ad->amp_mutex); | 407 | mutex_unlock(&ad->amp_mutex); |
406 | return 0; | 408 | return 0; |
407 | } | 409 | } |
408 | 410 | ||
@@ -412,13 +414,13 @@ static int ad1986a_pcm_amp_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
412 | struct ad198x_spec *ad = codec->spec; | 414 | struct ad198x_spec *ad = codec->spec; |
413 | int i, change = 0; | 415 | int i, change = 0; |
414 | 416 | ||
415 | down(&ad->amp_mutex); | 417 | mutex_lock(&ad->amp_mutex); |
416 | for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) { | 418 | for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) { |
417 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT); | 419 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT); |
418 | change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | 420 | change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); |
419 | } | 421 | } |
420 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT); | 422 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT); |
421 | up(&ad->amp_mutex); | 423 | mutex_unlock(&ad->amp_mutex); |
422 | return change; | 424 | return change; |
423 | } | 425 | } |
424 | 426 | ||
@@ -544,7 +546,7 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
544 | if (spec == NULL) | 546 | if (spec == NULL) |
545 | return -ENOMEM; | 547 | return -ENOMEM; |
546 | 548 | ||
547 | init_MUTEX(&spec->amp_mutex); | 549 | mutex_init(&spec->amp_mutex); |
548 | codec->spec = spec; | 550 | codec->spec = spec; |
549 | 551 | ||
550 | spec->multiout.max_channels = 6; | 552 | spec->multiout.max_channels = 6; |
@@ -708,7 +710,7 @@ static int patch_ad1983(struct hda_codec *codec) | |||
708 | if (spec == NULL) | 710 | if (spec == NULL) |
709 | return -ENOMEM; | 711 | return -ENOMEM; |
710 | 712 | ||
711 | init_MUTEX(&spec->amp_mutex); | 713 | mutex_init(&spec->amp_mutex); |
712 | codec->spec = spec; | 714 | codec->spec = spec; |
713 | 715 | ||
714 | spec->multiout.max_channels = 2; | 716 | spec->multiout.max_channels = 2; |
@@ -854,7 +856,7 @@ static int patch_ad1981(struct hda_codec *codec) | |||
854 | if (spec == NULL) | 856 | if (spec == NULL) |
855 | return -ENOMEM; | 857 | return -ENOMEM; |
856 | 858 | ||
857 | init_MUTEX(&spec->amp_mutex); | 859 | mutex_init(&spec->amp_mutex); |
858 | codec->spec = spec; | 860 | codec->spec = spec; |
859 | 861 | ||
860 | spec->multiout.max_channels = 2; | 862 | spec->multiout.max_channels = 2; |
@@ -2032,7 +2034,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2032 | if (spec == NULL) | 2034 | if (spec == NULL) |
2033 | return -ENOMEM; | 2035 | return -ENOMEM; |
2034 | 2036 | ||
2035 | init_MUTEX(&spec->amp_mutex); | 2037 | mutex_init(&spec->amp_mutex); |
2036 | codec->spec = spec; | 2038 | codec->spec = spec; |
2037 | 2039 | ||
2038 | if (codec->revision_id == AD1988A_REV2) | 2040 | if (codec->revision_id == AD1988A_REV2) |