mwlwifi: update to version 10.4.10-20231120
[openwrt/staging/hauke.git] / package / kernel / mwlwifi / patches / 001-Fix-compilation-warning-with-64-bit-system.patch
1 From ed4422e98ababf956674da3438ac42b3aa32c66e Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Wed, 10 May 2023 00:41:06 +0200
4 Subject: [PATCH] Fix compilation warning with 64 bit system
5
6 Use %zu and %zd where possible for ssize_t and size_t.
7 Use PTR_ERR to correctly convert to negative error.
8 Use universal pointer to support both 32 and 64bit systems.
9
10 Fix compilation warning:
11 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/fwcmd.c: In function 'mwl_fwcmd_get_fw_core_dump':
12 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/fwcmd.c:3608:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
13 3608 | (const void *)((u32)pcmd +
14 | ^
15 In file included from ./include/linux/device.h:15,
16 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/device.h:3,
17 from ./include/linux/dma-mapping.h:7,
18 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/dma-mapping.h:3,
19 from ./include/linux/skbuff.h:31,
20 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/skbuff.h:3,
21 from ./include/linux/if_ether.h:19,
22 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/if_ether.h:3,
23 from ./include/linux/etherdevice.h:20,
24 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/etherdevice.h:3,
25 from /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:20:
26 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c: In function 'pcie_tx_init_ndp':
27 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:38: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Werror=format=]
28 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
29 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 ./include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
31 110 | _p_func(dev, fmt, ##__VA_ARGS__); \
32 | ^~~
33 ./include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
34 144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
35 | ^~~~~~~
36 /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211/net/cfg80211.h:8828:9: note: in expansion of macro 'dev_err'
37 8828 | dev_err(&(wiphy)->dev, format, ##args)
38 | ^~~~~~~
39 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:17: note: in expansion of macro 'wiphy_err'
40 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
41 | ^~~~~~~~~
42 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:67: note: format string is defined here
43 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
44 | ~^
45 | |
46 | int
47 | %ld
48 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:38: error: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Werror=format=]
49 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
50 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51 ./include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
52 110 | _p_func(dev, fmt, ##__VA_ARGS__); \
53 | ^~~
54 ./include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
55 144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
56 | ^~~~~~~
57 /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211/net/cfg80211.h:8828:9: note: in expansion of macro 'dev_err'
58 8828 | dev_err(&(wiphy)->dev, format, ##args)
59 | ^~~~~~~
60 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:17: note: in expansion of macro 'wiphy_err'
61 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
62 | ^~~~~~~~~
63 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.c:338:71: note: format string is defined here
64 338 | wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
65 | ~^
66 | |
67 | int
68 | %ld
69 CC [M] /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/debugfs.o
70 In file included from ./include/linux/device.h:15,
71 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/device.h:3,
72 from ./include/linux/dma-mapping.h:7,
73 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/dma-mapping.h:3,
74 from ./include/linux/skbuff.h:31,
75 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/skbuff.h:3,
76 from ./include/linux/if_ether.h:19,
77 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/if_ether.h:3,
78 from ./include/linux/etherdevice.h:20,
79 from /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211-backport/linux/etherdevice.h:3,
80 from /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.c:19:
81 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.c: In function 'pcie_bf_mimo_ctrl_decode':
82 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.c:1325:37: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
83 1325 | filename, (unsigned int)fp_data);
84 | ^
85 ./include/linux/dev_printk.h:110:37: note: in definition of macro 'dev_printk_index_wrap'
86 110 | _p_func(dev, fmt, ##__VA_ARGS__); \
87 | ^~~~~~~~~~~
88 /home/ansuel/openwrt-ansuel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include/mac80211/net/cfg80211.h:8828:9: note: in expansion of macro 'dev_err'
89 8828 | dev_err(&(wiphy)->dev, format, ##args)
90 | ^~~~~~~
91 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.c:1324:17: note: in expansion of macro 'wiphy_err'
92 1324 | wiphy_err(priv->hw->wiphy, "Error opening %s! %x\n",
93 | ^~~~~~~~~
94 cc1: all warnings being treated as errors
95 make[4]: *** [scripts/Makefile.build:289: /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/tx_ndp.o] Error 1
96 make[4]: *** Waiting for unfinished jobs....
97 cc1: all warnings being treated as errors
98 make[4]: *** [scripts/Makefile.build:289: /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/hif/pcie/pcie.o] Error 1
99 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/debugfs.c: In function 'mwl_debugfs_regrdwr_read':
100 /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/mwlwifi-2023-04-29-6a436714/debugfs.c:1335:43: error: format '%d' expects argument of type 'int', but argument 4 has type 'ssize_t' {aka 'long int'} [-Werror=format=]
101 1335 | "error: %d(%u 0x%08x 0x%08x)\n",
102 | ~^
103 | |
104 | int
105 | %ld
106 1336 | ret, priv->reg_type, priv->reg_offset,
107 | ~~~
108 | |
109 | ssize_t {aka long int}
110 cc1: all warnings being treated as errors
111
112 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
113 ---
114 debugfs.c | 2 +-
115 hif/fwcmd.c | 2 +-
116 hif/pcie/pcie.c | 4 ++--
117 hif/pcie/tx_ndp.c | 2 +-
118 4 files changed, 5 insertions(+), 5 deletions(-)
119
120 --- a/debugfs.c
121 +++ b/debugfs.c
122 @@ -1342,7 +1342,7 @@ done:
123 priv->reg_value);
124 else
125 len += scnprintf(p + len, size - len,
126 - "error: %d(%u 0x%08x 0x%08x)\n",
127 + "error: %zd(%u 0x%08x 0x%08x)\n",
128 ret, priv->reg_type, priv->reg_offset,
129 priv->reg_value);
130
131 --- a/hif/fwcmd.c
132 +++ b/hif/fwcmd.c
133 @@ -3623,7 +3623,7 @@ int mwl_fwcmd_get_fw_core_dump(struct ie
134 core_dump->size_kb = pcmd->cmd_data.coredump.size_kb;
135 core_dump->flags = pcmd->cmd_data.coredump.flags;
136 memcpy(buff,
137 - (const void *)((u32)pcmd +
138 + (const void *)((uintptr_t)pcmd +
139 sizeof(struct hostcmd_cmd_get_fw_core_dump) -
140 sizeof(struct hostcmd_cmd_get_fw_core_dump_)),
141 MAX_CORE_DUMP_BUFFER);
142 --- a/hif/pcie/8964/tx_ndp.c
143 +++ b/hif/pcie/8964/tx_ndp.c
144 @@ -336,7 +336,7 @@ int pcie_tx_init_ndp(struct ieee80211_hw
145
146 if (sizeof(struct pcie_tx_ctrl_ndp) >
147 sizeof(tx_info->driver_data)) {
148 - wiphy_err(hw->wiphy, "driver data is not enough: %d (%d)\n",
149 + wiphy_err(hw->wiphy, "driver data is not enough: %zu (%zu)\n",
150 sizeof(struct pcie_tx_ctrl_ndp),
151 sizeof(tx_info->driver_data));
152 return -ENOMEM;
153 --- a/hif/pcie/pcie.c
154 +++ b/hif/pcie/pcie.c
155 @@ -1464,8 +1464,8 @@ static void pcie_bf_mimo_ctrl_decode(str
156 &fp_data->f_pos);
157 filp_close(fp_data, current->files);
158 } else {
159 - wiphy_err(priv->hw->wiphy, "Error opening %s! %x\n",
160 - filename, (unsigned int)fp_data);
161 + wiphy_err(priv->hw->wiphy, "Error opening %s! %ld\n",
162 + filename, PTR_ERR(fp_data));
163 }
164
165 #if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)