tty_port: If we are opened non blocking we still need to raise the carrier
[safe/jmp/linux-2.6] / drivers / uio / uio.c
index 68a4965..e941367 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/device.h>
 #include <linux/mm.h>
 #include <linux/idr.h>
+#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/kobject.h>
 #include <linux/uio_driver.h>
@@ -658,7 +659,7 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        return 0;
 }
 
-static struct vm_operations_struct uio_vm_ops = {
+static const struct vm_operations_struct uio_vm_ops = {
        .open = uio_vma_open,
        .close = uio_vma_close,
        .fault = uio_vma_fault,
@@ -708,7 +709,8 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
                return -EINVAL;
 
        requested_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
-       actual_pages = (idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT;
+       actual_pages = ((idev->info->mem[mi].addr & ~PAGE_MASK)
+                       + idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT;
        if (requested_pages > actual_pages)
                return -EINVAL;