Catalyst 12.8 ‘do_mmap’ 补丁

# Patch for "implicit declaration of function ‘do_mmap’"
# for AMD Catalyst 12.8 (fglrx 8.982)
--- /common/lib/modules/fglrx/build_mod/firegl_public.c
+++ /common/lib/modules/fglrx/build_mod/firegl_public.c
@@ -2115,6 +2115,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,
@@ -2127,9 +2133,14 @@
     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
@@ -2140,7 +2151,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,
@@ -2151,7 +2164,9 @@
                         addr,
                         len);
 #endif                        
+#ifndef NO_DO_MMAP
     up_write(&current->mm->mmap_sem);
+#endif
     return retcode;
 }

你可能感兴趣的:(补丁,catalyst,‘do_mmap’)