aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/hal2.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-23 06:00:39 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:13 -0500
commit910f5d202ce39cc78de1bbb679285a3167de9fb2 (patch)
tree2c5b55c2b141aaf016c459beb397fc702c41b967 /sound/oss/hal2.c
parent82d4dc5adb0055393248ad4ab8de392fac708a12 (diff)
[PATCH] sem2mutex: sound/oss/
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: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound/oss/hal2.c')
-rw-r--r--sound/oss/hal2.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/oss/hal2.c b/sound/oss/hal2.c
index afe97c4ce069..dd4f59d30a3a 100644
--- a/sound/oss/hal2.c
+++ b/sound/oss/hal2.c
@@ -32,6 +32,8 @@
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <linux/sound.h> 33#include <linux/sound.h>
34#include <linux/soundcard.h> 34#include <linux/soundcard.h>
35#include <linux/mutex.h>
36
35 37
36#include <asm/io.h> 38#include <asm/io.h>
37#include <asm/sgi/hpc3.h> 39#include <asm/sgi/hpc3.h>
@@ -92,7 +94,7 @@ struct hal2_codec {
92 94
93 wait_queue_head_t dma_wait; 95 wait_queue_head_t dma_wait;
94 spinlock_t lock; 96 spinlock_t lock;
95 struct semaphore sem; 97 struct mutex sem;
96 98
97 int usecount; /* recording and playback are 99 int usecount; /* recording and playback are
98 * independent */ 100 * independent */
@@ -1178,7 +1180,7 @@ static ssize_t hal2_read(struct file *file, char *buffer,
1178 1180
1179 if (!count) 1181 if (!count)
1180 return 0; 1182 return 0;
1181 if (down_interruptible(&adc->sem)) 1183 if (mutex_lock_interruptible(&adc->sem))
1182 return -EINTR; 1184 return -EINTR;
1183 if (file->f_flags & O_NONBLOCK) { 1185 if (file->f_flags & O_NONBLOCK) {
1184 err = hal2_get_buffer(hal2, buffer, count); 1186 err = hal2_get_buffer(hal2, buffer, count);
@@ -1217,7 +1219,7 @@ static ssize_t hal2_read(struct file *file, char *buffer,
1217 } 1219 }
1218 } while (count > 0 && err >= 0); 1220 } while (count > 0 && err >= 0);
1219 } 1221 }
1220 up(&adc->sem); 1222 mutex_unlock(&adc->sem);
1221 1223
1222 return err; 1224 return err;
1223} 1225}
@@ -1232,7 +1234,7 @@ static ssize_t hal2_write(struct file *file, const char *buffer,
1232 1234
1233 if (!count) 1235 if (!count)
1234 return 0; 1236 return 0;
1235 if (down_interruptible(&dac->sem)) 1237 if (mutex_lock_interruptible(&dac->sem))
1236 return -EINTR; 1238 return -EINTR;
1237 if (file->f_flags & O_NONBLOCK) { 1239 if (file->f_flags & O_NONBLOCK) {
1238 err = hal2_add_buffer(hal2, buf, count); 1240 err = hal2_add_buffer(hal2, buf, count);
@@ -1271,7 +1273,7 @@ static ssize_t hal2_write(struct file *file, const char *buffer,
1271 } 1273 }
1272 } while (count > 0 && err >= 0); 1274 } while (count > 0 && err >= 0);
1273 } 1275 }
1274 up(&dac->sem); 1276 mutex_unlock(&dac->sem);
1275 1277
1276 return err; 1278 return err;
1277} 1279}
@@ -1356,20 +1358,20 @@ static int hal2_release(struct inode *inode, struct file *file)
1356 if (file->f_mode & FMODE_READ) { 1358 if (file->f_mode & FMODE_READ) {
1357 struct hal2_codec *adc = &hal2->adc; 1359 struct hal2_codec *adc = &hal2->adc;
1358 1360
1359 down(&adc->sem); 1361 mutex_lock(&adc->sem);
1360 hal2_stop_adc(hal2); 1362 hal2_stop_adc(hal2);
1361 hal2_free_adc_dmabuf(adc); 1363 hal2_free_adc_dmabuf(adc);
1362 adc->usecount--; 1364 adc->usecount--;
1363 up(&adc->sem); 1365 mutex_unlock(&adc->sem);
1364 } 1366 }
1365 if (file->f_mode & FMODE_WRITE) { 1367 if (file->f_mode & FMODE_WRITE) {
1366 struct hal2_codec *dac = &hal2->dac; 1368 struct hal2_codec *dac = &hal2->dac;
1367 1369
1368 down(&dac->sem); 1370 mutex_lock(&dac->sem);
1369 hal2_sync_dac(hal2); 1371 hal2_sync_dac(hal2);
1370 hal2_free_dac_dmabuf(dac); 1372 hal2_free_dac_dmabuf(dac);
1371 dac->usecount--; 1373 dac->usecount--;
1372 up(&dac->sem); 1374 mutex_unlock(&dac->sem);
1373 } 1375 }
1374 1376
1375 return 0; 1377 return 0;
@@ -1400,7 +1402,7 @@ static void hal2_init_codec(struct hal2_codec *codec, struct hpc3_regs *hpc3,
1400 codec->pbus.pbusnr = index; 1402 codec->pbus.pbusnr = index;
1401 codec->pbus.pbus = &hpc3->pbdma[index]; 1403 codec->pbus.pbus = &hpc3->pbdma[index];
1402 init_waitqueue_head(&codec->dma_wait); 1404 init_waitqueue_head(&codec->dma_wait);
1403 init_MUTEX(&codec->sem); 1405 mutex_init(&codec->sem);
1404 spin_lock_init(&codec->lock); 1406 spin_lock_init(&codec->lock);
1405} 1407}
1406 1408