X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Foss%2Fcmpci.c;h=7cfbb08db5371df5073c35e8bc3b5f01e6c32e14;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=de60a059ff5f783c60d10127c701335d363637dc;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/sound/oss/cmpci.c b/sound/oss/cmpci.c index de60a059f..7cfbb08db 100644 --- a/sound/oss/cmpci.c +++ b/sound/oss/cmpci.c @@ -138,8 +138,6 @@ #endif #ifdef CONFIG_SOUND_CMPCI_JOYSTICK #include -#include - #endif /* --------------------------------------------------------------------- */ @@ -394,7 +392,7 @@ struct cm_state { unsigned char fmt, enable; spinlock_t lock; - struct mutex open_mutex; + struct semaphore open_sem; mode_t open_mode; wait_queue_head_t open_wait; @@ -1713,7 +1711,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ if (get_user(val, p)) return -EFAULT; - i = hweight32(val); + i = generic_hweight32(val); for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) { if (!(val & (1 << i))) continue; @@ -2827,21 +2825,21 @@ static int cm_open(struct inode *inode, struct file *file) VALIDATE_STATE(s); file->private_data = s; /* wait for device to become free */ - mutex_lock(&s->open_mutex); + down(&s->open_sem); while (s->open_mode & file->f_mode) { if (file->f_flags & O_NONBLOCK) { - mutex_unlock(&s->open_mutex); + up(&s->open_sem); return -EBUSY; } add_wait_queue(&s->open_wait, &wait); __set_current_state(TASK_INTERRUPTIBLE); - mutex_unlock(&s->open_mutex); + up(&s->open_sem); schedule(); remove_wait_queue(&s->open_wait, &wait); set_current_state(TASK_RUNNING); if (signal_pending(current)) return -ERESTARTSYS; - mutex_lock(&s->open_mutex); + down(&s->open_sem); } if (file->f_mode & FMODE_READ) { s->status &= ~DO_BIGENDIAN_R; @@ -2869,7 +2867,7 @@ static int cm_open(struct inode *inode, struct file *file) } set_fmt(s, fmtm, fmts); s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); - mutex_unlock(&s->open_mutex); + up(&s->open_sem); return nonseekable_open(inode, file); } @@ -2881,7 +2879,7 @@ static int cm_release(struct inode *inode, struct file *file) lock_kernel(); if (file->f_mode & FMODE_WRITE) drain_dac(s, file->f_flags & O_NONBLOCK); - mutex_lock(&s->open_mutex); + down(&s->open_sem); if (file->f_mode & FMODE_WRITE) { stop_dac(s); @@ -2905,7 +2903,7 @@ static int cm_release(struct inode *inode, struct file *file) s->status &= ~DO_BIGENDIAN_R; } s->open_mode &= ~(file->f_mode & (FMODE_READ|FMODE_WRITE)); - mutex_unlock(&s->open_mutex); + up(&s->open_sem); wake_up(&s->open_wait); unlock_kernel(); return 0; @@ -3082,7 +3080,7 @@ static int __devinit cm_probe(struct pci_dev *pcidev, const struct pci_device_id init_waitqueue_head(&s->dma_adc.wait); init_waitqueue_head(&s->dma_dac.wait); init_waitqueue_head(&s->open_wait); - mutex_init(&s->open_mutex); + init_MUTEX(&s->open_sem); spin_lock_init(&s->lock); s->magic = CM_MAGIC; s->dev = pcidev;