File: 0003-xtrx.c-fix-build-error-with-kernel-6.3.patch

package info (click to toggle)
xtrx-dkms 0.0.1%2Bgit20190320.5ae3a3e-3.7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 376 kB
  • sloc: ansic: 7,314; xml: 23; makefile: 21
file content (58 lines) | stat: -rw-r--r-- 2,039 bytes parent folder | download
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
51
52
53
54
55
56
57
58
From 68d80b30a74db6c767f9b4d555d7243930c955c4 Mon Sep 17 00:00:00 2001
From: "Ying-Chun Liu (PaulLiu)" <paulliu@debian.org>
Date: Sat, 24 Jun 2023 04:19:51 +0800
Forwarded: https://github.com/myriadrf/xtrx_linux_pcie_drv/pull/17
Bug-Debian: http://bugs.debian.org/1038003
Last-Update: 2023-06-24
Subject: [PATCH] xtrx.c: fix build error with kernel 6.3

vma->vm_flags is now read-only. We need to use vm_flags_set() instead.

Please refer kernel commit bc292ab00f6c
("mm: introduce vma->vm_flags wrapper functions")

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
---
 xtrx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Index: xtrx-dkms-0.0.1+git20190320.5ae3a3e/xtrx.c
===================================================================
--- xtrx-dkms-0.0.1+git20190320.5ae3a3e.orig/xtrx.c
+++ xtrx-dkms-0.0.1+git20190320.5ae3a3e/xtrx.c
@@ -1072,7 +1072,11 @@ static int xtrxfd_mmap(struct file *filp
 			return -EINVAL;
 		}
 		//vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
 		vma->vm_flags |= VM_LOCKED;
+#else
+		vm_flags_set(vma, VM_LOCKED);
+#endif
 
 		if (remap_pfn_range(vma, vma->vm_start,
 							virt_to_phys((void*)((unsigned long)xtrxdev->shared_mmap)) >> PAGE_SHIFT,
@@ -1087,7 +1091,11 @@ static int xtrxfd_mmap(struct file *filp
 		unsigned long pfn;
 		int bar = (region == REGION_CTRL) ? 0 : 1;
 		vma->vm_page_prot = pgprot_device(vma->vm_page_prot);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
 		vma->vm_flags |= VM_IO;
+#else
+		vm_flags_set(vma, VM_IO);
+#endif
 		pfn = pci_resource_start(xtrxdev->pdev, bar) >> PAGE_SHIFT;
 
 		if (io_remap_pfn_range(vma, vma->vm_start, pfn,
@@ -1112,7 +1120,11 @@ static int xtrxfd_mmap(struct file *filp
 		}
 
 		//vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
 		vma->vm_flags |= VM_LOCKED;
+#else
+		vm_flags_set(vma, VM_LOCKED);
+#endif
 
 		for (i = 0, off = 0; i < BUFS; ++i, off += bufsize) {
 #ifdef VA_DMA_ADDR_FIXUP