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/ens1370.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/ens1370.c')
-rw-r--r-- | sound/pci/ens1370.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index bee382995fe9..a5533c86b0b6 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/gameport.h> | 36 | #include <linux/gameport.h> |
37 | #include <linux/moduleparam.h> | 37 | #include <linux/moduleparam.h> |
38 | #include <linux/mutex.h> | ||
39 | |||
38 | #include <sound/core.h> | 40 | #include <sound/core.h> |
39 | #include <sound/control.h> | 41 | #include <sound/control.h> |
40 | #include <sound/pcm.h> | 42 | #include <sound/pcm.h> |
@@ -379,7 +381,7 @@ MODULE_PARM_DESC(lineio, "Line In to Rear Out (0 = auto, 1 = force)."); | |||
379 | 381 | ||
380 | struct ensoniq { | 382 | struct ensoniq { |
381 | spinlock_t reg_lock; | 383 | spinlock_t reg_lock; |
382 | struct semaphore src_mutex; | 384 | struct mutex src_mutex; |
383 | 385 | ||
384 | int irq; | 386 | int irq; |
385 | 387 | ||
@@ -609,7 +611,7 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97, | |||
609 | struct ensoniq *ensoniq = ac97->private_data; | 611 | struct ensoniq *ensoniq = ac97->private_data; |
610 | unsigned int t, x; | 612 | unsigned int t, x; |
611 | 613 | ||
612 | down(&ensoniq->src_mutex); | 614 | mutex_lock(&ensoniq->src_mutex); |
613 | for (t = 0; t < POLL_COUNT; t++) { | 615 | for (t = 0; t < POLL_COUNT; t++) { |
614 | if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) { | 616 | if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) { |
615 | /* save the current state for latter */ | 617 | /* save the current state for latter */ |
@@ -634,11 +636,11 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97, | |||
634 | /* restore SRC reg */ | 636 | /* restore SRC reg */ |
635 | snd_es1371_wait_src_ready(ensoniq); | 637 | snd_es1371_wait_src_ready(ensoniq); |
636 | outl(x, ES_REG(ensoniq, 1371_SMPRATE)); | 638 | outl(x, ES_REG(ensoniq, 1371_SMPRATE)); |
637 | up(&ensoniq->src_mutex); | 639 | mutex_unlock(&ensoniq->src_mutex); |
638 | return; | 640 | return; |
639 | } | 641 | } |
640 | } | 642 | } |
641 | up(&ensoniq->src_mutex); | 643 | mutex_unlock(&ensoniq->src_mutex); |
642 | snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n", | 644 | snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n", |
643 | ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); | 645 | ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); |
644 | } | 646 | } |
@@ -650,7 +652,7 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97, | |||
650 | unsigned int t, x, fail = 0; | 652 | unsigned int t, x, fail = 0; |
651 | 653 | ||
652 | __again: | 654 | __again: |
653 | down(&ensoniq->src_mutex); | 655 | mutex_lock(&ensoniq->src_mutex); |
654 | for (t = 0; t < POLL_COUNT; t++) { | 656 | for (t = 0; t < POLL_COUNT; t++) { |
655 | if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) { | 657 | if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) { |
656 | /* save the current state for latter */ | 658 | /* save the current state for latter */ |
@@ -683,11 +685,11 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97, | |||
683 | /* now wait for the stinkin' data (RDY) */ | 685 | /* now wait for the stinkin' data (RDY) */ |
684 | for (t = 0; t < POLL_COUNT; t++) { | 686 | for (t = 0; t < POLL_COUNT; t++) { |
685 | if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) { | 687 | if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) { |
686 | up(&ensoniq->src_mutex); | 688 | mutex_unlock(&ensoniq->src_mutex); |
687 | return ES_1371_CODEC_READ(x); | 689 | return ES_1371_CODEC_READ(x); |
688 | } | 690 | } |
689 | } | 691 | } |
690 | up(&ensoniq->src_mutex); | 692 | mutex_unlock(&ensoniq->src_mutex); |
691 | if (++fail > 10) { | 693 | if (++fail > 10) { |
692 | snd_printk(KERN_ERR "codec read timeout (final) " | 694 | snd_printk(KERN_ERR "codec read timeout (final) " |
693 | "at 0x%lx, reg = 0x%x [0x%x]\n", | 695 | "at 0x%lx, reg = 0x%x [0x%x]\n", |
@@ -698,7 +700,7 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97, | |||
698 | goto __again; | 700 | goto __again; |
699 | } | 701 | } |
700 | } | 702 | } |
701 | up(&ensoniq->src_mutex); | 703 | mutex_unlock(&ensoniq->src_mutex); |
702 | snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n", | 704 | snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n", |
703 | ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); | 705 | ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); |
704 | return 0; | 706 | return 0; |
@@ -717,7 +719,7 @@ static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate) | |||
717 | { | 719 | { |
718 | unsigned int n, truncm, freq, result; | 720 | unsigned int n, truncm, freq, result; |
719 | 721 | ||
720 | down(&ensoniq->src_mutex); | 722 | mutex_lock(&ensoniq->src_mutex); |
721 | n = rate / 3000; | 723 | n = rate / 3000; |
722 | if ((1 << n) & ((1 << 15) | (1 << 13) | (1 << 11) | (1 << 9))) | 724 | if ((1 << n) & ((1 << 15) | (1 << 13) | (1 << 11) | (1 << 9))) |
723 | n--; | 725 | n--; |
@@ -742,14 +744,14 @@ static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate) | |||
742 | snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff); | 744 | snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff); |
743 | snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8); | 745 | snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8); |
744 | snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8); | 746 | snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8); |
745 | up(&ensoniq->src_mutex); | 747 | mutex_unlock(&ensoniq->src_mutex); |
746 | } | 748 | } |
747 | 749 | ||
748 | static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate) | 750 | static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate) |
749 | { | 751 | { |
750 | unsigned int freq, r; | 752 | unsigned int freq, r; |
751 | 753 | ||
752 | down(&ensoniq->src_mutex); | 754 | mutex_lock(&ensoniq->src_mutex); |
753 | freq = ((rate << 15) + 1500) / 3000; | 755 | freq = ((rate << 15) + 1500) / 3000; |
754 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | | 756 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | |
755 | ES_1371_DIS_P2 | ES_1371_DIS_R1)) | | 757 | ES_1371_DIS_P2 | ES_1371_DIS_R1)) | |
@@ -763,14 +765,14 @@ static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate) | |||
763 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | | 765 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | |
764 | ES_1371_DIS_P2 | ES_1371_DIS_R1)); | 766 | ES_1371_DIS_P2 | ES_1371_DIS_R1)); |
765 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); | 767 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); |
766 | up(&ensoniq->src_mutex); | 768 | mutex_unlock(&ensoniq->src_mutex); |
767 | } | 769 | } |
768 | 770 | ||
769 | static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate) | 771 | static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate) |
770 | { | 772 | { |
771 | unsigned int freq, r; | 773 | unsigned int freq, r; |
772 | 774 | ||
773 | down(&ensoniq->src_mutex); | 775 | mutex_lock(&ensoniq->src_mutex); |
774 | freq = ((rate << 15) + 1500) / 3000; | 776 | freq = ((rate << 15) + 1500) / 3000; |
775 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | | 777 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | |
776 | ES_1371_DIS_P1 | ES_1371_DIS_R1)) | | 778 | ES_1371_DIS_P1 | ES_1371_DIS_R1)) | |
@@ -785,7 +787,7 @@ static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate) | |||
785 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | | 787 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | |
786 | ES_1371_DIS_P1 | ES_1371_DIS_R1)); | 788 | ES_1371_DIS_P1 | ES_1371_DIS_R1)); |
787 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); | 789 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); |
788 | up(&ensoniq->src_mutex); | 790 | mutex_unlock(&ensoniq->src_mutex); |
789 | } | 791 | } |
790 | 792 | ||
791 | #endif /* CHIP1371 */ | 793 | #endif /* CHIP1371 */ |
@@ -2123,7 +2125,7 @@ static int __devinit snd_ensoniq_create(struct snd_card *card, | |||
2123 | return -ENOMEM; | 2125 | return -ENOMEM; |
2124 | } | 2126 | } |
2125 | spin_lock_init(&ensoniq->reg_lock); | 2127 | spin_lock_init(&ensoniq->reg_lock); |
2126 | init_MUTEX(&ensoniq->src_mutex); | 2128 | mutex_init(&ensoniq->src_mutex); |
2127 | ensoniq->card = card; | 2129 | ensoniq->card = card; |
2128 | ensoniq->pci = pci; | 2130 | ensoniq->pci = pci; |
2129 | ensoniq->irq = -1; | 2131 | ensoniq->irq = -1; |