patch-2.4.0-test4 linux/drivers/sound/soundcard.c
Next file: linux/drivers/sound/trident.c
Previous file: linux/drivers/sound/sonicvibes.c
Back to the patch index
Back to the overall index
- Lines: 72
- Date:
Wed Jul 12 21:58:43 2000
- Orig file:
v2.4.0-test3/linux/drivers/sound/soundcard.c
- Orig date:
Mon Jul 10 16:47:24 2000
diff -u --recursive --new-file v2.4.0-test3/linux/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c
@@ -270,6 +270,7 @@
{
int dev = MINOR(inode->i_rdev);
+ lock_kernel();
DEB(printk("sound_release(dev=%d)\n", dev));
switch (dev & 0x0f) {
case SND_DEV_CTL:
@@ -297,6 +298,7 @@
notifier_call_chain(&sound_locker, 0, 0);
lock_depth--;
+ unlock_kernel();
return 0;
}
@@ -449,29 +451,35 @@
printk(KERN_ERR "Sound: mmap() not supported for other than audio devices\n");
return -EINVAL;
}
+ lock_kernel();
if (vma->vm_flags & VM_WRITE) /* Map write and read/write to the output buf */
dmap = audio_devs[dev]->dmap_out;
else if (vma->vm_flags & VM_READ)
dmap = audio_devs[dev]->dmap_in;
else {
printk(KERN_ERR "Sound: Undefined mmap() access\n");
+ unlock_kernel();
return -EINVAL;
}
if (dmap == NULL) {
printk(KERN_ERR "Sound: mmap() error. dmap == NULL\n");
+ unlock_kernel();
return -EIO;
}
if (dmap->raw_buf == NULL) {
printk(KERN_ERR "Sound: mmap() called when raw_buf == NULL\n");
+ unlock_kernel();
return -EIO;
}
if (dmap->mapping_flags) {
printk(KERN_ERR "Sound: mmap() called twice for the same DMA buffer\n");
+ unlock_kernel();
return -EIO;
}
if (vma->vm_pgoff != 0) {
printk(KERN_ERR "Sound: mmap() offset must be 0.\n");
+ unlock_kernel();
return -EINVAL;
}
size = vma->vm_end - vma->vm_start;
@@ -481,8 +489,10 @@
}
if (remap_page_range(vma->vm_start, virt_to_phys(dmap->raw_buf),
vma->vm_end - vma->vm_start,
- vma->vm_page_prot))
+ vma->vm_page_prot)) {
+ unlock_kernel();
return -EAGAIN;
+ }
dmap->mapping_flags |= DMA_MAP_MAPPED;
@@ -492,6 +502,7 @@
memset(dmap->raw_buf,
dmap->neutral_byte,
dmap->bytes_in_use);
+ unlock_kernel();
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)