mwlwifi: fix 6.1 Kernel support
[openwrt/openwrt.git] / package / kernel / mwlwifi / patches / 006-remove-uaccess-and-get_fs-calls-from-PCIe-for-Kenel-.patch
1 From ad911365cac3723d1c00d048905a5e22ff4a10f3 Mon Sep 17 00:00:00 2001
2 From: Stefan Kalscheuer <stefan@stklcode.de>
3 Date: Sun, 18 Jun 2023 17:53:27 +0200
4 Subject: [PATCH 1/2] remove uaccess and get_fs calls from PCIe for Kenel >=
5 5.18
6
7 Remove the calls to deprecated get_fs and force_uaccess_* API for modern
8 kernels.
9
10 The get_fs functionality and the transitional force_uaccess_* calls have
11 been removed Kernel 5.18 [1] while read and write operations have been
12 refactored, so the code can work on kernel- and userspace data without
13 the need to shifting the boundary using set_fs().
14
15 [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=967747bbc084b93b54e66f9047d342232314cd25
16
17 Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de>
18 ---
19 hif/pcie/pcie.c | 6 ++++--
20 1 file changed, 4 insertions(+), 2 deletions(-)
21
22 diff --git a/hif/pcie/pcie.c b/hif/pcie/pcie.c
23 index 24453b6..bee1cc5 100644
24 --- a/hif/pcie/pcie.c
25 +++ b/hif/pcie/pcie.c
26 @@ -1294,7 +1294,9 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv,
27 const char filename[] = "/tmp/BF_MIMO_Ctrl_Field_Output.txt";
28 char str_buf[256];
29 char *buf = &str_buf[0];
30 +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
31 mm_segment_t oldfs;
32 +#endif
33
34 #if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
35 oldfs = get_fs();
36 @@ -1302,7 +1304,7 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv,
37 #elif LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
38 oldfs = get_fs();
39 set_fs(KERNEL_DS);
40 -#else
41 +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
42 oldfs = force_uaccess_begin();
43 #endif
44
45 @@ -1326,7 +1328,7 @@ static void pcie_bf_mimo_ctrl_decode(struct mwl_priv *priv,
46
47 #if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
48 set_fs(oldfs);
49 -#else
50 +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
51 force_uaccess_end(oldfs);
52 #endif
53 }