patch-2.1.110 linux/drivers/char/mem.c
Next file: linux/drivers/char/radio-aimslab.c
Previous file: linux/drivers/char/lp_m68k.c
Back to the patch index
Back to the overall index
- Lines: 73
- Date:
Mon Jul 20 14:00:11 1998
- Orig file:
v2.1.109/linux/drivers/char/mem.c
- Orig date:
Wed Jun 24 22:54:05 1998
diff -u --recursive --new-file v2.1.109/linux/drivers/char/mem.c linux/drivers/char/mem.c
@@ -263,45 +263,55 @@
*/
static inline size_t read_zero_pagealigned(char * buf, size_t size)
{
+ struct mm_struct *mm;
struct vm_area_struct * vma;
unsigned long addr=(unsigned long)buf;
+ mm = current->mm;
+ /* Oops, this was forgotten before. -ben */
+ down(&mm->mmap_sem);
+
/* For private mappings, just map in zero pages. */
- for (vma = find_vma(current->mm, addr); vma; vma = vma->vm_next) {
+ for (vma = find_vma(mm, addr); vma; vma = vma->vm_next) {
unsigned long count;
if (vma->vm_start > addr || (vma->vm_flags & VM_WRITE) == 0)
- return size;
+ goto out_up;
if (vma->vm_flags & VM_SHARED)
break;
count = vma->vm_end - addr;
if (count > size)
count = size;
- flush_cache_range(current->mm, addr, addr + count);
- zap_page_range(current->mm, addr, count);
+ flush_cache_range(mm, addr, addr + count);
+ zap_page_range(mm, addr, count);
zeromap_page_range(addr, count, PAGE_COPY);
- flush_tlb_range(current->mm, addr, addr + count);
+ flush_tlb_range(mm, addr, addr + count);
size -= count;
buf += count;
addr += count;
if (size == 0)
- return 0;
+ goto out_up;
}
+
+ up(&mm->mmap_sem);
/* The shared case is hard. Let's do the conventional zeroing. */
do {
unsigned long unwritten = clear_user(buf, PAGE_SIZE);
if (unwritten)
return size + unwritten - PAGE_SIZE;
- if (need_resched)
+ if (current->need_resched)
schedule();
buf += PAGE_SIZE;
size -= PAGE_SIZE;
} while (size);
return size;
+out_up:
+ up(&mm->mmap_sem);
+ return size;
}
static ssize_t read_zero(struct file * file, char * buf,
@@ -565,6 +575,9 @@
#endif
#ifdef CONFIG_FTAPE
ftape_init();
+#endif
+#ifdef CONFIG_VIDEO_BT848
+ i2c_init();
#endif
#ifdef CONFIG_VIDEO_DEV
videodev_init();
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov