1 |
commit: 0933e08b7a49a8d4cd1a5bfbc3fba0411031c225 |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 28 19:53:03 2018 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 28 19:53:03 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0933e08b |
7 |
|
8 |
dell-laptop: Allocate buffer on heap rather than globally |
9 |
|
10 |
0000_README | 4 + |
11 |
1700_ia64_fix_ptrace.patch | 543 +++++++++++++++++---- |
12 |
...ocate_buffer_on_heap_rather_than_globally.patch | 458 +++++++++++++++++ |
13 |
3 files changed, 920 insertions(+), 85 deletions(-) |
14 |
|
15 |
diff --git a/0000_README b/0000_README |
16 |
index a7bb4af..994c735 100644 |
17 |
--- a/0000_README |
18 |
+++ b/0000_README |
19 |
@@ -99,6 +99,10 @@ Patch: 2900_dev-root-proc-mount-fix.patch |
20 |
From: https://bugs.gentoo.org/show_bug.cgi?id=438380 |
21 |
Desc: Ensure that /dev/root doesn't appear in /proc/mounts when bootint without an initramfs. |
22 |
|
23 |
+Patch: 2901_allocate_buffer_on_heap_rather_than_globally.patch |
24 |
+From: https://bugs.gentoo.org/646438 |
25 |
+Desc: Patchwork [v2] platform/x86: dell-laptop: Allocate buffer on heap rather than globally Bug #646438 |
26 |
+ |
27 |
Patch: 4200_fbcondecor.patch |
28 |
From: http://www.mepiscommunity.org/fbcondecor |
29 |
Desc: Bootsplash ported by Conrad Kostecki. (Bug #637434) |
30 |
|
31 |
diff --git a/1700_ia64_fix_ptrace.patch b/1700_ia64_fix_ptrace.patch |
32 |
index 6173b05..ad48a1a 100644 |
33 |
--- a/1700_ia64_fix_ptrace.patch |
34 |
+++ b/1700_ia64_fix_ptrace.patch |
35 |
@@ -1,87 +1,460 @@ |
36 |
-From patchwork Fri Feb 2 22:12:24 2018 |
37 |
-Content-Type: text/plain; charset="utf-8" |
38 |
-MIME-Version: 1.0 |
39 |
-Content-Transfer-Encoding: 8bit |
40 |
-Subject: ia64: fix ptrace(PTRACE_GETREGS) (unbreaks strace, gdb) |
41 |
-From: Sergei Trofimovich <slyfox@g.o> |
42 |
-X-Patchwork-Id: 10198159 |
43 |
-Message-Id: <20180202221224.16597-1-slyfox@g.o> |
44 |
-To: Tony Luck <tony.luck@×××××.com>, Fenghua Yu <fenghua.yu@×××××.com>, |
45 |
- linux-ia64@×××××××××××.org, linux-kernel@×××××××××××.org |
46 |
-Cc: Sergei Trofimovich <slyfox@g.o> |
47 |
-Date: Fri, 2 Feb 2018 22:12:24 +0000 |
48 |
- |
49 |
-The strace breakage looks like that: |
50 |
-./strace: get_regs: get_regs_error: Input/output error |
51 |
- |
52 |
-It happens because ia64 needs to load unwind tables |
53 |
-to read certain registers. Unwind tables fail to load |
54 |
-due to GCC quirk on the following code: |
55 |
- |
56 |
- extern char __end_unwind[]; |
57 |
- const struct unw_table_entry *end = (struct unw_table_entry *)table_end; |
58 |
- table->end = segment_base + end[-1].end_offset; |
59 |
- |
60 |
-GCC does not generate correct code for this single memory |
61 |
-reference after constant propagation (see https://gcc.gnu.org/PR84184). |
62 |
-Two triggers are required for bad code generation: |
63 |
-- '__end_unwind' has alignment lower (char), than |
64 |
- 'struct unw_table_entry' (8). |
65 |
-- symbol offset is negative. |
66 |
- |
67 |
-This commit workarounds it by fixing alignment of '__end_unwind'. |
68 |
-While at it use hidden symbols to generate shorter gp-relative |
69 |
-relocations. |
70 |
- |
71 |
-CC: Tony Luck <tony.luck@×××××.com> |
72 |
-CC: Fenghua Yu <fenghua.yu@×××××.com> |
73 |
-CC: linux-ia64@×××××××××××.org |
74 |
-CC: linux-kernel@×××××××××××.org |
75 |
-Bug: https://github.com/strace/strace/issues/33 |
76 |
-Bug: https://gcc.gnu.org/PR84184 |
77 |
-Reported-by: Émeric Maschino <emeric.maschino@×××××.com> |
78 |
-Signed-off-by: Sergei Trofimovich <slyfox@g.o> |
79 |
-Tested-by: stanton_arch@××××.com |
80 |
---- |
81 |
- arch/ia64/include/asm/sections.h | 1 - |
82 |
- arch/ia64/kernel/unwind.c | 15 ++++++++++++++- |
83 |
- 2 files changed, 14 insertions(+), 2 deletions(-) |
84 |
- |
85 |
-diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h |
86 |
-index f3481408594e..0fc4f1757a44 100644 |
87 |
---- a/arch/ia64/include/asm/sections.h |
88 |
-+++ b/arch/ia64/include/asm/sections.h |
89 |
-@@ -24,7 +24,6 @@ extern char __start_gate_mckinley_e9_patchlist[], __end_gate_mckinley_e9_patchli |
90 |
- extern char __start_gate_vtop_patchlist[], __end_gate_vtop_patchlist[]; |
91 |
- extern char __start_gate_fsyscall_patchlist[], __end_gate_fsyscall_patchlist[]; |
92 |
- extern char __start_gate_brl_fsys_bubble_down_patchlist[], __end_gate_brl_fsys_bubble_down_patchlist[]; |
93 |
--extern char __start_unwind[], __end_unwind[]; |
94 |
- extern char __start_ivt_text[], __end_ivt_text[]; |
95 |
- |
96 |
- #undef dereference_function_descriptor |
97 |
-diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c |
98 |
-index e04efa088902..025ba6700790 100644 |
99 |
---- a/arch/ia64/kernel/unwind.c |
100 |
-+++ b/arch/ia64/kernel/unwind.c |
101 |
-@@ -2243,7 +2243,20 @@ __initcall(create_gate_table); |
102 |
- void __init |
103 |
- unw_init (void) |
104 |
+diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c |
105 |
+index fc2dfc8..a7b1419 100644 |
106 |
+--- a/drivers/platform/x86/dell-laptop.c |
107 |
++++ b/drivers/platform/x86/dell-laptop.c |
108 |
+@@ -78,7 +78,6 @@ static struct platform_driver platform_driver = { |
109 |
+ } |
110 |
+ }; |
111 |
+ |
112 |
+-static struct calling_interface_buffer *buffer; |
113 |
+ static struct platform_device *platform_device; |
114 |
+ static struct backlight_device *dell_backlight_device; |
115 |
+ static struct rfkill *wifi_rfkill; |
116 |
+@@ -322,7 +321,8 @@ static const struct dmi_system_id dell_quirks[] __initconst = { |
117 |
+ { } |
118 |
+ }; |
119 |
+ |
120 |
+-static void dell_set_arguments(u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
121 |
++static void dell_fill_request(struct calling_interface_buffer *buffer, |
122 |
++ u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
123 |
+ { |
124 |
+ memset(buffer, 0, sizeof(struct calling_interface_buffer)); |
125 |
+ buffer->input[0] = arg0; |
126 |
+@@ -331,7 +331,8 @@ static void dell_set_arguments(u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
127 |
+ buffer->input[3] = arg3; |
128 |
+ } |
129 |
+ |
130 |
+-static int dell_send_request(u16 class, u16 select) |
131 |
++static int dell_send_request(struct calling_interface_buffer *buffer, |
132 |
++ u16 class, u16 select) |
133 |
+ { |
134 |
+ int ret; |
135 |
+ |
136 |
+@@ -468,21 +469,22 @@ static int dell_rfkill_set(void *data, bool blocked) |
137 |
+ int disable = blocked ? 1 : 0; |
138 |
+ unsigned long radio = (unsigned long)data; |
139 |
+ int hwswitch_bit = (unsigned long)data - 1; |
140 |
++ struct calling_interface_buffer buffer; |
141 |
+ int hwswitch; |
142 |
+ int status; |
143 |
+ int ret; |
144 |
+ |
145 |
+- dell_set_arguments(0, 0, 0, 0); |
146 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
147 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
148 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
149 |
+ if (ret) |
150 |
+ return ret; |
151 |
+- status = buffer->output[1]; |
152 |
++ status = buffer.output[1]; |
153 |
+ |
154 |
+- dell_set_arguments(0x2, 0, 0, 0); |
155 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
156 |
++ dell_fill_request(&buffer, 0x2, 0, 0, 0); |
157 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
158 |
+ if (ret) |
159 |
+ return ret; |
160 |
+- hwswitch = buffer->output[1]; |
161 |
++ hwswitch = buffer.output[1]; |
162 |
+ |
163 |
+ /* If the hardware switch controls this radio, and the hardware |
164 |
+ switch is disabled, always disable the radio */ |
165 |
+@@ -490,8 +492,8 @@ static int dell_rfkill_set(void *data, bool blocked) |
166 |
+ (status & BIT(0)) && !(status & BIT(16))) |
167 |
+ disable = 1; |
168 |
+ |
169 |
+- dell_set_arguments(1 | (radio<<8) | (disable << 16), 0, 0, 0); |
170 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
171 |
++ dell_fill_request(&buffer, 1 | (radio<<8) | (disable << 16), 0, 0, 0); |
172 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
173 |
+ return ret; |
174 |
+ } |
175 |
+ |
176 |
+@@ -500,9 +502,11 @@ static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio, |
177 |
+ { |
178 |
+ if (status & BIT(0)) { |
179 |
+ /* Has hw-switch, sync sw_state to BIOS */ |
180 |
++ struct calling_interface_buffer buffer; |
181 |
+ int block = rfkill_blocked(rfkill); |
182 |
+- dell_set_arguments(1 | (radio << 8) | (block << 16), 0, 0, 0); |
183 |
+- dell_send_request(CLASS_INFO, SELECT_RFKILL); |
184 |
++ dell_fill_request(&buffer, |
185 |
++ 1 | (radio << 8) | (block << 16), 0, 0, 0); |
186 |
++ dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
187 |
+ } else { |
188 |
+ /* No hw-switch, sync BIOS state to sw_state */ |
189 |
+ rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16))); |
190 |
+@@ -519,21 +523,22 @@ static void dell_rfkill_update_hw_state(struct rfkill *rfkill, int radio, |
191 |
+ static void dell_rfkill_query(struct rfkill *rfkill, void *data) |
192 |
+ { |
193 |
+ int radio = ((unsigned long)data & 0xF); |
194 |
++ struct calling_interface_buffer buffer; |
195 |
+ int hwswitch; |
196 |
+ int status; |
197 |
+ int ret; |
198 |
+ |
199 |
+- dell_set_arguments(0, 0, 0, 0); |
200 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
201 |
+- status = buffer->output[1]; |
202 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
203 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
204 |
++ status = buffer.output[1]; |
205 |
+ |
206 |
+ if (ret != 0 || !(status & BIT(0))) { |
207 |
+ return; |
208 |
+ } |
209 |
+ |
210 |
+- dell_set_arguments(0, 0x2, 0, 0); |
211 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
212 |
+- hwswitch = buffer->output[1]; |
213 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
214 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
215 |
++ hwswitch = buffer.output[1]; |
216 |
+ |
217 |
+ if (ret != 0) |
218 |
+ return; |
219 |
+@@ -550,22 +555,23 @@ static struct dentry *dell_laptop_dir; |
220 |
+ |
221 |
+ static int dell_debugfs_show(struct seq_file *s, void *data) |
222 |
{ |
223 |
-- extern char __gp[]; |
224 |
-+ #define __ia64_hidden __attribute__((visibility("hidden"))) |
225 |
-+ /* |
226 |
-+ * We use hidden symbols to generate more efficient code using |
227 |
-+ * gp-relative addressing. |
228 |
-+ */ |
229 |
-+ extern char __gp[] __ia64_hidden; |
230 |
-+ /* |
231 |
-+ * Unwind tables need to have proper alignment as init_unwind_table() |
232 |
-+ * uses negative offsets against '__end_unwind'. |
233 |
-+ * See https://gcc.gnu.org/PR84184 |
234 |
-+ */ |
235 |
-+ extern const struct unw_table_entry __start_unwind[] __ia64_hidden; |
236 |
-+ extern const struct unw_table_entry __end_unwind[] __ia64_hidden; |
237 |
-+ #undef __ia64_hidden |
238 |
- extern void unw_hash_index_t_is_too_narrow (void); |
239 |
- long i, off; |
240 |
++ struct calling_interface_buffer buffer; |
241 |
+ int hwswitch_state; |
242 |
+ int hwswitch_ret; |
243 |
+ int status; |
244 |
+ int ret; |
245 |
+ |
246 |
+- dell_set_arguments(0, 0, 0, 0); |
247 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
248 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
249 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
250 |
+ if (ret) |
251 |
+ return ret; |
252 |
+- status = buffer->output[1]; |
253 |
++ status = buffer.output[1]; |
254 |
+ |
255 |
+- dell_set_arguments(0, 0x2, 0, 0); |
256 |
+- hwswitch_ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
257 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
258 |
++ hwswitch_ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
259 |
+ if (hwswitch_ret) |
260 |
+ return hwswitch_ret; |
261 |
+- hwswitch_state = buffer->output[1]; |
262 |
++ hwswitch_state = buffer.output[1]; |
263 |
+ |
264 |
+ seq_printf(s, "return:\t%d\n", ret); |
265 |
+ seq_printf(s, "status:\t0x%X\n", status); |
266 |
+@@ -646,22 +652,23 @@ static const struct file_operations dell_debugfs_fops = { |
267 |
+ |
268 |
+ static void dell_update_rfkill(struct work_struct *ignored) |
269 |
+ { |
270 |
++ struct calling_interface_buffer buffer; |
271 |
+ int hwswitch = 0; |
272 |
+ int status; |
273 |
+ int ret; |
274 |
+ |
275 |
+- dell_set_arguments(0, 0, 0, 0); |
276 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
277 |
+- status = buffer->output[1]; |
278 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
279 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
280 |
++ status = buffer.output[1]; |
281 |
+ |
282 |
+ if (ret != 0) |
283 |
+ return; |
284 |
+ |
285 |
+- dell_set_arguments(0, 0x2, 0, 0); |
286 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
287 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
288 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
289 |
+ |
290 |
+ if (ret == 0 && (status & BIT(0))) |
291 |
+- hwswitch = buffer->output[1]; |
292 |
++ hwswitch = buffer.output[1]; |
293 |
+ |
294 |
+ if (wifi_rfkill) { |
295 |
+ dell_rfkill_update_hw_state(wifi_rfkill, 1, status, hwswitch); |
296 |
+@@ -719,6 +726,7 @@ static struct notifier_block dell_laptop_rbtn_notifier = { |
297 |
+ |
298 |
+ static int __init dell_setup_rfkill(void) |
299 |
+ { |
300 |
++ struct calling_interface_buffer buffer; |
301 |
+ int status, ret, whitelisted; |
302 |
+ const char *product; |
303 |
+ |
304 |
+@@ -734,9 +742,9 @@ static int __init dell_setup_rfkill(void) |
305 |
+ if (!force_rfkill && !whitelisted) |
306 |
+ return 0; |
307 |
+ |
308 |
+- dell_set_arguments(0, 0, 0, 0); |
309 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
310 |
+- status = buffer->output[1]; |
311 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
312 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
313 |
++ status = buffer.output[1]; |
314 |
+ |
315 |
+ /* dell wireless info smbios call is not supported */ |
316 |
+ if (ret != 0) |
317 |
+@@ -889,6 +897,7 @@ static void dell_cleanup_rfkill(void) |
318 |
+ |
319 |
+ static int dell_send_intensity(struct backlight_device *bd) |
320 |
+ { |
321 |
++ struct calling_interface_buffer buffer; |
322 |
+ struct calling_interface_token *token; |
323 |
+ int ret; |
324 |
+ |
325 |
+@@ -896,17 +905,21 @@ static int dell_send_intensity(struct backlight_device *bd) |
326 |
+ if (!token) |
327 |
+ return -ENODEV; |
328 |
+ |
329 |
+- dell_set_arguments(token->location, bd->props.brightness, 0, 0); |
330 |
++ dell_fill_request(&buffer, |
331 |
++ token->location, bd->props.brightness, 0, 0); |
332 |
+ if (power_supply_is_system_supplied() > 0) |
333 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_AC); |
334 |
++ ret = dell_send_request(&buffer, |
335 |
++ CLASS_TOKEN_WRITE, SELECT_TOKEN_AC); |
336 |
+ else |
337 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_BAT); |
338 |
++ ret = dell_send_request(&buffer, |
339 |
++ CLASS_TOKEN_WRITE, SELECT_TOKEN_BAT); |
340 |
+ |
341 |
+ return ret; |
342 |
+ } |
343 |
+ |
344 |
+ static int dell_get_intensity(struct backlight_device *bd) |
345 |
+ { |
346 |
++ struct calling_interface_buffer buffer; |
347 |
+ struct calling_interface_token *token; |
348 |
+ int ret; |
349 |
+ |
350 |
+@@ -914,14 +927,17 @@ static int dell_get_intensity(struct backlight_device *bd) |
351 |
+ if (!token) |
352 |
+ return -ENODEV; |
353 |
+ |
354 |
+- dell_set_arguments(token->location, 0, 0, 0); |
355 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
356 |
+ if (power_supply_is_system_supplied() > 0) |
357 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
358 |
++ ret = dell_send_request(&buffer, |
359 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
360 |
+ else |
361 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_BAT); |
362 |
++ ret = dell_send_request(&buffer, |
363 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_BAT); |
364 |
+ |
365 |
+ if (ret == 0) |
366 |
+- ret = buffer->output[1]; |
367 |
++ ret = buffer.output[1]; |
368 |
++ |
369 |
+ return ret; |
370 |
+ } |
371 |
+ |
372 |
+@@ -1186,31 +1202,33 @@ static enum led_brightness kbd_led_level; |
373 |
+ |
374 |
+ static int kbd_get_info(struct kbd_info *info) |
375 |
+ { |
376 |
++ struct calling_interface_buffer buffer; |
377 |
+ u8 units; |
378 |
+ int ret; |
379 |
+ |
380 |
+- dell_set_arguments(0, 0, 0, 0); |
381 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
382 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
383 |
++ ret = dell_send_request(&buffer, |
384 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
385 |
+ if (ret) |
386 |
+ return ret; |
387 |
+ |
388 |
+- info->modes = buffer->output[1] & 0xFFFF; |
389 |
+- info->type = (buffer->output[1] >> 24) & 0xFF; |
390 |
+- info->triggers = buffer->output[2] & 0xFF; |
391 |
+- units = (buffer->output[2] >> 8) & 0xFF; |
392 |
+- info->levels = (buffer->output[2] >> 16) & 0xFF; |
393 |
++ info->modes = buffer.output[1] & 0xFFFF; |
394 |
++ info->type = (buffer.output[1] >> 24) & 0xFF; |
395 |
++ info->triggers = buffer.output[2] & 0xFF; |
396 |
++ units = (buffer.output[2] >> 8) & 0xFF; |
397 |
++ info->levels = (buffer.output[2] >> 16) & 0xFF; |
398 |
+ |
399 |
+ if (quirks && quirks->kbd_led_levels_off_1 && info->levels) |
400 |
+ info->levels--; |
401 |
+ |
402 |
+ if (units & BIT(0)) |
403 |
+- info->seconds = (buffer->output[3] >> 0) & 0xFF; |
404 |
++ info->seconds = (buffer.output[3] >> 0) & 0xFF; |
405 |
+ if (units & BIT(1)) |
406 |
+- info->minutes = (buffer->output[3] >> 8) & 0xFF; |
407 |
++ info->minutes = (buffer.output[3] >> 8) & 0xFF; |
408 |
+ if (units & BIT(2)) |
409 |
+- info->hours = (buffer->output[3] >> 16) & 0xFF; |
410 |
++ info->hours = (buffer.output[3] >> 16) & 0xFF; |
411 |
+ if (units & BIT(3)) |
412 |
+- info->days = (buffer->output[3] >> 24) & 0xFF; |
413 |
++ info->days = (buffer.output[3] >> 24) & 0xFF; |
414 |
+ |
415 |
+ return ret; |
416 |
+ } |
417 |
+@@ -1270,31 +1288,34 @@ static int kbd_set_level(struct kbd_state *state, u8 level) |
418 |
+ |
419 |
+ static int kbd_get_state(struct kbd_state *state) |
420 |
+ { |
421 |
++ struct calling_interface_buffer buffer; |
422 |
+ int ret; |
423 |
+ |
424 |
+- dell_set_arguments(0x1, 0, 0, 0); |
425 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
426 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
427 |
++ ret = dell_send_request(&buffer, |
428 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
429 |
+ if (ret) |
430 |
+ return ret; |
431 |
+ |
432 |
+- state->mode_bit = ffs(buffer->output[1] & 0xFFFF); |
433 |
++ state->mode_bit = ffs(buffer.output[1] & 0xFFFF); |
434 |
+ if (state->mode_bit != 0) |
435 |
+ state->mode_bit--; |
436 |
+ |
437 |
+- state->triggers = (buffer->output[1] >> 16) & 0xFF; |
438 |
+- state->timeout_value = (buffer->output[1] >> 24) & 0x3F; |
439 |
+- state->timeout_unit = (buffer->output[1] >> 30) & 0x3; |
440 |
+- state->als_setting = buffer->output[2] & 0xFF; |
441 |
+- state->als_value = (buffer->output[2] >> 8) & 0xFF; |
442 |
+- state->level = (buffer->output[2] >> 16) & 0xFF; |
443 |
+- state->timeout_value_ac = (buffer->output[2] >> 24) & 0x3F; |
444 |
+- state->timeout_unit_ac = (buffer->output[2] >> 30) & 0x3; |
445 |
++ state->triggers = (buffer.output[1] >> 16) & 0xFF; |
446 |
++ state->timeout_value = (buffer.output[1] >> 24) & 0x3F; |
447 |
++ state->timeout_unit = (buffer.output[1] >> 30) & 0x3; |
448 |
++ state->als_setting = buffer.output[2] & 0xFF; |
449 |
++ state->als_value = (buffer.output[2] >> 8) & 0xFF; |
450 |
++ state->level = (buffer.output[2] >> 16) & 0xFF; |
451 |
++ state->timeout_value_ac = (buffer.output[2] >> 24) & 0x3F; |
452 |
++ state->timeout_unit_ac = (buffer.output[2] >> 30) & 0x3; |
453 |
+ |
454 |
+ return ret; |
455 |
+ } |
456 |
+ |
457 |
+ static int kbd_set_state(struct kbd_state *state) |
458 |
+ { |
459 |
++ struct calling_interface_buffer buffer; |
460 |
+ int ret; |
461 |
+ u32 input1; |
462 |
+ u32 input2; |
463 |
+@@ -1307,8 +1328,9 @@ static int kbd_set_state(struct kbd_state *state) |
464 |
+ input2 |= (state->level & 0xFF) << 16; |
465 |
+ input2 |= (state->timeout_value_ac & 0x3F) << 24; |
466 |
+ input2 |= (state->timeout_unit_ac & 0x3) << 30; |
467 |
+- dell_set_arguments(0x2, input1, input2, 0); |
468 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
469 |
++ dell_fill_request(&buffer, 0x2, input1, input2, 0); |
470 |
++ ret = dell_send_request(&buffer, |
471 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
472 |
+ |
473 |
+ return ret; |
474 |
+ } |
475 |
+@@ -1335,6 +1357,7 @@ static int kbd_set_state_safe(struct kbd_state *state, struct kbd_state *old) |
476 |
+ |
477 |
+ static int kbd_set_token_bit(u8 bit) |
478 |
+ { |
479 |
++ struct calling_interface_buffer buffer; |
480 |
+ struct calling_interface_token *token; |
481 |
+ int ret; |
482 |
+ |
483 |
+@@ -1345,14 +1368,15 @@ static int kbd_set_token_bit(u8 bit) |
484 |
+ if (!token) |
485 |
+ return -EINVAL; |
486 |
+ |
487 |
+- dell_set_arguments(token->location, token->value, 0, 0); |
488 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
489 |
++ dell_fill_request(&buffer, token->location, token->value, 0, 0); |
490 |
++ ret = dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
491 |
+ |
492 |
+ return ret; |
493 |
+ } |
494 |
+ |
495 |
+ static int kbd_get_token_bit(u8 bit) |
496 |
+ { |
497 |
++ struct calling_interface_buffer buffer; |
498 |
+ struct calling_interface_token *token; |
499 |
+ int ret; |
500 |
+ int val; |
501 |
+@@ -1364,9 +1388,9 @@ static int kbd_get_token_bit(u8 bit) |
502 |
+ if (!token) |
503 |
+ return -EINVAL; |
504 |
+ |
505 |
+- dell_set_arguments(token->location, 0, 0, 0); |
506 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_STD); |
507 |
+- val = buffer->output[1]; |
508 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
509 |
++ ret = dell_send_request(&buffer, CLASS_TOKEN_READ, SELECT_TOKEN_STD); |
510 |
++ val = buffer.output[1]; |
511 |
+ |
512 |
+ if (ret) |
513 |
+ return ret; |
514 |
+@@ -2102,6 +2126,7 @@ static struct notifier_block dell_laptop_notifier = { |
515 |
+ |
516 |
+ int dell_micmute_led_set(int state) |
517 |
+ { |
518 |
++ struct calling_interface_buffer buffer; |
519 |
+ struct calling_interface_token *token; |
520 |
+ |
521 |
+ if (state == 0) |
522 |
+@@ -2114,8 +2139,8 @@ int dell_micmute_led_set(int state) |
523 |
+ if (!token) |
524 |
+ return -ENODEV; |
525 |
+ |
526 |
+- dell_set_arguments(token->location, token->value, 0, 0); |
527 |
+- dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
528 |
++ dell_fill_request(&buffer, token->location, token->value, 0, 0); |
529 |
++ dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
530 |
+ |
531 |
+ return state; |
532 |
+ } |
533 |
+@@ -2146,13 +2171,6 @@ static int __init dell_init(void) |
534 |
+ if (ret) |
535 |
+ goto fail_platform_device2; |
536 |
+ |
537 |
+- buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL); |
538 |
+- if (!buffer) { |
539 |
+- ret = -ENOMEM; |
540 |
+- goto fail_buffer; |
541 |
+- } |
542 |
+- |
543 |
+- |
544 |
+ ret = dell_setup_rfkill(); |
545 |
+ |
546 |
+ if (ret) { |
547 |
+@@ -2177,10 +2195,13 @@ static int __init dell_init(void) |
548 |
+ |
549 |
+ token = dell_smbios_find_token(BRIGHTNESS_TOKEN); |
550 |
+ if (token) { |
551 |
+- dell_set_arguments(token->location, 0, 0, 0); |
552 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
553 |
++ struct calling_interface_buffer buffer; |
554 |
++ |
555 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
556 |
++ ret = dell_send_request(&buffer, |
557 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
558 |
+ if (ret) |
559 |
+- max_intensity = buffer->output[3]; |
560 |
++ max_intensity = buffer.output[3]; |
561 |
+ } |
562 |
|
563 |
+ if (max_intensity) { |
564 |
+@@ -2214,8 +2235,6 @@ static int __init dell_init(void) |
565 |
+ fail_get_brightness: |
566 |
+ backlight_device_unregister(dell_backlight_device); |
567 |
+ fail_backlight: |
568 |
+- kfree(buffer); |
569 |
+-fail_buffer: |
570 |
+ dell_cleanup_rfkill(); |
571 |
+ fail_rfkill: |
572 |
+ platform_device_del(platform_device); |
573 |
+@@ -2235,7 +2254,6 @@ static void __exit dell_exit(void) |
574 |
+ touchpad_led_exit(); |
575 |
+ kbd_led_exit(); |
576 |
+ backlight_device_unregister(dell_backlight_device); |
577 |
+- kfree(buffer); |
578 |
+ dell_cleanup_rfkill(); |
579 |
+ if (platform_device) { |
580 |
+ platform_device_unregister(platform_device); |
581 |
|
582 |
diff --git a/2901_allocate_buffer_on_heap_rather_than_globally.patch b/2901_allocate_buffer_on_heap_rather_than_globally.patch |
583 |
new file mode 100644 |
584 |
index 0000000..1912d9f |
585 |
--- /dev/null |
586 |
+++ b/2901_allocate_buffer_on_heap_rather_than_globally.patch |
587 |
@@ -0,0 +1,458 @@ |
588 |
+--- dell-laptop.c.orig 2018-02-28 19:24:04.598049000 +0000 |
589 |
++++ linux-4.15.0/drivers/platform/x86/dell-laptop.c 2018-02-28 19:40:00.358049000 +0000 |
590 |
+@@ -78,7 +78,6 @@ static struct platform_driver platform_d |
591 |
+ } |
592 |
+ }; |
593 |
+ |
594 |
+-static struct calling_interface_buffer *buffer; |
595 |
+ static struct platform_device *platform_device; |
596 |
+ static struct backlight_device *dell_backlight_device; |
597 |
+ static struct rfkill *wifi_rfkill; |
598 |
+@@ -286,7 +285,8 @@ static const struct dmi_system_id dell_q |
599 |
+ { } |
600 |
+ }; |
601 |
+ |
602 |
+-void dell_set_arguments(u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
603 |
++void dell_set_arguments(struct calling_interface_buffer *buffer, |
604 |
++ u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
605 |
+ { |
606 |
+ memset(buffer, 0, sizeof(struct calling_interface_buffer)); |
607 |
+ buffer->input[0] = arg0; |
608 |
+@@ -295,7 +295,8 @@ void dell_set_arguments(u32 arg0, u32 ar |
609 |
+ buffer->input[3] = arg3; |
610 |
+ } |
611 |
+ |
612 |
+-int dell_send_request(u16 class, u16 select) |
613 |
++int dell_send_request(struct calling_interface_buffer *buffer, |
614 |
++ u16 class, u16 select) |
615 |
+ { |
616 |
+ int ret; |
617 |
+ |
618 |
+@@ -432,21 +433,22 @@ static int dell_rfkill_set(void *data, b |
619 |
+ int disable = blocked ? 1 : 0; |
620 |
+ unsigned long radio = (unsigned long)data; |
621 |
+ int hwswitch_bit = (unsigned long)data - 1; |
622 |
++ struct calling_interface_buffer buffer; |
623 |
+ int hwswitch; |
624 |
+ int status; |
625 |
+ int ret; |
626 |
+ |
627 |
+- dell_set_arguments(0, 0, 0, 0); |
628 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
629 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
630 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
631 |
+ if (ret) |
632 |
+ return ret; |
633 |
+- status = buffer->output[1]; |
634 |
++ status = buffer.output[1]; |
635 |
+ |
636 |
+- dell_set_arguments(0x2, 0, 0, 0); |
637 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
638 |
++ dell_fill_request(&buffer, 0x2, 0, 0, 0); |
639 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
640 |
+ if (ret) |
641 |
+ return ret; |
642 |
+- hwswitch = buffer->output[1]; |
643 |
++ hwswitch = buffer.output[1]; |
644 |
+ |
645 |
+ /* If the hardware switch controls this radio, and the hardware |
646 |
+ switch is disabled, always disable the radio */ |
647 |
+@@ -454,8 +456,8 @@ static int dell_rfkill_set(void *data, b |
648 |
+ (status & BIT(0)) && !(status & BIT(16))) |
649 |
+ disable = 1; |
650 |
+ |
651 |
+- dell_set_arguments(1 | (radio<<8) | (disable << 16), 0, 0, 0); |
652 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
653 |
++ dell_fill_request(&buffer, 1 | (radio<<8) | (disable << 16), 0, 0, 0); |
654 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
655 |
+ return ret; |
656 |
+ } |
657 |
+ |
658 |
+@@ -464,9 +466,11 @@ static void dell_rfkill_update_sw_state( |
659 |
+ { |
660 |
+ if (status & BIT(0)) { |
661 |
+ /* Has hw-switch, sync sw_state to BIOS */ |
662 |
++ struct calling_interface_buffer buffer; |
663 |
+ int block = rfkill_blocked(rfkill); |
664 |
+- dell_set_arguments(1 | (radio << 8) | (block << 16), 0, 0, 0); |
665 |
+- dell_send_request(CLASS_INFO, SELECT_RFKILL); |
666 |
++ dell_fill_request(&buffer, |
667 |
++ 1 | (radio << 8) | (block << 16), 0, 0, 0); |
668 |
++ dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
669 |
+ } else { |
670 |
+ /* No hw-switch, sync BIOS state to sw_state */ |
671 |
+ rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16))); |
672 |
+@@ -483,21 +487,22 @@ static void dell_rfkill_update_hw_state( |
673 |
+ static void dell_rfkill_query(struct rfkill *rfkill, void *data) |
674 |
+ { |
675 |
+ int radio = ((unsigned long)data & 0xF); |
676 |
++ struct calling_interface_buffer buffer; |
677 |
+ int hwswitch; |
678 |
+ int status; |
679 |
+ int ret; |
680 |
+ |
681 |
+- dell_set_arguments(0, 0, 0, 0); |
682 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
683 |
+- status = buffer->output[1]; |
684 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
685 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
686 |
++ status = buffer.output[1]; |
687 |
+ |
688 |
+ if (ret != 0 || !(status & BIT(0))) { |
689 |
+ return; |
690 |
+ } |
691 |
+ |
692 |
+- dell_set_arguments(0, 0x2, 0, 0); |
693 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
694 |
+- hwswitch = buffer->output[1]; |
695 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
696 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
697 |
++ hwswitch = buffer.output[1]; |
698 |
+ |
699 |
+ if (ret != 0) |
700 |
+ return; |
701 |
+@@ -514,22 +519,23 @@ static struct dentry *dell_laptop_dir; |
702 |
+ |
703 |
+ static int dell_debugfs_show(struct seq_file *s, void *data) |
704 |
+ { |
705 |
++ struct calling_interface_buffer buffer; |
706 |
+ int hwswitch_state; |
707 |
+ int hwswitch_ret; |
708 |
+ int status; |
709 |
+ int ret; |
710 |
+ |
711 |
+- dell_set_arguments(0, 0, 0, 0); |
712 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
713 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
714 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
715 |
+ if (ret) |
716 |
+ return ret; |
717 |
+- status = buffer->output[1]; |
718 |
++ status = buffer.output[1]; |
719 |
+ |
720 |
+- dell_set_arguments(0, 0x2, 0, 0); |
721 |
+- hwswitch_ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
722 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
723 |
++ hwswitch_ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
724 |
+ if (hwswitch_ret) |
725 |
+ return hwswitch_ret; |
726 |
+- hwswitch_state = buffer->output[1]; |
727 |
++ hwswitch_state = buffer.output[1]; |
728 |
+ |
729 |
+ seq_printf(s, "return:\t%d\n", ret); |
730 |
+ seq_printf(s, "status:\t0x%X\n", status); |
731 |
+@@ -610,22 +616,23 @@ static const struct file_operations dell |
732 |
+ |
733 |
+ static void dell_update_rfkill(struct work_struct *ignored) |
734 |
+ { |
735 |
++ struct calling_interface_buffer buffer; |
736 |
+ int hwswitch = 0; |
737 |
+ int status; |
738 |
+ int ret; |
739 |
+ |
740 |
+- dell_set_arguments(0, 0, 0, 0); |
741 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
742 |
+- status = buffer->output[1]; |
743 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
744 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
745 |
++ status = buffer.output[1]; |
746 |
+ |
747 |
+ if (ret != 0) |
748 |
+ return; |
749 |
+ |
750 |
+- dell_set_arguments(0, 0x2, 0, 0); |
751 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
752 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
753 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
754 |
+ |
755 |
+ if (ret == 0 && (status & BIT(0))) |
756 |
+- hwswitch = buffer->output[1]; |
757 |
++ hwswitch = buffer.output[1]; |
758 |
+ |
759 |
+ if (wifi_rfkill) { |
760 |
+ dell_rfkill_update_hw_state(wifi_rfkill, 1, status, hwswitch); |
761 |
+@@ -683,6 +690,7 @@ static struct notifier_block dell_laptop |
762 |
+ |
763 |
+ static int __init dell_setup_rfkill(void) |
764 |
+ { |
765 |
++ struct calling_interface_buffer buffer; |
766 |
+ int status, ret, whitelisted; |
767 |
+ const char *product; |
768 |
+ |
769 |
+@@ -698,9 +706,9 @@ static int __init dell_setup_rfkill(void |
770 |
+ if (!force_rfkill && !whitelisted) |
771 |
+ return 0; |
772 |
+ |
773 |
+- dell_set_arguments(0, 0, 0, 0); |
774 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
775 |
+- status = buffer->output[1]; |
776 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
777 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
778 |
++ status = buffer.output[1]; |
779 |
+ |
780 |
+ /* dell wireless info smbios call is not supported */ |
781 |
+ if (ret != 0) |
782 |
+@@ -853,6 +861,7 @@ static void dell_cleanup_rfkill(void) |
783 |
+ |
784 |
+ static int dell_send_intensity(struct backlight_device *bd) |
785 |
+ { |
786 |
++ struct calling_interface_buffer buffer; |
787 |
+ struct calling_interface_token *token; |
788 |
+ int ret; |
789 |
+ |
790 |
+@@ -860,17 +869,21 @@ static int dell_send_intensity(struct ba |
791 |
+ if (!token) |
792 |
+ return -ENODEV; |
793 |
+ |
794 |
+- dell_set_arguments(token->location, bd->props.brightness, 0, 0); |
795 |
++ dell_fill_request(&buffer, |
796 |
++ token->location, bd->props.brightness, 0, 0); |
797 |
+ if (power_supply_is_system_supplied() > 0) |
798 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_AC); |
799 |
++ ret = dell_send_request(&buffer, |
800 |
++ CLASS_TOKEN_WRITE, SELECT_TOKEN_AC); |
801 |
+ else |
802 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_BAT); |
803 |
++ ret = dell_send_request(&buffer, |
804 |
++ CLASS_TOKEN_WRITE, SELECT_TOKEN_BAT); |
805 |
+ |
806 |
+ return ret; |
807 |
+ } |
808 |
+ |
809 |
+ static int dell_get_intensity(struct backlight_device *bd) |
810 |
+ { |
811 |
++ struct calling_interface_buffer buffer; |
812 |
+ struct calling_interface_token *token; |
813 |
+ int ret; |
814 |
+ |
815 |
+@@ -878,14 +891,17 @@ static int dell_get_intensity(struct bac |
816 |
+ if (!token) |
817 |
+ return -ENODEV; |
818 |
+ |
819 |
+- dell_set_arguments(token->location, 0, 0, 0); |
820 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
821 |
+ if (power_supply_is_system_supplied() > 0) |
822 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
823 |
++ ret = dell_send_request(&buffer, |
824 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
825 |
+ else |
826 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_BAT); |
827 |
++ ret = dell_send_request(&buffer, |
828 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_BAT); |
829 |
+ |
830 |
+ if (ret == 0) |
831 |
+- ret = buffer->output[1]; |
832 |
++ ret = buffer.output[1]; |
833 |
++ |
834 |
+ return ret; |
835 |
+ } |
836 |
+ |
837 |
+@@ -1149,31 +1165,33 @@ static DEFINE_MUTEX(kbd_led_mutex); |
838 |
+ |
839 |
+ static int kbd_get_info(struct kbd_info *info) |
840 |
+ { |
841 |
++ struct calling_interface_buffer buffer; |
842 |
+ u8 units; |
843 |
+ int ret; |
844 |
+ |
845 |
+- dell_set_arguments(0, 0, 0, 0); |
846 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
847 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
848 |
++ ret = dell_send_request(&buffer, |
849 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
850 |
+ if (ret) |
851 |
+ return ret; |
852 |
+ |
853 |
+- info->modes = buffer->output[1] & 0xFFFF; |
854 |
+- info->type = (buffer->output[1] >> 24) & 0xFF; |
855 |
+- info->triggers = buffer->output[2] & 0xFF; |
856 |
+- units = (buffer->output[2] >> 8) & 0xFF; |
857 |
+- info->levels = (buffer->output[2] >> 16) & 0xFF; |
858 |
++ info->modes = buffer.output[1] & 0xFFFF; |
859 |
++ info->type = (buffer.output[1] >> 24) & 0xFF; |
860 |
++ info->triggers = buffer.output[2] & 0xFF; |
861 |
++ units = (buffer.output[2] >> 8) & 0xFF; |
862 |
++ info->levels = (buffer.output[2] >> 16) & 0xFF; |
863 |
+ |
864 |
+ if (quirks && quirks->kbd_led_levels_off_1 && info->levels) |
865 |
+ info->levels--; |
866 |
+ |
867 |
+ if (units & BIT(0)) |
868 |
+- info->seconds = (buffer->output[3] >> 0) & 0xFF; |
869 |
++ info->seconds = (buffer.output[3] >> 0) & 0xFF; |
870 |
+ if (units & BIT(1)) |
871 |
+- info->minutes = (buffer->output[3] >> 8) & 0xFF; |
872 |
++ info->minutes = (buffer.output[3] >> 8) & 0xFF; |
873 |
+ if (units & BIT(2)) |
874 |
+- info->hours = (buffer->output[3] >> 16) & 0xFF; |
875 |
++ info->hours = (buffer.output[3] >> 16) & 0xFF; |
876 |
+ if (units & BIT(3)) |
877 |
+- info->days = (buffer->output[3] >> 24) & 0xFF; |
878 |
++ info->days = (buffer.output[3] >> 24) & 0xFF; |
879 |
+ |
880 |
+ return ret; |
881 |
+ } |
882 |
+@@ -1233,31 +1251,34 @@ static int kbd_set_level(struct kbd_stat |
883 |
+ |
884 |
+ static int kbd_get_state(struct kbd_state *state) |
885 |
+ { |
886 |
++ struct calling_interface_buffer buffer; |
887 |
+ int ret; |
888 |
+ |
889 |
+- dell_set_arguments(0x1, 0, 0, 0); |
890 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
891 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
892 |
++ ret = dell_send_request(&buffer, |
893 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
894 |
+ if (ret) |
895 |
+ return ret; |
896 |
+ |
897 |
+- state->mode_bit = ffs(buffer->output[1] & 0xFFFF); |
898 |
++ state->mode_bit = ffs(buffer.output[1] & 0xFFFF); |
899 |
+ if (state->mode_bit != 0) |
900 |
+ state->mode_bit--; |
901 |
+ |
902 |
+- state->triggers = (buffer->output[1] >> 16) & 0xFF; |
903 |
+- state->timeout_value = (buffer->output[1] >> 24) & 0x3F; |
904 |
+- state->timeout_unit = (buffer->output[1] >> 30) & 0x3; |
905 |
+- state->als_setting = buffer->output[2] & 0xFF; |
906 |
+- state->als_value = (buffer->output[2] >> 8) & 0xFF; |
907 |
+- state->level = (buffer->output[2] >> 16) & 0xFF; |
908 |
+- state->timeout_value_ac = (buffer->output[2] >> 24) & 0x3F; |
909 |
+- state->timeout_unit_ac = (buffer->output[2] >> 30) & 0x3; |
910 |
++ state->triggers = (buffer.output[1] >> 16) & 0xFF; |
911 |
++ state->timeout_value = (buffer.output[1] >> 24) & 0x3F; |
912 |
++ state->timeout_unit = (buffer.output[1] >> 30) & 0x3; |
913 |
++ state->als_setting = buffer.output[2] & 0xFF; |
914 |
++ state->als_value = (buffer.output[2] >> 8) & 0xFF; |
915 |
++ state->level = (buffer.output[2] >> 16) & 0xFF; |
916 |
++ state->timeout_value_ac = (buffer.output[2] >> 24) & 0x3F; |
917 |
++ state->timeout_unit_ac = (buffer.output[2] >> 30) & 0x3; |
918 |
+ |
919 |
+ return ret; |
920 |
+ } |
921 |
+ |
922 |
+ static int kbd_set_state(struct kbd_state *state) |
923 |
+ { |
924 |
++ struct calling_interface_buffer buffer; |
925 |
+ int ret; |
926 |
+ u32 input1; |
927 |
+ u32 input2; |
928 |
+@@ -1270,8 +1291,9 @@ static int kbd_set_state(struct kbd_stat |
929 |
+ input2 |= (state->level & 0xFF) << 16; |
930 |
+ input2 |= (state->timeout_value_ac & 0x3F) << 24; |
931 |
+ input2 |= (state->timeout_unit_ac & 0x3) << 30; |
932 |
+- dell_set_arguments(0x2, input1, input2, 0); |
933 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
934 |
++ dell_fill_request(&buffer, 0x2, input1, input2, 0); |
935 |
++ ret = dell_send_request(&buffer, |
936 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
937 |
+ |
938 |
+ return ret; |
939 |
+ } |
940 |
+@@ -1298,6 +1320,7 @@ static int kbd_set_state_safe(struct kbd |
941 |
+ |
942 |
+ static int kbd_set_token_bit(u8 bit) |
943 |
+ { |
944 |
++ struct calling_interface_buffer buffer; |
945 |
+ struct calling_interface_token *token; |
946 |
+ int ret; |
947 |
+ |
948 |
+@@ -1308,14 +1331,15 @@ static int kbd_set_token_bit(u8 bit) |
949 |
+ if (!token) |
950 |
+ return -EINVAL; |
951 |
+ |
952 |
+- dell_set_arguments(token->location, token->value, 0, 0); |
953 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
954 |
++ dell_fill_request(&buffer, token->location, token->value, 0, 0); |
955 |
++ ret = dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
956 |
+ |
957 |
+ return ret; |
958 |
+ } |
959 |
+ |
960 |
+ static int kbd_get_token_bit(u8 bit) |
961 |
+ { |
962 |
++ struct calling_interface_buffer buffer; |
963 |
+ struct calling_interface_token *token; |
964 |
+ int ret; |
965 |
+ int val; |
966 |
+@@ -1327,9 +1351,9 @@ static int kbd_get_token_bit(u8 bit) |
967 |
+ if (!token) |
968 |
+ return -EINVAL; |
969 |
+ |
970 |
+- dell_set_arguments(token->location, 0, 0, 0); |
971 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_STD); |
972 |
+- val = buffer->output[1]; |
973 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
974 |
++ ret = dell_send_request(&buffer, CLASS_TOKEN_READ, SELECT_TOKEN_STD); |
975 |
++ val = buffer.output[1]; |
976 |
+ |
977 |
+ if (ret) |
978 |
+ return ret; |
979 |
+@@ -2046,6 +2070,7 @@ static struct notifier_block dell_laptop |
980 |
+ |
981 |
+ int dell_micmute_led_set(int state) |
982 |
+ { |
983 |
++ struct calling_interface_buffer buffer; |
984 |
+ struct calling_interface_token *token; |
985 |
+ |
986 |
+ if (state == 0) |
987 |
+@@ -2058,8 +2083,8 @@ int dell_micmute_led_set(int state) |
988 |
+ if (!token) |
989 |
+ return -ENODEV; |
990 |
+ |
991 |
+- dell_set_arguments(token->location, token->value, 0, 0); |
992 |
+- dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
993 |
++ dell_fill_request(&buffer, token->location, token->value, 0, 0); |
994 |
++ dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
995 |
+ |
996 |
+ return state; |
997 |
+ } |
998 |
+@@ -2090,13 +2115,6 @@ static int __init dell_init(void) |
999 |
+ if (ret) |
1000 |
+ goto fail_platform_device2; |
1001 |
+ |
1002 |
+- buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL); |
1003 |
+- if (!buffer) { |
1004 |
+- ret = -ENOMEM; |
1005 |
+- goto fail_buffer; |
1006 |
+- } |
1007 |
+- |
1008 |
+- |
1009 |
+ ret = dell_setup_rfkill(); |
1010 |
+ |
1011 |
+ if (ret) { |
1012 |
+@@ -2121,10 +2139,13 @@ static int __init dell_init(void) |
1013 |
+ |
1014 |
+ token = dell_smbios_find_token(BRIGHTNESS_TOKEN); |
1015 |
+ if (token) { |
1016 |
+- dell_set_arguments(token->location, 0, 0, 0); |
1017 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
1018 |
++ struct calling_interface_buffer buffer; |
1019 |
++ |
1020 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
1021 |
++ ret = dell_send_request(&buffer, |
1022 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
1023 |
+ if (ret) |
1024 |
+- max_intensity = buffer->output[3]; |
1025 |
++ max_intensity = buffer.output[3]; |
1026 |
+ } |
1027 |
+ |
1028 |
+ if (max_intensity) { |
1029 |
+@@ -2158,8 +2179,6 @@ static int __init dell_init(void) |
1030 |
+ fail_get_brightness: |
1031 |
+ backlight_device_unregister(dell_backlight_device); |
1032 |
+ fail_backlight: |
1033 |
+- kfree(buffer); |
1034 |
+-fail_buffer: |
1035 |
+ dell_cleanup_rfkill(); |
1036 |
+ fail_rfkill: |
1037 |
+ platform_device_del(platform_device); |
1038 |
+@@ -2179,7 +2198,6 @@ static void __exit dell_exit(void) |
1039 |
+ touchpad_led_exit(); |
1040 |
+ kbd_led_exit(); |
1041 |
+ backlight_device_unregister(dell_backlight_device); |
1042 |
+- kfree(buffer); |
1043 |
+ dell_cleanup_rfkill(); |
1044 |
+ if (platform_device) { |
1045 |
+ platform_device_unregister(platform_device); |