From 910f5d202ce39cc78de1bbb679285a3167de9fb2 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Thu, 23 Mar 2006 03:00:39 -0800 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/oss/forte.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sound/oss/forte.c') diff --git a/sound/oss/forte.c b/sound/oss/forte.c index 8406bc90c4f..0294eec8ad9 100644 --- a/sound/oss/forte.c +++ b/sound/oss/forte.c @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -185,7 +186,7 @@ struct forte_chip { unsigned long iobase; int irq; - struct semaphore open_sem; /* Device access */ + struct mutex open_mutex; /* Device access */ spinlock_t lock; /* State */ spinlock_t ac97_lock; @@ -1242,13 +1243,13 @@ forte_dsp_open (struct inode *inode, struct file *file) struct forte_chip *chip = forte; /* FIXME: HACK FROM HELL! */ if (file->f_flags & O_NONBLOCK) { - if (down_trylock (&chip->open_sem)) { + if (!mutex_trylock(&chip->open_mutex)) { DPRINTK ("%s: returning -EAGAIN\n", __FUNCTION__); return -EAGAIN; } } else { - if (down_interruptible (&chip->open_sem)) { + if (mutex_lock_interruptible(&chip->open_mutex)) { DPRINTK ("%s: returning -ERESTARTSYS\n", __FUNCTION__); return -ERESTARTSYS; } @@ -1302,7 +1303,7 @@ forte_dsp_release (struct inode *inode, struct file *file) spin_unlock_irq (&chip->lock); } - up (&chip->open_sem); + mutex_unlock(&chip->open_mutex); return ret; } @@ -2011,7 +2012,7 @@ forte_probe (struct pci_dev *pci_dev, const struct pci_device_id *pci_id) memset (chip, 0, sizeof (struct forte_chip)); chip->pci_dev = pci_dev; - init_MUTEX(&chip->open_sem); + mutex_init(&chip->open_mutex); spin_lock_init (&chip->lock); spin_lock_init (&chip->ac97_lock); -- cgit