1 |
commit: ed41d637e2edb6303fe73f5d8be583a5d93046df |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 26 14:13:45 2018 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 26 14:13:45 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ed41d637 |
7 |
|
8 |
dell-laptop: Allocate buffer on heap rather than globally |
9 |
|
10 |
0000_README | 4 + |
11 |
...ocate_buffer_on_heap_rather_than_globally.patch | 489 +++++++++++++++++++++ |
12 |
2 files changed, 493 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 828cfeb..af0f948 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -91,6 +91,10 @@ Patch: 2900_dev-root-proc-mount-fix.patch |
19 |
From: https://bugs.gentoo.org/show_bug.cgi?id=438380 |
20 |
Desc: Ensure that /dev/root doesn't appear in /proc/mounts when bootint without an initramfs. |
21 |
|
22 |
+Patch: 2901_allocate_buffer_on_heap_rather_than_globally.patch |
23 |
+From: https://patchwork.kernel.org/patch/10194287/ |
24 |
+Desc: Patchwork [v2] platform/x86: dell-laptop: Allocate buffer on heap rather than globally |
25 |
+ |
26 |
Patch: 4200_fbcondecor.patch |
27 |
From: http://www.mepiscommunity.org/fbcondecor |
28 |
Desc: Bootsplash ported by Conrad Kostecki. (Bug #637434) |
29 |
|
30 |
diff --git a/2901_allocate_buffer_on_heap_rather_than_globally.patch b/2901_allocate_buffer_on_heap_rather_than_globally.patch |
31 |
new file mode 100644 |
32 |
index 0000000..dd2f7ad |
33 |
--- /dev/null |
34 |
+++ b/2901_allocate_buffer_on_heap_rather_than_globally.patch |
35 |
@@ -0,0 +1,489 @@ |
36 |
+From patchwork Wed Jan 31 17:47:35 2018 |
37 |
+Content-Type: text/plain; charset="utf-8" |
38 |
+MIME-Version: 1.0 |
39 |
+Content-Transfer-Encoding: 8bit |
40 |
+Subject: [v2] platform/x86: dell-laptop: Allocate buffer on heap rather than |
41 |
+ globally |
42 |
+From: Mario Limonciello <mario.limonciello@××××.com> |
43 |
+X-Patchwork-Id: 10194287 |
44 |
+Message-Id: <1517420855-19374-1-git-send-email-mario.limonciello@××××.com> |
45 |
+To: dvhart@×××××××××.org, Andy Shevchenko <andy.shevchenko@×××××.com> |
46 |
+Cc: pali.rohar@×××××.com, LKML <linux-kernel@×××××××××××.org>, |
47 |
+ platform-driver-x86@×××××××××××.org, |
48 |
+ Mario Limonciello <mario.limonciello@××××.com> |
49 |
+Date: Wed, 31 Jan 2018 11:47:35 -0600 |
50 |
+ |
51 |
+There is no longer a need for the buffer to be defined in |
52 |
+first 4GB physical address space. |
53 |
+ |
54 |
+Furthermore there may be race conditions with multiple different functions |
55 |
+working on a module wide buffer causing incorrect results. |
56 |
+ |
57 |
+Fixes: 549b4930f057658dc50d8010e66219233119a4d8 |
58 |
+Suggested-by: Pali Rohar <pali.rohar@×××××.com> |
59 |
+Signed-off-by: Mario Limonciello <mario.limonciello@××××.com> |
60 |
+Reviewed-by: Pali Rohár <pali.rohar@×××××.com> |
61 |
+--- |
62 |
+ drivers/platform/x86/dell-laptop.c | 188 ++++++++++++++++++++----------------- |
63 |
+ 1 file changed, 103 insertions(+), 85 deletions(-) |
64 |
+ |
65 |
+diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c |
66 |
+index fc2dfc8..a7b1419 100644 |
67 |
+--- a/drivers/platform/x86/dell-laptop.c |
68 |
++++ b/drivers/platform/x86/dell-laptop.c |
69 |
+@@ -78,7 +78,6 @@ static struct platform_driver platform_driver = { |
70 |
+ } |
71 |
+ }; |
72 |
+ |
73 |
+-static struct calling_interface_buffer *buffer; |
74 |
+ static struct platform_device *platform_device; |
75 |
+ static struct backlight_device *dell_backlight_device; |
76 |
+ static struct rfkill *wifi_rfkill; |
77 |
+@@ -322,7 +321,8 @@ static const struct dmi_system_id dell_quirks[] __initconst = { |
78 |
+ { } |
79 |
+ }; |
80 |
+ |
81 |
+-static void dell_set_arguments(u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
82 |
++static void dell_fill_request(struct calling_interface_buffer *buffer, |
83 |
++ u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
84 |
+ { |
85 |
+ memset(buffer, 0, sizeof(struct calling_interface_buffer)); |
86 |
+ buffer->input[0] = arg0; |
87 |
+@@ -331,7 +331,8 @@ static void dell_set_arguments(u32 arg0, u32 arg1, u32 arg2, u32 arg3) |
88 |
+ buffer->input[3] = arg3; |
89 |
+ } |
90 |
+ |
91 |
+-static int dell_send_request(u16 class, u16 select) |
92 |
++static int dell_send_request(struct calling_interface_buffer *buffer, |
93 |
++ u16 class, u16 select) |
94 |
+ { |
95 |
+ int ret; |
96 |
+ |
97 |
+@@ -468,21 +469,22 @@ static int dell_rfkill_set(void *data, bool blocked) |
98 |
+ int disable = blocked ? 1 : 0; |
99 |
+ unsigned long radio = (unsigned long)data; |
100 |
+ int hwswitch_bit = (unsigned long)data - 1; |
101 |
++ struct calling_interface_buffer buffer; |
102 |
+ int hwswitch; |
103 |
+ int status; |
104 |
+ int ret; |
105 |
+ |
106 |
+- dell_set_arguments(0, 0, 0, 0); |
107 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
108 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
109 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
110 |
+ if (ret) |
111 |
+ return ret; |
112 |
+- status = buffer->output[1]; |
113 |
++ status = buffer.output[1]; |
114 |
+ |
115 |
+- dell_set_arguments(0x2, 0, 0, 0); |
116 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
117 |
++ dell_fill_request(&buffer, 0x2, 0, 0, 0); |
118 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
119 |
+ if (ret) |
120 |
+ return ret; |
121 |
+- hwswitch = buffer->output[1]; |
122 |
++ hwswitch = buffer.output[1]; |
123 |
+ |
124 |
+ /* If the hardware switch controls this radio, and the hardware |
125 |
+ switch is disabled, always disable the radio */ |
126 |
+@@ -490,8 +492,8 @@ static int dell_rfkill_set(void *data, bool blocked) |
127 |
+ (status & BIT(0)) && !(status & BIT(16))) |
128 |
+ disable = 1; |
129 |
+ |
130 |
+- dell_set_arguments(1 | (radio<<8) | (disable << 16), 0, 0, 0); |
131 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
132 |
++ dell_fill_request(&buffer, 1 | (radio<<8) | (disable << 16), 0, 0, 0); |
133 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
134 |
+ return ret; |
135 |
+ } |
136 |
+ |
137 |
+@@ -500,9 +502,11 @@ static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio, |
138 |
+ { |
139 |
+ if (status & BIT(0)) { |
140 |
+ /* Has hw-switch, sync sw_state to BIOS */ |
141 |
++ struct calling_interface_buffer buffer; |
142 |
+ int block = rfkill_blocked(rfkill); |
143 |
+- dell_set_arguments(1 | (radio << 8) | (block << 16), 0, 0, 0); |
144 |
+- dell_send_request(CLASS_INFO, SELECT_RFKILL); |
145 |
++ dell_fill_request(&buffer, |
146 |
++ 1 | (radio << 8) | (block << 16), 0, 0, 0); |
147 |
++ dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
148 |
+ } else { |
149 |
+ /* No hw-switch, sync BIOS state to sw_state */ |
150 |
+ rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16))); |
151 |
+@@ -519,21 +523,22 @@ static void dell_rfkill_update_hw_state(struct rfkill *rfkill, int radio, |
152 |
+ static void dell_rfkill_query(struct rfkill *rfkill, void *data) |
153 |
+ { |
154 |
+ int radio = ((unsigned long)data & 0xF); |
155 |
++ struct calling_interface_buffer buffer; |
156 |
+ int hwswitch; |
157 |
+ int status; |
158 |
+ int ret; |
159 |
+ |
160 |
+- dell_set_arguments(0, 0, 0, 0); |
161 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
162 |
+- status = buffer->output[1]; |
163 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
164 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
165 |
++ status = buffer.output[1]; |
166 |
+ |
167 |
+ if (ret != 0 || !(status & BIT(0))) { |
168 |
+ return; |
169 |
+ } |
170 |
+ |
171 |
+- dell_set_arguments(0, 0x2, 0, 0); |
172 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
173 |
+- hwswitch = buffer->output[1]; |
174 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
175 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
176 |
++ hwswitch = buffer.output[1]; |
177 |
+ |
178 |
+ if (ret != 0) |
179 |
+ return; |
180 |
+@@ -550,22 +555,23 @@ static struct dentry *dell_laptop_dir; |
181 |
+ |
182 |
+ static int dell_debugfs_show(struct seq_file *s, void *data) |
183 |
+ { |
184 |
++ struct calling_interface_buffer buffer; |
185 |
+ int hwswitch_state; |
186 |
+ int hwswitch_ret; |
187 |
+ int status; |
188 |
+ int ret; |
189 |
+ |
190 |
+- dell_set_arguments(0, 0, 0, 0); |
191 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
192 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
193 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
194 |
+ if (ret) |
195 |
+ return ret; |
196 |
+- status = buffer->output[1]; |
197 |
++ status = buffer.output[1]; |
198 |
+ |
199 |
+- dell_set_arguments(0, 0x2, 0, 0); |
200 |
+- hwswitch_ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
201 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
202 |
++ hwswitch_ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
203 |
+ if (hwswitch_ret) |
204 |
+ return hwswitch_ret; |
205 |
+- hwswitch_state = buffer->output[1]; |
206 |
++ hwswitch_state = buffer.output[1]; |
207 |
+ |
208 |
+ seq_printf(s, "return:\t%d\n", ret); |
209 |
+ seq_printf(s, "status:\t0x%X\n", status); |
210 |
+@@ -646,22 +652,23 @@ static const struct file_operations dell_debugfs_fops = { |
211 |
+ |
212 |
+ static void dell_update_rfkill(struct work_struct *ignored) |
213 |
+ { |
214 |
++ struct calling_interface_buffer buffer; |
215 |
+ int hwswitch = 0; |
216 |
+ int status; |
217 |
+ int ret; |
218 |
+ |
219 |
+- dell_set_arguments(0, 0, 0, 0); |
220 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
221 |
+- status = buffer->output[1]; |
222 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
223 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
224 |
++ status = buffer.output[1]; |
225 |
+ |
226 |
+ if (ret != 0) |
227 |
+ return; |
228 |
+ |
229 |
+- dell_set_arguments(0, 0x2, 0, 0); |
230 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
231 |
++ dell_fill_request(&buffer, 0, 0x2, 0, 0); |
232 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
233 |
+ |
234 |
+ if (ret == 0 && (status & BIT(0))) |
235 |
+- hwswitch = buffer->output[1]; |
236 |
++ hwswitch = buffer.output[1]; |
237 |
+ |
238 |
+ if (wifi_rfkill) { |
239 |
+ dell_rfkill_update_hw_state(wifi_rfkill, 1, status, hwswitch); |
240 |
+@@ -719,6 +726,7 @@ static struct notifier_block dell_laptop_rbtn_notifier = { |
241 |
+ |
242 |
+ static int __init dell_setup_rfkill(void) |
243 |
+ { |
244 |
++ struct calling_interface_buffer buffer; |
245 |
+ int status, ret, whitelisted; |
246 |
+ const char *product; |
247 |
+ |
248 |
+@@ -734,9 +742,9 @@ static int __init dell_setup_rfkill(void) |
249 |
+ if (!force_rfkill && !whitelisted) |
250 |
+ return 0; |
251 |
+ |
252 |
+- dell_set_arguments(0, 0, 0, 0); |
253 |
+- ret = dell_send_request(CLASS_INFO, SELECT_RFKILL); |
254 |
+- status = buffer->output[1]; |
255 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
256 |
++ ret = dell_send_request(&buffer, CLASS_INFO, SELECT_RFKILL); |
257 |
++ status = buffer.output[1]; |
258 |
+ |
259 |
+ /* dell wireless info smbios call is not supported */ |
260 |
+ if (ret != 0) |
261 |
+@@ -889,6 +897,7 @@ static void dell_cleanup_rfkill(void) |
262 |
+ |
263 |
+ static int dell_send_intensity(struct backlight_device *bd) |
264 |
+ { |
265 |
++ struct calling_interface_buffer buffer; |
266 |
+ struct calling_interface_token *token; |
267 |
+ int ret; |
268 |
+ |
269 |
+@@ -896,17 +905,21 @@ static int dell_send_intensity(struct backlight_device *bd) |
270 |
+ if (!token) |
271 |
+ return -ENODEV; |
272 |
+ |
273 |
+- dell_set_arguments(token->location, bd->props.brightness, 0, 0); |
274 |
++ dell_fill_request(&buffer, |
275 |
++ token->location, bd->props.brightness, 0, 0); |
276 |
+ if (power_supply_is_system_supplied() > 0) |
277 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_AC); |
278 |
++ ret = dell_send_request(&buffer, |
279 |
++ CLASS_TOKEN_WRITE, SELECT_TOKEN_AC); |
280 |
+ else |
281 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_BAT); |
282 |
++ ret = dell_send_request(&buffer, |
283 |
++ CLASS_TOKEN_WRITE, SELECT_TOKEN_BAT); |
284 |
+ |
285 |
+ return ret; |
286 |
+ } |
287 |
+ |
288 |
+ static int dell_get_intensity(struct backlight_device *bd) |
289 |
+ { |
290 |
++ struct calling_interface_buffer buffer; |
291 |
+ struct calling_interface_token *token; |
292 |
+ int ret; |
293 |
+ |
294 |
+@@ -914,14 +927,17 @@ static int dell_get_intensity(struct backlight_device *bd) |
295 |
+ if (!token) |
296 |
+ return -ENODEV; |
297 |
+ |
298 |
+- dell_set_arguments(token->location, 0, 0, 0); |
299 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
300 |
+ if (power_supply_is_system_supplied() > 0) |
301 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
302 |
++ ret = dell_send_request(&buffer, |
303 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
304 |
+ else |
305 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_BAT); |
306 |
++ ret = dell_send_request(&buffer, |
307 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_BAT); |
308 |
+ |
309 |
+ if (ret == 0) |
310 |
+- ret = buffer->output[1]; |
311 |
++ ret = buffer.output[1]; |
312 |
++ |
313 |
+ return ret; |
314 |
+ } |
315 |
+ |
316 |
+@@ -1186,31 +1202,33 @@ static enum led_brightness kbd_led_level; |
317 |
+ |
318 |
+ static int kbd_get_info(struct kbd_info *info) |
319 |
+ { |
320 |
++ struct calling_interface_buffer buffer; |
321 |
+ u8 units; |
322 |
+ int ret; |
323 |
+ |
324 |
+- dell_set_arguments(0, 0, 0, 0); |
325 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
326 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
327 |
++ ret = dell_send_request(&buffer, |
328 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
329 |
+ if (ret) |
330 |
+ return ret; |
331 |
+ |
332 |
+- info->modes = buffer->output[1] & 0xFFFF; |
333 |
+- info->type = (buffer->output[1] >> 24) & 0xFF; |
334 |
+- info->triggers = buffer->output[2] & 0xFF; |
335 |
+- units = (buffer->output[2] >> 8) & 0xFF; |
336 |
+- info->levels = (buffer->output[2] >> 16) & 0xFF; |
337 |
++ info->modes = buffer.output[1] & 0xFFFF; |
338 |
++ info->type = (buffer.output[1] >> 24) & 0xFF; |
339 |
++ info->triggers = buffer.output[2] & 0xFF; |
340 |
++ units = (buffer.output[2] >> 8) & 0xFF; |
341 |
++ info->levels = (buffer.output[2] >> 16) & 0xFF; |
342 |
+ |
343 |
+ if (quirks && quirks->kbd_led_levels_off_1 && info->levels) |
344 |
+ info->levels--; |
345 |
+ |
346 |
+ if (units & BIT(0)) |
347 |
+- info->seconds = (buffer->output[3] >> 0) & 0xFF; |
348 |
++ info->seconds = (buffer.output[3] >> 0) & 0xFF; |
349 |
+ if (units & BIT(1)) |
350 |
+- info->minutes = (buffer->output[3] >> 8) & 0xFF; |
351 |
++ info->minutes = (buffer.output[3] >> 8) & 0xFF; |
352 |
+ if (units & BIT(2)) |
353 |
+- info->hours = (buffer->output[3] >> 16) & 0xFF; |
354 |
++ info->hours = (buffer.output[3] >> 16) & 0xFF; |
355 |
+ if (units & BIT(3)) |
356 |
+- info->days = (buffer->output[3] >> 24) & 0xFF; |
357 |
++ info->days = (buffer.output[3] >> 24) & 0xFF; |
358 |
+ |
359 |
+ return ret; |
360 |
+ } |
361 |
+@@ -1270,31 +1288,34 @@ static int kbd_set_level(struct kbd_state *state, u8 level) |
362 |
+ |
363 |
+ static int kbd_get_state(struct kbd_state *state) |
364 |
+ { |
365 |
++ struct calling_interface_buffer buffer; |
366 |
+ int ret; |
367 |
+ |
368 |
+- dell_set_arguments(0x1, 0, 0, 0); |
369 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
370 |
++ dell_fill_request(&buffer, 0, 0, 0, 0); |
371 |
++ ret = dell_send_request(&buffer, |
372 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
373 |
+ if (ret) |
374 |
+ return ret; |
375 |
+ |
376 |
+- state->mode_bit = ffs(buffer->output[1] & 0xFFFF); |
377 |
++ state->mode_bit = ffs(buffer.output[1] & 0xFFFF); |
378 |
+ if (state->mode_bit != 0) |
379 |
+ state->mode_bit--; |
380 |
+ |
381 |
+- state->triggers = (buffer->output[1] >> 16) & 0xFF; |
382 |
+- state->timeout_value = (buffer->output[1] >> 24) & 0x3F; |
383 |
+- state->timeout_unit = (buffer->output[1] >> 30) & 0x3; |
384 |
+- state->als_setting = buffer->output[2] & 0xFF; |
385 |
+- state->als_value = (buffer->output[2] >> 8) & 0xFF; |
386 |
+- state->level = (buffer->output[2] >> 16) & 0xFF; |
387 |
+- state->timeout_value_ac = (buffer->output[2] >> 24) & 0x3F; |
388 |
+- state->timeout_unit_ac = (buffer->output[2] >> 30) & 0x3; |
389 |
++ state->triggers = (buffer.output[1] >> 16) & 0xFF; |
390 |
++ state->timeout_value = (buffer.output[1] >> 24) & 0x3F; |
391 |
++ state->timeout_unit = (buffer.output[1] >> 30) & 0x3; |
392 |
++ state->als_setting = buffer.output[2] & 0xFF; |
393 |
++ state->als_value = (buffer.output[2] >> 8) & 0xFF; |
394 |
++ state->level = (buffer.output[2] >> 16) & 0xFF; |
395 |
++ state->timeout_value_ac = (buffer.output[2] >> 24) & 0x3F; |
396 |
++ state->timeout_unit_ac = (buffer.output[2] >> 30) & 0x3; |
397 |
+ |
398 |
+ return ret; |
399 |
+ } |
400 |
+ |
401 |
+ static int kbd_set_state(struct kbd_state *state) |
402 |
+ { |
403 |
++ struct calling_interface_buffer buffer; |
404 |
+ int ret; |
405 |
+ u32 input1; |
406 |
+ u32 input2; |
407 |
+@@ -1307,8 +1328,9 @@ static int kbd_set_state(struct kbd_state *state) |
408 |
+ input2 |= (state->level & 0xFF) << 16; |
409 |
+ input2 |= (state->timeout_value_ac & 0x3F) << 24; |
410 |
+ input2 |= (state->timeout_unit_ac & 0x3) << 30; |
411 |
+- dell_set_arguments(0x2, input1, input2, 0); |
412 |
+- ret = dell_send_request(CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
413 |
++ dell_fill_request(&buffer, 0x2, input1, input2, 0); |
414 |
++ ret = dell_send_request(&buffer, |
415 |
++ CLASS_KBD_BACKLIGHT, SELECT_KBD_BACKLIGHT); |
416 |
+ |
417 |
+ return ret; |
418 |
+ } |
419 |
+@@ -1335,6 +1357,7 @@ static int kbd_set_state_safe(struct kbd_state *state, struct kbd_state *old) |
420 |
+ |
421 |
+ static int kbd_set_token_bit(u8 bit) |
422 |
+ { |
423 |
++ struct calling_interface_buffer buffer; |
424 |
+ struct calling_interface_token *token; |
425 |
+ int ret; |
426 |
+ |
427 |
+@@ -1345,14 +1368,15 @@ static int kbd_set_token_bit(u8 bit) |
428 |
+ if (!token) |
429 |
+ return -EINVAL; |
430 |
+ |
431 |
+- dell_set_arguments(token->location, token->value, 0, 0); |
432 |
+- ret = dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
433 |
++ dell_fill_request(&buffer, token->location, token->value, 0, 0); |
434 |
++ ret = dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
435 |
+ |
436 |
+ return ret; |
437 |
+ } |
438 |
+ |
439 |
+ static int kbd_get_token_bit(u8 bit) |
440 |
+ { |
441 |
++ struct calling_interface_buffer buffer; |
442 |
+ struct calling_interface_token *token; |
443 |
+ int ret; |
444 |
+ int val; |
445 |
+@@ -1364,9 +1388,9 @@ static int kbd_get_token_bit(u8 bit) |
446 |
+ if (!token) |
447 |
+ return -EINVAL; |
448 |
+ |
449 |
+- dell_set_arguments(token->location, 0, 0, 0); |
450 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_STD); |
451 |
+- val = buffer->output[1]; |
452 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
453 |
++ ret = dell_send_request(&buffer, CLASS_TOKEN_READ, SELECT_TOKEN_STD); |
454 |
++ val = buffer.output[1]; |
455 |
+ |
456 |
+ if (ret) |
457 |
+ return ret; |
458 |
+@@ -2102,6 +2126,7 @@ static struct notifier_block dell_laptop_notifier = { |
459 |
+ |
460 |
+ int dell_micmute_led_set(int state) |
461 |
+ { |
462 |
++ struct calling_interface_buffer buffer; |
463 |
+ struct calling_interface_token *token; |
464 |
+ |
465 |
+ if (state == 0) |
466 |
+@@ -2114,8 +2139,8 @@ int dell_micmute_led_set(int state) |
467 |
+ if (!token) |
468 |
+ return -ENODEV; |
469 |
+ |
470 |
+- dell_set_arguments(token->location, token->value, 0, 0); |
471 |
+- dell_send_request(CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
472 |
++ dell_fill_request(&buffer, token->location, token->value, 0, 0); |
473 |
++ dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); |
474 |
+ |
475 |
+ return state; |
476 |
+ } |
477 |
+@@ -2146,13 +2171,6 @@ static int __init dell_init(void) |
478 |
+ if (ret) |
479 |
+ goto fail_platform_device2; |
480 |
+ |
481 |
+- buffer = kzalloc(sizeof(struct calling_interface_buffer), GFP_KERNEL); |
482 |
+- if (!buffer) { |
483 |
+- ret = -ENOMEM; |
484 |
+- goto fail_buffer; |
485 |
+- } |
486 |
+- |
487 |
+- |
488 |
+ ret = dell_setup_rfkill(); |
489 |
+ |
490 |
+ if (ret) { |
491 |
+@@ -2177,10 +2195,13 @@ static int __init dell_init(void) |
492 |
+ |
493 |
+ token = dell_smbios_find_token(BRIGHTNESS_TOKEN); |
494 |
+ if (token) { |
495 |
+- dell_set_arguments(token->location, 0, 0, 0); |
496 |
+- ret = dell_send_request(CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
497 |
++ struct calling_interface_buffer buffer; |
498 |
++ |
499 |
++ dell_fill_request(&buffer, token->location, 0, 0, 0); |
500 |
++ ret = dell_send_request(&buffer, |
501 |
++ CLASS_TOKEN_READ, SELECT_TOKEN_AC); |
502 |
+ if (ret) |
503 |
+- max_intensity = buffer->output[3]; |
504 |
++ max_intensity = buffer.output[3]; |
505 |
+ } |
506 |
+ |
507 |
+ if (max_intensity) { |
508 |
+@@ -2214,8 +2235,6 @@ static int __init dell_init(void) |
509 |
+ fail_get_brightness: |
510 |
+ backlight_device_unregister(dell_backlight_device); |
511 |
+ fail_backlight: |
512 |
+- kfree(buffer); |
513 |
+-fail_buffer: |
514 |
+ dell_cleanup_rfkill(); |
515 |
+ fail_rfkill: |
516 |
+ platform_device_del(platform_device); |
517 |
+@@ -2235,7 +2254,6 @@ static void __exit dell_exit(void) |
518 |
+ touchpad_led_exit(); |
519 |
+ kbd_led_exit(); |
520 |
+ backlight_device_unregister(dell_backlight_device); |
521 |
+- kfree(buffer); |
522 |
+ dell_cleanup_rfkill(); |
523 |
+ if (platform_device) { |
524 |
+ platform_device_unregister(platform_device); |