From 8f6788d071cf3460d5ba8f7dabd1bd8beef99f66 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Thu, 17 Aug 2017 16:28:52 -0700 Subject: [PATCH] qcacmn: Use vm_fault->address instead of virtual_address Linux kernel 4.10 removed vm_fault->virtual_address in favor of simply using vm_fault->address. Add conditional compilation to use the appropriate vm_fault address field based on the version of the Linux kernel being compiled against. Change-Id: I3f29721888bf349a7ac4f5f62d576b668ee0abc2 CRs-Fixed: 2094806 --- utils/pktlog/linux_ac.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/utils/pktlog/linux_ac.c b/utils/pktlog/linux_ac.c index e16142a30d..7e0aab5d58 100644 --- a/utils/pktlog/linux_ac.c +++ b/utils/pktlog/linux_ac.c @@ -991,9 +991,21 @@ static void pktlog_vclose(struct vm_area_struct *vma) PKTLOG_MOD_DEC_USE_COUNT; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) +static inline unsigned long pktlog_get_fault_address(struct vm_fault *vmf) +{ + return (unsigned long)vmf->virtual_address; +} +#else +static inline unsigned long pktlog_get_fault_address(struct vm_fault *vmf) +{ + return vmf->address; +} +#endif /* KERNEL_VERSION(4, 10, 0) */ + static int pktlog_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { - unsigned long address = (unsigned long)vmf->virtual_address; + unsigned long address = pktlog_get_fault_address(vmf); if (address == 0UL) return VM_FAULT_NOPAGE;