Browse Source

qcacmn: Remove vma from vm_operations_struct->fault handler

Linux kernel 4.10 removes the vm_area_struct parameter from the
vm_operations_struct->fault handler. Add conditional compilation to
provided the appropriate fault handler signature based on the version of
the Linux kernel being compiled against.

Change-Id: I467f4d8426ecfa55e4f2aac26a5326901239a752
CRs-Fixed: 2094824
Dustin Brown 7 years ago
parent
commit
4ff1c130d3
1 changed files with 15 additions and 2 deletions
  1. 15 2
      utils/pktlog/linux_ac.c

+ 15 - 2
utils/pktlog/linux_ac.c

@@ -1003,7 +1003,8 @@ static inline unsigned long pktlog_get_fault_address(struct vm_fault *vmf)
 }
 #endif /* KERNEL_VERSION(4, 10, 0) */
 
-static int pktlog_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+static int
+pktlog_fault_handler(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	unsigned long address = pktlog_get_fault_address(vmf);
 
@@ -1018,8 +1019,20 @@ static int pktlog_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	return 0;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
+static int pktlog_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+{
+	return pktlog_fault_handler(vma, vmf);
+}
+#else
+static int pktlog_fault(struct vm_fault *vmf)
+{
+	return pktlog_fault_handler(vmf->vma, vmf);
+}
+#endif
+
 static struct vm_operations_struct pktlog_vmops = {
-	open:  pktlog_vopen,
+	open: pktlog_vopen,
 	close:pktlog_vclose,
 	fault:pktlog_fault,
 };