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/pcxhr.c | |
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/pcxhr.c')
-rw-r--r-- | sound/pci/pcxhr/pcxhr.c | 36 |
1 files changed, 19 insertions, 17 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); |