]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/mem.c
Merge branch 'linus' into x86/urgent
[linux-2.6-omap-h63xx.git] / drivers / char / mem.c
index 934ffafedaea207131f7d193bed9e75c929f4db9..b6772d657547a4e25f275f2a1bd4bc29ac3188e4 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/bootmem.h>
 #include <linux/splice.h>
 #include <linux/pfn.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -79,7 +80,7 @@ static inline int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
 }
 #endif
 
-#ifdef CONFIG_NONPROMISC_DEVMEM
+#ifdef CONFIG_STRICT_DEVMEM
 static inline int range_is_allowed(unsigned long pfn, unsigned long size)
 {
        u64 from = ((u64)pfn) << PAGE_SHIFT;
@@ -889,6 +890,9 @@ static const struct file_operations kmsg_fops = {
 
 static int memory_open(struct inode * inode, struct file * filp)
 {
+       int ret = 0;
+
+       lock_kernel();
        switch (iminor(inode)) {
                case 1:
                        filp->f_op = &mem_fops;
@@ -932,11 +936,13 @@ static int memory_open(struct inode * inode, struct file * filp)
                        break;
 #endif
                default:
+                       unlock_kernel();
                        return -ENXIO;
        }
        if (filp->f_op && filp->f_op->open)
-               return filp->f_op->open(inode,filp);
-       return 0;
+               ret = filp->f_op->open(inode,filp);
+       unlock_kernel();
+       return ret;
 }
 
 static const struct file_operations memory_fops = {