git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git]
/
sound
/
oss
/
cs46xx.c
diff --git
a/sound/oss/cs46xx.c
b/sound/oss/cs46xx.c
index
53881bc
..
58e25c8
100644
(file)
--- a/
sound/oss/cs46xx.c
+++ b/
sound/oss/cs46xx.c
@@
-90,7
+90,6
@@
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/ac97_codec.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/ac97_codec.h>
-#include <linux/mutex.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/dma.h>
@@
-239,7
+238,7
@@
struct cs_state {
struct cs_card *card; /* Card info */
/* single open lock mechanism, only used for recording */
struct cs_card *card; /* Card info */
/* single open lock mechanism, only used for recording */
- struct
mutex open_mutex
;
+ struct
semaphore open_sem
;
wait_queue_head_t open_wait;
/* file mode */
wait_queue_head_t open_wait;
/* file mode */
@@
-298,7
+297,7
@@
struct cs_state {
unsigned subdivision;
} dmabuf;
/* Guard against mmap/write/read races */
unsigned subdivision;
} dmabuf;
/* Guard against mmap/write/read races */
- struct
mutex
sem;
+ struct
semaphore
sem;
};
struct cs_card {
};
struct cs_card {
@@
-376,7
+375,7
@@
struct cs_card {
unsigned char ibuf[CS_MIDIINBUF];
unsigned char obuf[CS_MIDIOUTBUF];
mode_t open_mode;
unsigned char ibuf[CS_MIDIINBUF];
unsigned char obuf[CS_MIDIOUTBUF];
mode_t open_mode;
- struct
mutex open_mutex
;
+ struct
semaphore open_sem
;
} midi;
struct cs46xx_pm pm;
};
} midi;
struct cs46xx_pm pm;
};
@@
-1429,9
+1428,9
@@
static int prog_dmabuf(struct cs_state *state)
{
int ret;
{
int ret;
-
mutex_lock
(&state->sem);
+
down
(&state->sem);
ret = __prog_dmabuf(state);
ret = __prog_dmabuf(state);
-
mutex_unlock
(&state->sem);
+
up
(&state->sem);
return ret;
}
return ret;
}
@@
-1832,17
+1831,17
@@
static int cs_midi_open(struct inode *inode, struct file *file)
file->private_data = card;
/* wait for device to become free */
file->private_data = card;
/* wait for device to become free */
-
mutex_lock(&card->midi.open_mutex
);
+
down(&card->midi.open_sem
);
while (card->midi.open_mode & file->f_mode) {
if (file->f_flags & O_NONBLOCK) {
while (card->midi.open_mode & file->f_mode) {
if (file->f_flags & O_NONBLOCK) {
-
mutex_unlock(&card->midi.open_mutex
);
+
up(&card->midi.open_sem
);
return -EBUSY;
}
return -EBUSY;
}
-
mutex_unlock(&card->midi.open_mutex
);
+
up(&card->midi.open_sem
);
interruptible_sleep_on(&card->midi.open_wait);
if (signal_pending(current))
return -ERESTARTSYS;
interruptible_sleep_on(&card->midi.open_wait);
if (signal_pending(current))
return -ERESTARTSYS;
-
mutex_lock(&card->midi.open_mutex
);
+
down(&card->midi.open_sem
);
}
spin_lock_irqsave(&card->midi.lock, flags);
if (!(card->midi.open_mode & (FMODE_READ | FMODE_WRITE))) {
}
spin_lock_irqsave(&card->midi.lock, flags);
if (!(card->midi.open_mode & (FMODE_READ | FMODE_WRITE))) {
@@
-1860,7
+1859,7
@@
static int cs_midi_open(struct inode *inode, struct file *file)
}
spin_unlock_irqrestore(&card->midi.lock, flags);
card->midi.open_mode |= (file->f_mode & (FMODE_READ | FMODE_WRITE));
}
spin_unlock_irqrestore(&card->midi.lock, flags);
card->midi.open_mode |= (file->f_mode & (FMODE_READ | FMODE_WRITE));
-
mutex_unlock(&card->midi.open_mutex
);
+
up(&card->midi.open_sem
);
return 0;
}
return 0;
}
@@
-1892,9
+1891,9
@@
static int cs_midi_release(struct inode *inode, struct file *file)
remove_wait_queue(&card->midi.owait, &wait);
current->state = TASK_RUNNING;
}
remove_wait_queue(&card->midi.owait, &wait);
current->state = TASK_RUNNING;
}
-
mutex_lock(&card->midi.open_mutex
);
+
down(&card->midi.open_sem
);
card->midi.open_mode &= (~(file->f_mode & (FMODE_READ | FMODE_WRITE)));
card->midi.open_mode &= (~(file->f_mode & (FMODE_READ | FMODE_WRITE)));
-
mutex_unlock(&card->midi.open_mutex
);
+
up(&card->midi.open_sem
);
wake_up(&card->midi.open_wait);
return 0;
}
wake_up(&card->midi.open_wait);
return 0;
}
@@
-2082,7
+2081,7
@@
static ssize_t cs_read(struct file *file, char __user *buffer, size_t count, lof
if (!access_ok(VERIFY_WRITE, buffer, count))
return -EFAULT;
if (!access_ok(VERIFY_WRITE, buffer, count))
return -EFAULT;
-
mutex_lock
(&state->sem);
+
down
(&state->sem);
if (!dmabuf->ready && (ret = __prog_dmabuf(state)))
goto out2;
if (!dmabuf->ready && (ret = __prog_dmabuf(state)))
goto out2;
@@
-2115,13
+2114,13
@@
static ssize_t cs_read(struct file *file, char __user *buffer, size_t count, lof
if (!ret) ret = -EAGAIN;
goto out;
}
if (!ret) ret = -EAGAIN;
goto out;
}
-
mutex_unlock
(&state->sem);
+
up
(&state->sem);
schedule();
if (signal_pending(current)) {
if(!ret) ret = -ERESTARTSYS;
goto out;
}
schedule();
if (signal_pending(current)) {
if(!ret) ret = -ERESTARTSYS;
goto out;
}
-
mutex_lock
(&state->sem);
+
down
(&state->sem);
if (dmabuf->mapped)
{
if(!ret)
if (dmabuf->mapped)
{
if(!ret)
@@
-2156,7
+2155,7
@@
static ssize_t cs_read(struct file *file, char __user *buffer, size_t count, lof
out:
remove_wait_queue(&state->dmabuf.wait, &wait);
out2:
out:
remove_wait_queue(&state->dmabuf.wait, &wait);
out2:
-
mutex_unlock
(&state->sem);
+
up
(&state->sem);
set_current_state(TASK_RUNNING);
CS_DBGOUT(CS_WAVE_READ | CS_FUNCTION, 4,
printk("cs46xx: cs_read()- %zd\n",ret) );
set_current_state(TASK_RUNNING);
CS_DBGOUT(CS_WAVE_READ | CS_FUNCTION, 4,
printk("cs46xx: cs_read()- %zd\n",ret) );
@@
-2185,7
+2184,7
@@
static ssize_t cs_write(struct file *file, const char __user *buffer, size_t cou
return -EFAULT;
dmabuf = &state->dmabuf;
return -EFAULT;
dmabuf = &state->dmabuf;
-
mutex_lock
(&state->sem);
+
down
(&state->sem);
if (dmabuf->mapped)
{
ret = -ENXIO;
if (dmabuf->mapped)
{
ret = -ENXIO;
@@
-2241,13
+2240,13
@@
static ssize_t cs_write(struct file *file, const char __user *buffer, size_t cou
if (!ret) ret = -EAGAIN;
goto out;
}
if (!ret) ret = -EAGAIN;
goto out;
}
-
mutex_unlock
(&state->sem);
+
up
(&state->sem);
schedule();
if (signal_pending(current)) {
if(!ret) ret = -ERESTARTSYS;
goto out;
}
schedule();
if (signal_pending(current)) {
if(!ret) ret = -ERESTARTSYS;
goto out;
}
-
mutex_lock
(&state->sem);
+
down
(&state->sem);
if (dmabuf->mapped)
{
if(!ret)
if (dmabuf->mapped)
{
if(!ret)
@@
-2279,7
+2278,7
@@
static ssize_t cs_write(struct file *file, const char __user *buffer, size_t cou
start_dac(state);
}
out:
start_dac(state);
}
out:
-
mutex_unlock
(&state->sem);
+
up
(&state->sem);
remove_wait_queue(&state->dmabuf.wait, &wait);
set_current_state(TASK_RUNNING);
remove_wait_queue(&state->dmabuf.wait, &wait);
set_current_state(TASK_RUNNING);
@@
-2412,7
+2411,7
@@
static int cs_mmap(struct file *file, struct vm_area_struct *vma)
goto out;
}
goto out;
}
- mutex_lock(&state->sem);
+ down(&state->sem);
dmabuf = &state->dmabuf;
if (cs4x_pgoff(vma) != 0)
{
dmabuf = &state->dmabuf;
if (cs4x_pgoff(vma) != 0)
{
@@
-2439,7
+2438,7
@@
static int cs_mmap(struct file *file, struct vm_area_struct *vma)
CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_mmap()-\n") );
out:
CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_mmap()-\n") );
out:
-
mutex_unlock
(&state->sem);
+
up
(&state->sem);
return ret;
}
return ret;
}
@@
-3201,7
+3200,7
@@
static int cs_open(struct inode *inode, struct file *file)
if (state == NULL)
return -ENOMEM;
memset(state, 0, sizeof(struct cs_state));
if (state == NULL)
return -ENOMEM;
memset(state, 0, sizeof(struct cs_state));
-
mutex_init
(&state->sem);
+
init_MUTEX
(&state->sem);
dmabuf = &state->dmabuf;
dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
if(dmabuf->pbuf==NULL)
dmabuf = &state->dmabuf;
dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
if(dmabuf->pbuf==NULL)
@@
-3242,10
+3241,10
@@
static int cs_open(struct inode *inode, struct file *file)
state->virt = 0;
state->magic = CS_STATE_MAGIC;
init_waitqueue_head(&dmabuf->wait);
state->virt = 0;
state->magic = CS_STATE_MAGIC;
init_waitqueue_head(&dmabuf->wait);
-
mutex_init(&state->open_mutex
);
+
init_MUTEX(&state->open_sem
);
file->private_data = card;
file->private_data = card;
-
mutex_lock(&state->open_mutex
);
+
down(&state->open_sem
);
/* set default sample format. According to OSS Programmer's Guide /dev/dsp
should be default to unsigned 8-bits, mono, with sample rate 8kHz and
/* set default sample format. According to OSS Programmer's Guide /dev/dsp
should be default to unsigned 8-bits, mono, with sample rate 8kHz and
@@
-3261,7
+3260,7
@@
static int cs_open(struct inode *inode, struct file *file)
cs_set_divisor(dmabuf);
state->open_mode |= FMODE_READ;
cs_set_divisor(dmabuf);
state->open_mode |= FMODE_READ;
-
mutex_unlock(&state->open_mutex
);
+
up(&state->open_sem
);
}
if(file->f_mode & FMODE_WRITE)
{
}
if(file->f_mode & FMODE_WRITE)
{
@@
-3272,7
+3271,7
@@
static int cs_open(struct inode *inode, struct file *file)
if (state == NULL)
return -ENOMEM;
memset(state, 0, sizeof(struct cs_state));
if (state == NULL)
return -ENOMEM;
memset(state, 0, sizeof(struct cs_state));
-
mutex_init
(&state->sem);
+
init_MUTEX
(&state->sem);
dmabuf = &state->dmabuf;
dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
if(dmabuf->pbuf==NULL)
dmabuf = &state->dmabuf;
dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
if(dmabuf->pbuf==NULL)
@@
-3313,10
+3312,10
@@
static int cs_open(struct inode *inode, struct file *file)
state->virt = 1;
state->magic = CS_STATE_MAGIC;
init_waitqueue_head(&dmabuf->wait);
state->virt = 1;
state->magic = CS_STATE_MAGIC;
init_waitqueue_head(&dmabuf->wait);
-
mutex_init(&state->open_mutex
);
+
init_MUTEX(&state->open_sem
);
file->private_data = card;
file->private_data = card;
-
mutex_lock(&state->open_mutex
);
+
down(&state->open_sem
);
/* set default sample format. According to OSS Programmer's Guide /dev/dsp
should be default to unsigned 8-bits, mono, with sample rate 8kHz and
/* set default sample format. According to OSS Programmer's Guide /dev/dsp
should be default to unsigned 8-bits, mono, with sample rate 8kHz and
@@
-3332,7
+3331,7
@@
static int cs_open(struct inode *inode, struct file *file)
cs_set_divisor(dmabuf);
state->open_mode |= FMODE_WRITE;
cs_set_divisor(dmabuf);
state->open_mode |= FMODE_WRITE;
-
mutex_unlock(&state->open_mutex
);
+
up(&state->open_sem
);
if((ret = prog_dmabuf(state)))
return ret;
}
if((ret = prog_dmabuf(state)))
return ret;
}
@@
-3364,14
+3363,14
@@
static int cs_release(struct inode *inode, struct file *file)
cs_clear_tail(state);
drain_dac(state, file->f_flags & O_NONBLOCK);
/* stop DMA state machine and free DMA buffers/channels */
cs_clear_tail(state);
drain_dac(state, file->f_flags & O_NONBLOCK);
/* stop DMA state machine and free DMA buffers/channels */
-
mutex_lock(&state->open_mutex
);
+
down(&state->open_sem
);
stop_dac(state);
dealloc_dmabuf(state);
state->card->free_pcm_channel(state->card, dmabuf->channel->num);
free_page((unsigned long)state->dmabuf.pbuf);
stop_dac(state);
dealloc_dmabuf(state);
state->card->free_pcm_channel(state->card, dmabuf->channel->num);
free_page((unsigned long)state->dmabuf.pbuf);
- /* we're covered by the open_
mutex
*/
-
mutex_unlock(&state->open_mutex
);
+ /* we're covered by the open_
sem
*/
+
up(&state->open_sem
);
state->card->states[state->virt] = NULL;
state->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
state->card->states[state->virt] = NULL;
state->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
@@
-3396,14
+3395,14
@@
static int cs_release(struct inode *inode, struct file *file)
{
CS_DBGOUT(CS_RELEASE, 2, printk("cs46xx: cs_release() FMODE_READ\n") );
dmabuf = &state->dmabuf;
{
CS_DBGOUT(CS_RELEASE, 2, printk("cs46xx: cs_release() FMODE_READ\n") );
dmabuf = &state->dmabuf;
-
mutex_lock(&state->open_mutex
);
+
down(&state->open_sem
);
stop_adc(state);
dealloc_dmabuf(state);
state->card->free_pcm_channel(state->card, dmabuf->channel->num);
free_page((unsigned long)state->dmabuf.pbuf);
stop_adc(state);
dealloc_dmabuf(state);
state->card->free_pcm_channel(state->card, dmabuf->channel->num);
free_page((unsigned long)state->dmabuf.pbuf);
- /* we're covered by the open_
mutex
*/
-
mutex_unlock(&state->open_mutex
);
+ /* we're covered by the open_
sem
*/
+
up(&state->open_sem
);
state->card->states[state->virt] = NULL;
state->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
state->card->states[state->virt] = NULL;
state->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
@@
-5508,7
+5507,7
@@
static int __devinit cs46xx_probe(struct pci_dev *pci_dev,
}
init_waitqueue_head(&card->midi.open_wait);
}
init_waitqueue_head(&card->midi.open_wait);
-
mutex_init(&card->midi.open_mutex
);
+
init_MUTEX(&card->midi.open_sem
);
init_waitqueue_head(&card->midi.iwait);
init_waitqueue_head(&card->midi.owait);
cs461x_pokeBA0(card, BA0_MIDCR, MIDCR_MRST);
init_waitqueue_head(&card->midi.iwait);
init_waitqueue_head(&card->midi.owait);
cs461x_pokeBA0(card, BA0_MIDCR, MIDCR_MRST);