sifiveu: add new target for SiFive U-based boards
[openwrt/openwrt.git] / package / kernel / ath10k-ct / patches / 203-ath10k-ct-fix-compilation-warning-for-debug-level.patch
1 From 3b07c3a6e4adebd0466f5e539f318224db8cfc37 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sat, 6 May 2023 15:29:52 +0200
4 Subject: [PATCH] ath10k-ct: fix compilation warning for debug level
5
6 Rework read_debug_level function as it does exceed the stack limit for
7 some arch.
8 Fix compilation error:
9 /__w/openwrt/openwrt/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-malta_be/ath10k-ct-regular/ath10k-ct-2022-05-13-f808496f/ath10k-5.15/debug.c: In function 'ath10k_read_debug_level':
10 /__w/openwrt/openwrt/openwrt/build_dir/target-mips-openwrt-linux-musl_musl/linux-malta_be/ath10k-ct-regular/ath10k-ct-2022-05-13-f808496f/ath10k-5.15/debug.c:1388:1: error: the frame size of 1440 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
11 1388 | }
12 | ^
13
14 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
15 ---
16 ath10k-5.15/debug.c | 85 +++++++++++++++++++++++++--------------------
17 ath10k-5.17/debug.c | 85 +++++++++++++++++++++++++--------------------
18 2 files changed, 96 insertions(+), 74 deletions(-)
19
20 diff --git a/ath10k-5.15/debug.c b/ath10k-5.15/debug.c
21 index af84012..d0fa911 100644
22 --- a/ath10k-5.15/debug.c
23 +++ b/ath10k-5.15/debug.c
24 @@ -1344,47 +1344,58 @@ static const struct file_operations fops_simulate_fw_crash = {
25 .llseek = default_llseek,
26 };
27
28 +static const char debug_level_buf[] =
29 + "To change debug level, set value adding up desired flags:\n"
30 + "PCI: 0x1\n"
31 + "WMI: 0x2\n"
32 + "HTC: 0x4\n"
33 + "HTT: 0x8\n"
34 + "MAC: 0x10\n"
35 + "BOOT: 0x20\n"
36 + "PCI-DUMP: 0x40\n"
37 + "HTT-DUMP: 0x80\n"
38 + "MGMT: 0x100\n"
39 + "DATA: 0x200\n"
40 + "BMI: 0x400\n"
41 + "REGULATORY: 0x800\n"
42 + "TESTMODE: 0x1000\n"
43 + "WMI-PRINT: 0x2000\n"
44 + "PCI-PS: 0x4000\n"
45 + "AHB: 0x8000\n"
46 + "SDIO: 0x10000\n"
47 + "SDIO_DUMP: 0x20000\n"
48 + "USB: 0x40000\n"
49 + "USB_BULK: 0x80000\n"
50 + "SNOC: 0x100000\n"
51 + "QMI: 0x200000\n"
52 + "BEACONS: 0x8000000\n"
53 + "NO-FW-DBGLOG:0x10000000\n"
54 + "MAC2: 0x20000000\n"
55 + "INFO-AS-DBG: 0x40000000\n"
56 + "FW: 0x80000000\n"
57 + "ALL: 0xEFFFFFFF\n";
58 +
59 +#define READ_DEBUG_LEVEL_SIZE sizeof(debug_level_buf) + 60
60 +
61 static ssize_t ath10k_read_debug_level(struct file *file,
62 char __user *user_buf,
63 size_t count, loff_t *ppos)
64 {
65 - int sz;
66 - const char buf[] =
67 - "To change debug level, set value adding up desired flags:\n"
68 - "PCI: 0x1\n"
69 - "WMI: 0x2\n"
70 - "HTC: 0x4\n"
71 - "HTT: 0x8\n"
72 - "MAC: 0x10\n"
73 - "BOOT: 0x20\n"
74 - "PCI-DUMP: 0x40\n"
75 - "HTT-DUMP: 0x80\n"
76 - "MGMT: 0x100\n"
77 - "DATA: 0x200\n"
78 - "BMI: 0x400\n"
79 - "REGULATORY: 0x800\n"
80 - "TESTMODE: 0x1000\n"
81 - "WMI-PRINT: 0x2000\n"
82 - "PCI-PS: 0x4000\n"
83 - "AHB: 0x8000\n"
84 - "SDIO: 0x10000\n"
85 - "SDIO_DUMP: 0x20000\n"
86 - "USB: 0x40000\n"
87 - "USB_BULK: 0x80000\n"
88 - "SNOC: 0x100000\n"
89 - "QMI: 0x200000\n"
90 - "BEACONS: 0x8000000\n"
91 - "NO-FW-DBGLOG:0x10000000\n"
92 - "MAC2: 0x20000000\n"
93 - "INFO-AS-DBG: 0x40000000\n"
94 - "FW: 0x80000000\n"
95 - "ALL: 0xEFFFFFFF\n";
96 - char wbuf[sizeof(buf) + 60];
97 - sz = snprintf(wbuf, sizeof(wbuf), "Current debug level: 0x%x\n\n%s",
98 - ath10k_debug_mask, buf);
99 - wbuf[sizeof(wbuf) - 1] = 0;
100 -
101 - return simple_read_from_buffer(user_buf, count, ppos, wbuf, sz);
102 + int sz, ret;
103 + char *wbuf;
104 +
105 + wbuf = kcalloc(READ_DEBUG_LEVEL_SIZE, sizeof(char), GFP_KERNEL);
106 + if (!wbuf)
107 + return -ENOMEM;
108 +
109 + sz = snprintf(wbuf, READ_DEBUG_LEVEL_SIZE,
110 + "Current debug level: 0x%x\n\n%s",
111 + ath10k_debug_mask, debug_level_buf);
112 +
113 + ret = simple_read_from_buffer(user_buf, count, ppos, wbuf, sz);
114 + kfree(wbuf);
115 +
116 + return ret;
117 }
118
119 /* Set logging level.
120 diff --git a/ath10k-5.17/debug.c b/ath10k-5.17/debug.c
121 index af84012..d0fa911 100644
122 --- a/ath10k-5.17/debug.c
123 +++ b/ath10k-5.17/debug.c
124 @@ -1344,47 +1344,58 @@ static const struct file_operations fops_simulate_fw_crash = {
125 .llseek = default_llseek,
126 };
127
128 +static const char debug_level_buf[] =
129 + "To change debug level, set value adding up desired flags:\n"
130 + "PCI: 0x1\n"
131 + "WMI: 0x2\n"
132 + "HTC: 0x4\n"
133 + "HTT: 0x8\n"
134 + "MAC: 0x10\n"
135 + "BOOT: 0x20\n"
136 + "PCI-DUMP: 0x40\n"
137 + "HTT-DUMP: 0x80\n"
138 + "MGMT: 0x100\n"
139 + "DATA: 0x200\n"
140 + "BMI: 0x400\n"
141 + "REGULATORY: 0x800\n"
142 + "TESTMODE: 0x1000\n"
143 + "WMI-PRINT: 0x2000\n"
144 + "PCI-PS: 0x4000\n"
145 + "AHB: 0x8000\n"
146 + "SDIO: 0x10000\n"
147 + "SDIO_DUMP: 0x20000\n"
148 + "USB: 0x40000\n"
149 + "USB_BULK: 0x80000\n"
150 + "SNOC: 0x100000\n"
151 + "QMI: 0x200000\n"
152 + "BEACONS: 0x8000000\n"
153 + "NO-FW-DBGLOG:0x10000000\n"
154 + "MAC2: 0x20000000\n"
155 + "INFO-AS-DBG: 0x40000000\n"
156 + "FW: 0x80000000\n"
157 + "ALL: 0xEFFFFFFF\n";
158 +
159 +#define READ_DEBUG_LEVEL_SIZE sizeof(debug_level_buf) + 60
160 +
161 static ssize_t ath10k_read_debug_level(struct file *file,
162 char __user *user_buf,
163 size_t count, loff_t *ppos)
164 {
165 - int sz;
166 - const char buf[] =
167 - "To change debug level, set value adding up desired flags:\n"
168 - "PCI: 0x1\n"
169 - "WMI: 0x2\n"
170 - "HTC: 0x4\n"
171 - "HTT: 0x8\n"
172 - "MAC: 0x10\n"
173 - "BOOT: 0x20\n"
174 - "PCI-DUMP: 0x40\n"
175 - "HTT-DUMP: 0x80\n"
176 - "MGMT: 0x100\n"
177 - "DATA: 0x200\n"
178 - "BMI: 0x400\n"
179 - "REGULATORY: 0x800\n"
180 - "TESTMODE: 0x1000\n"
181 - "WMI-PRINT: 0x2000\n"
182 - "PCI-PS: 0x4000\n"
183 - "AHB: 0x8000\n"
184 - "SDIO: 0x10000\n"
185 - "SDIO_DUMP: 0x20000\n"
186 - "USB: 0x40000\n"
187 - "USB_BULK: 0x80000\n"
188 - "SNOC: 0x100000\n"
189 - "QMI: 0x200000\n"
190 - "BEACONS: 0x8000000\n"
191 - "NO-FW-DBGLOG:0x10000000\n"
192 - "MAC2: 0x20000000\n"
193 - "INFO-AS-DBG: 0x40000000\n"
194 - "FW: 0x80000000\n"
195 - "ALL: 0xEFFFFFFF\n";
196 - char wbuf[sizeof(buf) + 60];
197 - sz = snprintf(wbuf, sizeof(wbuf), "Current debug level: 0x%x\n\n%s",
198 - ath10k_debug_mask, buf);
199 - wbuf[sizeof(wbuf) - 1] = 0;
200 -
201 - return simple_read_from_buffer(user_buf, count, ppos, wbuf, sz);
202 + int sz, ret;
203 + char *wbuf;
204 +
205 + wbuf = kcalloc(READ_DEBUG_LEVEL_SIZE, sizeof(char), GFP_KERNEL);
206 + if (!wbuf)
207 + return -ENOMEM;
208 +
209 + sz = snprintf(wbuf, READ_DEBUG_LEVEL_SIZE,
210 + "Current debug level: 0x%x\n\n%s",
211 + ath10k_debug_mask, debug_level_buf);
212 +
213 + ret = simple_read_from_buffer(user_buf, count, ppos, wbuf, sz);
214 + kfree(wbuf);
215 +
216 + return ret;
217 }
218
219 /* Set logging level.
220 --
221 2.39.2
222