summaryrefslogtreecommitdiff
path: root/community-testing/catalyst-dkms/3.5-do_mmap.patch
blob: 04248eb7bc5d02b71cbd68ea7294ef0f81be9de0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- a/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-06-15 18:30:13.483762070 +0200
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-06-17 17:47:36.543041869 +0200
@@ -2106,6 +2106,12 @@
     }
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
+# define NO_DO_MMAP
+# define do_mmap(a,b,c,d,e,f) vm_mmap(a, b, c, d, e, f)
+# define do_munmap(a,b,c) vm_munmap(b, c)
+#endif
+
 unsigned long ATI_API_CALL KCL_MEM_AllocLinearAddrInterval(
                                         KCL_IO_FILE_Handle file,
                                         unsigned long addr,
@@ -2117,10 +2123,13 @@
 
     flags = MAP_SHARED;
     prot  = PROT_READ|PROT_WRITE;
-
+#ifdef NO_DO_MMAP
+    vaddr = (void *) vm_mmap(file, 0, len, prot, flags, pgoff);
+#else
     down_write(&current->mm->mmap_sem);
     vaddr = (void *) do_mmap(file, 0, len, prot, flags, pgoff);
     up_write(&current->mm->mmap_sem);
+#endif
     if (IS_ERR(vaddr))
        return 0;
     else
@@ -2131,7 +2140,9 @@
 {
     int retcode = 0;
 
+#ifndef NO_DO_MMAP
     down_write(&current->mm->mmap_sem);
+#endif
 #ifdef FGL_LINUX_RHEL_MUNMAP_API
     retcode = do_munmap(current->mm,
                         addr,
@@ -2142,7 +2153,9 @@
                         addr,
                         len);
 #endif                        
+#ifndef NO_DO_MMAP
     up_write(&current->mm->mmap_sem);
+#endif
     return retcode;
 }