summaryrefslogtreecommitdiffstats
path: root/kernel/amd-3.5.0-missing_do_mmap.patch
blob: bb61eabe3e5edc0b76c0880dc646c61eee0a9ebf (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
--- lib/modules/fglrx/build_mod/firegl_public.c
+++ lib/modules/fglrx/build_mod/firegl_public.c
@@ -2148,9 +2148,13 @@ unsigned long ATI_API_CALL KCL_MEM_Alloc
     flags = MAP_SHARED;
     prot  = PROT_READ|PROT_WRITE;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+    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
@@ -2161,6 +2165,16 @@ int ATI_API_CALL KCL_MEM_ReleaseLinearAd
 {
     int retcode = 0;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+#ifdef FGL_LINUX_RHEL_MUNMAP_API
+    retcode = vm_munmap(addr,
+                        len,
+                        1);
+#else
+    retcode = vm_munmap(addr,
+                        len);
+#endif
+#else
     down_write(&current->mm->mmap_sem);
 #ifdef FGL_LINUX_RHEL_MUNMAP_API
     retcode = do_munmap(current->mm,
@@ -2171,8 +2185,9 @@ int ATI_API_CALL KCL_MEM_ReleaseLinearAd
     retcode = do_munmap(current->mm,
                         addr,
                         len);
-#endif                        
     up_write(&current->mm->mmap_sem);
+#endif
+#endif
     return retcode;
 }