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/pcxhr | |
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/pcxhr')
-rw-r--r-- | sound/pci/pcxhr/pcxhr.c | 36 | ||||
-rw-r--r-- | sound/pci/pcxhr/pcxhr.h | 5 | ||||
-rw-r--r-- | sound/pci/pcxhr/pcxhr_mixer.c | 75 |
3 files changed, 60 insertions, 56 deletions
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index b2cba75b6b16..31a3e8e1b234 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
31 | #include <linux/mutex.h> | ||
32 | |||
31 | #include <sound/core.h> | 33 | #include <sound/core.h> |
32 | #include <sound/initval.h> | 34 | #include <sound/initval.h> |
33 | #include <sound/info.h> | 35 | #include <sound/info.h> |
@@ -518,7 +520,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) | |||
518 | struct timeval my_tv1, my_tv2; | 520 | struct timeval my_tv1, my_tv2; |
519 | do_gettimeofday(&my_tv1); | 521 | do_gettimeofday(&my_tv1); |
520 | #endif | 522 | #endif |
521 | down(&mgr->setup_mutex); | 523 | mutex_lock(&mgr->setup_mutex); |
522 | 524 | ||
523 | /* check the pipes concerned and build pipe_array */ | 525 | /* check the pipes concerned and build pipe_array */ |
524 | for (i = 0; i < mgr->num_cards; i++) { | 526 | for (i = 0; i < mgr->num_cards; i++) { |
@@ -537,7 +539,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) | |||
537 | } | 539 | } |
538 | } | 540 | } |
539 | if (capture_mask == 0 && playback_mask == 0) { | 541 | if (capture_mask == 0 && playback_mask == 0) { |
540 | up(&mgr->setup_mutex); | 542 | mutex_unlock(&mgr->setup_mutex); |
541 | snd_printk(KERN_ERR "pcxhr_trigger_tasklet : no pipes\n"); | 543 | snd_printk(KERN_ERR "pcxhr_trigger_tasklet : no pipes\n"); |
542 | return; | 544 | return; |
543 | } | 545 | } |
@@ -548,7 +550,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) | |||
548 | /* synchronous stop of all the pipes concerned */ | 550 | /* synchronous stop of all the pipes concerned */ |
549 | err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0); | 551 | err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0); |
550 | if (err) { | 552 | if (err) { |
551 | up(&mgr->setup_mutex); | 553 | mutex_unlock(&mgr->setup_mutex); |
552 | snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error stop pipes (P%x C%x)\n", | 554 | snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error stop pipes (P%x C%x)\n", |
553 | playback_mask, capture_mask); | 555 | playback_mask, capture_mask); |
554 | return; | 556 | return; |
@@ -592,7 +594,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) | |||
592 | /* synchronous start of all the pipes concerned */ | 594 | /* synchronous start of all the pipes concerned */ |
593 | err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 1); | 595 | err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 1); |
594 | if (err) { | 596 | if (err) { |
595 | up(&mgr->setup_mutex); | 597 | mutex_unlock(&mgr->setup_mutex); |
596 | snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error start pipes (P%x C%x)\n", | 598 | snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error start pipes (P%x C%x)\n", |
597 | playback_mask, capture_mask); | 599 | playback_mask, capture_mask); |
598 | return; | 600 | return; |
@@ -619,7 +621,7 @@ static void pcxhr_trigger_tasklet(unsigned long arg) | |||
619 | } | 621 | } |
620 | spin_unlock_irqrestore(&mgr->lock, flags); | 622 | spin_unlock_irqrestore(&mgr->lock, flags); |
621 | 623 | ||
622 | up(&mgr->setup_mutex); | 624 | mutex_unlock(&mgr->setup_mutex); |
623 | 625 | ||
624 | #ifdef CONFIG_SND_DEBUG_DETECT | 626 | #ifdef CONFIG_SND_DEBUG_DETECT |
625 | do_gettimeofday(&my_tv2); | 627 | do_gettimeofday(&my_tv2); |
@@ -728,7 +730,7 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs) | |||
728 | } | 730 | } |
729 | */ | 731 | */ |
730 | 732 | ||
731 | down(&mgr->setup_mutex); | 733 | mutex_lock(&mgr->setup_mutex); |
732 | 734 | ||
733 | do { | 735 | do { |
734 | /* if the stream was stopped before, format and buffer were reset */ | 736 | /* if the stream was stopped before, format and buffer were reset */ |
@@ -755,7 +757,7 @@ static int pcxhr_prepare(struct snd_pcm_substream *subs) | |||
755 | } | 757 | } |
756 | } while(0); /* do only once (so we can use break instead of goto) */ | 758 | } while(0); /* do only once (so we can use break instead of goto) */ |
757 | 759 | ||
758 | up(&mgr->setup_mutex); | 760 | mutex_unlock(&mgr->setup_mutex); |
759 | 761 | ||
760 | return err; | 762 | return err; |
761 | } | 763 | } |
@@ -780,7 +782,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs, | |||
780 | /* set up format for the stream */ | 782 | /* set up format for the stream */ |
781 | format = params_format(hw); | 783 | format = params_format(hw); |
782 | 784 | ||
783 | down(&mgr->setup_mutex); | 785 | mutex_lock(&mgr->setup_mutex); |
784 | 786 | ||
785 | stream->channels = channels; | 787 | stream->channels = channels; |
786 | stream->format = format; | 788 | stream->format = format; |
@@ -789,7 +791,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs, | |||
789 | /* | 791 | /* |
790 | err = pcxhr_set_format(stream); | 792 | err = pcxhr_set_format(stream); |
791 | if(err) { | 793 | if(err) { |
792 | up(&mgr->setup_mutex); | 794 | mutex_unlock(&mgr->setup_mutex); |
793 | return err; | 795 | return err; |
794 | } | 796 | } |
795 | */ | 797 | */ |
@@ -801,7 +803,7 @@ static int pcxhr_hw_params(struct snd_pcm_substream *subs, | |||
801 | err = pcxhr_update_r_buffer(stream); | 803 | err = pcxhr_update_r_buffer(stream); |
802 | } | 804 | } |
803 | */ | 805 | */ |
804 | up(&mgr->setup_mutex); | 806 | mutex_unlock(&mgr->setup_mutex); |
805 | 807 | ||
806 | return err; | 808 | return err; |
807 | } | 809 | } |
@@ -847,7 +849,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs) | |||
847 | struct pcxhr_stream *stream; | 849 | struct pcxhr_stream *stream; |
848 | int is_capture; | 850 | int is_capture; |
849 | 851 | ||
850 | down(&mgr->setup_mutex); | 852 | mutex_lock(&mgr->setup_mutex); |
851 | 853 | ||
852 | /* copy the struct snd_pcm_hardware struct */ | 854 | /* copy the struct snd_pcm_hardware struct */ |
853 | runtime->hw = pcxhr_caps; | 855 | runtime->hw = pcxhr_caps; |
@@ -871,7 +873,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs) | |||
871 | /* streams in use */ | 873 | /* streams in use */ |
872 | snd_printk(KERN_ERR "pcxhr_open chip%d subs%d in use\n", | 874 | snd_printk(KERN_ERR "pcxhr_open chip%d subs%d in use\n", |
873 | chip->chip_idx, subs->number); | 875 | chip->chip_idx, subs->number); |
874 | up(&mgr->setup_mutex); | 876 | mutex_unlock(&mgr->setup_mutex); |
875 | return -EBUSY; | 877 | return -EBUSY; |
876 | } | 878 | } |
877 | 879 | ||
@@ -887,7 +889,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs) | |||
887 | &external_rate) || | 889 | &external_rate) || |
888 | external_rate == 0) { | 890 | external_rate == 0) { |
889 | /* cannot detect the external clock rate */ | 891 | /* cannot detect the external clock rate */ |
890 | up(&mgr->setup_mutex); | 892 | mutex_unlock(&mgr->setup_mutex); |
891 | return -EBUSY; | 893 | return -EBUSY; |
892 | } | 894 | } |
893 | runtime->hw.rate_min = runtime->hw.rate_max = external_rate; | 895 | runtime->hw.rate_min = runtime->hw.rate_max = external_rate; |
@@ -905,7 +907,7 @@ static int pcxhr_open(struct snd_pcm_substream *subs) | |||
905 | 907 | ||
906 | mgr->ref_count_rate++; | 908 | mgr->ref_count_rate++; |
907 | 909 | ||
908 | up(&mgr->setup_mutex); | 910 | mutex_unlock(&mgr->setup_mutex); |
909 | return 0; | 911 | return 0; |
910 | } | 912 | } |
911 | 913 | ||
@@ -916,7 +918,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs) | |||
916 | struct pcxhr_mgr *mgr = chip->mgr; | 918 | struct pcxhr_mgr *mgr = chip->mgr; |
917 | struct pcxhr_stream *stream = subs->runtime->private_data; | 919 | struct pcxhr_stream *stream = subs->runtime->private_data; |
918 | 920 | ||
919 | down(&mgr->setup_mutex); | 921 | mutex_lock(&mgr->setup_mutex); |
920 | 922 | ||
921 | snd_printdd("pcxhr_close chip%d subs%d\n", chip->chip_idx, subs->number); | 923 | snd_printdd("pcxhr_close chip%d subs%d\n", chip->chip_idx, subs->number); |
922 | 924 | ||
@@ -929,7 +931,7 @@ static int pcxhr_close(struct snd_pcm_substream *subs) | |||
929 | stream->status = PCXHR_STREAM_STATUS_FREE; | 931 | stream->status = PCXHR_STREAM_STATUS_FREE; |
930 | stream->substream = NULL; | 932 | stream->substream = NULL; |
931 | 933 | ||
932 | up(&mgr->setup_mutex); | 934 | mutex_unlock(&mgr->setup_mutex); |
933 | 935 | ||
934 | return 0; | 936 | return 0; |
935 | } | 937 | } |
@@ -1264,7 +1266,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id | |||
1264 | spin_lock_init(&mgr->msg_lock); | 1266 | spin_lock_init(&mgr->msg_lock); |
1265 | 1267 | ||
1266 | /* init setup mutex*/ | 1268 | /* init setup mutex*/ |
1267 | init_MUTEX(&mgr->setup_mutex); | 1269 | mutex_init(&mgr->setup_mutex); |
1268 | 1270 | ||
1269 | /* init taslket */ | 1271 | /* init taslket */ |
1270 | tasklet_init(&mgr->msg_taskq, pcxhr_msg_tasklet, (unsigned long) mgr); | 1272 | tasklet_init(&mgr->msg_taskq, pcxhr_msg_tasklet, (unsigned long) mgr); |
diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h index 049f2b3f2867..652064787a55 100644 --- a/sound/pci/pcxhr/pcxhr.h +++ b/sound/pci/pcxhr/pcxhr.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define __SOUND_PCXHR_H | 24 | #define __SOUND_PCXHR_H |
25 | 25 | ||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/mutex.h> | ||
27 | #include <sound/pcm.h> | 28 | #include <sound/pcm.h> |
28 | 29 | ||
29 | #define PCXHR_DRIVER_VERSION 0x000804 /* 0.8.4 */ | 30 | #define PCXHR_DRIVER_VERSION 0x000804 /* 0.8.4 */ |
@@ -76,8 +77,8 @@ struct pcxhr_mgr { | |||
76 | spinlock_t lock; /* interrupt spinlock */ | 77 | spinlock_t lock; /* interrupt spinlock */ |
77 | spinlock_t msg_lock; /* message spinlock */ | 78 | spinlock_t msg_lock; /* message spinlock */ |
78 | 79 | ||
79 | struct semaphore setup_mutex; /* mutex used in hw_params, open and close */ | 80 | struct mutex setup_mutex; /* mutex used in hw_params, open and close */ |
80 | struct semaphore mixer_mutex; /* mutex for mixer */ | 81 | struct mutex mixer_mutex; /* mutex for mixer */ |
81 | 82 | ||
82 | /* hardware interface */ | 83 | /* hardware interface */ |
83 | unsigned int dsp_loaded; /* bit flags of loaded dsp indices */ | 84 | unsigned int dsp_loaded; /* bit flags of loaded dsp indices */ |
diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c index 760e733ac25e..94e63a1e90d9 100644 --- a/sound/pci/pcxhr/pcxhr_mixer.c +++ b/sound/pci/pcxhr/pcxhr_mixer.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/time.h> | 25 | #include <linux/time.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/mutex.h> | ||
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include "pcxhr.h" | 30 | #include "pcxhr.h" |
30 | #include "pcxhr_hwdep.h" | 31 | #include "pcxhr_hwdep.h" |
@@ -92,7 +93,7 @@ static int pcxhr_analog_vol_get(struct snd_kcontrol *kcontrol, | |||
92 | struct snd_ctl_elem_value *ucontrol) | 93 | struct snd_ctl_elem_value *ucontrol) |
93 | { | 94 | { |
94 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); | 95 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); |
95 | down(&chip->mgr->mixer_mutex); | 96 | mutex_lock(&chip->mgr->mixer_mutex); |
96 | if (kcontrol->private_value == 0) { /* playback */ | 97 | if (kcontrol->private_value == 0) { /* playback */ |
97 | ucontrol->value.integer.value[0] = chip->analog_playback_volume[0]; | 98 | ucontrol->value.integer.value[0] = chip->analog_playback_volume[0]; |
98 | ucontrol->value.integer.value[1] = chip->analog_playback_volume[1]; | 99 | ucontrol->value.integer.value[1] = chip->analog_playback_volume[1]; |
@@ -100,7 +101,7 @@ static int pcxhr_analog_vol_get(struct snd_kcontrol *kcontrol, | |||
100 | ucontrol->value.integer.value[0] = chip->analog_capture_volume[0]; | 101 | ucontrol->value.integer.value[0] = chip->analog_capture_volume[0]; |
101 | ucontrol->value.integer.value[1] = chip->analog_capture_volume[1]; | 102 | ucontrol->value.integer.value[1] = chip->analog_capture_volume[1]; |
102 | } | 103 | } |
103 | up(&chip->mgr->mixer_mutex); | 104 | mutex_unlock(&chip->mgr->mixer_mutex); |
104 | return 0; | 105 | return 0; |
105 | } | 106 | } |
106 | 107 | ||
@@ -111,7 +112,7 @@ static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol, | |||
111 | int changed = 0; | 112 | int changed = 0; |
112 | int is_capture, i; | 113 | int is_capture, i; |
113 | 114 | ||
114 | down(&chip->mgr->mixer_mutex); | 115 | mutex_lock(&chip->mgr->mixer_mutex); |
115 | is_capture = (kcontrol->private_value != 0); | 116 | is_capture = (kcontrol->private_value != 0); |
116 | for (i = 0; i < 2; i++) { | 117 | for (i = 0; i < 2; i++) { |
117 | int new_volume = ucontrol->value.integer.value[i]; | 118 | int new_volume = ucontrol->value.integer.value[i]; |
@@ -123,7 +124,7 @@ static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol, | |||
123 | pcxhr_update_analog_audio_level(chip, is_capture, i); | 124 | pcxhr_update_analog_audio_level(chip, is_capture, i); |
124 | } | 125 | } |
125 | } | 126 | } |
126 | up(&chip->mgr->mixer_mutex); | 127 | mutex_unlock(&chip->mgr->mixer_mutex); |
127 | return changed; | 128 | return changed; |
128 | } | 129 | } |
129 | 130 | ||
@@ -150,10 +151,10 @@ static int pcxhr_audio_sw_get(struct snd_kcontrol *kcontrol, | |||
150 | { | 151 | { |
151 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); | 152 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); |
152 | 153 | ||
153 | down(&chip->mgr->mixer_mutex); | 154 | mutex_lock(&chip->mgr->mixer_mutex); |
154 | ucontrol->value.integer.value[0] = chip->analog_playback_active[0]; | 155 | ucontrol->value.integer.value[0] = chip->analog_playback_active[0]; |
155 | ucontrol->value.integer.value[1] = chip->analog_playback_active[1]; | 156 | ucontrol->value.integer.value[1] = chip->analog_playback_active[1]; |
156 | up(&chip->mgr->mixer_mutex); | 157 | mutex_unlock(&chip->mgr->mixer_mutex); |
157 | return 0; | 158 | return 0; |
158 | } | 159 | } |
159 | 160 | ||
@@ -162,7 +163,7 @@ static int pcxhr_audio_sw_put(struct snd_kcontrol *kcontrol, | |||
162 | { | 163 | { |
163 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); | 164 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); |
164 | int i, changed = 0; | 165 | int i, changed = 0; |
165 | down(&chip->mgr->mixer_mutex); | 166 | mutex_lock(&chip->mgr->mixer_mutex); |
166 | for(i = 0; i < 2; i++) { | 167 | for(i = 0; i < 2; i++) { |
167 | if (chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { | 168 | if (chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { |
168 | chip->analog_playback_active[i] = ucontrol->value.integer.value[i]; | 169 | chip->analog_playback_active[i] = ucontrol->value.integer.value[i]; |
@@ -170,7 +171,7 @@ static int pcxhr_audio_sw_put(struct snd_kcontrol *kcontrol, | |||
170 | pcxhr_update_analog_audio_level(chip, 0, i); /* update playback levels */ | 171 | pcxhr_update_analog_audio_level(chip, 0, i); /* update playback levels */ |
171 | } | 172 | } |
172 | } | 173 | } |
173 | up(&chip->mgr->mixer_mutex); | 174 | mutex_unlock(&chip->mgr->mixer_mutex); |
174 | return changed; | 175 | return changed; |
175 | } | 176 | } |
176 | 177 | ||
@@ -299,14 +300,14 @@ static int pcxhr_pcm_vol_get(struct snd_kcontrol *kcontrol, | |||
299 | int *stored_volume; | 300 | int *stored_volume; |
300 | int is_capture = kcontrol->private_value; | 301 | int is_capture = kcontrol->private_value; |
301 | 302 | ||
302 | down(&chip->mgr->mixer_mutex); | 303 | mutex_lock(&chip->mgr->mixer_mutex); |
303 | if (is_capture) | 304 | if (is_capture) |
304 | stored_volume = chip->digital_capture_volume; /* digital capture */ | 305 | stored_volume = chip->digital_capture_volume; /* digital capture */ |
305 | else | 306 | else |
306 | stored_volume = chip->digital_playback_volume[idx]; /* digital playback */ | 307 | stored_volume = chip->digital_playback_volume[idx]; /* digital playback */ |
307 | ucontrol->value.integer.value[0] = stored_volume[0]; | 308 | ucontrol->value.integer.value[0] = stored_volume[0]; |
308 | ucontrol->value.integer.value[1] = stored_volume[1]; | 309 | ucontrol->value.integer.value[1] = stored_volume[1]; |
309 | up(&chip->mgr->mixer_mutex); | 310 | mutex_unlock(&chip->mgr->mixer_mutex); |
310 | return 0; | 311 | return 0; |
311 | } | 312 | } |
312 | 313 | ||
@@ -320,7 +321,7 @@ static int pcxhr_pcm_vol_put(struct snd_kcontrol *kcontrol, | |||
320 | int *stored_volume; | 321 | int *stored_volume; |
321 | int i; | 322 | int i; |
322 | 323 | ||
323 | down(&chip->mgr->mixer_mutex); | 324 | mutex_lock(&chip->mgr->mixer_mutex); |
324 | if (is_capture) | 325 | if (is_capture) |
325 | stored_volume = chip->digital_capture_volume; /* digital capture */ | 326 | stored_volume = chip->digital_capture_volume; /* digital capture */ |
326 | else | 327 | else |
@@ -335,7 +336,7 @@ static int pcxhr_pcm_vol_put(struct snd_kcontrol *kcontrol, | |||
335 | } | 336 | } |
336 | if (! is_capture && changed) | 337 | if (! is_capture && changed) |
337 | pcxhr_update_playback_stream_level(chip, idx); /* update playback volume */ | 338 | pcxhr_update_playback_stream_level(chip, idx); /* update playback volume */ |
338 | up(&chip->mgr->mixer_mutex); | 339 | mutex_unlock(&chip->mgr->mixer_mutex); |
339 | return changed; | 340 | return changed; |
340 | } | 341 | } |
341 | 342 | ||
@@ -356,10 +357,10 @@ static int pcxhr_pcm_sw_get(struct snd_kcontrol *kcontrol, | |||
356 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); | 357 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); |
357 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ | 358 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ |
358 | 359 | ||
359 | down(&chip->mgr->mixer_mutex); | 360 | mutex_lock(&chip->mgr->mixer_mutex); |
360 | ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0]; | 361 | ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0]; |
361 | ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1]; | 362 | ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1]; |
362 | up(&chip->mgr->mixer_mutex); | 363 | mutex_unlock(&chip->mgr->mixer_mutex); |
363 | return 0; | 364 | return 0; |
364 | } | 365 | } |
365 | 366 | ||
@@ -370,7 +371,7 @@ static int pcxhr_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
370 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ | 371 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ |
371 | int i, j; | 372 | int i, j; |
372 | 373 | ||
373 | down(&chip->mgr->mixer_mutex); | 374 | mutex_lock(&chip->mgr->mixer_mutex); |
374 | j = idx; | 375 | j = idx; |
375 | for (i = 0; i < 2; i++) { | 376 | for (i = 0; i < 2; i++) { |
376 | if (chip->digital_playback_active[j][i] != ucontrol->value.integer.value[i]) { | 377 | if (chip->digital_playback_active[j][i] != ucontrol->value.integer.value[i]) { |
@@ -380,7 +381,7 @@ static int pcxhr_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
380 | } | 381 | } |
381 | if (changed) | 382 | if (changed) |
382 | pcxhr_update_playback_stream_level(chip, idx); | 383 | pcxhr_update_playback_stream_level(chip, idx); |
383 | up(&chip->mgr->mixer_mutex); | 384 | mutex_unlock(&chip->mgr->mixer_mutex); |
384 | return changed; | 385 | return changed; |
385 | } | 386 | } |
386 | 387 | ||
@@ -402,10 +403,10 @@ static int pcxhr_monitor_vol_get(struct snd_kcontrol *kcontrol, | |||
402 | struct snd_ctl_elem_value *ucontrol) | 403 | struct snd_ctl_elem_value *ucontrol) |
403 | { | 404 | { |
404 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); | 405 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); |
405 | down(&chip->mgr->mixer_mutex); | 406 | mutex_lock(&chip->mgr->mixer_mutex); |
406 | ucontrol->value.integer.value[0] = chip->monitoring_volume[0]; | 407 | ucontrol->value.integer.value[0] = chip->monitoring_volume[0]; |
407 | ucontrol->value.integer.value[1] = chip->monitoring_volume[1]; | 408 | ucontrol->value.integer.value[1] = chip->monitoring_volume[1]; |
408 | up(&chip->mgr->mixer_mutex); | 409 | mutex_unlock(&chip->mgr->mixer_mutex); |
409 | return 0; | 410 | return 0; |
410 | } | 411 | } |
411 | 412 | ||
@@ -416,7 +417,7 @@ static int pcxhr_monitor_vol_put(struct snd_kcontrol *kcontrol, | |||
416 | int changed = 0; | 417 | int changed = 0; |
417 | int i; | 418 | int i; |
418 | 419 | ||
419 | down(&chip->mgr->mixer_mutex); | 420 | mutex_lock(&chip->mgr->mixer_mutex); |
420 | for (i = 0; i < 2; i++) { | 421 | for (i = 0; i < 2; i++) { |
421 | if (chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) { | 422 | if (chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) { |
422 | chip->monitoring_volume[i] = ucontrol->value.integer.value[i]; | 423 | chip->monitoring_volume[i] = ucontrol->value.integer.value[i]; |
@@ -426,7 +427,7 @@ static int pcxhr_monitor_vol_put(struct snd_kcontrol *kcontrol, | |||
426 | changed = 1; | 427 | changed = 1; |
427 | } | 428 | } |
428 | } | 429 | } |
429 | up(&chip->mgr->mixer_mutex); | 430 | mutex_unlock(&chip->mgr->mixer_mutex); |
430 | return changed; | 431 | return changed; |
431 | } | 432 | } |
432 | 433 | ||
@@ -446,10 +447,10 @@ static int pcxhr_monitor_sw_get(struct snd_kcontrol *kcontrol, | |||
446 | struct snd_ctl_elem_value *ucontrol) | 447 | struct snd_ctl_elem_value *ucontrol) |
447 | { | 448 | { |
448 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); | 449 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); |
449 | down(&chip->mgr->mixer_mutex); | 450 | mutex_lock(&chip->mgr->mixer_mutex); |
450 | ucontrol->value.integer.value[0] = chip->monitoring_active[0]; | 451 | ucontrol->value.integer.value[0] = chip->monitoring_active[0]; |
451 | ucontrol->value.integer.value[1] = chip->monitoring_active[1]; | 452 | ucontrol->value.integer.value[1] = chip->monitoring_active[1]; |
452 | up(&chip->mgr->mixer_mutex); | 453 | mutex_unlock(&chip->mgr->mixer_mutex); |
453 | return 0; | 454 | return 0; |
454 | } | 455 | } |
455 | 456 | ||
@@ -460,7 +461,7 @@ static int pcxhr_monitor_sw_put(struct snd_kcontrol *kcontrol, | |||
460 | int changed = 0; | 461 | int changed = 0; |
461 | int i; | 462 | int i; |
462 | 463 | ||
463 | down(&chip->mgr->mixer_mutex); | 464 | mutex_lock(&chip->mgr->mixer_mutex); |
464 | for (i = 0; i < 2; i++) { | 465 | for (i = 0; i < 2; i++) { |
465 | if (chip->monitoring_active[i] != ucontrol->value.integer.value[i]) { | 466 | if (chip->monitoring_active[i] != ucontrol->value.integer.value[i]) { |
466 | chip->monitoring_active[i] = ucontrol->value.integer.value[i]; | 467 | chip->monitoring_active[i] = ucontrol->value.integer.value[i]; |
@@ -474,7 +475,7 @@ static int pcxhr_monitor_sw_put(struct snd_kcontrol *kcontrol, | |||
474 | /* update right monitoring volume and mute */ | 475 | /* update right monitoring volume and mute */ |
475 | pcxhr_update_audio_pipe_level(chip, 0, 1); | 476 | pcxhr_update_audio_pipe_level(chip, 0, 1); |
476 | 477 | ||
477 | up(&chip->mgr->mixer_mutex); | 478 | mutex_unlock(&chip->mgr->mixer_mutex); |
478 | return (changed != 0); | 479 | return (changed != 0); |
479 | } | 480 | } |
480 | 481 | ||
@@ -571,13 +572,13 @@ static int pcxhr_audio_src_put(struct snd_kcontrol *kcontrol, | |||
571 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); | 572 | struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); |
572 | int ret = 0; | 573 | int ret = 0; |
573 | 574 | ||
574 | down(&chip->mgr->mixer_mutex); | 575 | mutex_lock(&chip->mgr->mixer_mutex); |
575 | if (chip->audio_capture_source != ucontrol->value.enumerated.item[0]) { | 576 | if (chip->audio_capture_source != ucontrol->value.enumerated.item[0]) { |
576 | chip->audio_capture_source = ucontrol->value.enumerated.item[0]; | 577 | chip->audio_capture_source = ucontrol->value.enumerated.item[0]; |
577 | pcxhr_set_audio_source(chip); | 578 | pcxhr_set_audio_source(chip); |
578 | ret = 1; | 579 | ret = 1; |
579 | } | 580 | } |
580 | up(&chip->mgr->mixer_mutex); | 581 | mutex_unlock(&chip->mgr->mixer_mutex); |
581 | return ret; | 582 | return ret; |
582 | } | 583 | } |
583 | 584 | ||
@@ -636,9 +637,9 @@ static int pcxhr_clock_type_put(struct snd_kcontrol *kcontrol, | |||
636 | struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol); | 637 | struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol); |
637 | int rate, ret = 0; | 638 | int rate, ret = 0; |
638 | 639 | ||
639 | down(&mgr->mixer_mutex); | 640 | mutex_lock(&mgr->mixer_mutex); |
640 | if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) { | 641 | if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) { |
641 | down(&mgr->setup_mutex); | 642 | mutex_lock(&mgr->setup_mutex); |
642 | mgr->use_clock_type = ucontrol->value.enumerated.item[0]; | 643 | mgr->use_clock_type = ucontrol->value.enumerated.item[0]; |
643 | if (mgr->use_clock_type) | 644 | if (mgr->use_clock_type) |
644 | pcxhr_get_external_clock(mgr, mgr->use_clock_type, &rate); | 645 | pcxhr_get_external_clock(mgr, mgr->use_clock_type, &rate); |
@@ -649,10 +650,10 @@ static int pcxhr_clock_type_put(struct snd_kcontrol *kcontrol, | |||
649 | if (mgr->sample_rate) | 650 | if (mgr->sample_rate) |
650 | mgr->sample_rate = rate; | 651 | mgr->sample_rate = rate; |
651 | } | 652 | } |
652 | up(&mgr->setup_mutex); | 653 | mutex_unlock(&mgr->setup_mutex); |
653 | ret = 1; /* return 1 even if the set was not done. ok ? */ | 654 | ret = 1; /* return 1 even if the set was not done. ok ? */ |
654 | } | 655 | } |
655 | up(&mgr->mixer_mutex); | 656 | mutex_unlock(&mgr->mixer_mutex); |
656 | return ret; | 657 | return ret; |
657 | } | 658 | } |
658 | 659 | ||
@@ -685,7 +686,7 @@ static int pcxhr_clock_rate_get(struct snd_kcontrol *kcontrol, | |||
685 | struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol); | 686 | struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol); |
686 | int i, err, rate; | 687 | int i, err, rate; |
687 | 688 | ||
688 | down(&mgr->mixer_mutex); | 689 | mutex_lock(&mgr->mixer_mutex); |
689 | for(i = 0; i < 3 + mgr->capture_chips; i++) { | 690 | for(i = 0; i < 3 + mgr->capture_chips; i++) { |
690 | if (i == PCXHR_CLOCK_TYPE_INTERNAL) | 691 | if (i == PCXHR_CLOCK_TYPE_INTERNAL) |
691 | rate = mgr->sample_rate_real; | 692 | rate = mgr->sample_rate_real; |
@@ -696,7 +697,7 @@ static int pcxhr_clock_rate_get(struct snd_kcontrol *kcontrol, | |||
696 | } | 697 | } |
697 | ucontrol->value.integer.value[i] = rate; | 698 | ucontrol->value.integer.value[i] = rate; |
698 | } | 699 | } |
699 | up(&mgr->mixer_mutex); | 700 | mutex_unlock(&mgr->mixer_mutex); |
700 | return 0; | 701 | return 0; |
701 | } | 702 | } |
702 | 703 | ||
@@ -765,7 +766,7 @@ static int pcxhr_iec958_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
765 | unsigned char aes_bits; | 766 | unsigned char aes_bits; |
766 | int i, err; | 767 | int i, err; |
767 | 768 | ||
768 | down(&chip->mgr->mixer_mutex); | 769 | mutex_lock(&chip->mgr->mixer_mutex); |
769 | for(i = 0; i < 5; i++) { | 770 | for(i = 0; i < 5; i++) { |
770 | if (kcontrol->private_value == 0) /* playback */ | 771 | if (kcontrol->private_value == 0) /* playback */ |
771 | aes_bits = chip->aes_bits[i]; | 772 | aes_bits = chip->aes_bits[i]; |
@@ -776,7 +777,7 @@ static int pcxhr_iec958_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
776 | } | 777 | } |
777 | ucontrol->value.iec958.status[i] = aes_bits; | 778 | ucontrol->value.iec958.status[i] = aes_bits; |
778 | } | 779 | } |
779 | up(&chip->mgr->mixer_mutex); | 780 | mutex_unlock(&chip->mgr->mixer_mutex); |
780 | return 0; | 781 | return 0; |
781 | } | 782 | } |
782 | 783 | ||
@@ -828,14 +829,14 @@ static int pcxhr_iec958_put(struct snd_kcontrol *kcontrol, | |||
828 | int i, changed = 0; | 829 | int i, changed = 0; |
829 | 830 | ||
830 | /* playback */ | 831 | /* playback */ |
831 | down(&chip->mgr->mixer_mutex); | 832 | mutex_lock(&chip->mgr->mixer_mutex); |
832 | for (i = 0; i < 5; i++) { | 833 | for (i = 0; i < 5; i++) { |
833 | if (ucontrol->value.iec958.status[i] != chip->aes_bits[i]) { | 834 | if (ucontrol->value.iec958.status[i] != chip->aes_bits[i]) { |
834 | pcxhr_iec958_update_byte(chip, i, ucontrol->value.iec958.status[i]); | 835 | pcxhr_iec958_update_byte(chip, i, ucontrol->value.iec958.status[i]); |
835 | changed = 1; | 836 | changed = 1; |
836 | } | 837 | } |
837 | } | 838 | } |
838 | up(&chip->mgr->mixer_mutex); | 839 | mutex_unlock(&chip->mgr->mixer_mutex); |
839 | return changed; | 840 | return changed; |
840 | } | 841 | } |
841 | 842 | ||
@@ -916,7 +917,7 @@ int pcxhr_create_mixer(struct pcxhr_mgr *mgr) | |||
916 | struct snd_pcxhr *chip; | 917 | struct snd_pcxhr *chip; |
917 | int err, i; | 918 | int err, i; |
918 | 919 | ||
919 | init_MUTEX(&mgr->mixer_mutex); /* can be in another place */ | 920 | mutex_init(&mgr->mixer_mutex); /* can be in another place */ |
920 | 921 | ||
921 | for (i = 0; i < mgr->num_cards; i++) { | 922 | for (i = 0; i < mgr->num_cards; i++) { |
922 | struct snd_kcontrol_new temp; | 923 | struct snd_kcontrol_new temp; |