diff options
Diffstat (limited to 'sound/pci/atiixp.c')
-rw-r--r-- | sound/pci/atiixp.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index b7217adaf1d7..12e618851262 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <linux/mutex.h> | ||
30 | #include <sound/core.h> | 31 | #include <sound/core.h> |
31 | #include <sound/pcm.h> | 32 | #include <sound/pcm.h> |
32 | #include <sound/pcm_params.h> | 33 | #include <sound/pcm_params.h> |
@@ -277,7 +278,7 @@ struct atiixp { | |||
277 | unsigned int codec_not_ready_bits; /* for codec detection */ | 278 | unsigned int codec_not_ready_bits; /* for codec detection */ |
278 | 279 | ||
279 | int spdif_over_aclink; /* passed from the module option */ | 280 | int spdif_over_aclink; /* passed from the module option */ |
280 | struct semaphore open_mutex; /* playback open mutex */ | 281 | struct mutex open_mutex; /* playback open mutex */ |
281 | }; | 282 | }; |
282 | 283 | ||
283 | 284 | ||
@@ -1051,9 +1052,9 @@ static int snd_atiixp_playback_open(struct snd_pcm_substream *substream) | |||
1051 | struct atiixp *chip = snd_pcm_substream_chip(substream); | 1052 | struct atiixp *chip = snd_pcm_substream_chip(substream); |
1052 | int err; | 1053 | int err; |
1053 | 1054 | ||
1054 | down(&chip->open_mutex); | 1055 | mutex_lock(&chip->open_mutex); |
1055 | err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 0); | 1056 | err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 0); |
1056 | up(&chip->open_mutex); | 1057 | mutex_unlock(&chip->open_mutex); |
1057 | if (err < 0) | 1058 | if (err < 0) |
1058 | return err; | 1059 | return err; |
1059 | substream->runtime->hw.channels_max = chip->max_channels; | 1060 | substream->runtime->hw.channels_max = chip->max_channels; |
@@ -1068,9 +1069,9 @@ static int snd_atiixp_playback_close(struct snd_pcm_substream *substream) | |||
1068 | { | 1069 | { |
1069 | struct atiixp *chip = snd_pcm_substream_chip(substream); | 1070 | struct atiixp *chip = snd_pcm_substream_chip(substream); |
1070 | int err; | 1071 | int err; |
1071 | down(&chip->open_mutex); | 1072 | mutex_lock(&chip->open_mutex); |
1072 | err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); | 1073 | err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); |
1073 | up(&chip->open_mutex); | 1074 | mutex_unlock(&chip->open_mutex); |
1074 | return err; | 1075 | return err; |
1075 | } | 1076 | } |
1076 | 1077 | ||
@@ -1090,12 +1091,12 @@ static int snd_atiixp_spdif_open(struct snd_pcm_substream *substream) | |||
1090 | { | 1091 | { |
1091 | struct atiixp *chip = snd_pcm_substream_chip(substream); | 1092 | struct atiixp *chip = snd_pcm_substream_chip(substream); |
1092 | int err; | 1093 | int err; |
1093 | down(&chip->open_mutex); | 1094 | mutex_lock(&chip->open_mutex); |
1094 | if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */ | 1095 | if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */ |
1095 | err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 2); | 1096 | err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 2); |
1096 | else | 1097 | else |
1097 | err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_SPDIF], -1); | 1098 | err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_SPDIF], -1); |
1098 | up(&chip->open_mutex); | 1099 | mutex_unlock(&chip->open_mutex); |
1099 | return err; | 1100 | return err; |
1100 | } | 1101 | } |
1101 | 1102 | ||
@@ -1103,12 +1104,12 @@ static int snd_atiixp_spdif_close(struct snd_pcm_substream *substream) | |||
1103 | { | 1104 | { |
1104 | struct atiixp *chip = snd_pcm_substream_chip(substream); | 1105 | struct atiixp *chip = snd_pcm_substream_chip(substream); |
1105 | int err; | 1106 | int err; |
1106 | down(&chip->open_mutex); | 1107 | mutex_lock(&chip->open_mutex); |
1107 | if (chip->spdif_over_aclink) | 1108 | if (chip->spdif_over_aclink) |
1108 | err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); | 1109 | err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); |
1109 | else | 1110 | else |
1110 | err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_SPDIF]); | 1111 | err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_SPDIF]); |
1111 | up(&chip->open_mutex); | 1112 | mutex_unlock(&chip->open_mutex); |
1112 | return err; | 1113 | return err; |
1113 | } | 1114 | } |
1114 | 1115 | ||
@@ -1560,7 +1561,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, | |||
1560 | } | 1561 | } |
1561 | 1562 | ||
1562 | spin_lock_init(&chip->reg_lock); | 1563 | spin_lock_init(&chip->reg_lock); |
1563 | init_MUTEX(&chip->open_mutex); | 1564 | mutex_init(&chip->open_mutex); |
1564 | chip->card = card; | 1565 | chip->card = card; |
1565 | chip->pci = pci; | 1566 | chip->pci = pci; |
1566 | chip->irq = -1; | 1567 | chip->irq = -1; |