1 |
Author: mpagano |
2 |
Date: 2013-12-06 23:52:05 +0000 (Fri, 06 Dec 2013) |
3 |
New Revision: 2602 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.12/1002_linux-3.12.3.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/3.12/0000_README |
9 |
Log: |
10 |
Linux patch 3.12.3 |
11 |
|
12 |
Modified: genpatches-2.6/trunk/3.12/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/3.12/0000_README 2013-12-06 23:49:49 UTC (rev 2601) |
15 |
+++ genpatches-2.6/trunk/3.12/0000_README 2013-12-06 23:52:05 UTC (rev 2602) |
16 |
@@ -50,6 +50,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 3.12.2 |
19 |
|
20 |
+Patch: 1002_linux-3.12.3.patch |
21 |
+From: http://www.kernel.org |
22 |
+Desc: Linux 3.12.3 |
23 |
+ |
24 |
Patch: 1500_XATTR_USER_PREFIX.patch |
25 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
26 |
Desc: Support for namespace user.pax.* on tmpfs. |
27 |
|
28 |
Added: genpatches-2.6/trunk/3.12/1002_linux-3.12.3.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/3.12/1002_linux-3.12.3.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/3.12/1002_linux-3.12.3.patch 2013-12-06 23:52:05 UTC (rev 2602) |
32 |
@@ -0,0 +1,8639 @@ |
33 |
+diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt |
34 |
+index 9d4c1d18..fb78e60a 100644 |
35 |
+--- a/Documentation/sysctl/kernel.txt |
36 |
++++ b/Documentation/sysctl/kernel.txt |
37 |
+@@ -290,13 +290,24 @@ Default value is "/sbin/hotplug". |
38 |
+ kptr_restrict: |
39 |
+ |
40 |
+ This toggle indicates whether restrictions are placed on |
41 |
+-exposing kernel addresses via /proc and other interfaces. When |
42 |
+-kptr_restrict is set to (0), there are no restrictions. When |
43 |
+-kptr_restrict is set to (1), the default, kernel pointers |
44 |
+-printed using the %pK format specifier will be replaced with 0's |
45 |
+-unless the user has CAP_SYSLOG. When kptr_restrict is set to |
46 |
+-(2), kernel pointers printed using %pK will be replaced with 0's |
47 |
+-regardless of privileges. |
48 |
++exposing kernel addresses via /proc and other interfaces. |
49 |
++ |
50 |
++When kptr_restrict is set to (0), the default, there are no restrictions. |
51 |
++ |
52 |
++When kptr_restrict is set to (1), kernel pointers printed using the %pK |
53 |
++format specifier will be replaced with 0's unless the user has CAP_SYSLOG |
54 |
++and effective user and group ids are equal to the real ids. This is |
55 |
++because %pK checks are done at read() time rather than open() time, so |
56 |
++if permissions are elevated between the open() and the read() (e.g via |
57 |
++a setuid binary) then %pK will not leak kernel pointers to unprivileged |
58 |
++users. Note, this is a temporary solution only. The correct long-term |
59 |
++solution is to do the permission checks at open() time. Consider removing |
60 |
++world read permissions from files that use %pK, and using dmesg_restrict |
61 |
++to protect against uses of %pK in dmesg(8) if leaking kernel pointer |
62 |
++values to unprivileged users is a concern. |
63 |
++ |
64 |
++When kptr_restrict is set to (2), kernel pointers printed using |
65 |
++%pK will be replaced with 0's regardless of privileges. |
66 |
+ |
67 |
+ ============================================================== |
68 |
+ |
69 |
+diff --git a/Makefile b/Makefile |
70 |
+index e6e72b62..b28bc57d 100644 |
71 |
+--- a/Makefile |
72 |
++++ b/Makefile |
73 |
+@@ -1,6 +1,6 @@ |
74 |
+ VERSION = 3 |
75 |
+ PATCHLEVEL = 12 |
76 |
+-SUBLEVEL = 2 |
77 |
++SUBLEVEL = 3 |
78 |
+ EXTRAVERSION = |
79 |
+ NAME = One Giant Leap for Frogkind |
80 |
+ |
81 |
+diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi |
82 |
+index 1e12aeff..aa537ed1 100644 |
83 |
+--- a/arch/arm/boot/dts/bcm2835.dtsi |
84 |
++++ b/arch/arm/boot/dts/bcm2835.dtsi |
85 |
+@@ -85,6 +85,8 @@ |
86 |
+ reg = <0x7e205000 0x1000>; |
87 |
+ interrupts = <2 21>; |
88 |
+ clocks = <&clk_i2c>; |
89 |
++ #address-cells = <1>; |
90 |
++ #size-cells = <0>; |
91 |
+ status = "disabled"; |
92 |
+ }; |
93 |
+ |
94 |
+@@ -93,6 +95,8 @@ |
95 |
+ reg = <0x7e804000 0x1000>; |
96 |
+ interrupts = <2 21>; |
97 |
+ clocks = <&clk_i2c>; |
98 |
++ #address-cells = <1>; |
99 |
++ #size-cells = <0>; |
100 |
+ status = "disabled"; |
101 |
+ }; |
102 |
+ |
103 |
+diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/cros5250-common.dtsi |
104 |
+index dc259e8b..9b186ac0 100644 |
105 |
+--- a/arch/arm/boot/dts/cros5250-common.dtsi |
106 |
++++ b/arch/arm/boot/dts/cros5250-common.dtsi |
107 |
+@@ -27,6 +27,13 @@ |
108 |
+ i2c2_bus: i2c2-bus { |
109 |
+ samsung,pin-pud = <0>; |
110 |
+ }; |
111 |
++ |
112 |
++ max77686_irq: max77686-irq { |
113 |
++ samsung,pins = "gpx3-2"; |
114 |
++ samsung,pin-function = <0>; |
115 |
++ samsung,pin-pud = <0>; |
116 |
++ samsung,pin-drv = <0>; |
117 |
++ }; |
118 |
+ }; |
119 |
+ |
120 |
+ i2c@12C60000 { |
121 |
+@@ -35,6 +42,11 @@ |
122 |
+ |
123 |
+ max77686@09 { |
124 |
+ compatible = "maxim,max77686"; |
125 |
++ interrupt-parent = <&gpx3>; |
126 |
++ interrupts = <2 0>; |
127 |
++ pinctrl-names = "default"; |
128 |
++ pinctrl-0 = <&max77686_irq>; |
129 |
++ wakeup-source; |
130 |
+ reg = <0x09>; |
131 |
+ |
132 |
+ voltage-regulators { |
133 |
+diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S |
134 |
+index 9cbe70c8..ec3e5cf4 100644 |
135 |
+--- a/arch/arm/kernel/entry-armv.S |
136 |
++++ b/arch/arm/kernel/entry-armv.S |
137 |
+@@ -192,6 +192,7 @@ __dabt_svc: |
138 |
+ svc_entry |
139 |
+ mov r2, sp |
140 |
+ dabt_helper |
141 |
++ THUMB( ldr r5, [sp, #S_PSR] ) @ potentially updated CPSR |
142 |
+ svc_exit r5 @ return from exception |
143 |
+ UNWIND(.fnend ) |
144 |
+ ENDPROC(__dabt_svc) |
145 |
+diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile |
146 |
+index 3b0a9538..e0fda04e 100644 |
147 |
+--- a/arch/arm/mach-at91/Makefile |
148 |
++++ b/arch/arm/mach-at91/Makefile |
149 |
+@@ -2,7 +2,7 @@ |
150 |
+ # Makefile for the linux kernel. |
151 |
+ # |
152 |
+ |
153 |
+-obj-y := irq.o gpio.o setup.o |
154 |
++obj-y := irq.o gpio.o setup.o sysirq_mask.o |
155 |
+ obj-m := |
156 |
+ obj-n := |
157 |
+ obj- := |
158 |
+diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c |
159 |
+index 5de6074b..ae10d14d 100644 |
160 |
+--- a/arch/arm/mach-at91/at91sam9260.c |
161 |
++++ b/arch/arm/mach-at91/at91sam9260.c |
162 |
+@@ -349,6 +349,8 @@ static void __init at91sam9260_initialize(void) |
163 |
+ arm_pm_idle = at91sam9_idle; |
164 |
+ arm_pm_restart = at91sam9_alt_restart; |
165 |
+ |
166 |
++ at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT); |
167 |
++ |
168 |
+ /* Register GPIO subsystem */ |
169 |
+ at91_gpio_init(at91sam9260_gpio, 3); |
170 |
+ } |
171 |
+diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c |
172 |
+index 0e079324..e761e74a 100644 |
173 |
+--- a/arch/arm/mach-at91/at91sam9261.c |
174 |
++++ b/arch/arm/mach-at91/at91sam9261.c |
175 |
+@@ -291,6 +291,8 @@ static void __init at91sam9261_initialize(void) |
176 |
+ arm_pm_idle = at91sam9_idle; |
177 |
+ arm_pm_restart = at91sam9_alt_restart; |
178 |
+ |
179 |
++ at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT); |
180 |
++ |
181 |
+ /* Register GPIO subsystem */ |
182 |
+ at91_gpio_init(at91sam9261_gpio, 3); |
183 |
+ } |
184 |
+diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c |
185 |
+index 6ce7d185..e6fed625 100644 |
186 |
+--- a/arch/arm/mach-at91/at91sam9263.c |
187 |
++++ b/arch/arm/mach-at91/at91sam9263.c |
188 |
+@@ -328,6 +328,9 @@ static void __init at91sam9263_initialize(void) |
189 |
+ arm_pm_idle = at91sam9_idle; |
190 |
+ arm_pm_restart = at91sam9_alt_restart; |
191 |
+ |
192 |
++ at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0); |
193 |
++ at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1); |
194 |
++ |
195 |
+ /* Register GPIO subsystem */ |
196 |
+ at91_gpio_init(at91sam9263_gpio, 5); |
197 |
+ } |
198 |
+diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c |
199 |
+index 474ee04d..9f7a97c8 100644 |
200 |
+--- a/arch/arm/mach-at91/at91sam9g45.c |
201 |
++++ b/arch/arm/mach-at91/at91sam9g45.c |
202 |
+@@ -377,6 +377,9 @@ static void __init at91sam9g45_initialize(void) |
203 |
+ arm_pm_idle = at91sam9_idle; |
204 |
+ arm_pm_restart = at91sam9g45_restart; |
205 |
+ |
206 |
++ at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC); |
207 |
++ at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT); |
208 |
++ |
209 |
+ /* Register GPIO subsystem */ |
210 |
+ at91_gpio_init(at91sam9g45_gpio, 5); |
211 |
+ } |
212 |
+diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c |
213 |
+index c7d670d1..4d6001c3 100644 |
214 |
+--- a/arch/arm/mach-at91/at91sam9n12.c |
215 |
++++ b/arch/arm/mach-at91/at91sam9n12.c |
216 |
+@@ -223,7 +223,13 @@ static void __init at91sam9n12_map_io(void) |
217 |
+ at91_init_sram(0, AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE); |
218 |
+ } |
219 |
+ |
220 |
++static void __init at91sam9n12_initialize(void) |
221 |
++{ |
222 |
++ at91_sysirq_mask_rtc(AT91SAM9N12_BASE_RTC); |
223 |
++} |
224 |
++ |
225 |
+ AT91_SOC_START(at91sam9n12) |
226 |
+ .map_io = at91sam9n12_map_io, |
227 |
+ .register_clocks = at91sam9n12_register_clocks, |
228 |
++ .init = at91sam9n12_initialize, |
229 |
+ AT91_SOC_END |
230 |
+diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c |
231 |
+index d4ec0d9a..301e1728 100644 |
232 |
+--- a/arch/arm/mach-at91/at91sam9rl.c |
233 |
++++ b/arch/arm/mach-at91/at91sam9rl.c |
234 |
+@@ -294,6 +294,9 @@ static void __init at91sam9rl_initialize(void) |
235 |
+ arm_pm_idle = at91sam9_idle; |
236 |
+ arm_pm_restart = at91sam9_alt_restart; |
237 |
+ |
238 |
++ at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC); |
239 |
++ at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT); |
240 |
++ |
241 |
+ /* Register GPIO subsystem */ |
242 |
+ at91_gpio_init(at91sam9rl_gpio, 4); |
243 |
+ } |
244 |
+diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c |
245 |
+index 916e5a14..e8a2e075 100644 |
246 |
+--- a/arch/arm/mach-at91/at91sam9x5.c |
247 |
++++ b/arch/arm/mach-at91/at91sam9x5.c |
248 |
+@@ -322,6 +322,11 @@ static void __init at91sam9x5_map_io(void) |
249 |
+ at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); |
250 |
+ } |
251 |
+ |
252 |
++static void __init at91sam9x5_initialize(void) |
253 |
++{ |
254 |
++ at91_sysirq_mask_rtc(AT91SAM9X5_BASE_RTC); |
255 |
++} |
256 |
++ |
257 |
+ /* -------------------------------------------------------------------- |
258 |
+ * Interrupt initialization |
259 |
+ * -------------------------------------------------------------------- */ |
260 |
+@@ -329,4 +334,5 @@ static void __init at91sam9x5_map_io(void) |
261 |
+ AT91_SOC_START(at91sam9x5) |
262 |
+ .map_io = at91sam9x5_map_io, |
263 |
+ .register_clocks = at91sam9x5_register_clocks, |
264 |
++ .init = at91sam9x5_initialize, |
265 |
+ AT91_SOC_END |
266 |
+diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h |
267 |
+index dc6e2f5f..26dee3ce 100644 |
268 |
+--- a/arch/arm/mach-at91/generic.h |
269 |
++++ b/arch/arm/mach-at91/generic.h |
270 |
+@@ -34,6 +34,8 @@ extern int __init at91_aic_of_init(struct device_node *node, |
271 |
+ struct device_node *parent); |
272 |
+ extern int __init at91_aic5_of_init(struct device_node *node, |
273 |
+ struct device_node *parent); |
274 |
++extern void __init at91_sysirq_mask_rtc(u32 rtc_base); |
275 |
++extern void __init at91_sysirq_mask_rtt(u32 rtt_base); |
276 |
+ |
277 |
+ |
278 |
+ /* Timer */ |
279 |
+diff --git a/arch/arm/mach-at91/include/mach/at91sam9n12.h b/arch/arm/mach-at91/include/mach/at91sam9n12.h |
280 |
+index d374b87c..0151bcf6 100644 |
281 |
+--- a/arch/arm/mach-at91/include/mach/at91sam9n12.h |
282 |
++++ b/arch/arm/mach-at91/include/mach/at91sam9n12.h |
283 |
+@@ -49,6 +49,11 @@ |
284 |
+ #define AT91SAM9N12_BASE_USART3 0xf8028000 |
285 |
+ |
286 |
+ /* |
287 |
++ * System Peripherals |
288 |
++ */ |
289 |
++#define AT91SAM9N12_BASE_RTC 0xfffffeb0 |
290 |
++ |
291 |
++/* |
292 |
+ * Internal Memory. |
293 |
+ */ |
294 |
+ #define AT91SAM9N12_SRAM_BASE 0x00300000 /* Internal SRAM base address */ |
295 |
+diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h |
296 |
+index c75ee19b..2fc76c49 100644 |
297 |
+--- a/arch/arm/mach-at91/include/mach/at91sam9x5.h |
298 |
++++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h |
299 |
+@@ -55,6 +55,11 @@ |
300 |
+ #define AT91SAM9X5_BASE_USART2 0xf8024000 |
301 |
+ |
302 |
+ /* |
303 |
++ * System Peripherals |
304 |
++ */ |
305 |
++#define AT91SAM9X5_BASE_RTC 0xfffffeb0 |
306 |
++ |
307 |
++/* |
308 |
+ * Internal Memory. |
309 |
+ */ |
310 |
+ #define AT91SAM9X5_SRAM_BASE 0x00300000 /* Internal SRAM base address */ |
311 |
+diff --git a/arch/arm/mach-at91/include/mach/sama5d3.h b/arch/arm/mach-at91/include/mach/sama5d3.h |
312 |
+index 31096a8a..25613d8c 100644 |
313 |
+--- a/arch/arm/mach-at91/include/mach/sama5d3.h |
314 |
++++ b/arch/arm/mach-at91/include/mach/sama5d3.h |
315 |
+@@ -73,6 +73,11 @@ |
316 |
+ #define SAMA5D3_BASE_USART3 0xf8024000 |
317 |
+ |
318 |
+ /* |
319 |
++ * System Peripherals |
320 |
++ */ |
321 |
++#define SAMA5D3_BASE_RTC 0xfffffeb0 |
322 |
++ |
323 |
++/* |
324 |
+ * Internal Memory |
325 |
+ */ |
326 |
+ #define SAMA5D3_SRAM_BASE 0x00300000 /* Internal SRAM base address */ |
327 |
+diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c |
328 |
+index 40127971..3ea86428 100644 |
329 |
+--- a/arch/arm/mach-at91/sama5d3.c |
330 |
++++ b/arch/arm/mach-at91/sama5d3.c |
331 |
+@@ -371,7 +371,13 @@ static void __init sama5d3_map_io(void) |
332 |
+ at91_init_sram(0, SAMA5D3_SRAM_BASE, SAMA5D3_SRAM_SIZE); |
333 |
+ } |
334 |
+ |
335 |
++static void __init sama5d3_initialize(void) |
336 |
++{ |
337 |
++ at91_sysirq_mask_rtc(SAMA5D3_BASE_RTC); |
338 |
++} |
339 |
++ |
340 |
+ AT91_SOC_START(sama5d3) |
341 |
+ .map_io = sama5d3_map_io, |
342 |
+ .register_clocks = sama5d3_register_clocks, |
343 |
++ .init = sama5d3_initialize, |
344 |
+ AT91_SOC_END |
345 |
+diff --git a/arch/arm/mach-at91/sysirq_mask.c b/arch/arm/mach-at91/sysirq_mask.c |
346 |
+new file mode 100644 |
347 |
+index 00000000..2ba694f9 |
348 |
+--- /dev/null |
349 |
++++ b/arch/arm/mach-at91/sysirq_mask.c |
350 |
+@@ -0,0 +1,71 @@ |
351 |
++/* |
352 |
++ * sysirq_mask.c - System-interrupt masking |
353 |
++ * |
354 |
++ * Copyright (C) 2013 Johan Hovold <jhovold@×××××.com> |
355 |
++ * |
356 |
++ * Functions to disable system interrupts from backup-powered peripherals. |
357 |
++ * |
358 |
++ * The RTC and RTT-peripherals are generally powered by backup power (VDDBU) |
359 |
++ * and are not reset on wake-up, user, watchdog or software reset. This means |
360 |
++ * that their interrupts may be enabled during early boot (e.g. after a user |
361 |
++ * reset). |
362 |
++ * |
363 |
++ * As the RTC and RTT share the system-interrupt line with the PIT, an |
364 |
++ * interrupt occurring before a handler has been installed would lead to the |
365 |
++ * system interrupt being disabled and prevent the system from booting. |
366 |
++ * |
367 |
++ * This program is free software; you can redistribute it and/or modify |
368 |
++ * it under the terms of the GNU General Public License as published by |
369 |
++ * the Free Software Foundation; either version 2 of the License, or |
370 |
++ * (at your option) any later version. |
371 |
++ */ |
372 |
++ |
373 |
++#include <linux/io.h> |
374 |
++#include <mach/at91_rtt.h> |
375 |
++ |
376 |
++#include "generic.h" |
377 |
++ |
378 |
++#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ |
379 |
++#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ |
380 |
++ |
381 |
++void __init at91_sysirq_mask_rtc(u32 rtc_base) |
382 |
++{ |
383 |
++ void __iomem *base; |
384 |
++ u32 mask; |
385 |
++ |
386 |
++ base = ioremap(rtc_base, 64); |
387 |
++ if (!base) |
388 |
++ return; |
389 |
++ |
390 |
++ mask = readl_relaxed(base + AT91_RTC_IMR); |
391 |
++ if (mask) { |
392 |
++ pr_info("AT91: Disabling rtc irq\n"); |
393 |
++ writel_relaxed(mask, base + AT91_RTC_IDR); |
394 |
++ (void)readl_relaxed(base + AT91_RTC_IMR); /* flush */ |
395 |
++ } |
396 |
++ |
397 |
++ iounmap(base); |
398 |
++} |
399 |
++ |
400 |
++void __init at91_sysirq_mask_rtt(u32 rtt_base) |
401 |
++{ |
402 |
++ void __iomem *base; |
403 |
++ void __iomem *reg; |
404 |
++ u32 mode; |
405 |
++ |
406 |
++ base = ioremap(rtt_base, 16); |
407 |
++ if (!base) |
408 |
++ return; |
409 |
++ |
410 |
++ reg = base + AT91_RTT_MR; |
411 |
++ |
412 |
++ mode = readl_relaxed(reg); |
413 |
++ if (mode & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN)) { |
414 |
++ pr_info("AT91: Disabling rtt irq\n"); |
415 |
++ mode &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); |
416 |
++ writel_relaxed(mode, reg); |
417 |
++ (void)readl_relaxed(reg); /* flush */ |
418 |
++ } |
419 |
++ |
420 |
++ iounmap(base); |
421 |
++} |
422 |
+diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c |
423 |
+index 9181a241..ef85ac49 100644 |
424 |
+--- a/arch/arm/mach-imx/clk-imx6q.c |
425 |
++++ b/arch/arm/mach-imx/clk-imx6q.c |
426 |
+@@ -428,7 +428,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) |
427 |
+ clk[asrc_podf] = imx_clk_divider("asrc_podf", "asrc_pred", base + 0x30, 9, 3); |
428 |
+ clk[spdif_pred] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3); |
429 |
+ clk[spdif_podf] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3); |
430 |
+- clk[can_root] = imx_clk_divider("can_root", "pll3_usb_otg", base + 0x20, 2, 6); |
431 |
++ clk[can_root] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6); |
432 |
+ clk[ecspi_root] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6); |
433 |
+ clk[gpu2d_core_podf] = imx_clk_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 23, 3); |
434 |
+ clk[gpu3d_core_podf] = imx_clk_divider("gpu3d_core_podf", "gpu3d_core_sel", base + 0x18, 26, 3); |
435 |
+diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c |
436 |
+index 8c60fcb0..2f4c9248 100644 |
437 |
+--- a/arch/arm/mach-integrator/integrator_cp.c |
438 |
++++ b/arch/arm/mach-integrator/integrator_cp.c |
439 |
+@@ -199,7 +199,8 @@ static struct mmci_platform_data mmc_data = { |
440 |
+ static void cp_clcd_enable(struct clcd_fb *fb) |
441 |
+ { |
442 |
+ struct fb_var_screeninfo *var = &fb->fb.var; |
443 |
+- u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2; |
444 |
++ u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2 |
445 |
++ | CM_CTRL_LCDEN0 | CM_CTRL_LCDEN1; |
446 |
+ |
447 |
+ if (var->bits_per_pixel <= 8 || |
448 |
+ (var->bits_per_pixel == 16 && var->green.length == 5)) |
449 |
+diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c |
450 |
+index 3926f370..e022a869 100644 |
451 |
+--- a/arch/arm/mach-omap2/irq.c |
452 |
++++ b/arch/arm/mach-omap2/irq.c |
453 |
+@@ -233,7 +233,7 @@ static inline void omap_intc_handle_irq(void __iomem *base_addr, struct pt_regs |
454 |
+ goto out; |
455 |
+ |
456 |
+ irqnr = readl_relaxed(base_addr + 0xd8); |
457 |
+-#ifdef CONFIG_SOC_TI81XX |
458 |
++#if IS_ENABLED(CONFIG_SOC_TI81XX) || IS_ENABLED(CONFIG_SOC_AM33XX) |
459 |
+ if (irqnr) |
460 |
+ goto out; |
461 |
+ irqnr = readl_relaxed(base_addr + 0xf8); |
462 |
+diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c |
463 |
+index b69dd9ab..53f07358 100644 |
464 |
+--- a/arch/arm/mach-omap2/omap_device.c |
465 |
++++ b/arch/arm/mach-omap2/omap_device.c |
466 |
+@@ -621,6 +621,7 @@ static int _od_suspend_noirq(struct device *dev) |
467 |
+ |
468 |
+ if (!ret && !pm_runtime_status_suspended(dev)) { |
469 |
+ if (pm_generic_runtime_suspend(dev) == 0) { |
470 |
++ pm_runtime_set_suspended(dev); |
471 |
+ omap_device_idle(pdev); |
472 |
+ od->flags |= OMAP_DEVICE_SUSPENDED; |
473 |
+ } |
474 |
+@@ -634,10 +635,18 @@ static int _od_resume_noirq(struct device *dev) |
475 |
+ struct platform_device *pdev = to_platform_device(dev); |
476 |
+ struct omap_device *od = to_omap_device(pdev); |
477 |
+ |
478 |
+- if ((od->flags & OMAP_DEVICE_SUSPENDED) && |
479 |
+- !pm_runtime_status_suspended(dev)) { |
480 |
++ if (od->flags & OMAP_DEVICE_SUSPENDED) { |
481 |
+ od->flags &= ~OMAP_DEVICE_SUSPENDED; |
482 |
+ omap_device_enable(pdev); |
483 |
++ /* |
484 |
++ * XXX: we run before core runtime pm has resumed itself. At |
485 |
++ * this point in time, we just restore the runtime pm state and |
486 |
++ * considering symmetric operations in resume, we donot expect |
487 |
++ * to fail. If we failed, something changed in core runtime_pm |
488 |
++ * framework OR some device driver messed things up, hence, WARN |
489 |
++ */ |
490 |
++ WARN(pm_runtime_set_active(dev), |
491 |
++ "Could not set %s runtime state active\n", dev_name(dev)); |
492 |
+ pm_generic_runtime_resume(dev); |
493 |
+ } |
494 |
+ |
495 |
+diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c |
496 |
+index e838ba27..c9808c68 100644 |
497 |
+--- a/arch/arm/mach-sa1100/assabet.c |
498 |
++++ b/arch/arm/mach-sa1100/assabet.c |
499 |
+@@ -512,6 +512,9 @@ static void __init assabet_map_io(void) |
500 |
+ * Its called GPCLKR0 in my SA1110 manual. |
501 |
+ */ |
502 |
+ Ser1SDCR0 |= SDCR0_SUS; |
503 |
++ MSC1 = (MSC1 & ~0xffff) | |
504 |
++ MSC_NonBrst | MSC_32BitStMem | |
505 |
++ MSC_RdAcc(2) | MSC_WrAcc(2) | MSC_Rec(0); |
506 |
+ |
507 |
+ if (!machine_has_neponset()) |
508 |
+ sa1100_register_uart_fns(&assabet_port_fns); |
509 |
+diff --git a/arch/arm/mm/extable.c b/arch/arm/mm/extable.c |
510 |
+index 9d285626..312e15e6 100644 |
511 |
+--- a/arch/arm/mm/extable.c |
512 |
++++ b/arch/arm/mm/extable.c |
513 |
+@@ -9,8 +9,13 @@ int fixup_exception(struct pt_regs *regs) |
514 |
+ const struct exception_table_entry *fixup; |
515 |
+ |
516 |
+ fixup = search_exception_tables(instruction_pointer(regs)); |
517 |
+- if (fixup) |
518 |
++ if (fixup) { |
519 |
+ regs->ARM_pc = fixup->fixup; |
520 |
++#ifdef CONFIG_THUMB2_KERNEL |
521 |
++ /* Clear the IT state to avoid nasty surprises in the fixup */ |
522 |
++ regs->ARM_cpsr &= ~PSR_IT_MASK; |
523 |
++#endif |
524 |
++ } |
525 |
+ |
526 |
+ return fixup != NULL; |
527 |
+ } |
528 |
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
529 |
+index f0bebc5e..0b27b657 100644 |
530 |
+--- a/arch/arm64/include/asm/pgtable.h |
531 |
++++ b/arch/arm64/include/asm/pgtable.h |
532 |
+@@ -25,10 +25,11 @@ |
533 |
+ * Software defined PTE bits definition. |
534 |
+ */ |
535 |
+ #define PTE_VALID (_AT(pteval_t, 1) << 0) |
536 |
+-#define PTE_PROT_NONE (_AT(pteval_t, 1) << 2) /* only when !PTE_VALID */ |
537 |
+-#define PTE_FILE (_AT(pteval_t, 1) << 3) /* only when !pte_present() */ |
538 |
++#define PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !pte_present() */ |
539 |
+ #define PTE_DIRTY (_AT(pteval_t, 1) << 55) |
540 |
+ #define PTE_SPECIAL (_AT(pteval_t, 1) << 56) |
541 |
++ /* bit 57 for PMD_SECT_SPLITTING */ |
542 |
++#define PTE_PROT_NONE (_AT(pteval_t, 1) << 58) /* only when !PTE_VALID */ |
543 |
+ |
544 |
+ /* |
545 |
+ * VMALLOC and SPARSEMEM_VMEMMAP ranges. |
546 |
+@@ -357,18 +358,20 @@ extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; |
547 |
+ |
548 |
+ /* |
549 |
+ * Encode and decode a swap entry: |
550 |
+- * bits 0, 2: present (must both be zero) |
551 |
+- * bit 3: PTE_FILE |
552 |
+- * bits 4-8: swap type |
553 |
+- * bits 9-63: swap offset |
554 |
++ * bits 0-1: present (must be zero) |
555 |
++ * bit 2: PTE_FILE |
556 |
++ * bits 3-8: swap type |
557 |
++ * bits 9-57: swap offset |
558 |
+ */ |
559 |
+-#define __SWP_TYPE_SHIFT 4 |
560 |
++#define __SWP_TYPE_SHIFT 3 |
561 |
+ #define __SWP_TYPE_BITS 6 |
562 |
++#define __SWP_OFFSET_BITS 49 |
563 |
+ #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) |
564 |
+ #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) |
565 |
++#define __SWP_OFFSET_MASK ((1UL << __SWP_OFFSET_BITS) - 1) |
566 |
+ |
567 |
+ #define __swp_type(x) (((x).val >> __SWP_TYPE_SHIFT) & __SWP_TYPE_MASK) |
568 |
+-#define __swp_offset(x) ((x).val >> __SWP_OFFSET_SHIFT) |
569 |
++#define __swp_offset(x) (((x).val >> __SWP_OFFSET_SHIFT) & __SWP_OFFSET_MASK) |
570 |
+ #define __swp_entry(type,offset) ((swp_entry_t) { ((type) << __SWP_TYPE_SHIFT) | ((offset) << __SWP_OFFSET_SHIFT) }) |
571 |
+ |
572 |
+ #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) |
573 |
+@@ -382,15 +385,15 @@ extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; |
574 |
+ |
575 |
+ /* |
576 |
+ * Encode and decode a file entry: |
577 |
+- * bits 0, 2: present (must both be zero) |
578 |
+- * bit 3: PTE_FILE |
579 |
+- * bits 4-63: file offset / PAGE_SIZE |
580 |
++ * bits 0-1: present (must be zero) |
581 |
++ * bit 2: PTE_FILE |
582 |
++ * bits 3-57: file offset / PAGE_SIZE |
583 |
+ */ |
584 |
+ #define pte_file(pte) (pte_val(pte) & PTE_FILE) |
585 |
+-#define pte_to_pgoff(x) (pte_val(x) >> 4) |
586 |
+-#define pgoff_to_pte(x) __pte(((x) << 4) | PTE_FILE) |
587 |
++#define pte_to_pgoff(x) (pte_val(x) >> 3) |
588 |
++#define pgoff_to_pte(x) __pte(((x) << 3) | PTE_FILE) |
589 |
+ |
590 |
+-#define PTE_FILE_MAX_BITS 60 |
591 |
++#define PTE_FILE_MAX_BITS 55 |
592 |
+ |
593 |
+ extern int kern_addr_valid(unsigned long addr); |
594 |
+ |
595 |
+diff --git a/arch/avr32/boot/u-boot/head.S b/arch/avr32/boot/u-boot/head.S |
596 |
+index 4488fa27..2ffc298f 100644 |
597 |
+--- a/arch/avr32/boot/u-boot/head.S |
598 |
++++ b/arch/avr32/boot/u-boot/head.S |
599 |
+@@ -8,6 +8,8 @@ |
600 |
+ * published by the Free Software Foundation. |
601 |
+ */ |
602 |
+ #include <asm/setup.h> |
603 |
++#include <asm/thread_info.h> |
604 |
++#include <asm/sysreg.h> |
605 |
+ |
606 |
+ /* |
607 |
+ * The kernel is loaded where we want it to be and all caches |
608 |
+@@ -20,11 +22,6 @@ |
609 |
+ .section .init.text,"ax" |
610 |
+ .global _start |
611 |
+ _start: |
612 |
+- /* Check if the boot loader actually provided a tag table */ |
613 |
+- lddpc r0, magic_number |
614 |
+- cp.w r12, r0 |
615 |
+- brne no_tag_table |
616 |
+- |
617 |
+ /* Initialize .bss */ |
618 |
+ lddpc r2, bss_start_addr |
619 |
+ lddpc r3, end_addr |
620 |
+@@ -34,6 +31,25 @@ _start: |
621 |
+ cp r2, r3 |
622 |
+ brlo 1b |
623 |
+ |
624 |
++ /* Initialize status register */ |
625 |
++ lddpc r0, init_sr |
626 |
++ mtsr SYSREG_SR, r0 |
627 |
++ |
628 |
++ /* Set initial stack pointer */ |
629 |
++ lddpc sp, stack_addr |
630 |
++ sub sp, -THREAD_SIZE |
631 |
++ |
632 |
++#ifdef CONFIG_FRAME_POINTER |
633 |
++ /* Mark last stack frame */ |
634 |
++ mov lr, 0 |
635 |
++ mov r7, 0 |
636 |
++#endif |
637 |
++ |
638 |
++ /* Check if the boot loader actually provided a tag table */ |
639 |
++ lddpc r0, magic_number |
640 |
++ cp.w r12, r0 |
641 |
++ brne no_tag_table |
642 |
++ |
643 |
+ /* |
644 |
+ * Save the tag table address for later use. This must be done |
645 |
+ * _after_ .bss has been initialized... |
646 |
+@@ -53,8 +69,15 @@ bss_start_addr: |
647 |
+ .long __bss_start |
648 |
+ end_addr: |
649 |
+ .long _end |
650 |
++init_sr: |
651 |
++ .long 0x007f0000 /* Supervisor mode, everything masked */ |
652 |
++stack_addr: |
653 |
++ .long init_thread_union |
654 |
++panic_addr: |
655 |
++ .long panic |
656 |
+ |
657 |
+ no_tag_table: |
658 |
+ sub r12, pc, (. - 2f) |
659 |
+- bral panic |
660 |
++ /* branch to panic() which can be far away with that construct */ |
661 |
++ lddpc pc, panic_addr |
662 |
+ 2: .asciz "Boot loader didn't provide correct magic number\n" |
663 |
+diff --git a/arch/avr32/kernel/entry-avr32b.S b/arch/avr32/kernel/entry-avr32b.S |
664 |
+index 9899d3cc..7301f480 100644 |
665 |
+--- a/arch/avr32/kernel/entry-avr32b.S |
666 |
++++ b/arch/avr32/kernel/entry-avr32b.S |
667 |
+@@ -401,9 +401,10 @@ handle_critical: |
668 |
+ /* We should never get here... */ |
669 |
+ bad_return: |
670 |
+ sub r12, pc, (. - 1f) |
671 |
+- bral panic |
672 |
++ lddpc pc, 2f |
673 |
+ .align 2 |
674 |
+ 1: .asciz "Return from critical exception!" |
675 |
++2: .long panic |
676 |
+ |
677 |
+ .align 1 |
678 |
+ do_bus_error_write: |
679 |
+diff --git a/arch/avr32/kernel/head.S b/arch/avr32/kernel/head.S |
680 |
+index 6163bd0a..59eae6df 100644 |
681 |
+--- a/arch/avr32/kernel/head.S |
682 |
++++ b/arch/avr32/kernel/head.S |
683 |
+@@ -10,33 +10,13 @@ |
684 |
+ #include <linux/linkage.h> |
685 |
+ |
686 |
+ #include <asm/page.h> |
687 |
+-#include <asm/thread_info.h> |
688 |
+-#include <asm/sysreg.h> |
689 |
+ |
690 |
+ .section .init.text,"ax" |
691 |
+ .global kernel_entry |
692 |
+ kernel_entry: |
693 |
+- /* Initialize status register */ |
694 |
+- lddpc r0, init_sr |
695 |
+- mtsr SYSREG_SR, r0 |
696 |
+- |
697 |
+- /* Set initial stack pointer */ |
698 |
+- lddpc sp, stack_addr |
699 |
+- sub sp, -THREAD_SIZE |
700 |
+- |
701 |
+-#ifdef CONFIG_FRAME_POINTER |
702 |
+- /* Mark last stack frame */ |
703 |
+- mov lr, 0 |
704 |
+- mov r7, 0 |
705 |
+-#endif |
706 |
+- |
707 |
+ /* Start the show */ |
708 |
+ lddpc pc, kernel_start_addr |
709 |
+ |
710 |
+ .align 2 |
711 |
+-init_sr: |
712 |
+- .long 0x007f0000 /* Supervisor mode, everything masked */ |
713 |
+-stack_addr: |
714 |
+- .long init_thread_union |
715 |
+ kernel_start_addr: |
716 |
+ .long start_kernel |
717 |
+diff --git a/arch/parisc/include/asm/socket.h b/arch/parisc/include/asm/socket.h |
718 |
+new file mode 100644 |
719 |
+index 00000000..748016cb |
720 |
+--- /dev/null |
721 |
++++ b/arch/parisc/include/asm/socket.h |
722 |
+@@ -0,0 +1,11 @@ |
723 |
++#ifndef _ASM_SOCKET_H |
724 |
++#define _ASM_SOCKET_H |
725 |
++ |
726 |
++#include <uapi/asm/socket.h> |
727 |
++ |
728 |
++/* O_NONBLOCK clashes with the bits used for socket types. Therefore we |
729 |
++ * have to define SOCK_NONBLOCK to a different value here. |
730 |
++ */ |
731 |
++#define SOCK_NONBLOCK 0x40000000 |
732 |
++ |
733 |
++#endif /* _ASM_SOCKET_H */ |
734 |
+diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h |
735 |
+index 71700e63..9f2174f4 100644 |
736 |
+--- a/arch/parisc/include/uapi/asm/socket.h |
737 |
++++ b/arch/parisc/include/uapi/asm/socket.h |
738 |
+@@ -1,5 +1,5 @@ |
739 |
+-#ifndef _ASM_SOCKET_H |
740 |
+-#define _ASM_SOCKET_H |
741 |
++#ifndef _UAPI_ASM_SOCKET_H |
742 |
++#define _UAPI_ASM_SOCKET_H |
743 |
+ |
744 |
+ #include <asm/sockios.h> |
745 |
+ |
746 |
+@@ -75,9 +75,4 @@ |
747 |
+ |
748 |
+ #define SO_BUSY_POLL 0x4027 |
749 |
+ |
750 |
+-/* O_NONBLOCK clashes with the bits used for socket types. Therefore we |
751 |
+- * have to define SOCK_NONBLOCK to a different value here. |
752 |
+- */ |
753 |
+-#define SOCK_NONBLOCK 0x40000000 |
754 |
+- |
755 |
+-#endif /* _ASM_SOCKET_H */ |
756 |
++#endif /* _UAPI_ASM_SOCKET_H */ |
757 |
+diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c |
758 |
+index 36d49e6b..fea2dba1 100644 |
759 |
+--- a/arch/powerpc/kernel/signal_32.c |
760 |
++++ b/arch/powerpc/kernel/signal_32.c |
761 |
+@@ -445,6 +445,12 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, |
762 |
+ #endif /* CONFIG_ALTIVEC */ |
763 |
+ if (copy_fpr_to_user(&frame->mc_fregs, current)) |
764 |
+ return 1; |
765 |
++ |
766 |
++ /* |
767 |
++ * Clear the MSR VSX bit to indicate there is no valid state attached |
768 |
++ * to this context, except in the specific case below where we set it. |
769 |
++ */ |
770 |
++ msr &= ~MSR_VSX; |
771 |
+ #ifdef CONFIG_VSX |
772 |
+ /* |
773 |
+ * Copy VSR 0-31 upper half from thread_struct to local |
774 |
+@@ -457,15 +463,7 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, |
775 |
+ if (copy_vsx_to_user(&frame->mc_vsregs, current)) |
776 |
+ return 1; |
777 |
+ msr |= MSR_VSX; |
778 |
+- } else if (!ctx_has_vsx_region) |
779 |
+- /* |
780 |
+- * With a small context structure we can't hold the VSX |
781 |
+- * registers, hence clear the MSR value to indicate the state |
782 |
+- * was not saved. |
783 |
+- */ |
784 |
+- msr &= ~MSR_VSX; |
785 |
+- |
786 |
+- |
787 |
++ } |
788 |
+ #endif /* CONFIG_VSX */ |
789 |
+ #ifdef CONFIG_SPE |
790 |
+ /* save spe registers */ |
791 |
+diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c |
792 |
+index f93ec283..1e7ba881 100644 |
793 |
+--- a/arch/powerpc/kernel/signal_64.c |
794 |
++++ b/arch/powerpc/kernel/signal_64.c |
795 |
+@@ -121,6 +121,12 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, |
796 |
+ flush_fp_to_thread(current); |
797 |
+ /* copy fpr regs and fpscr */ |
798 |
+ err |= copy_fpr_to_user(&sc->fp_regs, current); |
799 |
++ |
800 |
++ /* |
801 |
++ * Clear the MSR VSX bit to indicate there is no valid state attached |
802 |
++ * to this context, except in the specific case below where we set it. |
803 |
++ */ |
804 |
++ msr &= ~MSR_VSX; |
805 |
+ #ifdef CONFIG_VSX |
806 |
+ /* |
807 |
+ * Copy VSX low doubleword to local buffer for formatting, |
808 |
+diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c |
809 |
+index 1694d738..26588fdc 100644 |
810 |
+--- a/arch/s390/lib/uaccess_pt.c |
811 |
++++ b/arch/s390/lib/uaccess_pt.c |
812 |
+@@ -78,11 +78,14 @@ static size_t copy_in_kernel(size_t count, void __user *to, |
813 |
+ * contains the (negative) exception code. |
814 |
+ */ |
815 |
+ #ifdef CONFIG_64BIT |
816 |
++ |
817 |
+ static unsigned long follow_table(struct mm_struct *mm, |
818 |
+ unsigned long address, int write) |
819 |
+ { |
820 |
+ unsigned long *table = (unsigned long *)__pa(mm->pgd); |
821 |
+ |
822 |
++ if (unlikely(address > mm->context.asce_limit - 1)) |
823 |
++ return -0x38UL; |
824 |
+ switch (mm->context.asce_bits & _ASCE_TYPE_MASK) { |
825 |
+ case _ASCE_TYPE_REGION1: |
826 |
+ table = table + ((address >> 53) & 0x7ff); |
827 |
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c |
828 |
+index 1fa8be40..122f737a 100644 |
829 |
+--- a/arch/sh/boards/mach-ecovec24/setup.c |
830 |
++++ b/arch/sh/boards/mach-ecovec24/setup.c |
831 |
+@@ -15,6 +15,7 @@ |
832 |
+ #include <linux/mmc/sh_mmcif.h> |
833 |
+ #include <linux/mmc/sh_mobile_sdhi.h> |
834 |
+ #include <linux/mtd/physmap.h> |
835 |
++#include <linux/mfd/tmio.h> |
836 |
+ #include <linux/gpio.h> |
837 |
+ #include <linux/interrupt.h> |
838 |
+ #include <linux/io.h> |
839 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
840 |
+index 5e00b5a5..0c611d89 100644 |
841 |
+--- a/block/blk-core.c |
842 |
++++ b/block/blk-core.c |
843 |
+@@ -645,10 +645,12 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) |
844 |
+ __set_bit(QUEUE_FLAG_BYPASS, &q->queue_flags); |
845 |
+ |
846 |
+ if (blkcg_init_queue(q)) |
847 |
+- goto fail_id; |
848 |
++ goto fail_bdi; |
849 |
+ |
850 |
+ return q; |
851 |
+ |
852 |
++fail_bdi: |
853 |
++ bdi_destroy(&q->backing_dev_info); |
854 |
+ fail_id: |
855 |
+ ida_simple_remove(&blk_queue_ida, q->id); |
856 |
+ fail_q: |
857 |
+diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c |
858 |
+index 06007f0e..52222a2f 100644 |
859 |
+--- a/crypto/asymmetric_keys/x509_public_key.c |
860 |
++++ b/crypto/asymmetric_keys/x509_public_key.c |
861 |
+@@ -106,7 +106,6 @@ error_no_sig: |
862 |
+ static int x509_key_preparse(struct key_preparsed_payload *prep) |
863 |
+ { |
864 |
+ struct x509_certificate *cert; |
865 |
+- struct tm now; |
866 |
+ size_t srlen, sulen; |
867 |
+ char *desc = NULL; |
868 |
+ int ret; |
869 |
+@@ -137,43 +136,6 @@ static int x509_key_preparse(struct key_preparsed_payload *prep) |
870 |
+ goto error_free_cert; |
871 |
+ } |
872 |
+ |
873 |
+- time_to_tm(CURRENT_TIME.tv_sec, 0, &now); |
874 |
+- pr_devel("Now: %04ld-%02d-%02d %02d:%02d:%02d\n", |
875 |
+- now.tm_year + 1900, now.tm_mon + 1, now.tm_mday, |
876 |
+- now.tm_hour, now.tm_min, now.tm_sec); |
877 |
+- if (now.tm_year < cert->valid_from.tm_year || |
878 |
+- (now.tm_year == cert->valid_from.tm_year && |
879 |
+- (now.tm_mon < cert->valid_from.tm_mon || |
880 |
+- (now.tm_mon == cert->valid_from.tm_mon && |
881 |
+- (now.tm_mday < cert->valid_from.tm_mday || |
882 |
+- (now.tm_mday == cert->valid_from.tm_mday && |
883 |
+- (now.tm_hour < cert->valid_from.tm_hour || |
884 |
+- (now.tm_hour == cert->valid_from.tm_hour && |
885 |
+- (now.tm_min < cert->valid_from.tm_min || |
886 |
+- (now.tm_min == cert->valid_from.tm_min && |
887 |
+- (now.tm_sec < cert->valid_from.tm_sec |
888 |
+- ))))))))))) { |
889 |
+- pr_warn("Cert %s is not yet valid\n", cert->fingerprint); |
890 |
+- ret = -EKEYREJECTED; |
891 |
+- goto error_free_cert; |
892 |
+- } |
893 |
+- if (now.tm_year > cert->valid_to.tm_year || |
894 |
+- (now.tm_year == cert->valid_to.tm_year && |
895 |
+- (now.tm_mon > cert->valid_to.tm_mon || |
896 |
+- (now.tm_mon == cert->valid_to.tm_mon && |
897 |
+- (now.tm_mday > cert->valid_to.tm_mday || |
898 |
+- (now.tm_mday == cert->valid_to.tm_mday && |
899 |
+- (now.tm_hour > cert->valid_to.tm_hour || |
900 |
+- (now.tm_hour == cert->valid_to.tm_hour && |
901 |
+- (now.tm_min > cert->valid_to.tm_min || |
902 |
+- (now.tm_min == cert->valid_to.tm_min && |
903 |
+- (now.tm_sec > cert->valid_to.tm_sec |
904 |
+- ))))))))))) { |
905 |
+- pr_warn("Cert %s has expired\n", cert->fingerprint); |
906 |
+- ret = -EKEYEXPIRED; |
907 |
+- goto error_free_cert; |
908 |
+- } |
909 |
+- |
910 |
+ cert->pub->algo = x509_public_key_algorithms[cert->pkey_algo]; |
911 |
+ cert->pub->id_type = PKEY_ID_X509; |
912 |
+ |
913 |
+diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c |
914 |
+index d7e53ea5..79de26ed 100644 |
915 |
+--- a/drivers/acpi/pci_root.c |
916 |
++++ b/drivers/acpi/pci_root.c |
917 |
+@@ -63,6 +63,9 @@ static struct acpi_scan_handler pci_root_handler = { |
918 |
+ .ids = root_device_ids, |
919 |
+ .attach = acpi_pci_root_add, |
920 |
+ .detach = acpi_pci_root_remove, |
921 |
++ .hotplug = { |
922 |
++ .ignore = true, |
923 |
++ }, |
924 |
+ }; |
925 |
+ |
926 |
+ static DEFINE_MUTEX(osc_lock); |
927 |
+diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c |
928 |
+index 3601738e..d047771c 100644 |
929 |
+--- a/drivers/acpi/scan.c |
930 |
++++ b/drivers/acpi/scan.c |
931 |
+@@ -1812,7 +1812,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) |
932 |
+ */ |
933 |
+ list_for_each_entry(hwid, &pnp.ids, list) { |
934 |
+ handler = acpi_scan_match_handler(hwid->id, NULL); |
935 |
+- if (handler) { |
936 |
++ if (handler && !handler->hotplug.ignore) { |
937 |
+ acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, |
938 |
+ acpi_hotplug_notify_cb, handler); |
939 |
+ break; |
940 |
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c |
941 |
+index 8e28f923..14f1e950 100644 |
942 |
+--- a/drivers/ata/ahci.c |
943 |
++++ b/drivers/ata/ahci.c |
944 |
+@@ -292,6 +292,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { |
945 |
+ { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */ |
946 |
+ { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */ |
947 |
+ { PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */ |
948 |
++ { PCI_VDEVICE(INTEL, 0x9c83), board_ahci }, /* Wildcat Point-LP AHCI */ |
949 |
++ { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ |
950 |
++ { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ |
951 |
++ { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ |
952 |
+ |
953 |
+ /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
954 |
+ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
955 |
+@@ -431,6 +435,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { |
956 |
+ .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ |
957 |
+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3), |
958 |
+ .driver_data = board_ahci_yes_fbs }, |
959 |
++ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), |
960 |
++ .driver_data = board_ahci_yes_fbs }, |
961 |
+ |
962 |
+ /* Promise */ |
963 |
+ { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ |
964 |
+diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
965 |
+index aaac4fb0..cfb74470 100644 |
966 |
+--- a/drivers/ata/libahci.c |
967 |
++++ b/drivers/ata/libahci.c |
968 |
+@@ -1275,9 +1275,11 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, |
969 |
+ { |
970 |
+ struct ata_port *ap = link->ap; |
971 |
+ struct ahci_host_priv *hpriv = ap->host->private_data; |
972 |
++ struct ahci_port_priv *pp = ap->private_data; |
973 |
+ const char *reason = NULL; |
974 |
+ unsigned long now, msecs; |
975 |
+ struct ata_taskfile tf; |
976 |
++ bool fbs_disabled = false; |
977 |
+ int rc; |
978 |
+ |
979 |
+ DPRINTK("ENTER\n"); |
980 |
+@@ -1287,6 +1289,16 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, |
981 |
+ if (rc && rc != -EOPNOTSUPP) |
982 |
+ ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc); |
983 |
+ |
984 |
++ /* |
985 |
++ * According to AHCI-1.2 9.3.9: if FBS is enable, software shall |
986 |
++ * clear PxFBS.EN to '0' prior to issuing software reset to devices |
987 |
++ * that is attached to port multiplier. |
988 |
++ */ |
989 |
++ if (!ata_is_host_link(link) && pp->fbs_enabled) { |
990 |
++ ahci_disable_fbs(ap); |
991 |
++ fbs_disabled = true; |
992 |
++ } |
993 |
++ |
994 |
+ ata_tf_init(link->device, &tf); |
995 |
+ |
996 |
+ /* issue the first D2H Register FIS */ |
997 |
+@@ -1327,6 +1339,10 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, |
998 |
+ } else |
999 |
+ *class = ahci_dev_classify(ap); |
1000 |
+ |
1001 |
++ /* re-enable FBS if disabled before */ |
1002 |
++ if (fbs_disabled) |
1003 |
++ ahci_enable_fbs(ap); |
1004 |
++ |
1005 |
+ DPRINTK("EXIT, class=%u\n", *class); |
1006 |
+ return 0; |
1007 |
+ |
1008 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
1009 |
+index 83b1a9fb..81a94a39 100644 |
1010 |
+--- a/drivers/ata/libata-core.c |
1011 |
++++ b/drivers/ata/libata-core.c |
1012 |
+@@ -4126,6 +4126,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
1013 |
+ { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
1014 |
+ { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, |
1015 |
+ { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, |
1016 |
++ { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, |
1017 |
+ |
1018 |
+ /* Devices we expect to fail diagnostics */ |
1019 |
+ |
1020 |
+diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c |
1021 |
+index 150a917f..e37413228 100644 |
1022 |
+--- a/drivers/ata/libata-transport.c |
1023 |
++++ b/drivers/ata/libata-transport.c |
1024 |
+@@ -321,25 +321,25 @@ int ata_tport_add(struct device *parent, |
1025 |
+ /* |
1026 |
+ * ATA link attributes |
1027 |
+ */ |
1028 |
++static int noop(int x) { return x; } |
1029 |
+ |
1030 |
+- |
1031 |
+-#define ata_link_show_linkspeed(field) \ |
1032 |
++#define ata_link_show_linkspeed(field, format) \ |
1033 |
+ static ssize_t \ |
1034 |
+ show_ata_link_##field(struct device *dev, \ |
1035 |
+ struct device_attribute *attr, char *buf) \ |
1036 |
+ { \ |
1037 |
+ struct ata_link *link = transport_class_to_link(dev); \ |
1038 |
+ \ |
1039 |
+- return sprintf(buf,"%s\n", sata_spd_string(fls(link->field))); \ |
1040 |
++ return sprintf(buf, "%s\n", sata_spd_string(format(link->field))); \ |
1041 |
+ } |
1042 |
+ |
1043 |
+-#define ata_link_linkspeed_attr(field) \ |
1044 |
+- ata_link_show_linkspeed(field) \ |
1045 |
++#define ata_link_linkspeed_attr(field, format) \ |
1046 |
++ ata_link_show_linkspeed(field, format) \ |
1047 |
+ static DEVICE_ATTR(field, S_IRUGO, show_ata_link_##field, NULL) |
1048 |
+ |
1049 |
+-ata_link_linkspeed_attr(hw_sata_spd_limit); |
1050 |
+-ata_link_linkspeed_attr(sata_spd_limit); |
1051 |
+-ata_link_linkspeed_attr(sata_spd); |
1052 |
++ata_link_linkspeed_attr(hw_sata_spd_limit, fls); |
1053 |
++ata_link_linkspeed_attr(sata_spd_limit, fls); |
1054 |
++ata_link_linkspeed_attr(sata_spd, noop); |
1055 |
+ |
1056 |
+ |
1057 |
+ static DECLARE_TRANSPORT_CLASS(ata_link_class, |
1058 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
1059 |
+index 35fa3689..06051767 100644 |
1060 |
+--- a/drivers/base/dd.c |
1061 |
++++ b/drivers/base/dd.c |
1062 |
+@@ -499,7 +499,7 @@ static void __device_release_driver(struct device *dev) |
1063 |
+ BUS_NOTIFY_UNBIND_DRIVER, |
1064 |
+ dev); |
1065 |
+ |
1066 |
+- pm_runtime_put(dev); |
1067 |
++ pm_runtime_put_sync(dev); |
1068 |
+ |
1069 |
+ if (dev->bus && dev->bus->remove) |
1070 |
+ dev->bus->remove(dev); |
1071 |
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c |
1072 |
+index 2f036ca4..c8dac730 100644 |
1073 |
+--- a/drivers/block/loop.c |
1074 |
++++ b/drivers/block/loop.c |
1075 |
+@@ -894,13 +894,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, |
1076 |
+ |
1077 |
+ bio_list_init(&lo->lo_bio_list); |
1078 |
+ |
1079 |
+- /* |
1080 |
+- * set queue make_request_fn, and add limits based on lower level |
1081 |
+- * device |
1082 |
+- */ |
1083 |
+- blk_queue_make_request(lo->lo_queue, loop_make_request); |
1084 |
+- lo->lo_queue->queuedata = lo; |
1085 |
+- |
1086 |
+ if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync) |
1087 |
+ blk_queue_flush(lo->lo_queue, REQ_FLUSH); |
1088 |
+ |
1089 |
+@@ -1618,6 +1611,8 @@ static int loop_add(struct loop_device **l, int i) |
1090 |
+ if (!lo) |
1091 |
+ goto out; |
1092 |
+ |
1093 |
++ lo->lo_state = Lo_unbound; |
1094 |
++ |
1095 |
+ /* allocate id, if @id >= 0, we're requesting that specific id */ |
1096 |
+ if (i >= 0) { |
1097 |
+ err = idr_alloc(&loop_index_idr, lo, i, i + 1, GFP_KERNEL); |
1098 |
+@@ -1633,7 +1628,13 @@ static int loop_add(struct loop_device **l, int i) |
1099 |
+ err = -ENOMEM; |
1100 |
+ lo->lo_queue = blk_alloc_queue(GFP_KERNEL); |
1101 |
+ if (!lo->lo_queue) |
1102 |
+- goto out_free_dev; |
1103 |
++ goto out_free_idr; |
1104 |
++ |
1105 |
++ /* |
1106 |
++ * set queue make_request_fn |
1107 |
++ */ |
1108 |
++ blk_queue_make_request(lo->lo_queue, loop_make_request); |
1109 |
++ lo->lo_queue->queuedata = lo; |
1110 |
+ |
1111 |
+ disk = lo->lo_disk = alloc_disk(1 << part_shift); |
1112 |
+ if (!disk) |
1113 |
+@@ -1678,6 +1679,8 @@ static int loop_add(struct loop_device **l, int i) |
1114 |
+ |
1115 |
+ out_free_queue: |
1116 |
+ blk_cleanup_queue(lo->lo_queue); |
1117 |
++out_free_idr: |
1118 |
++ idr_remove(&loop_index_idr, i); |
1119 |
+ out_free_dev: |
1120 |
+ kfree(lo); |
1121 |
+ out: |
1122 |
+diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c |
1123 |
+index bf4b9d28..6620b73d 100644 |
1124 |
+--- a/drivers/block/xen-blkback/blkback.c |
1125 |
++++ b/drivers/block/xen-blkback/blkback.c |
1126 |
+@@ -887,6 +887,8 @@ static int dispatch_discard_io(struct xen_blkif *blkif, |
1127 |
+ unsigned long secure; |
1128 |
+ struct phys_req preq; |
1129 |
+ |
1130 |
++ xen_blkif_get(blkif); |
1131 |
++ |
1132 |
+ preq.sector_number = req->u.discard.sector_number; |
1133 |
+ preq.nr_sects = req->u.discard.nr_sectors; |
1134 |
+ |
1135 |
+@@ -899,7 +901,6 @@ static int dispatch_discard_io(struct xen_blkif *blkif, |
1136 |
+ } |
1137 |
+ blkif->st_ds_req++; |
1138 |
+ |
1139 |
+- xen_blkif_get(blkif); |
1140 |
+ secure = (blkif->vbd.discard_secure && |
1141 |
+ (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ? |
1142 |
+ BLKDEV_DISCARD_SECURE : 0; |
1143 |
+diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c |
1144 |
+index 794123fc..bf8902a0 100644 |
1145 |
+--- a/drivers/cpufreq/highbank-cpufreq.c |
1146 |
++++ b/drivers/cpufreq/highbank-cpufreq.c |
1147 |
+@@ -66,7 +66,8 @@ static int hb_cpufreq_driver_init(void) |
1148 |
+ struct device_node *np; |
1149 |
+ int ret; |
1150 |
+ |
1151 |
+- if (!of_machine_is_compatible("calxeda,highbank")) |
1152 |
++ if ((!of_machine_is_compatible("calxeda,highbank")) && |
1153 |
++ (!of_machine_is_compatible("calxeda,ecx-2000"))) |
1154 |
+ return -ENODEV; |
1155 |
+ |
1156 |
+ cpu_dev = get_cpu_device(0); |
1157 |
+diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c |
1158 |
+index d8ececaf..3efc4dcf 100644 |
1159 |
+--- a/drivers/dma/ioat/dma_v3.c |
1160 |
++++ b/drivers/dma/ioat/dma_v3.c |
1161 |
+@@ -87,13 +87,6 @@ static const u8 pq_idx_to_field[] = { 1, 4, 5, 0, 1, 2, 4, 5 }; |
1162 |
+ static const u8 pq16_idx_to_field[] = { 1, 4, 1, 2, 3, 4, 5, 6, 7, |
1163 |
+ 0, 1, 2, 3, 4, 5, 6 }; |
1164 |
+ |
1165 |
+-/* |
1166 |
+- * technically sources 1 and 2 do not require SED, but the op will have |
1167 |
+- * at least 9 descriptors so that's irrelevant. |
1168 |
+- */ |
1169 |
+-static const u8 pq16_idx_to_sed[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, |
1170 |
+- 1, 1, 1, 1, 1, 1, 1 }; |
1171 |
+- |
1172 |
+ static void ioat3_eh(struct ioat2_dma_chan *ioat); |
1173 |
+ |
1174 |
+ static dma_addr_t xor_get_src(struct ioat_raw_descriptor *descs[2], int idx) |
1175 |
+@@ -135,12 +128,6 @@ static void pq_set_src(struct ioat_raw_descriptor *descs[2], |
1176 |
+ pq->coef[idx] = coef; |
1177 |
+ } |
1178 |
+ |
1179 |
+-static int sed_get_pq16_pool_idx(int src_cnt) |
1180 |
+-{ |
1181 |
+- |
1182 |
+- return pq16_idx_to_sed[src_cnt]; |
1183 |
+-} |
1184 |
+- |
1185 |
+ static bool is_jf_ioat(struct pci_dev *pdev) |
1186 |
+ { |
1187 |
+ switch (pdev->device) { |
1188 |
+@@ -1129,9 +1116,6 @@ __ioat3_prep_pq16_lock(struct dma_chan *c, enum sum_check_flags *result, |
1189 |
+ u8 op; |
1190 |
+ int i, s, idx, num_descs; |
1191 |
+ |
1192 |
+- /* this function only handles src_cnt 9 - 16 */ |
1193 |
+- BUG_ON(src_cnt < 9); |
1194 |
+- |
1195 |
+ /* this function is only called with 9-16 sources */ |
1196 |
+ op = result ? IOAT_OP_PQ_VAL_16S : IOAT_OP_PQ_16S; |
1197 |
+ |
1198 |
+@@ -1159,8 +1143,7 @@ __ioat3_prep_pq16_lock(struct dma_chan *c, enum sum_check_flags *result, |
1199 |
+ |
1200 |
+ descs[0] = (struct ioat_raw_descriptor *) pq; |
1201 |
+ |
1202 |
+- desc->sed = ioat3_alloc_sed(device, |
1203 |
+- sed_get_pq16_pool_idx(src_cnt)); |
1204 |
++ desc->sed = ioat3_alloc_sed(device, (src_cnt-2) >> 3); |
1205 |
+ if (!desc->sed) { |
1206 |
+ dev_err(to_dev(chan), |
1207 |
+ "%s: no free sed entries\n", __func__); |
1208 |
+@@ -1218,13 +1201,21 @@ __ioat3_prep_pq16_lock(struct dma_chan *c, enum sum_check_flags *result, |
1209 |
+ return &desc->txd; |
1210 |
+ } |
1211 |
+ |
1212 |
++static int src_cnt_flags(unsigned int src_cnt, unsigned long flags) |
1213 |
++{ |
1214 |
++ if (dmaf_p_disabled_continue(flags)) |
1215 |
++ return src_cnt + 1; |
1216 |
++ else if (dmaf_continue(flags)) |
1217 |
++ return src_cnt + 3; |
1218 |
++ else |
1219 |
++ return src_cnt; |
1220 |
++} |
1221 |
++ |
1222 |
+ static struct dma_async_tx_descriptor * |
1223 |
+ ioat3_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src, |
1224 |
+ unsigned int src_cnt, const unsigned char *scf, size_t len, |
1225 |
+ unsigned long flags) |
1226 |
+ { |
1227 |
+- struct dma_device *dma = chan->device; |
1228 |
+- |
1229 |
+ /* specify valid address for disabled result */ |
1230 |
+ if (flags & DMA_PREP_PQ_DISABLE_P) |
1231 |
+ dst[0] = dst[1]; |
1232 |
+@@ -1244,7 +1235,7 @@ ioat3_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src, |
1233 |
+ single_source_coef[0] = scf[0]; |
1234 |
+ single_source_coef[1] = 0; |
1235 |
+ |
1236 |
+- return (src_cnt > 8) && (dma->max_pq > 8) ? |
1237 |
++ return src_cnt_flags(src_cnt, flags) > 8 ? |
1238 |
+ __ioat3_prep_pq16_lock(chan, NULL, dst, single_source, |
1239 |
+ 2, single_source_coef, len, |
1240 |
+ flags) : |
1241 |
+@@ -1252,7 +1243,7 @@ ioat3_prep_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src, |
1242 |
+ single_source_coef, len, flags); |
1243 |
+ |
1244 |
+ } else { |
1245 |
+- return (src_cnt > 8) && (dma->max_pq > 8) ? |
1246 |
++ return src_cnt_flags(src_cnt, flags) > 8 ? |
1247 |
+ __ioat3_prep_pq16_lock(chan, NULL, dst, src, src_cnt, |
1248 |
+ scf, len, flags) : |
1249 |
+ __ioat3_prep_pq_lock(chan, NULL, dst, src, src_cnt, |
1250 |
+@@ -1265,8 +1256,6 @@ ioat3_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, |
1251 |
+ unsigned int src_cnt, const unsigned char *scf, size_t len, |
1252 |
+ enum sum_check_flags *pqres, unsigned long flags) |
1253 |
+ { |
1254 |
+- struct dma_device *dma = chan->device; |
1255 |
+- |
1256 |
+ /* specify valid address for disabled result */ |
1257 |
+ if (flags & DMA_PREP_PQ_DISABLE_P) |
1258 |
+ pq[0] = pq[1]; |
1259 |
+@@ -1278,7 +1267,7 @@ ioat3_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src, |
1260 |
+ */ |
1261 |
+ *pqres = 0; |
1262 |
+ |
1263 |
+- return (src_cnt > 8) && (dma->max_pq > 8) ? |
1264 |
++ return src_cnt_flags(src_cnt, flags) > 8 ? |
1265 |
+ __ioat3_prep_pq16_lock(chan, pqres, pq, src, src_cnt, scf, len, |
1266 |
+ flags) : |
1267 |
+ __ioat3_prep_pq_lock(chan, pqres, pq, src, src_cnt, scf, len, |
1268 |
+@@ -1289,7 +1278,6 @@ static struct dma_async_tx_descriptor * |
1269 |
+ ioat3_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src, |
1270 |
+ unsigned int src_cnt, size_t len, unsigned long flags) |
1271 |
+ { |
1272 |
+- struct dma_device *dma = chan->device; |
1273 |
+ unsigned char scf[src_cnt]; |
1274 |
+ dma_addr_t pq[2]; |
1275 |
+ |
1276 |
+@@ -1298,7 +1286,7 @@ ioat3_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src, |
1277 |
+ flags |= DMA_PREP_PQ_DISABLE_Q; |
1278 |
+ pq[1] = dst; /* specify valid address for disabled result */ |
1279 |
+ |
1280 |
+- return (src_cnt > 8) && (dma->max_pq > 8) ? |
1281 |
++ return src_cnt_flags(src_cnt, flags) > 8 ? |
1282 |
+ __ioat3_prep_pq16_lock(chan, NULL, pq, src, src_cnt, scf, len, |
1283 |
+ flags) : |
1284 |
+ __ioat3_prep_pq_lock(chan, NULL, pq, src, src_cnt, scf, len, |
1285 |
+@@ -1310,7 +1298,6 @@ ioat3_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src, |
1286 |
+ unsigned int src_cnt, size_t len, |
1287 |
+ enum sum_check_flags *result, unsigned long flags) |
1288 |
+ { |
1289 |
+- struct dma_device *dma = chan->device; |
1290 |
+ unsigned char scf[src_cnt]; |
1291 |
+ dma_addr_t pq[2]; |
1292 |
+ |
1293 |
+@@ -1324,8 +1311,7 @@ ioat3_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src, |
1294 |
+ flags |= DMA_PREP_PQ_DISABLE_Q; |
1295 |
+ pq[1] = pq[0]; /* specify valid address for disabled result */ |
1296 |
+ |
1297 |
+- |
1298 |
+- return (src_cnt > 8) && (dma->max_pq > 8) ? |
1299 |
++ return src_cnt_flags(src_cnt, flags) > 8 ? |
1300 |
+ __ioat3_prep_pq16_lock(chan, result, pq, &src[1], src_cnt - 1, |
1301 |
+ scf, len, flags) : |
1302 |
+ __ioat3_prep_pq_lock(chan, result, pq, &src[1], src_cnt - 1, |
1303 |
+@@ -1545,6 +1531,8 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device) |
1304 |
+ goto free_resources; |
1305 |
+ } |
1306 |
+ |
1307 |
++ memset(page_address(dest), 0, PAGE_SIZE); |
1308 |
++ |
1309 |
+ /* test for non-zero parity sum */ |
1310 |
+ op = IOAT_OP_XOR_VAL; |
1311 |
+ |
1312 |
+diff --git a/drivers/edac/highbank_l2_edac.c b/drivers/edac/highbank_l2_edac.c |
1313 |
+index c2bd8c6a..10d3d298 100644 |
1314 |
+--- a/drivers/edac/highbank_l2_edac.c |
1315 |
++++ b/drivers/edac/highbank_l2_edac.c |
1316 |
+@@ -90,28 +90,30 @@ static int highbank_l2_err_probe(struct platform_device *pdev) |
1317 |
+ goto err; |
1318 |
+ } |
1319 |
+ |
1320 |
++ dci->mod_name = dev_name(&pdev->dev); |
1321 |
++ dci->dev_name = dev_name(&pdev->dev); |
1322 |
++ |
1323 |
++ if (edac_device_add_device(dci)) |
1324 |
++ goto err; |
1325 |
++ |
1326 |
+ drvdata->db_irq = platform_get_irq(pdev, 0); |
1327 |
+ res = devm_request_irq(&pdev->dev, drvdata->db_irq, |
1328 |
+ highbank_l2_err_handler, |
1329 |
+ 0, dev_name(&pdev->dev), dci); |
1330 |
+ if (res < 0) |
1331 |
+- goto err; |
1332 |
++ goto err2; |
1333 |
+ |
1334 |
+ drvdata->sb_irq = platform_get_irq(pdev, 1); |
1335 |
+ res = devm_request_irq(&pdev->dev, drvdata->sb_irq, |
1336 |
+ highbank_l2_err_handler, |
1337 |
+ 0, dev_name(&pdev->dev), dci); |
1338 |
+ if (res < 0) |
1339 |
+- goto err; |
1340 |
+- |
1341 |
+- dci->mod_name = dev_name(&pdev->dev); |
1342 |
+- dci->dev_name = dev_name(&pdev->dev); |
1343 |
+- |
1344 |
+- if (edac_device_add_device(dci)) |
1345 |
+- goto err; |
1346 |
++ goto err2; |
1347 |
+ |
1348 |
+ devres_close_group(&pdev->dev, NULL); |
1349 |
+ return 0; |
1350 |
++err2: |
1351 |
++ edac_device_del_device(&pdev->dev); |
1352 |
+ err: |
1353 |
+ devres_release_group(&pdev->dev, NULL); |
1354 |
+ edac_device_free_ctl_info(dci); |
1355 |
+diff --git a/drivers/edac/highbank_mc_edac.c b/drivers/edac/highbank_mc_edac.c |
1356 |
+index 4695dd2d..7a783075 100644 |
1357 |
+--- a/drivers/edac/highbank_mc_edac.c |
1358 |
++++ b/drivers/edac/highbank_mc_edac.c |
1359 |
+@@ -189,14 +189,6 @@ static int highbank_mc_probe(struct platform_device *pdev) |
1360 |
+ goto err; |
1361 |
+ } |
1362 |
+ |
1363 |
+- irq = platform_get_irq(pdev, 0); |
1364 |
+- res = devm_request_irq(&pdev->dev, irq, highbank_mc_err_handler, |
1365 |
+- 0, dev_name(&pdev->dev), mci); |
1366 |
+- if (res < 0) { |
1367 |
+- dev_err(&pdev->dev, "Unable to request irq %d\n", irq); |
1368 |
+- goto err; |
1369 |
+- } |
1370 |
+- |
1371 |
+ mci->mtype_cap = MEM_FLAG_DDR3; |
1372 |
+ mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; |
1373 |
+ mci->edac_cap = EDAC_FLAG_SECDED; |
1374 |
+@@ -217,10 +209,20 @@ static int highbank_mc_probe(struct platform_device *pdev) |
1375 |
+ if (res < 0) |
1376 |
+ goto err; |
1377 |
+ |
1378 |
++ irq = platform_get_irq(pdev, 0); |
1379 |
++ res = devm_request_irq(&pdev->dev, irq, highbank_mc_err_handler, |
1380 |
++ 0, dev_name(&pdev->dev), mci); |
1381 |
++ if (res < 0) { |
1382 |
++ dev_err(&pdev->dev, "Unable to request irq %d\n", irq); |
1383 |
++ goto err2; |
1384 |
++ } |
1385 |
++ |
1386 |
+ highbank_mc_create_debugfs_nodes(mci); |
1387 |
+ |
1388 |
+ devres_close_group(&pdev->dev, NULL); |
1389 |
+ return 0; |
1390 |
++err2: |
1391 |
++ edac_mc_del_mc(&pdev->dev); |
1392 |
+ err: |
1393 |
+ devres_release_group(&pdev->dev, NULL); |
1394 |
+ edac_mc_free(mci); |
1395 |
+diff --git a/drivers/gpio/gpio-msm-v2.c b/drivers/gpio/gpio-msm-v2.c |
1396 |
+index f7a0cc4d..7b373009 100644 |
1397 |
+--- a/drivers/gpio/gpio-msm-v2.c |
1398 |
++++ b/drivers/gpio/gpio-msm-v2.c |
1399 |
+@@ -102,7 +102,7 @@ struct msm_gpio_dev { |
1400 |
+ DECLARE_BITMAP(wake_irqs, MAX_NR_GPIO); |
1401 |
+ DECLARE_BITMAP(dual_edge_irqs, MAX_NR_GPIO); |
1402 |
+ struct irq_domain *domain; |
1403 |
+- unsigned int summary_irq; |
1404 |
++ int summary_irq; |
1405 |
+ void __iomem *msm_tlmm_base; |
1406 |
+ }; |
1407 |
+ |
1408 |
+diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c |
1409 |
+index 3c3321f9..db312904 100644 |
1410 |
+--- a/drivers/gpio/gpio-mvebu.c |
1411 |
++++ b/drivers/gpio/gpio-mvebu.c |
1412 |
+@@ -79,7 +79,7 @@ struct mvebu_gpio_chip { |
1413 |
+ spinlock_t lock; |
1414 |
+ void __iomem *membase; |
1415 |
+ void __iomem *percpu_membase; |
1416 |
+- unsigned int irqbase; |
1417 |
++ int irqbase; |
1418 |
+ struct irq_domain *domain; |
1419 |
+ int soc_variant; |
1420 |
+ }; |
1421 |
+diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c |
1422 |
+index 4274e2e7..e925ca2e 100644 |
1423 |
+--- a/drivers/gpio/gpio-pl061.c |
1424 |
++++ b/drivers/gpio/gpio-pl061.c |
1425 |
+@@ -286,11 +286,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) |
1426 |
+ if (!chip->base) |
1427 |
+ return -ENOMEM; |
1428 |
+ |
1429 |
+- chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, |
1430 |
+- irq_base, &pl061_domain_ops, chip); |
1431 |
+- if (!chip->domain) |
1432 |
+- return -ENODEV; |
1433 |
+- |
1434 |
+ spin_lock_init(&chip->lock); |
1435 |
+ |
1436 |
+ chip->gc.request = pl061_gpio_request; |
1437 |
+@@ -320,6 +315,11 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) |
1438 |
+ irq_set_chained_handler(irq, pl061_irq_handler); |
1439 |
+ irq_set_handler_data(irq, chip); |
1440 |
+ |
1441 |
++ chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR, |
1442 |
++ irq_base, &pl061_domain_ops, chip); |
1443 |
++ if (!chip->domain) |
1444 |
++ return -ENODEV; |
1445 |
++ |
1446 |
+ for (i = 0; i < PL061_GPIO_NR; i++) { |
1447 |
+ if (pdata) { |
1448 |
+ if (pdata->directions & (1 << i)) |
1449 |
+diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c |
1450 |
+index 6038966a..8f64b670 100644 |
1451 |
+--- a/drivers/gpio/gpio-rcar.c |
1452 |
++++ b/drivers/gpio/gpio-rcar.c |
1453 |
+@@ -380,7 +380,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) |
1454 |
+ if (!p->irq_domain) { |
1455 |
+ ret = -ENXIO; |
1456 |
+ dev_err(&pdev->dev, "cannot initialize irq domain\n"); |
1457 |
+- goto err1; |
1458 |
++ goto err0; |
1459 |
+ } |
1460 |
+ |
1461 |
+ if (devm_request_irq(&pdev->dev, irq->start, |
1462 |
+diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c |
1463 |
+index d8e4f6ef..db2de1a2 100644 |
1464 |
+--- a/drivers/gpio/gpio-twl4030.c |
1465 |
++++ b/drivers/gpio/gpio-twl4030.c |
1466 |
+@@ -354,17 +354,18 @@ static void twl_set(struct gpio_chip *chip, unsigned offset, int value) |
1467 |
+ static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value) |
1468 |
+ { |
1469 |
+ struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); |
1470 |
++ int ret = -EINVAL; |
1471 |
+ |
1472 |
+ mutex_lock(&priv->mutex); |
1473 |
+ if (offset < TWL4030_GPIO_MAX) |
1474 |
+- twl4030_set_gpio_dataout(offset, value); |
1475 |
++ ret = twl4030_set_gpio_direction(offset, 0); |
1476 |
+ |
1477 |
+ priv->direction |= BIT(offset); |
1478 |
+ mutex_unlock(&priv->mutex); |
1479 |
+ |
1480 |
+ twl_set(chip, offset, value); |
1481 |
+ |
1482 |
+- return 0; |
1483 |
++ return ret; |
1484 |
+ } |
1485 |
+ |
1486 |
+ static int twl_to_irq(struct gpio_chip *chip, unsigned offset) |
1487 |
+diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
1488 |
+index b53fff84..a069b5e2 100644 |
1489 |
+--- a/drivers/gpu/drm/i915/intel_ddi.c |
1490 |
++++ b/drivers/gpu/drm/i915/intel_ddi.c |
1491 |
+@@ -1285,6 +1285,26 @@ void intel_ddi_get_config(struct intel_encoder *encoder, |
1492 |
+ default: |
1493 |
+ break; |
1494 |
+ } |
1495 |
++ |
1496 |
++ if (encoder->type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp_bpp && |
1497 |
++ pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) { |
1498 |
++ /* |
1499 |
++ * This is a big fat ugly hack. |
1500 |
++ * |
1501 |
++ * Some machines in UEFI boot mode provide us a VBT that has 18 |
1502 |
++ * bpp and 1.62 GHz link bandwidth for eDP, which for reasons |
1503 |
++ * unknown we fail to light up. Yet the same BIOS boots up with |
1504 |
++ * 24 bpp and 2.7 GHz link. Use the same bpp as the BIOS uses as |
1505 |
++ * max, not what it tells us to use. |
1506 |
++ * |
1507 |
++ * Note: This will still be broken if the eDP panel is not lit |
1508 |
++ * up by the BIOS, and thus we can't get the mode at module |
1509 |
++ * load. |
1510 |
++ */ |
1511 |
++ DRM_DEBUG_KMS("pipe has %d bpp for eDP panel, overriding BIOS-provided max %d bpp\n", |
1512 |
++ pipe_config->pipe_bpp, dev_priv->vbt.edp_bpp); |
1513 |
++ dev_priv->vbt.edp_bpp = pipe_config->pipe_bpp; |
1514 |
++ } |
1515 |
+ } |
1516 |
+ |
1517 |
+ static void intel_ddi_destroy(struct drm_encoder *encoder) |
1518 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
1519 |
+index d78d33f9..333aa1bc 100644 |
1520 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
1521 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
1522 |
+@@ -6770,7 +6770,9 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base) |
1523 |
+ intel_crtc->cursor_visible = visible; |
1524 |
+ } |
1525 |
+ /* and commit changes on next vblank */ |
1526 |
++ POSTING_READ(CURCNTR(pipe)); |
1527 |
+ I915_WRITE(CURBASE(pipe), base); |
1528 |
++ POSTING_READ(CURBASE(pipe)); |
1529 |
+ } |
1530 |
+ |
1531 |
+ static void ivb_update_cursor(struct drm_crtc *crtc, u32 base) |
1532 |
+@@ -6799,7 +6801,9 @@ static void ivb_update_cursor(struct drm_crtc *crtc, u32 base) |
1533 |
+ intel_crtc->cursor_visible = visible; |
1534 |
+ } |
1535 |
+ /* and commit changes on next vblank */ |
1536 |
++ POSTING_READ(CURCNTR_IVB(pipe)); |
1537 |
+ I915_WRITE(CURBASE_IVB(pipe), base); |
1538 |
++ POSTING_READ(CURBASE_IVB(pipe)); |
1539 |
+ } |
1540 |
+ |
1541 |
+ /* If no-part of the cursor is visible on the framebuffer, then the GPU may hang... */ |
1542 |
+diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c |
1543 |
+index 7fa7df54..922cacc1 100644 |
1544 |
+--- a/drivers/gpu/drm/i915/intel_dvo.c |
1545 |
++++ b/drivers/gpu/drm/i915/intel_dvo.c |
1546 |
+@@ -171,11 +171,16 @@ static void intel_enable_dvo(struct intel_encoder *encoder) |
1547 |
+ { |
1548 |
+ struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
1549 |
+ struct intel_dvo *intel_dvo = enc_to_dvo(encoder); |
1550 |
++ struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
1551 |
+ u32 dvo_reg = intel_dvo->dev.dvo_reg; |
1552 |
+ u32 temp = I915_READ(dvo_reg); |
1553 |
+ |
1554 |
+ I915_WRITE(dvo_reg, temp | DVO_ENABLE); |
1555 |
+ I915_READ(dvo_reg); |
1556 |
++ intel_dvo->dev.dev_ops->mode_set(&intel_dvo->dev, |
1557 |
++ &crtc->config.requested_mode, |
1558 |
++ &crtc->config.adjusted_mode); |
1559 |
++ |
1560 |
+ intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, true); |
1561 |
+ } |
1562 |
+ |
1563 |
+@@ -184,6 +189,7 @@ static void intel_dvo_dpms(struct drm_connector *connector, int mode) |
1564 |
+ { |
1565 |
+ struct intel_dvo *intel_dvo = intel_attached_dvo(connector); |
1566 |
+ struct drm_crtc *crtc; |
1567 |
++ struct intel_crtc_config *config; |
1568 |
+ |
1569 |
+ /* dvo supports only 2 dpms states. */ |
1570 |
+ if (mode != DRM_MODE_DPMS_ON) |
1571 |
+@@ -204,10 +210,16 @@ static void intel_dvo_dpms(struct drm_connector *connector, int mode) |
1572 |
+ /* We call connector dpms manually below in case pipe dpms doesn't |
1573 |
+ * change due to cloning. */ |
1574 |
+ if (mode == DRM_MODE_DPMS_ON) { |
1575 |
++ config = &to_intel_crtc(crtc)->config; |
1576 |
++ |
1577 |
+ intel_dvo->base.connectors_active = true; |
1578 |
+ |
1579 |
+ intel_crtc_update_dpms(crtc); |
1580 |
+ |
1581 |
++ intel_dvo->dev.dev_ops->mode_set(&intel_dvo->dev, |
1582 |
++ &config->requested_mode, |
1583 |
++ &config->adjusted_mode); |
1584 |
++ |
1585 |
+ intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, true); |
1586 |
+ } else { |
1587 |
+ intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, false); |
1588 |
+@@ -299,10 +311,6 @@ static void intel_dvo_mode_set(struct intel_encoder *encoder) |
1589 |
+ break; |
1590 |
+ } |
1591 |
+ |
1592 |
+- intel_dvo->dev.dev_ops->mode_set(&intel_dvo->dev, |
1593 |
+- &crtc->config.requested_mode, |
1594 |
+- adjusted_mode); |
1595 |
+- |
1596 |
+ /* Save the data order, since I don't know what it should be set to. */ |
1597 |
+ dvo_val = I915_READ(dvo_reg) & |
1598 |
+ (DVO_PRESERVE_MASK | DVO_DATA_ORDER_GBRG); |
1599 |
+diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c |
1600 |
+index 8649f1c3..ee7d6491 100644 |
1601 |
+--- a/drivers/gpu/drm/i915/intel_uncore.c |
1602 |
++++ b/drivers/gpu/drm/i915/intel_uncore.c |
1603 |
+@@ -204,6 +204,19 @@ static void vlv_force_wake_put(struct drm_i915_private *dev_priv) |
1604 |
+ gen6_gt_check_fifodbg(dev_priv); |
1605 |
+ } |
1606 |
+ |
1607 |
++static void intel_uncore_forcewake_reset(struct drm_device *dev) |
1608 |
++{ |
1609 |
++ struct drm_i915_private *dev_priv = dev->dev_private; |
1610 |
++ |
1611 |
++ if (IS_VALLEYVIEW(dev)) { |
1612 |
++ vlv_force_wake_reset(dev_priv); |
1613 |
++ } else if (INTEL_INFO(dev)->gen >= 6) { |
1614 |
++ __gen6_gt_force_wake_reset(dev_priv); |
1615 |
++ if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) |
1616 |
++ __gen6_gt_force_wake_mt_reset(dev_priv); |
1617 |
++ } |
1618 |
++} |
1619 |
++ |
1620 |
+ void intel_uncore_early_sanitize(struct drm_device *dev) |
1621 |
+ { |
1622 |
+ struct drm_i915_private *dev_priv = dev->dev_private; |
1623 |
+@@ -259,19 +272,8 @@ void intel_uncore_init(struct drm_device *dev) |
1624 |
+ dev_priv->uncore.funcs.force_wake_put = |
1625 |
+ __gen6_gt_force_wake_put; |
1626 |
+ } |
1627 |
+-} |
1628 |
+ |
1629 |
+-static void intel_uncore_forcewake_reset(struct drm_device *dev) |
1630 |
+-{ |
1631 |
+- struct drm_i915_private *dev_priv = dev->dev_private; |
1632 |
+- |
1633 |
+- if (IS_VALLEYVIEW(dev)) { |
1634 |
+- vlv_force_wake_reset(dev_priv); |
1635 |
+- } else if (INTEL_INFO(dev)->gen >= 6) { |
1636 |
+- __gen6_gt_force_wake_reset(dev_priv); |
1637 |
+- if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) |
1638 |
+- __gen6_gt_force_wake_mt_reset(dev_priv); |
1639 |
+- } |
1640 |
++ intel_uncore_forcewake_reset(dev); |
1641 |
+ } |
1642 |
+ |
1643 |
+ void intel_uncore_sanitize(struct drm_device *dev) |
1644 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c |
1645 |
+index f32b7123..d2dfdf76 100644 |
1646 |
+--- a/drivers/gpu/drm/nouveau/nouveau_gem.c |
1647 |
++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c |
1648 |
+@@ -317,7 +317,8 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence, |
1649 |
+ list_for_each_safe(entry, tmp, list) { |
1650 |
+ nvbo = list_entry(entry, struct nouveau_bo, entry); |
1651 |
+ |
1652 |
+- nouveau_bo_fence(nvbo, fence); |
1653 |
++ if (likely(fence)) |
1654 |
++ nouveau_bo_fence(nvbo, fence); |
1655 |
+ |
1656 |
+ if (unlikely(nvbo->validate_mapped)) { |
1657 |
+ ttm_bo_kunmap(&nvbo->kmap); |
1658 |
+diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c |
1659 |
+index 88722f23..f437b30c 100644 |
1660 |
+--- a/drivers/gpu/drm/qxl/qxl_fb.c |
1661 |
++++ b/drivers/gpu/drm/qxl/qxl_fb.c |
1662 |
+@@ -108,7 +108,7 @@ static void qxl_fb_dirty_flush(struct fb_info *info) |
1663 |
+ u32 x1, x2, y1, y2; |
1664 |
+ |
1665 |
+ /* TODO: hard coding 32 bpp */ |
1666 |
+- int stride = qfbdev->qfb.base.pitches[0] * 4; |
1667 |
++ int stride = qfbdev->qfb.base.pitches[0]; |
1668 |
+ |
1669 |
+ x1 = qfbdev->dirty.x1; |
1670 |
+ x2 = qfbdev->dirty.x2; |
1671 |
+diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c |
1672 |
+index 0109a964..821ab7b9 100644 |
1673 |
+--- a/drivers/gpu/drm/qxl/qxl_release.c |
1674 |
++++ b/drivers/gpu/drm/qxl/qxl_release.c |
1675 |
+@@ -92,6 +92,7 @@ qxl_release_free(struct qxl_device *qdev, |
1676 |
+ - DRM_FILE_OFFSET); |
1677 |
+ qxl_fence_remove_release(&bo->fence, release->id); |
1678 |
+ qxl_bo_unref(&bo); |
1679 |
++ kfree(entry); |
1680 |
+ } |
1681 |
+ spin_lock(&qdev->release_idr_lock); |
1682 |
+ idr_remove(&qdev->release_idr, release->id); |
1683 |
+diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c |
1684 |
+index bf87f6d4..86d9ee08 100644 |
1685 |
+--- a/drivers/gpu/drm/radeon/atombios_crtc.c |
1686 |
++++ b/drivers/gpu/drm/radeon/atombios_crtc.c |
1687 |
+@@ -1753,7 +1753,7 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) |
1688 |
+ if (pll != ATOM_PPLL_INVALID) |
1689 |
+ return pll; |
1690 |
+ } |
1691 |
+- } else { |
1692 |
++ } else if (!ASIC_IS_DCE41(rdev)) { /* Don't share PLLs on DCE4.1 chips */ |
1693 |
+ /* use the same PPLL for all monitors with the same clock */ |
1694 |
+ pll = radeon_get_shared_nondp_ppll(crtc); |
1695 |
+ if (pll != ATOM_PPLL_INVALID) |
1696 |
+diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c |
1697 |
+index deaf98cd..0652ee0a 100644 |
1698 |
+--- a/drivers/gpu/drm/radeon/atombios_i2c.c |
1699 |
++++ b/drivers/gpu/drm/radeon/atombios_i2c.c |
1700 |
+@@ -56,8 +56,10 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, |
1701 |
+ return -EINVAL; |
1702 |
+ } |
1703 |
+ args.ucRegIndex = buf[0]; |
1704 |
+- if (num > 1) |
1705 |
+- memcpy(&out, &buf[1], num - 1); |
1706 |
++ if (num > 1) { |
1707 |
++ num--; |
1708 |
++ memcpy(&out, &buf[1], num); |
1709 |
++ } |
1710 |
+ args.lpI2CDataOut = cpu_to_le16(out); |
1711 |
+ } else { |
1712 |
+ if (num > ATOM_MAX_HW_I2C_READ) { |
1713 |
+diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c |
1714 |
+index 8f7e0453..5720e66d 100644 |
1715 |
+--- a/drivers/gpu/drm/radeon/radeon_asic.c |
1716 |
++++ b/drivers/gpu/drm/radeon/radeon_asic.c |
1717 |
+@@ -2019,6 +2019,8 @@ static struct radeon_asic ci_asic = { |
1718 |
+ .bandwidth_update = &dce8_bandwidth_update, |
1719 |
+ .get_vblank_counter = &evergreen_get_vblank_counter, |
1720 |
+ .wait_for_vblank = &dce4_wait_for_vblank, |
1721 |
++ .set_backlight_level = &atombios_set_backlight_level, |
1722 |
++ .get_backlight_level = &atombios_get_backlight_level, |
1723 |
+ .hdmi_enable = &evergreen_hdmi_enable, |
1724 |
+ .hdmi_setmode = &evergreen_hdmi_setmode, |
1725 |
+ }, |
1726 |
+@@ -2119,6 +2121,8 @@ static struct radeon_asic kv_asic = { |
1727 |
+ .bandwidth_update = &dce8_bandwidth_update, |
1728 |
+ .get_vblank_counter = &evergreen_get_vblank_counter, |
1729 |
+ .wait_for_vblank = &dce4_wait_for_vblank, |
1730 |
++ .set_backlight_level = &atombios_set_backlight_level, |
1731 |
++ .get_backlight_level = &atombios_get_backlight_level, |
1732 |
+ .hdmi_enable = &evergreen_hdmi_enable, |
1733 |
+ .hdmi_setmode = &evergreen_hdmi_setmode, |
1734 |
+ }, |
1735 |
+diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c |
1736 |
+index b990b1a2..3b1de72b 100644 |
1737 |
+--- a/drivers/gpu/drm/radeon/radeon_gart.c |
1738 |
++++ b/drivers/gpu/drm/radeon/radeon_gart.c |
1739 |
+@@ -1156,6 +1156,8 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, |
1740 |
+ return -ENOMEM; |
1741 |
+ |
1742 |
+ r = radeon_ib_get(rdev, ridx, &ib, NULL, ndw * 4); |
1743 |
++ if (r) |
1744 |
++ return r; |
1745 |
+ ib.length_dw = 0; |
1746 |
+ |
1747 |
+ r = radeon_vm_update_pdes(rdev, vm, &ib, bo_va->soffset, bo_va->eoffset); |
1748 |
+diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
1749 |
+index 7cb178a3..bc73021d 100644 |
1750 |
+--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
1751 |
++++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c |
1752 |
+@@ -422,6 +422,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, |
1753 |
+ /* Pin framebuffer & get tilling informations */ |
1754 |
+ obj = radeon_fb->obj; |
1755 |
+ rbo = gem_to_radeon_bo(obj); |
1756 |
++retry: |
1757 |
+ r = radeon_bo_reserve(rbo, false); |
1758 |
+ if (unlikely(r != 0)) |
1759 |
+ return r; |
1760 |
+@@ -430,6 +431,33 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, |
1761 |
+ &base); |
1762 |
+ if (unlikely(r != 0)) { |
1763 |
+ radeon_bo_unreserve(rbo); |
1764 |
++ |
1765 |
++ /* On old GPU like RN50 with little vram pining can fails because |
1766 |
++ * current fb is taking all space needed. So instead of unpining |
1767 |
++ * the old buffer after pining the new one, first unpin old one |
1768 |
++ * and then retry pining new one. |
1769 |
++ * |
1770 |
++ * As only master can set mode only master can pin and it is |
1771 |
++ * unlikely the master client will race with itself especialy |
1772 |
++ * on those old gpu with single crtc. |
1773 |
++ * |
1774 |
++ * We don't shutdown the display controller because new buffer |
1775 |
++ * will end up in same spot. |
1776 |
++ */ |
1777 |
++ if (!atomic && fb && fb != crtc->fb) { |
1778 |
++ struct radeon_bo *old_rbo; |
1779 |
++ unsigned long nsize, osize; |
1780 |
++ |
1781 |
++ old_rbo = gem_to_radeon_bo(to_radeon_framebuffer(fb)->obj); |
1782 |
++ osize = radeon_bo_size(old_rbo); |
1783 |
++ nsize = radeon_bo_size(rbo); |
1784 |
++ if (nsize <= osize && !radeon_bo_reserve(old_rbo, false)) { |
1785 |
++ radeon_bo_unpin(old_rbo); |
1786 |
++ radeon_bo_unreserve(old_rbo); |
1787 |
++ fb = NULL; |
1788 |
++ goto retry; |
1789 |
++ } |
1790 |
++ } |
1791 |
+ return -EINVAL; |
1792 |
+ } |
1793 |
+ radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); |
1794 |
+diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c |
1795 |
+index 308eff5b..ab0a1724 100644 |
1796 |
+--- a/drivers/gpu/drm/radeon/radeon_uvd.c |
1797 |
++++ b/drivers/gpu/drm/radeon/radeon_uvd.c |
1798 |
+@@ -240,6 +240,8 @@ void radeon_uvd_free_handles(struct radeon_device *rdev, struct drm_file *filp) |
1799 |
+ if (handle != 0 && rdev->uvd.filp[i] == filp) { |
1800 |
+ struct radeon_fence *fence; |
1801 |
+ |
1802 |
++ radeon_uvd_note_usage(rdev); |
1803 |
++ |
1804 |
+ r = radeon_uvd_get_destroy_msg(rdev, |
1805 |
+ R600_RING_TYPE_UVD_INDEX, handle, &fence); |
1806 |
+ if (r) { |
1807 |
+@@ -620,7 +622,7 @@ static int radeon_uvd_send_msg(struct radeon_device *rdev, |
1808 |
+ if (r) |
1809 |
+ goto err; |
1810 |
+ |
1811 |
+- r = radeon_ib_get(rdev, ring, &ib, NULL, 16); |
1812 |
++ r = radeon_ib_get(rdev, ring, &ib, NULL, 64); |
1813 |
+ if (r) |
1814 |
+ goto err; |
1815 |
+ |
1816 |
+diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h |
1817 |
+index 7e2e0ea6..6e23019c 100644 |
1818 |
+--- a/drivers/gpu/drm/radeon/sid.h |
1819 |
++++ b/drivers/gpu/drm/radeon/sid.h |
1820 |
+@@ -478,7 +478,7 @@ |
1821 |
+ #define STATE3_MASK (0x1f << 15) |
1822 |
+ #define STATE3_SHIFT 15 |
1823 |
+ |
1824 |
+-#define MC_SEQ_TRAIN_WAKEUP_CNTL 0x2808 |
1825 |
++#define MC_SEQ_TRAIN_WAKEUP_CNTL 0x28e8 |
1826 |
+ #define TRAIN_DONE_D0 (1 << 30) |
1827 |
+ #define TRAIN_DONE_D1 (1 << 31) |
1828 |
+ |
1829 |
+diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c |
1830 |
+index 9364129b..d700698a 100644 |
1831 |
+--- a/drivers/gpu/drm/radeon/trinity_dpm.c |
1832 |
++++ b/drivers/gpu/drm/radeon/trinity_dpm.c |
1833 |
+@@ -1873,9 +1873,9 @@ int trinity_dpm_init(struct radeon_device *rdev) |
1834 |
+ pi->enable_sclk_ds = true; |
1835 |
+ pi->enable_gfx_power_gating = true; |
1836 |
+ pi->enable_gfx_clock_gating = true; |
1837 |
+- pi->enable_mg_clock_gating = true; |
1838 |
+- pi->enable_gfx_dynamic_mgpg = true; /* ??? */ |
1839 |
+- pi->override_dynamic_mgpg = true; |
1840 |
++ pi->enable_mg_clock_gating = false; |
1841 |
++ pi->enable_gfx_dynamic_mgpg = false; |
1842 |
++ pi->override_dynamic_mgpg = false; |
1843 |
+ pi->enable_auto_thermal_throttling = true; |
1844 |
+ pi->voltage_drop_in_dce = false; /* need to restructure dpm/modeset interaction */ |
1845 |
+ pi->uvd_dpm = true; /* ??? */ |
1846 |
+diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c |
1847 |
+index f1a857ec..72980532 100644 |
1848 |
+--- a/drivers/gpu/drm/ttm/ttm_bo.c |
1849 |
++++ b/drivers/gpu/drm/ttm/ttm_bo.c |
1850 |
+@@ -986,24 +986,32 @@ out_unlock: |
1851 |
+ return ret; |
1852 |
+ } |
1853 |
+ |
1854 |
+-static int ttm_bo_mem_compat(struct ttm_placement *placement, |
1855 |
+- struct ttm_mem_reg *mem) |
1856 |
++static bool ttm_bo_mem_compat(struct ttm_placement *placement, |
1857 |
++ struct ttm_mem_reg *mem, |
1858 |
++ uint32_t *new_flags) |
1859 |
+ { |
1860 |
+ int i; |
1861 |
+ |
1862 |
+ if (mem->mm_node && placement->lpfn != 0 && |
1863 |
+ (mem->start < placement->fpfn || |
1864 |
+ mem->start + mem->num_pages > placement->lpfn)) |
1865 |
+- return -1; |
1866 |
++ return false; |
1867 |
+ |
1868 |
+ for (i = 0; i < placement->num_placement; i++) { |
1869 |
+- if ((placement->placement[i] & mem->placement & |
1870 |
+- TTM_PL_MASK_CACHING) && |
1871 |
+- (placement->placement[i] & mem->placement & |
1872 |
+- TTM_PL_MASK_MEM)) |
1873 |
+- return i; |
1874 |
++ *new_flags = placement->placement[i]; |
1875 |
++ if ((*new_flags & mem->placement & TTM_PL_MASK_CACHING) && |
1876 |
++ (*new_flags & mem->placement & TTM_PL_MASK_MEM)) |
1877 |
++ return true; |
1878 |
++ } |
1879 |
++ |
1880 |
++ for (i = 0; i < placement->num_busy_placement; i++) { |
1881 |
++ *new_flags = placement->busy_placement[i]; |
1882 |
++ if ((*new_flags & mem->placement & TTM_PL_MASK_CACHING) && |
1883 |
++ (*new_flags & mem->placement & TTM_PL_MASK_MEM)) |
1884 |
++ return true; |
1885 |
+ } |
1886 |
+- return -1; |
1887 |
++ |
1888 |
++ return false; |
1889 |
+ } |
1890 |
+ |
1891 |
+ int ttm_bo_validate(struct ttm_buffer_object *bo, |
1892 |
+@@ -1012,6 +1020,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, |
1893 |
+ bool no_wait_gpu) |
1894 |
+ { |
1895 |
+ int ret; |
1896 |
++ uint32_t new_flags; |
1897 |
+ |
1898 |
+ lockdep_assert_held(&bo->resv->lock.base); |
1899 |
+ /* Check that range is valid */ |
1900 |
+@@ -1022,8 +1031,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, |
1901 |
+ /* |
1902 |
+ * Check whether we need to move buffer. |
1903 |
+ */ |
1904 |
+- ret = ttm_bo_mem_compat(placement, &bo->mem); |
1905 |
+- if (ret < 0) { |
1906 |
++ if (!ttm_bo_mem_compat(placement, &bo->mem, &new_flags)) { |
1907 |
+ ret = ttm_bo_move_buffer(bo, placement, interruptible, |
1908 |
+ no_wait_gpu); |
1909 |
+ if (ret) |
1910 |
+@@ -1033,7 +1041,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, |
1911 |
+ * Use the access and other non-mapping-related flag bits from |
1912 |
+ * the compatible memory placement flags to the active flags |
1913 |
+ */ |
1914 |
+- ttm_flag_masked(&bo->mem.placement, placement->placement[ret], |
1915 |
++ ttm_flag_masked(&bo->mem.placement, new_flags, |
1916 |
+ ~TTM_PL_MASK_MEMTYPE); |
1917 |
+ } |
1918 |
+ /* |
1919 |
+diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c |
1920 |
+index 7cc904d3..4834c463 100644 |
1921 |
+--- a/drivers/gpu/drm/ttm/ttm_bo_util.c |
1922 |
++++ b/drivers/gpu/drm/ttm/ttm_bo_util.c |
1923 |
+@@ -343,19 +343,25 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, |
1924 |
+ if (ret) |
1925 |
+ goto out; |
1926 |
+ |
1927 |
++ /* |
1928 |
++ * Single TTM move. NOP. |
1929 |
++ */ |
1930 |
+ if (old_iomap == NULL && new_iomap == NULL) |
1931 |
+ goto out2; |
1932 |
++ |
1933 |
++ /* |
1934 |
++ * Move nonexistent data. NOP. |
1935 |
++ */ |
1936 |
+ if (old_iomap == NULL && ttm == NULL) |
1937 |
+ goto out2; |
1938 |
+ |
1939 |
+- if (ttm->state == tt_unpopulated) { |
1940 |
++ /* |
1941 |
++ * TTM might be null for moves within the same region. |
1942 |
++ */ |
1943 |
++ if (ttm && ttm->state == tt_unpopulated) { |
1944 |
+ ret = ttm->bdev->driver->ttm_tt_populate(ttm); |
1945 |
+- if (ret) { |
1946 |
+- /* if we fail here don't nuke the mm node |
1947 |
+- * as the bo still owns it */ |
1948 |
+- old_copy.mm_node = NULL; |
1949 |
++ if (ret) |
1950 |
+ goto out1; |
1951 |
+- } |
1952 |
+ } |
1953 |
+ |
1954 |
+ add = 0; |
1955 |
+@@ -381,11 +387,8 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, |
1956 |
+ prot); |
1957 |
+ } else |
1958 |
+ ret = ttm_copy_io_page(new_iomap, old_iomap, page); |
1959 |
+- if (ret) { |
1960 |
+- /* failing here, means keep old copy as-is */ |
1961 |
+- old_copy.mm_node = NULL; |
1962 |
++ if (ret) |
1963 |
+ goto out1; |
1964 |
+- } |
1965 |
+ } |
1966 |
+ mb(); |
1967 |
+ out2: |
1968 |
+@@ -403,7 +406,12 @@ out1: |
1969 |
+ ttm_mem_reg_iounmap(bdev, old_mem, new_iomap); |
1970 |
+ out: |
1971 |
+ ttm_mem_reg_iounmap(bdev, &old_copy, old_iomap); |
1972 |
+- ttm_bo_mem_put(bo, &old_copy); |
1973 |
++ |
1974 |
++ /* |
1975 |
++ * On error, keep the mm node! |
1976 |
++ */ |
1977 |
++ if (!ret) |
1978 |
++ ttm_bo_mem_put(bo, &old_copy); |
1979 |
+ return ret; |
1980 |
+ } |
1981 |
+ EXPORT_SYMBOL(ttm_bo_move_memcpy); |
1982 |
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c |
1983 |
+index 37fb4bef..252501a5 100644 |
1984 |
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c |
1985 |
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c |
1986 |
+@@ -32,6 +32,8 @@ |
1987 |
+ #include <drm/drmP.h> |
1988 |
+ #include "vmwgfx_resource_priv.h" |
1989 |
+ |
1990 |
++#define VMW_RES_EVICT_ERR_COUNT 10 |
1991 |
++ |
1992 |
+ struct vmw_user_dma_buffer { |
1993 |
+ struct ttm_base_object base; |
1994 |
+ struct vmw_dma_buffer dma; |
1995 |
+@@ -1091,8 +1093,9 @@ vmw_resource_backoff_reservation(struct ww_acquire_ctx *ticket, |
1996 |
+ * to a backup buffer. |
1997 |
+ * |
1998 |
+ * @res: The resource to evict. |
1999 |
++ * @interruptible: Whether to wait interruptible. |
2000 |
+ */ |
2001 |
+-int vmw_resource_do_evict(struct vmw_resource *res) |
2002 |
++int vmw_resource_do_evict(struct vmw_resource *res, bool interruptible) |
2003 |
+ { |
2004 |
+ struct ttm_validate_buffer val_buf; |
2005 |
+ const struct vmw_res_func *func = res->func; |
2006 |
+@@ -1102,7 +1105,8 @@ int vmw_resource_do_evict(struct vmw_resource *res) |
2007 |
+ BUG_ON(!func->may_evict); |
2008 |
+ |
2009 |
+ val_buf.bo = NULL; |
2010 |
+- ret = vmw_resource_check_buffer(res, &ticket, true, &val_buf); |
2011 |
++ ret = vmw_resource_check_buffer(res, &ticket, interruptible, |
2012 |
++ &val_buf); |
2013 |
+ if (unlikely(ret != 0)) |
2014 |
+ return ret; |
2015 |
+ |
2016 |
+@@ -1141,6 +1145,7 @@ int vmw_resource_validate(struct vmw_resource *res) |
2017 |
+ struct vmw_private *dev_priv = res->dev_priv; |
2018 |
+ struct list_head *lru_list = &dev_priv->res_lru[res->func->res_type]; |
2019 |
+ struct ttm_validate_buffer val_buf; |
2020 |
++ unsigned err_count = 0; |
2021 |
+ |
2022 |
+ if (likely(!res->func->may_evict)) |
2023 |
+ return 0; |
2024 |
+@@ -1155,7 +1160,7 @@ int vmw_resource_validate(struct vmw_resource *res) |
2025 |
+ |
2026 |
+ write_lock(&dev_priv->resource_lock); |
2027 |
+ if (list_empty(lru_list) || !res->func->may_evict) { |
2028 |
+- DRM_ERROR("Out of device device id entries " |
2029 |
++ DRM_ERROR("Out of device device resources " |
2030 |
+ "for %s.\n", res->func->type_name); |
2031 |
+ ret = -EBUSY; |
2032 |
+ write_unlock(&dev_priv->resource_lock); |
2033 |
+@@ -1168,7 +1173,19 @@ int vmw_resource_validate(struct vmw_resource *res) |
2034 |
+ list_del_init(&evict_res->lru_head); |
2035 |
+ |
2036 |
+ write_unlock(&dev_priv->resource_lock); |
2037 |
+- vmw_resource_do_evict(evict_res); |
2038 |
++ |
2039 |
++ ret = vmw_resource_do_evict(evict_res, true); |
2040 |
++ if (unlikely(ret != 0)) { |
2041 |
++ write_lock(&dev_priv->resource_lock); |
2042 |
++ list_add_tail(&evict_res->lru_head, lru_list); |
2043 |
++ write_unlock(&dev_priv->resource_lock); |
2044 |
++ if (ret == -ERESTARTSYS || |
2045 |
++ ++err_count > VMW_RES_EVICT_ERR_COUNT) { |
2046 |
++ vmw_resource_unreference(&evict_res); |
2047 |
++ goto out_no_validate; |
2048 |
++ } |
2049 |
++ } |
2050 |
++ |
2051 |
+ vmw_resource_unreference(&evict_res); |
2052 |
+ } while (1); |
2053 |
+ |
2054 |
+@@ -1253,13 +1270,15 @@ bool vmw_resource_needs_backup(const struct vmw_resource *res) |
2055 |
+ * @type: The resource type to evict |
2056 |
+ * |
2057 |
+ * To avoid thrashing starvation or as part of the hibernation sequence, |
2058 |
+- * evict all evictable resources of a specific type. |
2059 |
++ * try to evict all evictable resources of a specific type. |
2060 |
+ */ |
2061 |
+ static void vmw_resource_evict_type(struct vmw_private *dev_priv, |
2062 |
+ enum vmw_res_type type) |
2063 |
+ { |
2064 |
+ struct list_head *lru_list = &dev_priv->res_lru[type]; |
2065 |
+ struct vmw_resource *evict_res; |
2066 |
++ unsigned err_count = 0; |
2067 |
++ int ret; |
2068 |
+ |
2069 |
+ do { |
2070 |
+ write_lock(&dev_priv->resource_lock); |
2071 |
+@@ -1272,7 +1291,18 @@ static void vmw_resource_evict_type(struct vmw_private *dev_priv, |
2072 |
+ lru_head)); |
2073 |
+ list_del_init(&evict_res->lru_head); |
2074 |
+ write_unlock(&dev_priv->resource_lock); |
2075 |
+- vmw_resource_do_evict(evict_res); |
2076 |
++ |
2077 |
++ ret = vmw_resource_do_evict(evict_res, false); |
2078 |
++ if (unlikely(ret != 0)) { |
2079 |
++ write_lock(&dev_priv->resource_lock); |
2080 |
++ list_add_tail(&evict_res->lru_head, lru_list); |
2081 |
++ write_unlock(&dev_priv->resource_lock); |
2082 |
++ if (++err_count > VMW_RES_EVICT_ERR_COUNT) { |
2083 |
++ vmw_resource_unreference(&evict_res); |
2084 |
++ return; |
2085 |
++ } |
2086 |
++ } |
2087 |
++ |
2088 |
+ vmw_resource_unreference(&evict_res); |
2089 |
+ } while (1); |
2090 |
+ |
2091 |
+diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig |
2092 |
+index c91d5471..1fc15699 100644 |
2093 |
+--- a/drivers/hid/Kconfig |
2094 |
++++ b/drivers/hid/Kconfig |
2095 |
+@@ -242,6 +242,7 @@ config HID_HOLTEK |
2096 |
+ - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 / |
2097 |
+ Zalman ZM-GM1 |
2098 |
+ - SHARKOON DarkGlider Gaming mouse |
2099 |
++ - LEETGION Hellion Gaming Mouse |
2100 |
+ |
2101 |
+ config HOLTEK_FF |
2102 |
+ bool "Holtek On Line Grip force feedback support" |
2103 |
+@@ -369,12 +370,14 @@ config LOGITECH_FF |
2104 |
+ force feedback. |
2105 |
+ |
2106 |
+ config LOGIRUMBLEPAD2_FF |
2107 |
+- bool "Logitech RumblePad/Rumblepad 2 force feedback support" |
2108 |
++ bool "Logitech force feedback support (variant 2)" |
2109 |
+ depends on HID_LOGITECH |
2110 |
+ select INPUT_FF_MEMLESS |
2111 |
+ help |
2112 |
+- Say Y here if you want to enable force feedback support for Logitech |
2113 |
+- RumblePad and Rumblepad 2 devices. |
2114 |
++ Say Y here if you want to enable force feedback support for: |
2115 |
++ - Logitech RumblePad |
2116 |
++ - Logitech Rumblepad 2 |
2117 |
++ - Logitech Formula Vibration Feedback Wheel |
2118 |
+ |
2119 |
+ config LOGIG940_FF |
2120 |
+ bool "Logitech Flight System G940 force feedback support" |
2121 |
+@@ -453,9 +456,11 @@ config HID_MULTITOUCH |
2122 |
+ - Pixcir dual touch panels |
2123 |
+ - Quanta panels |
2124 |
+ - eGalax dual-touch panels, including the Joojoo and Wetab tablets |
2125 |
++ - SiS multitouch panels |
2126 |
+ - Stantum multitouch panels |
2127 |
+ - Touch International Panels |
2128 |
+ - Unitec Panels |
2129 |
++ - Wistron optical touch panels |
2130 |
+ - XAT optical touch panels |
2131 |
+ - Xiroku optical touch panels |
2132 |
+ - Zytronic touch panels |
2133 |
+diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c |
2134 |
+index 881cf7b4..3b219b95 100644 |
2135 |
+--- a/drivers/hid/hid-apple.c |
2136 |
++++ b/drivers/hid/hid-apple.c |
2137 |
+@@ -46,6 +46,12 @@ module_param(iso_layout, uint, 0644); |
2138 |
+ MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. " |
2139 |
+ "(0 = disabled, [1] = enabled)"); |
2140 |
+ |
2141 |
++static unsigned int swap_opt_cmd = 0; |
2142 |
++module_param(swap_opt_cmd, uint, 0644); |
2143 |
++MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\") keys. " |
2144 |
++ "(For people who want to keep Windows PC keyboard muscle memory. " |
2145 |
++ "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)"); |
2146 |
++ |
2147 |
+ struct apple_sc { |
2148 |
+ unsigned long quirks; |
2149 |
+ unsigned int fn_on; |
2150 |
+@@ -150,6 +156,14 @@ static const struct apple_key_translation apple_iso_keyboard[] = { |
2151 |
+ { } |
2152 |
+ }; |
2153 |
+ |
2154 |
++static const struct apple_key_translation swapped_option_cmd_keys[] = { |
2155 |
++ { KEY_LEFTALT, KEY_LEFTMETA }, |
2156 |
++ { KEY_LEFTMETA, KEY_LEFTALT }, |
2157 |
++ { KEY_RIGHTALT, KEY_RIGHTMETA }, |
2158 |
++ { KEY_RIGHTMETA,KEY_RIGHTALT }, |
2159 |
++ { } |
2160 |
++}; |
2161 |
++ |
2162 |
+ static const struct apple_key_translation *apple_find_translation( |
2163 |
+ const struct apple_key_translation *table, u16 from) |
2164 |
+ { |
2165 |
+@@ -242,6 +256,14 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, |
2166 |
+ } |
2167 |
+ } |
2168 |
+ |
2169 |
++ if (swap_opt_cmd) { |
2170 |
++ trans = apple_find_translation(swapped_option_cmd_keys, usage->code); |
2171 |
++ if (trans) { |
2172 |
++ input_event(input, usage->type, trans->to, value); |
2173 |
++ return 1; |
2174 |
++ } |
2175 |
++ } |
2176 |
++ |
2177 |
+ return 0; |
2178 |
+ } |
2179 |
+ |
2180 |
+diff --git a/drivers/hid/hid-axff.c b/drivers/hid/hid-axff.c |
2181 |
+index 64ab94a5..a594e478 100644 |
2182 |
+--- a/drivers/hid/hid-axff.c |
2183 |
++++ b/drivers/hid/hid-axff.c |
2184 |
+@@ -95,7 +95,7 @@ static int axff_init(struct hid_device *hid) |
2185 |
+ } |
2186 |
+ } |
2187 |
+ |
2188 |
+- if (field_count < 4) { |
2189 |
++ if (field_count < 4 && hid->product != 0xf705) { |
2190 |
+ hid_err(hid, "not enough fields in the report: %d\n", |
2191 |
+ field_count); |
2192 |
+ return -ENODEV; |
2193 |
+@@ -180,6 +180,7 @@ static void ax_remove(struct hid_device *hdev) |
2194 |
+ |
2195 |
+ static const struct hid_device_id ax_devices[] = { |
2196 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802), }, |
2197 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705), }, |
2198 |
+ { } |
2199 |
+ }; |
2200 |
+ MODULE_DEVICE_TABLE(hid, ax_devices); |
2201 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
2202 |
+index e80da623..c08b5c14 100644 |
2203 |
+--- a/drivers/hid/hid-core.c |
2204 |
++++ b/drivers/hid/hid-core.c |
2205 |
+@@ -1605,6 +1605,7 @@ static const struct hid_device_id hid_have_special_driver[] = { |
2206 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, |
2207 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, |
2208 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, |
2209 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) }, |
2210 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, |
2211 |
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, |
2212 |
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, |
2213 |
+@@ -1716,6 +1717,7 @@ static const struct hid_device_id hid_have_special_driver[] = { |
2214 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, |
2215 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, |
2216 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, |
2217 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) }, |
2218 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, |
2219 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) }, |
2220 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, |
2221 |
+@@ -1754,6 +1756,7 @@ static const struct hid_device_id hid_have_special_driver[] = { |
2222 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) }, |
2223 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, |
2224 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, |
2225 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL) }, |
2226 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) }, |
2227 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, |
2228 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, |
2229 |
+@@ -1801,12 +1804,14 @@ static const struct hid_device_id hid_have_special_driver[] = { |
2230 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, |
2231 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, |
2232 |
+ #if IS_ENABLED(CONFIG_HID_ROCCAT) |
2233 |
+- { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, |
2234 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, |
2235 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, |
2236 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKUFX) }, |
2237 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, |
2238 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, |
2239 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) }, |
2240 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE_OPTICAL) }, |
2241 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEXTD) }, |
2242 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, |
2243 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, |
2244 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, |
2245 |
+@@ -1816,6 +1821,8 @@ static const struct hid_device_id hid_have_special_driver[] = { |
2246 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, |
2247 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
2248 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, |
2249 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH) }, |
2250 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS817_TOUCH) }, |
2251 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, |
2252 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) }, |
2253 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) }, |
2254 |
+@@ -2376,15 +2383,6 @@ bool hid_ignore(struct hid_device *hdev) |
2255 |
+ hdev->type == HID_TYPE_USBNONE) |
2256 |
+ return true; |
2257 |
+ break; |
2258 |
+- case USB_VENDOR_ID_DWAV: |
2259 |
+- /* These are handled by usbtouchscreen. hdev->type is probably |
2260 |
+- * HID_TYPE_USBNONE, but we say !HID_TYPE_USBMOUSE to match |
2261 |
+- * usbtouchscreen. */ |
2262 |
+- if ((hdev->product == USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER || |
2263 |
+- hdev->product == USB_DEVICE_ID_DWAV_TOUCHCONTROLLER) && |
2264 |
+- hdev->type != HID_TYPE_USBMOUSE) |
2265 |
+- return true; |
2266 |
+- break; |
2267 |
+ case USB_VENDOR_ID_VELLEMAN: |
2268 |
+ /* These are not HID devices. They are handled by comedi. */ |
2269 |
+ if ((hdev->product >= USB_DEVICE_ID_VELLEMAN_K8055_FIRST && |
2270 |
+diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c |
2271 |
+index e696566c..0caa676d 100644 |
2272 |
+--- a/drivers/hid/hid-holtek-mouse.c |
2273 |
++++ b/drivers/hid/hid-holtek-mouse.c |
2274 |
+@@ -28,6 +28,7 @@ |
2275 |
+ * - USB ID 04d9:a04a, sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200 |
2276 |
+ * and Zalman ZM-GM1 |
2277 |
+ * - USB ID 04d9:a081, sold as SHARKOON DarkGlider Gaming mouse |
2278 |
++ * - USB ID 04d9:a072, sold as LEETGION Hellion Gaming Mouse |
2279 |
+ */ |
2280 |
+ |
2281 |
+ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
2282 |
+@@ -40,6 +41,7 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
2283 |
+ * 0x2fff, so they don't exceed HID_MAX_USAGES */ |
2284 |
+ switch (hdev->product) { |
2285 |
+ case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067: |
2286 |
++ case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072: |
2287 |
+ if (*rsize >= 122 && rdesc[115] == 0xff && rdesc[116] == 0x7f |
2288 |
+ && rdesc[120] == 0xff && rdesc[121] == 0x7f) { |
2289 |
+ hid_info(hdev, "Fixing up report descriptor\n"); |
2290 |
+@@ -66,6 +68,8 @@ static const struct hid_device_id holtek_mouse_devices[] = { |
2291 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, |
2292 |
+ USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, |
2293 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, |
2294 |
++ USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) }, |
2295 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, |
2296 |
+ USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, |
2297 |
+ { } |
2298 |
+ }; |
2299 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
2300 |
+index f0296a50..9480b425 100644 |
2301 |
+--- a/drivers/hid/hid-ids.h |
2302 |
++++ b/drivers/hid/hid-ids.h |
2303 |
+@@ -332,6 +332,11 @@ |
2304 |
+ #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc |
2305 |
+ #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0003 |
2306 |
+ #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS 0x0100 |
2307 |
++#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0101 0x0101 |
2308 |
++#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0102 0x0102 |
2309 |
++#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0106 0x0106 |
2310 |
++#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a |
2311 |
++#define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 |
2312 |
+ |
2313 |
+ #define USB_VENDOR_ID_GLAB 0x06c2 |
2314 |
+ #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 |
2315 |
+@@ -448,8 +453,9 @@ |
2316 |
+ |
2317 |
+ #define USB_VENDOR_ID_HOLTEK_ALT 0x04d9 |
2318 |
+ #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 |
2319 |
+-#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067 |
2320 |
+ #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a |
2321 |
++#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067 |
2322 |
++#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072 0xa072 |
2323 |
+ #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081 |
2324 |
+ |
2325 |
+ #define USB_VENDOR_ID_IMATION 0x0718 |
2326 |
+@@ -571,6 +577,7 @@ |
2327 |
+ #define USB_DEVICE_ID_DINOVO_EDGE 0xc714 |
2328 |
+ #define USB_DEVICE_ID_DINOVO_MINI 0xc71f |
2329 |
+ #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2 0xca03 |
2330 |
++#define USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL 0xca04 |
2331 |
+ |
2332 |
+ #define USB_VENDOR_ID_LUMIO 0x202e |
2333 |
+ #define USB_DEVICE_ID_CRYSTALTOUCH 0x0006 |
2334 |
+@@ -745,6 +752,10 @@ |
2335 |
+ #define USB_VENDOR_ID_SIGMATEL 0x066F |
2336 |
+ #define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 |
2337 |
+ |
2338 |
++#define USB_VENDOR_ID_SIS2_TOUCH 0x0457 |
2339 |
++#define USB_DEVICE_ID_SIS9200_TOUCH 0x9200 |
2340 |
++#define USB_DEVICE_ID_SIS817_TOUCH 0x0817 |
2341 |
++ |
2342 |
+ #define USB_VENDOR_ID_SKYCABLE 0x1223 |
2343 |
+ #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 |
2344 |
+ |
2345 |
+@@ -888,6 +899,9 @@ |
2346 |
+ #define USB_DEVICE_ID_SUPER_DUAL_BOX_PRO 0x8802 |
2347 |
+ #define USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO 0x8804 |
2348 |
+ |
2349 |
++#define USB_VENDOR_ID_WISTRON 0x0fb8 |
2350 |
++#define USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH 0x1109 |
2351 |
++ |
2352 |
+ #define USB_VENDOR_ID_X_TENSIONS 0x1ae7 |
2353 |
+ #define USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE 0x9001 |
2354 |
+ |
2355 |
+diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c |
2356 |
+index 6f12ecd3..1bfd292c 100644 |
2357 |
+--- a/drivers/hid/hid-lg.c |
2358 |
++++ b/drivers/hid/hid-lg.c |
2359 |
+@@ -45,6 +45,7 @@ |
2360 |
+ /* Size of the original descriptors of the Driving Force (and Pro) wheels */ |
2361 |
+ #define DF_RDESC_ORIG_SIZE 130 |
2362 |
+ #define DFP_RDESC_ORIG_SIZE 97 |
2363 |
++#define FV_RDESC_ORIG_SIZE 130 |
2364 |
+ #define MOMO_RDESC_ORIG_SIZE 87 |
2365 |
+ |
2366 |
+ /* Fixed report descriptors for Logitech Driving Force (and Pro) |
2367 |
+@@ -170,6 +171,73 @@ static __u8 dfp_rdesc_fixed[] = { |
2368 |
+ 0xC0 /* End Collection */ |
2369 |
+ }; |
2370 |
+ |
2371 |
++static __u8 fv_rdesc_fixed[] = { |
2372 |
++0x05, 0x01, /* Usage Page (Desktop), */ |
2373 |
++0x09, 0x04, /* Usage (Joystik), */ |
2374 |
++0xA1, 0x01, /* Collection (Application), */ |
2375 |
++0xA1, 0x02, /* Collection (Logical), */ |
2376 |
++0x95, 0x01, /* Report Count (1), */ |
2377 |
++0x75, 0x0A, /* Report Size (10), */ |
2378 |
++0x15, 0x00, /* Logical Minimum (0), */ |
2379 |
++0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
2380 |
++0x35, 0x00, /* Physical Minimum (0), */ |
2381 |
++0x46, 0xFF, 0x03, /* Physical Maximum (1023), */ |
2382 |
++0x09, 0x30, /* Usage (X), */ |
2383 |
++0x81, 0x02, /* Input (Variable), */ |
2384 |
++0x95, 0x0C, /* Report Count (12), */ |
2385 |
++0x75, 0x01, /* Report Size (1), */ |
2386 |
++0x25, 0x01, /* Logical Maximum (1), */ |
2387 |
++0x45, 0x01, /* Physical Maximum (1), */ |
2388 |
++0x05, 0x09, /* Usage Page (Button), */ |
2389 |
++0x19, 0x01, /* Usage Minimum (01h), */ |
2390 |
++0x29, 0x0C, /* Usage Maximum (0Ch), */ |
2391 |
++0x81, 0x02, /* Input (Variable), */ |
2392 |
++0x95, 0x02, /* Report Count (2), */ |
2393 |
++0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
2394 |
++0x09, 0x01, /* Usage (01h), */ |
2395 |
++0x81, 0x02, /* Input (Variable), */ |
2396 |
++0x09, 0x02, /* Usage (02h), */ |
2397 |
++0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
2398 |
++0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
2399 |
++0x95, 0x01, /* Report Count (1), */ |
2400 |
++0x75, 0x08, /* Report Size (8), */ |
2401 |
++0x81, 0x02, /* Input (Variable), */ |
2402 |
++0x05, 0x01, /* Usage Page (Desktop), */ |
2403 |
++0x25, 0x07, /* Logical Maximum (7), */ |
2404 |
++0x46, 0x3B, 0x01, /* Physical Maximum (315), */ |
2405 |
++0x75, 0x04, /* Report Size (4), */ |
2406 |
++0x65, 0x14, /* Unit (Degrees), */ |
2407 |
++0x09, 0x39, /* Usage (Hat Switch), */ |
2408 |
++0x81, 0x42, /* Input (Variable, Null State), */ |
2409 |
++0x75, 0x01, /* Report Size (1), */ |
2410 |
++0x95, 0x04, /* Report Count (4), */ |
2411 |
++0x65, 0x00, /* Unit, */ |
2412 |
++0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ |
2413 |
++0x09, 0x01, /* Usage (01h), */ |
2414 |
++0x25, 0x01, /* Logical Maximum (1), */ |
2415 |
++0x45, 0x01, /* Physical Maximum (1), */ |
2416 |
++0x81, 0x02, /* Input (Variable), */ |
2417 |
++0x05, 0x01, /* Usage Page (Desktop), */ |
2418 |
++0x95, 0x01, /* Report Count (1), */ |
2419 |
++0x75, 0x08, /* Report Size (8), */ |
2420 |
++0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
2421 |
++0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
2422 |
++0x09, 0x31, /* Usage (Y), */ |
2423 |
++0x81, 0x02, /* Input (Variable), */ |
2424 |
++0x09, 0x32, /* Usage (Z), */ |
2425 |
++0x81, 0x02, /* Input (Variable), */ |
2426 |
++0xC0, /* End Collection, */ |
2427 |
++0xA1, 0x02, /* Collection (Logical), */ |
2428 |
++0x26, 0xFF, 0x00, /* Logical Maximum (255), */ |
2429 |
++0x46, 0xFF, 0x00, /* Physical Maximum (255), */ |
2430 |
++0x95, 0x07, /* Report Count (7), */ |
2431 |
++0x75, 0x08, /* Report Size (8), */ |
2432 |
++0x09, 0x03, /* Usage (03h), */ |
2433 |
++0x91, 0x02, /* Output (Variable), */ |
2434 |
++0xC0, /* End Collection, */ |
2435 |
++0xC0 /* End Collection */ |
2436 |
++}; |
2437 |
++ |
2438 |
+ static __u8 momo_rdesc_fixed[] = { |
2439 |
+ 0x05, 0x01, /* Usage Page (Desktop), */ |
2440 |
+ 0x09, 0x04, /* Usage (Joystik), */ |
2441 |
+@@ -275,6 +343,15 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
2442 |
+ } |
2443 |
+ break; |
2444 |
+ |
2445 |
++ case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL: |
2446 |
++ if (*rsize == FV_RDESC_ORIG_SIZE) { |
2447 |
++ hid_info(hdev, |
2448 |
++ "fixing up Logitech Formula Vibration report descriptor\n"); |
2449 |
++ rdesc = fv_rdesc_fixed; |
2450 |
++ *rsize = sizeof(fv_rdesc_fixed); |
2451 |
++ } |
2452 |
++ break; |
2453 |
++ |
2454 |
+ case USB_DEVICE_ID_LOGITECH_DFP_WHEEL: |
2455 |
+ if (*rsize == DFP_RDESC_ORIG_SIZE) { |
2456 |
+ hid_info(hdev, |
2457 |
+@@ -492,6 +569,7 @@ static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
2458 |
+ case USB_DEVICE_ID_LOGITECH_G27_WHEEL: |
2459 |
+ case USB_DEVICE_ID_LOGITECH_WII_WHEEL: |
2460 |
+ case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2: |
2461 |
++ case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL: |
2462 |
+ field->application = HID_GD_MULTIAXIS; |
2463 |
+ break; |
2464 |
+ default: |
2465 |
+@@ -639,6 +717,8 @@ static const struct hid_device_id lg_devices[] = { |
2466 |
+ .driver_data = LG_NOGET | LG_FF4 }, |
2467 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2), |
2468 |
+ .driver_data = LG_FF4 }, |
2469 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL), |
2470 |
++ .driver_data = LG_FF2 }, |
2471 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL), |
2472 |
+ .driver_data = LG_FF4 }, |
2473 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL), |
2474 |
+diff --git a/drivers/hid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c |
2475 |
+index 1a42eaa6..0e3fb1a7 100644 |
2476 |
+--- a/drivers/hid/hid-lg2ff.c |
2477 |
++++ b/drivers/hid/hid-lg2ff.c |
2478 |
+@@ -95,7 +95,7 @@ int lg2ff_init(struct hid_device *hid) |
2479 |
+ |
2480 |
+ hid_hw_request(hid, report, HID_REQ_SET_REPORT); |
2481 |
+ |
2482 |
+- hid_info(hid, "Force feedback for Logitech RumblePad/Rumblepad 2 by Anssi Hannula <anssi.hannula@×××××.com>\n"); |
2483 |
++ hid_info(hid, "Force feedback for Logitech variant 2 rumble devices by Anssi Hannula <anssi.hannula@×××××.com>\n"); |
2484 |
+ |
2485 |
+ return 0; |
2486 |
+ } |
2487 |
+diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c |
2488 |
+index 8782fe1a..49f6cc0f 100644 |
2489 |
+--- a/drivers/hid/hid-lg4ff.c |
2490 |
++++ b/drivers/hid/hid-lg4ff.c |
2491 |
+@@ -218,12 +218,46 @@ static void hid_lg4ff_set_autocenter_default(struct input_dev *dev, u16 magnitud |
2492 |
+ struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; |
2493 |
+ struct hid_report *report = list_entry(report_list->next, struct hid_report, list); |
2494 |
+ __s32 *value = report->field[0]->value; |
2495 |
++ __u32 expand_a, expand_b; |
2496 |
++ |
2497 |
++ /* De-activate Auto-Center */ |
2498 |
++ if (magnitude == 0) { |
2499 |
++ value[0] = 0xf5; |
2500 |
++ value[1] = 0x00; |
2501 |
++ value[2] = 0x00; |
2502 |
++ value[3] = 0x00; |
2503 |
++ value[4] = 0x00; |
2504 |
++ value[5] = 0x00; |
2505 |
++ value[6] = 0x00; |
2506 |
++ |
2507 |
++ hid_hw_request(hid, report, HID_REQ_SET_REPORT); |
2508 |
++ return; |
2509 |
++ } |
2510 |
++ |
2511 |
++ if (magnitude <= 0xaaaa) { |
2512 |
++ expand_a = 0x0c * magnitude; |
2513 |
++ expand_b = 0x80 * magnitude; |
2514 |
++ } else { |
2515 |
++ expand_a = (0x0c * 0xaaaa) + 0x06 * (magnitude - 0xaaaa); |
2516 |
++ expand_b = (0x80 * 0xaaaa) + 0xff * (magnitude - 0xaaaa); |
2517 |
++ } |
2518 |
+ |
2519 |
+ value[0] = 0xfe; |
2520 |
+ value[1] = 0x0d; |
2521 |
+- value[2] = magnitude >> 13; |
2522 |
+- value[3] = magnitude >> 13; |
2523 |
+- value[4] = magnitude >> 8; |
2524 |
++ value[2] = expand_a / 0xaaaa; |
2525 |
++ value[3] = expand_a / 0xaaaa; |
2526 |
++ value[4] = expand_b / 0xaaaa; |
2527 |
++ value[5] = 0x00; |
2528 |
++ value[6] = 0x00; |
2529 |
++ |
2530 |
++ hid_hw_request(hid, report, HID_REQ_SET_REPORT); |
2531 |
++ |
2532 |
++ /* Activate Auto-Center */ |
2533 |
++ value[0] = 0x14; |
2534 |
++ value[1] = 0x00; |
2535 |
++ value[2] = 0x00; |
2536 |
++ value[3] = 0x00; |
2537 |
++ value[4] = 0x00; |
2538 |
+ value[5] = 0x00; |
2539 |
+ value[6] = 0x00; |
2540 |
+ |
2541 |
+diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c |
2542 |
+index 5e5fe1b8..d83b1e8b 100644 |
2543 |
+--- a/drivers/hid/hid-multitouch.c |
2544 |
++++ b/drivers/hid/hid-multitouch.c |
2545 |
+@@ -250,12 +250,12 @@ static struct mt_class mt_classes[] = { |
2546 |
+ { .name = MT_CLS_GENERALTOUCH_TWOFINGERS, |
2547 |
+ .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | |
2548 |
+ MT_QUIRK_VALID_IS_INRANGE | |
2549 |
+- MT_QUIRK_SLOT_IS_CONTACTNUMBER, |
2550 |
++ MT_QUIRK_SLOT_IS_CONTACTID, |
2551 |
+ .maxcontacts = 2 |
2552 |
+ }, |
2553 |
+ { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
2554 |
+ .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | |
2555 |
+- MT_QUIRK_SLOT_IS_CONTACTNUMBER |
2556 |
++ MT_QUIRK_SLOT_IS_CONTACTID |
2557 |
+ }, |
2558 |
+ |
2559 |
+ { .name = MT_CLS_FLATFROG, |
2560 |
+@@ -1173,6 +1173,21 @@ static const struct hid_device_id mt_devices[] = { |
2561 |
+ { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
2562 |
+ MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
2563 |
+ USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) }, |
2564 |
++ { .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS, |
2565 |
++ MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
2566 |
++ USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0101) }, |
2567 |
++ { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
2568 |
++ MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
2569 |
++ USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0102) }, |
2570 |
++ { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
2571 |
++ MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
2572 |
++ USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_0106) }, |
2573 |
++ { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
2574 |
++ MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
2575 |
++ USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A) }, |
2576 |
++ { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
2577 |
++ MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
2578 |
++ USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100) }, |
2579 |
+ |
2580 |
+ /* Gametel game controller */ |
2581 |
+ { .driver_data = MT_CLS_NSMU, |
2582 |
+@@ -1284,6 +1299,14 @@ static const struct hid_device_id mt_devices[] = { |
2583 |
+ MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, |
2584 |
+ USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) }, |
2585 |
+ |
2586 |
++ /* SiS panels */ |
2587 |
++ { .driver_data = MT_CLS_DEFAULT, |
2588 |
++ HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, |
2589 |
++ USB_DEVICE_ID_SIS9200_TOUCH) }, |
2590 |
++ { .driver_data = MT_CLS_DEFAULT, |
2591 |
++ HID_USB_DEVICE(USB_VENDOR_ID_SIS2_TOUCH, |
2592 |
++ USB_DEVICE_ID_SIS817_TOUCH) }, |
2593 |
++ |
2594 |
+ /* Stantum panels */ |
2595 |
+ { .driver_data = MT_CLS_CONFIDENCE, |
2596 |
+ MT_USB_DEVICE(USB_VENDOR_ID_STANTUM, |
2597 |
+@@ -1312,6 +1335,12 @@ static const struct hid_device_id mt_devices[] = { |
2598 |
+ { .driver_data = MT_CLS_NSMU, |
2599 |
+ MT_USB_DEVICE(USB_VENDOR_ID_UNITEC, |
2600 |
+ USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, |
2601 |
++ |
2602 |
++ /* Wistron panels */ |
2603 |
++ { .driver_data = MT_CLS_NSMU, |
2604 |
++ MT_USB_DEVICE(USB_VENDOR_ID_WISTRON, |
2605 |
++ USB_DEVICE_ID_WISTRON_OPTICAL_TOUCH) }, |
2606 |
++ |
2607 |
+ /* XAT */ |
2608 |
+ { .driver_data = MT_CLS_NSMU, |
2609 |
+ MT_USB_DEVICE(USB_VENDOR_ID_XAT, |
2610 |
+diff --git a/drivers/hid/hid-roccat-common.c b/drivers/hid/hid-roccat-common.c |
2611 |
+index 74f70403..e8408999 100644 |
2612 |
+--- a/drivers/hid/hid-roccat-common.c |
2613 |
++++ b/drivers/hid/hid-roccat-common.c |
2614 |
+@@ -65,10 +65,11 @@ int roccat_common2_send(struct usb_device *usb_dev, uint report_id, |
2615 |
+ EXPORT_SYMBOL_GPL(roccat_common2_send); |
2616 |
+ |
2617 |
+ enum roccat_common2_control_states { |
2618 |
+- ROCCAT_COMMON_CONTROL_STATUS_OVERLOAD = 0, |
2619 |
++ ROCCAT_COMMON_CONTROL_STATUS_CRITICAL = 0, |
2620 |
+ ROCCAT_COMMON_CONTROL_STATUS_OK = 1, |
2621 |
+ ROCCAT_COMMON_CONTROL_STATUS_INVALID = 2, |
2622 |
+- ROCCAT_COMMON_CONTROL_STATUS_WAIT = 3, |
2623 |
++ ROCCAT_COMMON_CONTROL_STATUS_BUSY = 3, |
2624 |
++ ROCCAT_COMMON_CONTROL_STATUS_CRITICAL_NEW = 4, |
2625 |
+ }; |
2626 |
+ |
2627 |
+ static int roccat_common2_receive_control_status(struct usb_device *usb_dev) |
2628 |
+@@ -88,13 +89,12 @@ static int roccat_common2_receive_control_status(struct usb_device *usb_dev) |
2629 |
+ switch (control.value) { |
2630 |
+ case ROCCAT_COMMON_CONTROL_STATUS_OK: |
2631 |
+ return 0; |
2632 |
+- case ROCCAT_COMMON_CONTROL_STATUS_WAIT: |
2633 |
++ case ROCCAT_COMMON_CONTROL_STATUS_BUSY: |
2634 |
+ msleep(500); |
2635 |
+ continue; |
2636 |
+ case ROCCAT_COMMON_CONTROL_STATUS_INVALID: |
2637 |
+- |
2638 |
+- case ROCCAT_COMMON_CONTROL_STATUS_OVERLOAD: |
2639 |
+- /* seems to be critical - replug necessary */ |
2640 |
++ case ROCCAT_COMMON_CONTROL_STATUS_CRITICAL: |
2641 |
++ case ROCCAT_COMMON_CONTROL_STATUS_CRITICAL_NEW: |
2642 |
+ return -EINVAL; |
2643 |
+ default: |
2644 |
+ dev_err(&usb_dev->dev, |
2645 |
+diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c |
2646 |
+index 0c8e1ef0..96604771 100644 |
2647 |
+--- a/drivers/hid/hid-roccat-kovaplus.c |
2648 |
++++ b/drivers/hid/hid-roccat-kovaplus.c |
2649 |
+@@ -554,9 +554,13 @@ static void kovaplus_keep_values_up_to_date(struct kovaplus_device *kovaplus, |
2650 |
+ break; |
2651 |
+ case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI: |
2652 |
+ kovaplus->actual_cpi = kovaplus_convert_event_cpi(button_report->data1); |
2653 |
++ break; |
2654 |
+ case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY: |
2655 |
+ kovaplus->actual_x_sensitivity = button_report->data1; |
2656 |
+ kovaplus->actual_y_sensitivity = button_report->data2; |
2657 |
++ break; |
2658 |
++ default: |
2659 |
++ break; |
2660 |
+ } |
2661 |
+ } |
2662 |
+ |
2663 |
+diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c |
2664 |
+index 10e15810..9e4cdca5 100644 |
2665 |
+--- a/drivers/hid/hid-sensor-hub.c |
2666 |
++++ b/drivers/hid/hid-sensor-hub.c |
2667 |
+@@ -326,7 +326,8 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, |
2668 |
+ field->logical == attr_usage_id) { |
2669 |
+ sensor_hub_fill_attr_info(info, i, report->id, |
2670 |
+ field->unit, field->unit_exponent, |
2671 |
+- field->report_size); |
2672 |
++ field->report_size * |
2673 |
++ field->report_count); |
2674 |
+ ret = 0; |
2675 |
+ } else { |
2676 |
+ for (j = 0; j < field->maxusage; ++j) { |
2677 |
+@@ -338,7 +339,8 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, |
2678 |
+ i, report->id, |
2679 |
+ field->unit, |
2680 |
+ field->unit_exponent, |
2681 |
+- field->report_size); |
2682 |
++ field->report_size * |
2683 |
++ field->report_count); |
2684 |
+ ret = 0; |
2685 |
+ break; |
2686 |
+ } |
2687 |
+@@ -425,9 +427,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev, |
2688 |
+ hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", |
2689 |
+ i, report->field[i]->usage->collection_index, |
2690 |
+ report->field[i]->usage->hid, |
2691 |
+- report->field[i]->report_size/8); |
2692 |
+- |
2693 |
+- sz = report->field[i]->report_size/8; |
2694 |
++ (report->field[i]->report_size * |
2695 |
++ report->field[i]->report_count)/8); |
2696 |
++ sz = (report->field[i]->report_size * |
2697 |
++ report->field[i]->report_count)/8; |
2698 |
+ if (pdata->pending.status && pdata->pending.attr_usage_id == |
2699 |
+ report->field[i]->usage->hid) { |
2700 |
+ hid_dbg(hdev, "data was pending ...\n"); |
2701 |
+diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c |
2702 |
+index 71adf9e6..e30567af 100644 |
2703 |
+--- a/drivers/hid/hid-wiimote-modules.c |
2704 |
++++ b/drivers/hid/hid-wiimote-modules.c |
2705 |
+@@ -1656,9 +1656,9 @@ static void wiimod_pro_in_ext(struct wiimote_data *wdata, const __u8 *ext) |
2706 |
+ ry = (ext[6] & 0xff) | ((ext[7] & 0x0f) << 8); |
2707 |
+ |
2708 |
+ input_report_abs(wdata->extension.input, ABS_X, lx - 0x800); |
2709 |
+- input_report_abs(wdata->extension.input, ABS_Y, ly - 0x800); |
2710 |
++ input_report_abs(wdata->extension.input, ABS_Y, 0x800 - ly); |
2711 |
+ input_report_abs(wdata->extension.input, ABS_RX, rx - 0x800); |
2712 |
+- input_report_abs(wdata->extension.input, ABS_RY, ry - 0x800); |
2713 |
++ input_report_abs(wdata->extension.input, ABS_RY, 0x800 - ry); |
2714 |
+ |
2715 |
+ input_report_key(wdata->extension.input, |
2716 |
+ wiimod_pro_map[WIIMOD_PRO_KEY_RIGHT], |
2717 |
+diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c |
2718 |
+index 93b00d76..cedc6da9 100644 |
2719 |
+--- a/drivers/hid/uhid.c |
2720 |
++++ b/drivers/hid/uhid.c |
2721 |
+@@ -287,7 +287,7 @@ static int uhid_event_from_user(const char __user *buffer, size_t len, |
2722 |
+ */ |
2723 |
+ struct uhid_create_req_compat *compat; |
2724 |
+ |
2725 |
+- compat = kmalloc(sizeof(*compat), GFP_KERNEL); |
2726 |
++ compat = kzalloc(sizeof(*compat), GFP_KERNEL); |
2727 |
+ if (!compat) |
2728 |
+ return -ENOMEM; |
2729 |
+ |
2730 |
+diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c |
2731 |
+index 3fca3be0..0db9a672 100644 |
2732 |
+--- a/drivers/hid/usbhid/hid-quirks.c |
2733 |
++++ b/drivers/hid/usbhid/hid-quirks.c |
2734 |
+@@ -84,6 +84,8 @@ static const struct hid_blacklist { |
2735 |
+ { USB_VENDOR_ID_REALTEK, USB_DEVICE_ID_REALTEK_READER, HID_QUIRK_NO_INIT_REPORTS }, |
2736 |
+ { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, |
2737 |
+ { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, |
2738 |
++ { USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS9200_TOUCH, HID_QUIRK_NOGET }, |
2739 |
++ { USB_VENDOR_ID_SIS2_TOUCH, USB_DEVICE_ID_SIS817_TOUCH, HID_QUIRK_NOGET }, |
2740 |
+ { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
2741 |
+ { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, |
2742 |
+ { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, |
2743 |
+diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c |
2744 |
+index c65da3d9..4bf9507c 100644 |
2745 |
+--- a/drivers/i2c/busses/i2c-wmt.c |
2746 |
++++ b/drivers/i2c/busses/i2c-wmt.c |
2747 |
+@@ -349,6 +349,7 @@ static int wmt_i2c_reset_hardware(struct wmt_i2c_dev *i2c_dev) |
2748 |
+ err = clk_set_rate(i2c_dev->clk, 20000000); |
2749 |
+ if (err) { |
2750 |
+ dev_err(i2c_dev->dev, "failed to set clock = 20Mhz\n"); |
2751 |
++ clk_disable_unprepare(i2c_dev->clk); |
2752 |
+ return err; |
2753 |
+ } |
2754 |
+ |
2755 |
+diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c |
2756 |
+index a764da77..f821facb 100644 |
2757 |
+--- a/drivers/i2c/muxes/i2c-mux-gpio.c |
2758 |
++++ b/drivers/i2c/muxes/i2c-mux-gpio.c |
2759 |
+@@ -30,15 +30,15 @@ static void i2c_mux_gpio_set(const struct gpiomux *mux, unsigned val) |
2760 |
+ int i; |
2761 |
+ |
2762 |
+ for (i = 0; i < mux->data.n_gpios; i++) |
2763 |
+- gpio_set_value(mux->gpio_base + mux->data.gpios[i], |
2764 |
+- val & (1 << i)); |
2765 |
++ gpio_set_value_cansleep(mux->gpio_base + mux->data.gpios[i], |
2766 |
++ val & (1 << i)); |
2767 |
+ } |
2768 |
+ |
2769 |
+ static int i2c_mux_gpio_select(struct i2c_adapter *adap, void *data, u32 chan) |
2770 |
+ { |
2771 |
+ struct gpiomux *mux = data; |
2772 |
+ |
2773 |
+- i2c_mux_gpio_set(mux, mux->data.values[chan]); |
2774 |
++ i2c_mux_gpio_set(mux, chan); |
2775 |
+ |
2776 |
+ return 0; |
2777 |
+ } |
2778 |
+@@ -228,7 +228,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev) |
2779 |
+ unsigned int class = mux->data.classes ? mux->data.classes[i] : 0; |
2780 |
+ |
2781 |
+ mux->adap[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, nr, |
2782 |
+- i, class, |
2783 |
++ mux->data.values[i], class, |
2784 |
+ i2c_mux_gpio_select, deselect); |
2785 |
+ if (!mux->adap[i]) { |
2786 |
+ ret = -ENODEV; |
2787 |
+diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c |
2788 |
+index 709c1325..34277153 100644 |
2789 |
+--- a/drivers/iio/accel/kxsd9.c |
2790 |
++++ b/drivers/iio/accel/kxsd9.c |
2791 |
+@@ -112,9 +112,10 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address) |
2792 |
+ mutex_lock(&st->buf_lock); |
2793 |
+ st->tx[0] = KXSD9_READ(address); |
2794 |
+ ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers)); |
2795 |
+- if (ret) |
2796 |
+- return ret; |
2797 |
+- return (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0); |
2798 |
++ if (!ret) |
2799 |
++ ret = (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0); |
2800 |
++ mutex_unlock(&st->buf_lock); |
2801 |
++ return ret; |
2802 |
+ } |
2803 |
+ |
2804 |
+ static IIO_CONST_ATTR(accel_scale_available, |
2805 |
+diff --git a/drivers/infiniband/hw/ipath/ipath_user_sdma.c b/drivers/infiniband/hw/ipath/ipath_user_sdma.c |
2806 |
+index f5cb13b2..cc04b7ba 100644 |
2807 |
+--- a/drivers/infiniband/hw/ipath/ipath_user_sdma.c |
2808 |
++++ b/drivers/infiniband/hw/ipath/ipath_user_sdma.c |
2809 |
+@@ -280,9 +280,7 @@ static int ipath_user_sdma_pin_pages(const struct ipath_devdata *dd, |
2810 |
+ int j; |
2811 |
+ int ret; |
2812 |
+ |
2813 |
+- ret = get_user_pages(current, current->mm, addr, |
2814 |
+- npages, 0, 1, pages, NULL); |
2815 |
+- |
2816 |
++ ret = get_user_pages_fast(addr, npages, 0, pages); |
2817 |
+ if (ret != npages) { |
2818 |
+ int i; |
2819 |
+ |
2820 |
+@@ -811,10 +809,7 @@ int ipath_user_sdma_writev(struct ipath_devdata *dd, |
2821 |
+ while (dim) { |
2822 |
+ const int mxp = 8; |
2823 |
+ |
2824 |
+- down_write(¤t->mm->mmap_sem); |
2825 |
+ ret = ipath_user_sdma_queue_pkts(dd, pq, &list, iov, dim, mxp); |
2826 |
+- up_write(¤t->mm->mmap_sem); |
2827 |
+- |
2828 |
+ if (ret <= 0) |
2829 |
+ goto done_unlock; |
2830 |
+ else { |
2831 |
+diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c |
2832 |
+index 016e7429..5bfc02f4 100644 |
2833 |
+--- a/drivers/infiniband/hw/qib/qib_iba7322.c |
2834 |
++++ b/drivers/infiniband/hw/qib/qib_iba7322.c |
2835 |
+@@ -6190,21 +6190,20 @@ static int setup_txselect(const char *str, struct kernel_param *kp) |
2836 |
+ { |
2837 |
+ struct qib_devdata *dd; |
2838 |
+ unsigned long val; |
2839 |
+- int ret; |
2840 |
+- |
2841 |
++ char *n; |
2842 |
+ if (strlen(str) >= MAX_ATTEN_LEN) { |
2843 |
+ pr_info("txselect_values string too long\n"); |
2844 |
+ return -ENOSPC; |
2845 |
+ } |
2846 |
+- ret = kstrtoul(str, 0, &val); |
2847 |
+- if (ret || val >= (TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ + |
2848 |
++ val = simple_strtoul(str, &n, 0); |
2849 |
++ if (n == str || val >= (TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ + |
2850 |
+ TXDDS_MFG_SZ)) { |
2851 |
+ pr_info("txselect_values must start with a number < %d\n", |
2852 |
+ TXDDS_TABLE_SZ + TXDDS_EXTRA_SZ + TXDDS_MFG_SZ); |
2853 |
+- return ret ? ret : -EINVAL; |
2854 |
++ return -EINVAL; |
2855 |
+ } |
2856 |
+- |
2857 |
+ strcpy(txselect_list, str); |
2858 |
++ |
2859 |
+ list_for_each_entry(dd, &qib_dev_list, list) |
2860 |
+ if (dd->deviceid == PCI_DEVICE_ID_QLOGIC_IB_7322) |
2861 |
+ set_no_qsfp_atten(dd, 1); |
2862 |
+diff --git a/drivers/infiniband/hw/qib/qib_user_sdma.c b/drivers/infiniband/hw/qib/qib_user_sdma.c |
2863 |
+index d0a0ea0c..165aee2c 100644 |
2864 |
+--- a/drivers/infiniband/hw/qib/qib_user_sdma.c |
2865 |
++++ b/drivers/infiniband/hw/qib/qib_user_sdma.c |
2866 |
+@@ -594,8 +594,7 @@ static int qib_user_sdma_pin_pages(const struct qib_devdata *dd, |
2867 |
+ else |
2868 |
+ j = npages; |
2869 |
+ |
2870 |
+- ret = get_user_pages(current, current->mm, addr, |
2871 |
+- j, 0, 1, pages, NULL); |
2872 |
++ ret = get_user_pages_fast(addr, j, 0, pages); |
2873 |
+ if (ret != j) { |
2874 |
+ i = 0; |
2875 |
+ j = ret; |
2876 |
+@@ -1294,11 +1293,8 @@ int qib_user_sdma_writev(struct qib_ctxtdata *rcd, |
2877 |
+ int mxp = 8; |
2878 |
+ int ndesc = 0; |
2879 |
+ |
2880 |
+- down_write(¤t->mm->mmap_sem); |
2881 |
+ ret = qib_user_sdma_queue_pkts(dd, ppd, pq, |
2882 |
+ iov, dim, &list, &mxp, &ndesc); |
2883 |
+- up_write(¤t->mm->mmap_sem); |
2884 |
+- |
2885 |
+ if (ret < 0) |
2886 |
+ goto done_unlock; |
2887 |
+ else { |
2888 |
+diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c |
2889 |
+index 6df23502..db5d0a31 100644 |
2890 |
+--- a/drivers/infiniband/ulp/isert/ib_isert.c |
2891 |
++++ b/drivers/infiniband/ulp/isert/ib_isert.c |
2892 |
+@@ -1991,8 +1991,6 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
2893 |
+ |
2894 |
+ if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) { |
2895 |
+ data_left = se_cmd->data_length; |
2896 |
+- iscsit_increment_maxcmdsn(cmd, conn->sess); |
2897 |
+- cmd->stat_sn = conn->stat_sn++; |
2898 |
+ } else { |
2899 |
+ sg_off = cmd->write_data_done / PAGE_SIZE; |
2900 |
+ data_left = se_cmd->data_length - cmd->write_data_done; |
2901 |
+@@ -2204,8 +2202,6 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
2902 |
+ |
2903 |
+ if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) { |
2904 |
+ data_left = se_cmd->data_length; |
2905 |
+- iscsit_increment_maxcmdsn(cmd, conn->sess); |
2906 |
+- cmd->stat_sn = conn->stat_sn++; |
2907 |
+ } else { |
2908 |
+ sg_off = cmd->write_data_done / PAGE_SIZE; |
2909 |
+ data_left = se_cmd->data_length - cmd->write_data_done; |
2910 |
+@@ -2259,18 +2255,26 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd, |
2911 |
+ data_len = min(data_left, rdma_write_max); |
2912 |
+ wr->cur_rdma_length = data_len; |
2913 |
+ |
2914 |
+- spin_lock_irqsave(&isert_conn->conn_lock, flags); |
2915 |
+- fr_desc = list_first_entry(&isert_conn->conn_frwr_pool, |
2916 |
+- struct fast_reg_descriptor, list); |
2917 |
+- list_del(&fr_desc->list); |
2918 |
+- spin_unlock_irqrestore(&isert_conn->conn_lock, flags); |
2919 |
+- wr->fr_desc = fr_desc; |
2920 |
++ /* if there is a single dma entry, dma mr is sufficient */ |
2921 |
++ if (count == 1) { |
2922 |
++ ib_sge->addr = ib_sg_dma_address(ib_dev, &sg_start[0]); |
2923 |
++ ib_sge->length = ib_sg_dma_len(ib_dev, &sg_start[0]); |
2924 |
++ ib_sge->lkey = isert_conn->conn_mr->lkey; |
2925 |
++ wr->fr_desc = NULL; |
2926 |
++ } else { |
2927 |
++ spin_lock_irqsave(&isert_conn->conn_lock, flags); |
2928 |
++ fr_desc = list_first_entry(&isert_conn->conn_frwr_pool, |
2929 |
++ struct fast_reg_descriptor, list); |
2930 |
++ list_del(&fr_desc->list); |
2931 |
++ spin_unlock_irqrestore(&isert_conn->conn_lock, flags); |
2932 |
++ wr->fr_desc = fr_desc; |
2933 |
+ |
2934 |
+- ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn, |
2935 |
+- ib_sge, offset, data_len); |
2936 |
+- if (ret) { |
2937 |
+- list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool); |
2938 |
+- goto unmap_sg; |
2939 |
++ ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn, |
2940 |
++ ib_sge, offset, data_len); |
2941 |
++ if (ret) { |
2942 |
++ list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool); |
2943 |
++ goto unmap_sg; |
2944 |
++ } |
2945 |
+ } |
2946 |
+ |
2947 |
+ return 0; |
2948 |
+@@ -2306,7 +2310,7 @@ isert_put_datain(struct iscsi_conn *conn, struct iscsi_cmd *cmd) |
2949 |
+ * Build isert_conn->tx_desc for iSCSI response PDU and attach |
2950 |
+ */ |
2951 |
+ isert_create_send_desc(isert_conn, isert_cmd, &isert_cmd->tx_desc); |
2952 |
+- iscsit_build_rsp_pdu(cmd, conn, false, (struct iscsi_scsi_rsp *) |
2953 |
++ iscsit_build_rsp_pdu(cmd, conn, true, (struct iscsi_scsi_rsp *) |
2954 |
+ &isert_cmd->tx_desc.iscsi_header); |
2955 |
+ isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); |
2956 |
+ isert_init_send_wr(isert_cmd, &isert_cmd->tx_desc.send_wr); |
2957 |
+diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c |
2958 |
+index f93baf82..17b58f4f 100644 |
2959 |
+--- a/drivers/infiniband/ulp/srp/ib_srp.c |
2960 |
++++ b/drivers/infiniband/ulp/srp/ib_srp.c |
2961 |
+@@ -534,6 +534,11 @@ static void srp_remove_target(struct srp_target_port *target) |
2962 |
+ ib_destroy_cm_id(target->cm_id); |
2963 |
+ srp_free_target_ib(target); |
2964 |
+ srp_free_req_data(target); |
2965 |
++ |
2966 |
++ spin_lock(&target->srp_host->target_lock); |
2967 |
++ list_del(&target->list); |
2968 |
++ spin_unlock(&target->srp_host->target_lock); |
2969 |
++ |
2970 |
+ scsi_host_put(target->scsi_host); |
2971 |
+ } |
2972 |
+ |
2973 |
+@@ -545,10 +550,6 @@ static void srp_remove_work(struct work_struct *work) |
2974 |
+ WARN_ON_ONCE(target->state != SRP_TARGET_REMOVED); |
2975 |
+ |
2976 |
+ srp_remove_target(target); |
2977 |
+- |
2978 |
+- spin_lock(&target->srp_host->target_lock); |
2979 |
+- list_del(&target->list); |
2980 |
+- spin_unlock(&target->srp_host->target_lock); |
2981 |
+ } |
2982 |
+ |
2983 |
+ static void srp_rport_delete(struct srp_rport *rport) |
2984 |
+@@ -1302,14 +1303,13 @@ static void srp_handle_recv(struct srp_target_port *target, struct ib_wc *wc) |
2985 |
+ PFX "Recv failed with error code %d\n", res); |
2986 |
+ } |
2987 |
+ |
2988 |
+-static void srp_handle_qp_err(enum ib_wc_status wc_status, |
2989 |
+- enum ib_wc_opcode wc_opcode, |
2990 |
++static void srp_handle_qp_err(enum ib_wc_status wc_status, bool send_err, |
2991 |
+ struct srp_target_port *target) |
2992 |
+ { |
2993 |
+ if (target->connected && !target->qp_in_error) { |
2994 |
+ shost_printk(KERN_ERR, target->scsi_host, |
2995 |
+ PFX "failed %s status %d\n", |
2996 |
+- wc_opcode & IB_WC_RECV ? "receive" : "send", |
2997 |
++ send_err ? "send" : "receive", |
2998 |
+ wc_status); |
2999 |
+ } |
3000 |
+ target->qp_in_error = true; |
3001 |
+@@ -1325,7 +1325,7 @@ static void srp_recv_completion(struct ib_cq *cq, void *target_ptr) |
3002 |
+ if (likely(wc.status == IB_WC_SUCCESS)) { |
3003 |
+ srp_handle_recv(target, &wc); |
3004 |
+ } else { |
3005 |
+- srp_handle_qp_err(wc.status, wc.opcode, target); |
3006 |
++ srp_handle_qp_err(wc.status, false, target); |
3007 |
+ } |
3008 |
+ } |
3009 |
+ } |
3010 |
+@@ -1341,7 +1341,7 @@ static void srp_send_completion(struct ib_cq *cq, void *target_ptr) |
3011 |
+ iu = (struct srp_iu *) (uintptr_t) wc.wr_id; |
3012 |
+ list_add(&iu->list, &target->free_tx); |
3013 |
+ } else { |
3014 |
+- srp_handle_qp_err(wc.status, wc.opcode, target); |
3015 |
++ srp_handle_qp_err(wc.status, true, target); |
3016 |
+ } |
3017 |
+ } |
3018 |
+ } |
3019 |
+@@ -1751,7 +1751,7 @@ static int srp_abort(struct scsi_cmnd *scmnd) |
3020 |
+ shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n"); |
3021 |
+ |
3022 |
+ if (!req || !srp_claim_req(target, req, scmnd)) |
3023 |
+- return FAILED; |
3024 |
++ return SUCCESS; |
3025 |
+ if (srp_send_tsk_mgmt(target, req->index, scmnd->device->lun, |
3026 |
+ SRP_TSK_ABORT_TASK) == 0) |
3027 |
+ ret = SUCCESS; |
3028 |
+diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c |
3029 |
+index b6ded17b..a06e1255 100644 |
3030 |
+--- a/drivers/input/evdev.c |
3031 |
++++ b/drivers/input/evdev.c |
3032 |
+@@ -18,6 +18,8 @@ |
3033 |
+ #include <linux/poll.h> |
3034 |
+ #include <linux/sched.h> |
3035 |
+ #include <linux/slab.h> |
3036 |
++#include <linux/vmalloc.h> |
3037 |
++#include <linux/mm.h> |
3038 |
+ #include <linux/module.h> |
3039 |
+ #include <linux/init.h> |
3040 |
+ #include <linux/input/mt.h> |
3041 |
+@@ -369,7 +371,11 @@ static int evdev_release(struct inode *inode, struct file *file) |
3042 |
+ mutex_unlock(&evdev->mutex); |
3043 |
+ |
3044 |
+ evdev_detach_client(evdev, client); |
3045 |
+- kfree(client); |
3046 |
++ |
3047 |
++ if (is_vmalloc_addr(client)) |
3048 |
++ vfree(client); |
3049 |
++ else |
3050 |
++ kfree(client); |
3051 |
+ |
3052 |
+ evdev_close_device(evdev); |
3053 |
+ |
3054 |
+@@ -389,12 +395,14 @@ static int evdev_open(struct inode *inode, struct file *file) |
3055 |
+ { |
3056 |
+ struct evdev *evdev = container_of(inode->i_cdev, struct evdev, cdev); |
3057 |
+ unsigned int bufsize = evdev_compute_buffer_size(evdev->handle.dev); |
3058 |
++ unsigned int size = sizeof(struct evdev_client) + |
3059 |
++ bufsize * sizeof(struct input_event); |
3060 |
+ struct evdev_client *client; |
3061 |
+ int error; |
3062 |
+ |
3063 |
+- client = kzalloc(sizeof(struct evdev_client) + |
3064 |
+- bufsize * sizeof(struct input_event), |
3065 |
+- GFP_KERNEL); |
3066 |
++ client = kzalloc(size, GFP_KERNEL | __GFP_NOWARN); |
3067 |
++ if (!client) |
3068 |
++ client = vzalloc(size); |
3069 |
+ if (!client) |
3070 |
+ return -ENOMEM; |
3071 |
+ |
3072 |
+diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c |
3073 |
+index 83658472..7c5d72a6 100644 |
3074 |
+--- a/drivers/input/mouse/alps.c |
3075 |
++++ b/drivers/input/mouse/alps.c |
3076 |
+@@ -103,7 +103,6 @@ static const struct alps_model_info alps_model_data[] = { |
3077 |
+ /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ |
3078 |
+ { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, |
3079 |
+ ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, |
3080 |
+- { { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_DUALPOINT }, /* Dell XT2 */ |
3081 |
+ { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ |
3082 |
+ { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, |
3083 |
+ ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ |
3084 |
+diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c |
3085 |
+index f51765ff..888a81a7 100644 |
3086 |
+--- a/drivers/input/mouse/cypress_ps2.c |
3087 |
++++ b/drivers/input/mouse/cypress_ps2.c |
3088 |
+@@ -439,7 +439,7 @@ static int cypress_get_finger_count(unsigned char header_byte) |
3089 |
+ case 2: return 5; |
3090 |
+ default: |
3091 |
+ /* Invalid contact (e.g. palm). Ignore it. */ |
3092 |
+- return -1; |
3093 |
++ return 0; |
3094 |
+ } |
3095 |
+ } |
3096 |
+ |
3097 |
+@@ -452,17 +452,10 @@ static int cypress_parse_packet(struct psmouse *psmouse, |
3098 |
+ { |
3099 |
+ unsigned char *packet = psmouse->packet; |
3100 |
+ unsigned char header_byte = packet[0]; |
3101 |
+- int contact_cnt; |
3102 |
+ |
3103 |
+ memset(report_data, 0, sizeof(struct cytp_report_data)); |
3104 |
+ |
3105 |
+- contact_cnt = cypress_get_finger_count(header_byte); |
3106 |
+- |
3107 |
+- if (contact_cnt < 0) /* e.g. palm detect */ |
3108 |
+- return -EINVAL; |
3109 |
+- |
3110 |
+- report_data->contact_cnt = contact_cnt; |
3111 |
+- |
3112 |
++ report_data->contact_cnt = cypress_get_finger_count(header_byte); |
3113 |
+ report_data->tap = (header_byte & ABS_MULTIFINGER_TAP) ? 1 : 0; |
3114 |
+ |
3115 |
+ if (report_data->contact_cnt == 1) { |
3116 |
+@@ -535,11 +528,9 @@ static void cypress_process_packet(struct psmouse *psmouse, bool zero_pkt) |
3117 |
+ int slots[CYTP_MAX_MT_SLOTS]; |
3118 |
+ int n; |
3119 |
+ |
3120 |
+- if (cypress_parse_packet(psmouse, cytp, &report_data)) |
3121 |
+- return; |
3122 |
++ cypress_parse_packet(psmouse, cytp, &report_data); |
3123 |
+ |
3124 |
+ n = report_data.contact_cnt; |
3125 |
+- |
3126 |
+ if (n > CYTP_MAX_MT_SLOTS) |
3127 |
+ n = CYTP_MAX_MT_SLOTS; |
3128 |
+ |
3129 |
+@@ -605,10 +596,6 @@ static psmouse_ret_t cypress_validate_byte(struct psmouse *psmouse) |
3130 |
+ return PSMOUSE_BAD_DATA; |
3131 |
+ |
3132 |
+ contact_cnt = cypress_get_finger_count(packet[0]); |
3133 |
+- |
3134 |
+- if (contact_cnt < 0) |
3135 |
+- return PSMOUSE_BAD_DATA; |
3136 |
+- |
3137 |
+ if (cytp->mode & CYTP_BIT_ABS_NO_PRESSURE) |
3138 |
+ cypress_set_packet_size(psmouse, contact_cnt == 2 ? 7 : 4); |
3139 |
+ else |
3140 |
+diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
3141 |
+index 5f306f79..0ec9abbe 100644 |
3142 |
+--- a/drivers/input/serio/i8042-x86ia64io.h |
3143 |
++++ b/drivers/input/serio/i8042-x86ia64io.h |
3144 |
+@@ -765,6 +765,7 @@ static struct pnp_device_id pnp_kbd_devids[] = { |
3145 |
+ { .id = "CPQA0D7", .driver_data = 0 }, |
3146 |
+ { .id = "", }, |
3147 |
+ }; |
3148 |
++MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids); |
3149 |
+ |
3150 |
+ static struct pnp_driver i8042_pnp_kbd_driver = { |
3151 |
+ .name = "i8042 kbd", |
3152 |
+@@ -786,6 +787,7 @@ static struct pnp_device_id pnp_aux_devids[] = { |
3153 |
+ { .id = "SYN0801", .driver_data = 0 }, |
3154 |
+ { .id = "", }, |
3155 |
+ }; |
3156 |
++MODULE_DEVICE_TABLE(pnp, pnp_aux_devids); |
3157 |
+ |
3158 |
+ static struct pnp_driver i8042_pnp_aux_driver = { |
3159 |
+ .name = "i8042 aux", |
3160 |
+diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c |
3161 |
+index 721fdb35..ae4b6b90 100644 |
3162 |
+--- a/drivers/input/touchscreen/usbtouchscreen.c |
3163 |
++++ b/drivers/input/touchscreen/usbtouchscreen.c |
3164 |
+@@ -146,12 +146,10 @@ enum { |
3165 |
+ |
3166 |
+ #define USB_DEVICE_HID_CLASS(vend, prod) \ |
3167 |
+ .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ |
3168 |
+- | USB_DEVICE_ID_MATCH_INT_PROTOCOL \ |
3169 |
+ | USB_DEVICE_ID_MATCH_DEVICE, \ |
3170 |
+ .idVendor = (vend), \ |
3171 |
+ .idProduct = (prod), \ |
3172 |
+- .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ |
3173 |
+- .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE |
3174 |
++ .bInterfaceClass = USB_INTERFACE_CLASS_HID |
3175 |
+ |
3176 |
+ static const struct usb_device_id usbtouch_devices[] = { |
3177 |
+ #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX |
3178 |
+diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c |
3179 |
+index f42fc7ed..d1734d9d 100644 |
3180 |
+--- a/drivers/md/bcache/btree.c |
3181 |
++++ b/drivers/md/bcache/btree.c |
3182 |
+@@ -1742,6 +1742,9 @@ static bool fix_overlapping_extents(struct btree *b, |
3183 |
+ if (bkey_cmp(insert, k) < 0) { |
3184 |
+ bch_cut_front(insert, k); |
3185 |
+ } else { |
3186 |
++ if (bkey_cmp(&START_KEY(insert), &START_KEY(k)) > 0) |
3187 |
++ old_offset = KEY_START(insert); |
3188 |
++ |
3189 |
+ if (bkey_written(b, k) && |
3190 |
+ bkey_cmp(&START_KEY(insert), &START_KEY(k)) <= 0) { |
3191 |
+ /* |
3192 |
+@@ -1803,6 +1806,10 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, |
3193 |
+ if (fix_overlapping_extents(b, k, &iter, op)) |
3194 |
+ return false; |
3195 |
+ |
3196 |
++ if (KEY_DIRTY(k)) |
3197 |
++ bcache_dev_sectors_dirty_add(b->c, KEY_INODE(k), |
3198 |
++ KEY_START(k), KEY_SIZE(k)); |
3199 |
++ |
3200 |
+ while (m != end(i) && |
3201 |
+ bkey_cmp(k, &START_KEY(m)) > 0) |
3202 |
+ prev = m, m = bkey_next(m); |
3203 |
+@@ -1831,10 +1838,6 @@ static bool btree_insert_key(struct btree *b, struct btree_op *op, |
3204 |
+ insert: shift_keys(b, m, k); |
3205 |
+ copy: bkey_copy(m, k); |
3206 |
+ merged: |
3207 |
+- if (KEY_DIRTY(k)) |
3208 |
+- bcache_dev_sectors_dirty_add(b->c, KEY_INODE(k), |
3209 |
+- KEY_START(k), KEY_SIZE(k)); |
3210 |
+- |
3211 |
+ bch_check_keys(b, "%u for %s", status, op_type(op)); |
3212 |
+ |
3213 |
+ if (b->level && !KEY_OFFSET(k)) |
3214 |
+diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c |
3215 |
+index 29569768..ea3e4b4f 100644 |
3216 |
+--- a/drivers/md/dm-cache-target.c |
3217 |
++++ b/drivers/md/dm-cache-target.c |
3218 |
+@@ -148,6 +148,9 @@ struct cache { |
3219 |
+ wait_queue_head_t migration_wait; |
3220 |
+ atomic_t nr_migrations; |
3221 |
+ |
3222 |
++ wait_queue_head_t quiescing_wait; |
3223 |
++ atomic_t quiescing_ack; |
3224 |
++ |
3225 |
+ /* |
3226 |
+ * cache_size entries, dirty if set |
3227 |
+ */ |
3228 |
+@@ -748,8 +751,9 @@ static void cell_defer(struct cache *cache, struct dm_bio_prison_cell *cell, |
3229 |
+ |
3230 |
+ static void cleanup_migration(struct dm_cache_migration *mg) |
3231 |
+ { |
3232 |
+- dec_nr_migrations(mg->cache); |
3233 |
++ struct cache *cache = mg->cache; |
3234 |
+ free_migration(mg); |
3235 |
++ dec_nr_migrations(cache); |
3236 |
+ } |
3237 |
+ |
3238 |
+ static void migration_failure(struct dm_cache_migration *mg) |
3239 |
+@@ -1346,34 +1350,51 @@ static void writeback_some_dirty_blocks(struct cache *cache) |
3240 |
+ /*---------------------------------------------------------------- |
3241 |
+ * Main worker loop |
3242 |
+ *--------------------------------------------------------------*/ |
3243 |
+-static void start_quiescing(struct cache *cache) |
3244 |
++static bool is_quiescing(struct cache *cache) |
3245 |
+ { |
3246 |
++ int r; |
3247 |
+ unsigned long flags; |
3248 |
+ |
3249 |
+ spin_lock_irqsave(&cache->lock, flags); |
3250 |
+- cache->quiescing = 1; |
3251 |
++ r = cache->quiescing; |
3252 |
+ spin_unlock_irqrestore(&cache->lock, flags); |
3253 |
++ |
3254 |
++ return r; |
3255 |
+ } |
3256 |
+ |
3257 |
+-static void stop_quiescing(struct cache *cache) |
3258 |
++static void ack_quiescing(struct cache *cache) |
3259 |
++{ |
3260 |
++ if (is_quiescing(cache)) { |
3261 |
++ atomic_inc(&cache->quiescing_ack); |
3262 |
++ wake_up(&cache->quiescing_wait); |
3263 |
++ } |
3264 |
++} |
3265 |
++ |
3266 |
++static void wait_for_quiescing_ack(struct cache *cache) |
3267 |
++{ |
3268 |
++ wait_event(cache->quiescing_wait, atomic_read(&cache->quiescing_ack)); |
3269 |
++} |
3270 |
++ |
3271 |
++static void start_quiescing(struct cache *cache) |
3272 |
+ { |
3273 |
+ unsigned long flags; |
3274 |
+ |
3275 |
+ spin_lock_irqsave(&cache->lock, flags); |
3276 |
+- cache->quiescing = 0; |
3277 |
++ cache->quiescing = true; |
3278 |
+ spin_unlock_irqrestore(&cache->lock, flags); |
3279 |
++ |
3280 |
++ wait_for_quiescing_ack(cache); |
3281 |
+ } |
3282 |
+ |
3283 |
+-static bool is_quiescing(struct cache *cache) |
3284 |
++static void stop_quiescing(struct cache *cache) |
3285 |
+ { |
3286 |
+- int r; |
3287 |
+ unsigned long flags; |
3288 |
+ |
3289 |
+ spin_lock_irqsave(&cache->lock, flags); |
3290 |
+- r = cache->quiescing; |
3291 |
++ cache->quiescing = false; |
3292 |
+ spin_unlock_irqrestore(&cache->lock, flags); |
3293 |
+ |
3294 |
+- return r; |
3295 |
++ atomic_set(&cache->quiescing_ack, 0); |
3296 |
+ } |
3297 |
+ |
3298 |
+ static void wait_for_migrations(struct cache *cache) |
3299 |
+@@ -1420,16 +1441,15 @@ static void do_worker(struct work_struct *ws) |
3300 |
+ struct cache *cache = container_of(ws, struct cache, worker); |
3301 |
+ |
3302 |
+ do { |
3303 |
+- if (!is_quiescing(cache)) |
3304 |
++ if (!is_quiescing(cache)) { |
3305 |
++ writeback_some_dirty_blocks(cache); |
3306 |
++ process_deferred_writethrough_bios(cache); |
3307 |
+ process_deferred_bios(cache); |
3308 |
++ } |
3309 |
+ |
3310 |
+ process_migrations(cache, &cache->quiesced_migrations, issue_copy); |
3311 |
+ process_migrations(cache, &cache->completed_migrations, complete_migration); |
3312 |
+ |
3313 |
+- writeback_some_dirty_blocks(cache); |
3314 |
+- |
3315 |
+- process_deferred_writethrough_bios(cache); |
3316 |
+- |
3317 |
+ if (commit_if_needed(cache)) { |
3318 |
+ process_deferred_flush_bios(cache, false); |
3319 |
+ |
3320 |
+@@ -1442,6 +1462,9 @@ static void do_worker(struct work_struct *ws) |
3321 |
+ process_migrations(cache, &cache->need_commit_migrations, |
3322 |
+ migration_success_post_commit); |
3323 |
+ } |
3324 |
++ |
3325 |
++ ack_quiescing(cache); |
3326 |
++ |
3327 |
+ } while (more_work(cache)); |
3328 |
+ } |
3329 |
+ |
3330 |
+@@ -2005,6 +2028,9 @@ static int cache_create(struct cache_args *ca, struct cache **result) |
3331 |
+ atomic_set(&cache->nr_migrations, 0); |
3332 |
+ init_waitqueue_head(&cache->migration_wait); |
3333 |
+ |
3334 |
++ init_waitqueue_head(&cache->quiescing_wait); |
3335 |
++ atomic_set(&cache->quiescing_ack, 0); |
3336 |
++ |
3337 |
+ r = -ENOMEM; |
3338 |
+ cache->nr_dirty = 0; |
3339 |
+ cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size)); |
3340 |
+diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c |
3341 |
+index de570a55..799e479d 100644 |
3342 |
+--- a/drivers/md/dm-mpath.c |
3343 |
++++ b/drivers/md/dm-mpath.c |
3344 |
+@@ -87,6 +87,7 @@ struct multipath { |
3345 |
+ unsigned queue_if_no_path:1; /* Queue I/O if last path fails? */ |
3346 |
+ unsigned saved_queue_if_no_path:1; /* Saved state during suspension */ |
3347 |
+ unsigned retain_attached_hw_handler:1; /* If there's already a hw_handler present, don't change it. */ |
3348 |
++ unsigned pg_init_disabled:1; /* pg_init is not currently allowed */ |
3349 |
+ |
3350 |
+ unsigned pg_init_retries; /* Number of times to retry pg_init */ |
3351 |
+ unsigned pg_init_count; /* Number of times pg_init called */ |
3352 |
+@@ -497,7 +498,8 @@ static void process_queued_ios(struct work_struct *work) |
3353 |
+ (!pgpath && !m->queue_if_no_path)) |
3354 |
+ must_queue = 0; |
3355 |
+ |
3356 |
+- if (m->pg_init_required && !m->pg_init_in_progress && pgpath) |
3357 |
++ if (m->pg_init_required && !m->pg_init_in_progress && pgpath && |
3358 |
++ !m->pg_init_disabled) |
3359 |
+ __pg_init_all_paths(m); |
3360 |
+ |
3361 |
+ spin_unlock_irqrestore(&m->lock, flags); |
3362 |
+@@ -942,10 +944,20 @@ static void multipath_wait_for_pg_init_completion(struct multipath *m) |
3363 |
+ |
3364 |
+ static void flush_multipath_work(struct multipath *m) |
3365 |
+ { |
3366 |
++ unsigned long flags; |
3367 |
++ |
3368 |
++ spin_lock_irqsave(&m->lock, flags); |
3369 |
++ m->pg_init_disabled = 1; |
3370 |
++ spin_unlock_irqrestore(&m->lock, flags); |
3371 |
++ |
3372 |
+ flush_workqueue(kmpath_handlerd); |
3373 |
+ multipath_wait_for_pg_init_completion(m); |
3374 |
+ flush_workqueue(kmultipathd); |
3375 |
+ flush_work(&m->trigger_event); |
3376 |
++ |
3377 |
++ spin_lock_irqsave(&m->lock, flags); |
3378 |
++ m->pg_init_disabled = 0; |
3379 |
++ spin_unlock_irqrestore(&m->lock, flags); |
3380 |
+ } |
3381 |
+ |
3382 |
+ static void multipath_dtr(struct dm_target *ti) |
3383 |
+@@ -1164,7 +1176,7 @@ static int pg_init_limit_reached(struct multipath *m, struct pgpath *pgpath) |
3384 |
+ |
3385 |
+ spin_lock_irqsave(&m->lock, flags); |
3386 |
+ |
3387 |
+- if (m->pg_init_count <= m->pg_init_retries) |
3388 |
++ if (m->pg_init_count <= m->pg_init_retries && !m->pg_init_disabled) |
3389 |
+ m->pg_init_required = 1; |
3390 |
+ else |
3391 |
+ limit_reached = 1; |
3392 |
+@@ -1714,7 +1726,7 @@ out: |
3393 |
+ *---------------------------------------------------------------*/ |
3394 |
+ static struct target_type multipath_target = { |
3395 |
+ .name = "multipath", |
3396 |
+- .version = {1, 5, 1}, |
3397 |
++ .version = {1, 6, 0}, |
3398 |
+ .module = THIS_MODULE, |
3399 |
+ .ctr = multipath_ctr, |
3400 |
+ .dtr = multipath_dtr, |
3401 |
+diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c |
3402 |
+index 8f878353..41d907b5 100644 |
3403 |
+--- a/drivers/md/dm-table.c |
3404 |
++++ b/drivers/md/dm-table.c |
3405 |
+@@ -545,14 +545,28 @@ static int adjoin(struct dm_table *table, struct dm_target *ti) |
3406 |
+ |
3407 |
+ /* |
3408 |
+ * Used to dynamically allocate the arg array. |
3409 |
++ * |
3410 |
++ * We do first allocation with GFP_NOIO because dm-mpath and dm-thin must |
3411 |
++ * process messages even if some device is suspended. These messages have a |
3412 |
++ * small fixed number of arguments. |
3413 |
++ * |
3414 |
++ * On the other hand, dm-switch needs to process bulk data using messages and |
3415 |
++ * excessive use of GFP_NOIO could cause trouble. |
3416 |
+ */ |
3417 |
+ static char **realloc_argv(unsigned *array_size, char **old_argv) |
3418 |
+ { |
3419 |
+ char **argv; |
3420 |
+ unsigned new_size; |
3421 |
++ gfp_t gfp; |
3422 |
+ |
3423 |
+- new_size = *array_size ? *array_size * 2 : 64; |
3424 |
+- argv = kmalloc(new_size * sizeof(*argv), GFP_KERNEL); |
3425 |
++ if (*array_size) { |
3426 |
++ new_size = *array_size * 2; |
3427 |
++ gfp = GFP_KERNEL; |
3428 |
++ } else { |
3429 |
++ new_size = 8; |
3430 |
++ gfp = GFP_NOIO; |
3431 |
++ } |
3432 |
++ argv = kmalloc(new_size * sizeof(*argv), gfp); |
3433 |
+ if (argv) { |
3434 |
+ memcpy(argv, old_argv, *array_size * sizeof(*argv)); |
3435 |
+ *array_size = new_size; |
3436 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
3437 |
+index 561a65f8..ba46d974 100644 |
3438 |
+--- a/drivers/md/md.c |
3439 |
++++ b/drivers/md/md.c |
3440 |
+@@ -3620,6 +3620,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len) |
3441 |
+ mddev->in_sync = 1; |
3442 |
+ del_timer_sync(&mddev->safemode_timer); |
3443 |
+ } |
3444 |
++ blk_set_stacking_limits(&mddev->queue->limits); |
3445 |
+ pers->run(mddev); |
3446 |
+ set_bit(MD_CHANGE_DEVS, &mddev->flags); |
3447 |
+ mddev_resume(mddev); |
3448 |
+@@ -7791,7 +7792,7 @@ void md_check_recovery(struct mddev *mddev) |
3449 |
+ if (mddev->ro && !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) |
3450 |
+ return; |
3451 |
+ if ( ! ( |
3452 |
+- (mddev->flags & ~ (1<<MD_CHANGE_PENDING)) || |
3453 |
++ (mddev->flags & MD_UPDATE_SB_FLAGS & ~ (1<<MD_CHANGE_PENDING)) || |
3454 |
+ test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || |
3455 |
+ test_bit(MD_RECOVERY_DONE, &mddev->recovery) || |
3456 |
+ (mddev->external == 0 && mddev->safemode == 1) || |
3457 |
+diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c |
3458 |
+index 172147eb..af96e24e 100644 |
3459 |
+--- a/drivers/md/persistent-data/dm-array.c |
3460 |
++++ b/drivers/md/persistent-data/dm-array.c |
3461 |
+@@ -509,15 +509,18 @@ static int grow_add_tail_block(struct resize *resize) |
3462 |
+ static int grow_needs_more_blocks(struct resize *resize) |
3463 |
+ { |
3464 |
+ int r; |
3465 |
++ unsigned old_nr_blocks = resize->old_nr_full_blocks; |
3466 |
+ |
3467 |
+ if (resize->old_nr_entries_in_last_block > 0) { |
3468 |
++ old_nr_blocks++; |
3469 |
++ |
3470 |
+ r = grow_extend_tail_block(resize, resize->max_entries); |
3471 |
+ if (r) |
3472 |
+ return r; |
3473 |
+ } |
3474 |
+ |
3475 |
+ r = insert_full_ablocks(resize->info, resize->size_of_block, |
3476 |
+- resize->old_nr_full_blocks, |
3477 |
++ old_nr_blocks, |
3478 |
+ resize->new_nr_full_blocks, |
3479 |
+ resize->max_entries, resize->value, |
3480 |
+ &resize->root); |
3481 |
+diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
3482 |
+index f8b90684..e4109f61 100644 |
3483 |
+--- a/drivers/md/raid5.c |
3484 |
++++ b/drivers/md/raid5.c |
3485 |
+@@ -340,7 +340,8 @@ static void release_stripe(struct stripe_head *sh) |
3486 |
+ unsigned long flags; |
3487 |
+ bool wakeup; |
3488 |
+ |
3489 |
+- if (test_and_set_bit(STRIPE_ON_RELEASE_LIST, &sh->state)) |
3490 |
++ if (unlikely(!conf->mddev->thread) || |
3491 |
++ test_and_set_bit(STRIPE_ON_RELEASE_LIST, &sh->state)) |
3492 |
+ goto slow_path; |
3493 |
+ wakeup = llist_add(&sh->release_list, &conf->released_stripes); |
3494 |
+ if (wakeup) |
3495 |
+@@ -5239,6 +5240,9 @@ raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len) |
3496 |
+ old_groups = conf->worker_groups; |
3497 |
+ old_group_cnt = conf->worker_cnt_per_group; |
3498 |
+ |
3499 |
++ if (old_groups) |
3500 |
++ flush_workqueue(raid5_wq); |
3501 |
++ |
3502 |
+ conf->worker_groups = NULL; |
3503 |
+ err = alloc_thread_groups(conf, new); |
3504 |
+ if (err) { |
3505 |
+diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c |
3506 |
+index a204f282..fb504f1e 100644 |
3507 |
+--- a/drivers/media/dvb-frontends/af9013.c |
3508 |
++++ b/drivers/media/dvb-frontends/af9013.c |
3509 |
+@@ -24,6 +24,9 @@ |
3510 |
+ |
3511 |
+ #include "af9013_priv.h" |
3512 |
+ |
3513 |
++/* Max transfer size done by I2C transfer functions */ |
3514 |
++#define MAX_XFER_SIZE 64 |
3515 |
++ |
3516 |
+ struct af9013_state { |
3517 |
+ struct i2c_adapter *i2c; |
3518 |
+ struct dvb_frontend fe; |
3519 |
+@@ -50,16 +53,23 @@ static int af9013_wr_regs_i2c(struct af9013_state *priv, u8 mbox, u16 reg, |
3520 |
+ const u8 *val, int len) |
3521 |
+ { |
3522 |
+ int ret; |
3523 |
+- u8 buf[3+len]; |
3524 |
++ u8 buf[MAX_XFER_SIZE]; |
3525 |
+ struct i2c_msg msg[1] = { |
3526 |
+ { |
3527 |
+ .addr = priv->config.i2c_addr, |
3528 |
+ .flags = 0, |
3529 |
+- .len = sizeof(buf), |
3530 |
++ .len = 3 + len, |
3531 |
+ .buf = buf, |
3532 |
+ } |
3533 |
+ }; |
3534 |
+ |
3535 |
++ if (3 + len > sizeof(buf)) { |
3536 |
++ dev_warn(&priv->i2c->dev, |
3537 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
3538 |
++ KBUILD_MODNAME, reg, len); |
3539 |
++ return -EINVAL; |
3540 |
++ } |
3541 |
++ |
3542 |
+ buf[0] = (reg >> 8) & 0xff; |
3543 |
+ buf[1] = (reg >> 0) & 0xff; |
3544 |
+ buf[2] = mbox; |
3545 |
+diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c |
3546 |
+index a777b4b9..30ee5905 100644 |
3547 |
+--- a/drivers/media/dvb-frontends/af9033.c |
3548 |
++++ b/drivers/media/dvb-frontends/af9033.c |
3549 |
+@@ -21,6 +21,9 @@ |
3550 |
+ |
3551 |
+ #include "af9033_priv.h" |
3552 |
+ |
3553 |
++/* Max transfer size done by I2C transfer functions */ |
3554 |
++#define MAX_XFER_SIZE 64 |
3555 |
++ |
3556 |
+ struct af9033_state { |
3557 |
+ struct i2c_adapter *i2c; |
3558 |
+ struct dvb_frontend fe; |
3559 |
+@@ -40,16 +43,23 @@ static int af9033_wr_regs(struct af9033_state *state, u32 reg, const u8 *val, |
3560 |
+ int len) |
3561 |
+ { |
3562 |
+ int ret; |
3563 |
+- u8 buf[3 + len]; |
3564 |
++ u8 buf[MAX_XFER_SIZE]; |
3565 |
+ struct i2c_msg msg[1] = { |
3566 |
+ { |
3567 |
+ .addr = state->cfg.i2c_addr, |
3568 |
+ .flags = 0, |
3569 |
+- .len = sizeof(buf), |
3570 |
++ .len = 3 + len, |
3571 |
+ .buf = buf, |
3572 |
+ } |
3573 |
+ }; |
3574 |
+ |
3575 |
++ if (3 + len > sizeof(buf)) { |
3576 |
++ dev_warn(&state->i2c->dev, |
3577 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
3578 |
++ KBUILD_MODNAME, reg, len); |
3579 |
++ return -EINVAL; |
3580 |
++ } |
3581 |
++ |
3582 |
+ buf[0] = (reg >> 16) & 0xff; |
3583 |
+ buf[1] = (reg >> 8) & 0xff; |
3584 |
+ buf[2] = (reg >> 0) & 0xff; |
3585 |
+@@ -161,7 +171,14 @@ static int af9033_wr_reg_val_tab(struct af9033_state *state, |
3586 |
+ const struct reg_val *tab, int tab_len) |
3587 |
+ { |
3588 |
+ int ret, i, j; |
3589 |
+- u8 buf[tab_len]; |
3590 |
++ u8 buf[MAX_XFER_SIZE]; |
3591 |
++ |
3592 |
++ if (tab_len > sizeof(buf)) { |
3593 |
++ dev_warn(&state->i2c->dev, |
3594 |
++ "%s: i2c wr len=%d is too big!\n", |
3595 |
++ KBUILD_MODNAME, tab_len); |
3596 |
++ return -EINVAL; |
3597 |
++ } |
3598 |
+ |
3599 |
+ dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len); |
3600 |
+ |
3601 |
+diff --git a/drivers/media/dvb-frontends/bcm3510.c b/drivers/media/dvb-frontends/bcm3510.c |
3602 |
+index 1b77909c..39a29dd2 100644 |
3603 |
+--- a/drivers/media/dvb-frontends/bcm3510.c |
3604 |
++++ b/drivers/media/dvb-frontends/bcm3510.c |
3605 |
+@@ -44,6 +44,9 @@ |
3606 |
+ #include "bcm3510.h" |
3607 |
+ #include "bcm3510_priv.h" |
3608 |
+ |
3609 |
++/* Max transfer size done by bcm3510_do_hab_cmd() function */ |
3610 |
++#define MAX_XFER_SIZE 128 |
3611 |
++ |
3612 |
+ struct bcm3510_state { |
3613 |
+ |
3614 |
+ struct i2c_adapter* i2c; |
3615 |
+@@ -201,9 +204,19 @@ static int bcm3510_hab_send_request(struct bcm3510_state *st, u8 *buf, int len) |
3616 |
+ |
3617 |
+ static int bcm3510_do_hab_cmd(struct bcm3510_state *st, u8 cmd, u8 msgid, u8 *obuf, u8 olen, u8 *ibuf, u8 ilen) |
3618 |
+ { |
3619 |
+- u8 ob[olen+2],ib[ilen+2]; |
3620 |
++ u8 ob[MAX_XFER_SIZE], ib[MAX_XFER_SIZE]; |
3621 |
+ int ret = 0; |
3622 |
+ |
3623 |
++ if (ilen + 2 > sizeof(ib)) { |
3624 |
++ deb_hab("do_hab_cmd: ilen=%d is too big!\n", ilen); |
3625 |
++ return -EINVAL; |
3626 |
++ } |
3627 |
++ |
3628 |
++ if (olen + 2 > sizeof(ob)) { |
3629 |
++ deb_hab("do_hab_cmd: olen=%d is too big!\n", olen); |
3630 |
++ return -EINVAL; |
3631 |
++ } |
3632 |
++ |
3633 |
+ ob[0] = cmd; |
3634 |
+ ob[1] = msgid; |
3635 |
+ memcpy(&ob[2],obuf,olen); |
3636 |
+diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c |
3637 |
+index 7ca5c69d..51447a04 100644 |
3638 |
+--- a/drivers/media/dvb-frontends/cxd2820r_core.c |
3639 |
++++ b/drivers/media/dvb-frontends/cxd2820r_core.c |
3640 |
+@@ -21,12 +21,15 @@ |
3641 |
+ |
3642 |
+ #include "cxd2820r_priv.h" |
3643 |
+ |
3644 |
++/* Max transfer size done by I2C transfer functions */ |
3645 |
++#define MAX_XFER_SIZE 64 |
3646 |
++ |
3647 |
+ /* write multiple registers */ |
3648 |
+ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, |
3649 |
+ u8 *val, int len) |
3650 |
+ { |
3651 |
+ int ret; |
3652 |
+- u8 buf[len+1]; |
3653 |
++ u8 buf[MAX_XFER_SIZE]; |
3654 |
+ struct i2c_msg msg[1] = { |
3655 |
+ { |
3656 |
+ .addr = i2c, |
3657 |
+@@ -36,6 +39,13 @@ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, |
3658 |
+ } |
3659 |
+ }; |
3660 |
+ |
3661 |
++ if (1 + len > sizeof(buf)) { |
3662 |
++ dev_warn(&priv->i2c->dev, |
3663 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
3664 |
++ KBUILD_MODNAME, reg, len); |
3665 |
++ return -EINVAL; |
3666 |
++ } |
3667 |
++ |
3668 |
+ buf[0] = reg; |
3669 |
+ memcpy(&buf[1], val, len); |
3670 |
+ |
3671 |
+@@ -55,7 +65,7 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, |
3672 |
+ u8 *val, int len) |
3673 |
+ { |
3674 |
+ int ret; |
3675 |
+- u8 buf[len]; |
3676 |
++ u8 buf[MAX_XFER_SIZE]; |
3677 |
+ struct i2c_msg msg[2] = { |
3678 |
+ { |
3679 |
+ .addr = i2c, |
3680 |
+@@ -70,6 +80,13 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg, |
3681 |
+ } |
3682 |
+ }; |
3683 |
+ |
3684 |
++ if (len > sizeof(buf)) { |
3685 |
++ dev_warn(&priv->i2c->dev, |
3686 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
3687 |
++ KBUILD_MODNAME, reg, len); |
3688 |
++ return -EINVAL; |
3689 |
++ } |
3690 |
++ |
3691 |
+ ret = i2c_transfer(priv->i2c, msg, 2); |
3692 |
+ if (ret == 2) { |
3693 |
+ memcpy(val, buf, len); |
3694 |
+diff --git a/drivers/media/dvb-frontends/itd1000.c b/drivers/media/dvb-frontends/itd1000.c |
3695 |
+index c1c3400b..cadcae4c 100644 |
3696 |
+--- a/drivers/media/dvb-frontends/itd1000.c |
3697 |
++++ b/drivers/media/dvb-frontends/itd1000.c |
3698 |
+@@ -31,6 +31,9 @@ |
3699 |
+ #include "itd1000.h" |
3700 |
+ #include "itd1000_priv.h" |
3701 |
+ |
3702 |
++/* Max transfer size done by I2C transfer functions */ |
3703 |
++#define MAX_XFER_SIZE 64 |
3704 |
++ |
3705 |
+ static int debug; |
3706 |
+ module_param(debug, int, 0644); |
3707 |
+ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); |
3708 |
+@@ -52,10 +55,18 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); |
3709 |
+ /* don't write more than one byte with flexcop behind */ |
3710 |
+ static int itd1000_write_regs(struct itd1000_state *state, u8 reg, u8 v[], u8 len) |
3711 |
+ { |
3712 |
+- u8 buf[1+len]; |
3713 |
++ u8 buf[MAX_XFER_SIZE]; |
3714 |
+ struct i2c_msg msg = { |
3715 |
+ .addr = state->cfg->i2c_address, .flags = 0, .buf = buf, .len = len+1 |
3716 |
+ }; |
3717 |
++ |
3718 |
++ if (1 + len > sizeof(buf)) { |
3719 |
++ printk(KERN_WARNING |
3720 |
++ "itd1000: i2c wr reg=%04x: len=%d is too big!\n", |
3721 |
++ reg, len); |
3722 |
++ return -EINVAL; |
3723 |
++ } |
3724 |
++ |
3725 |
+ buf[0] = reg; |
3726 |
+ memcpy(&buf[1], v, len); |
3727 |
+ |
3728 |
+diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c |
3729 |
+index ec388c1d..a74ac0dd 100644 |
3730 |
+--- a/drivers/media/dvb-frontends/mt312.c |
3731 |
++++ b/drivers/media/dvb-frontends/mt312.c |
3732 |
+@@ -36,6 +36,8 @@ |
3733 |
+ #include "mt312_priv.h" |
3734 |
+ #include "mt312.h" |
3735 |
+ |
3736 |
++/* Max transfer size done by I2C transfer functions */ |
3737 |
++#define MAX_XFER_SIZE 64 |
3738 |
+ |
3739 |
+ struct mt312_state { |
3740 |
+ struct i2c_adapter *i2c; |
3741 |
+@@ -96,9 +98,15 @@ static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg, |
3742 |
+ const u8 *src, const size_t count) |
3743 |
+ { |
3744 |
+ int ret; |
3745 |
+- u8 buf[count + 1]; |
3746 |
++ u8 buf[MAX_XFER_SIZE]; |
3747 |
+ struct i2c_msg msg; |
3748 |
+ |
3749 |
++ if (1 + count > sizeof(buf)) { |
3750 |
++ printk(KERN_WARNING |
3751 |
++ "mt312: write: len=%zd is too big!\n", count); |
3752 |
++ return -EINVAL; |
3753 |
++ } |
3754 |
++ |
3755 |
+ if (debug) { |
3756 |
+ int i; |
3757 |
+ dprintk("W(%d):", reg & 0x7f); |
3758 |
+diff --git a/drivers/media/dvb-frontends/nxt200x.c b/drivers/media/dvb-frontends/nxt200x.c |
3759 |
+index 8e288940..fbca9856 100644 |
3760 |
+--- a/drivers/media/dvb-frontends/nxt200x.c |
3761 |
++++ b/drivers/media/dvb-frontends/nxt200x.c |
3762 |
+@@ -39,6 +39,9 @@ |
3763 |
+ */ |
3764 |
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
3765 |
+ |
3766 |
++/* Max transfer size done by I2C transfer functions */ |
3767 |
++#define MAX_XFER_SIZE 64 |
3768 |
++ |
3769 |
+ #define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw" |
3770 |
+ #define NXT2004_DEFAULT_FIRMWARE "dvb-fe-nxt2004.fw" |
3771 |
+ #define CRC_CCIT_MASK 0x1021 |
3772 |
+@@ -95,10 +98,16 @@ static int i2c_readbytes(struct nxt200x_state *state, u8 addr, u8 *buf, u8 len) |
3773 |
+ static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, |
3774 |
+ const u8 *buf, u8 len) |
3775 |
+ { |
3776 |
+- u8 buf2 [len+1]; |
3777 |
++ u8 buf2[MAX_XFER_SIZE]; |
3778 |
+ int err; |
3779 |
+ struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len + 1 }; |
3780 |
+ |
3781 |
++ if (1 + len > sizeof(buf2)) { |
3782 |
++ pr_warn("%s: i2c wr reg=%04x: len=%d is too big!\n", |
3783 |
++ __func__, reg, len); |
3784 |
++ return -EINVAL; |
3785 |
++ } |
3786 |
++ |
3787 |
+ buf2[0] = reg; |
3788 |
+ memcpy(&buf2[1], buf, len); |
3789 |
+ |
3790 |
+diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c |
3791 |
+index 362d26d1..7efb796c 100644 |
3792 |
+--- a/drivers/media/dvb-frontends/rtl2830.c |
3793 |
++++ b/drivers/media/dvb-frontends/rtl2830.c |
3794 |
+@@ -27,20 +27,30 @@ |
3795 |
+ |
3796 |
+ #include "rtl2830_priv.h" |
3797 |
+ |
3798 |
++/* Max transfer size done by I2C transfer functions */ |
3799 |
++#define MAX_XFER_SIZE 64 |
3800 |
++ |
3801 |
+ /* write multiple hardware registers */ |
3802 |
+ static int rtl2830_wr(struct rtl2830_priv *priv, u8 reg, const u8 *val, int len) |
3803 |
+ { |
3804 |
+ int ret; |
3805 |
+- u8 buf[1+len]; |
3806 |
++ u8 buf[MAX_XFER_SIZE]; |
3807 |
+ struct i2c_msg msg[1] = { |
3808 |
+ { |
3809 |
+ .addr = priv->cfg.i2c_addr, |
3810 |
+ .flags = 0, |
3811 |
+- .len = 1+len, |
3812 |
++ .len = 1 + len, |
3813 |
+ .buf = buf, |
3814 |
+ } |
3815 |
+ }; |
3816 |
+ |
3817 |
++ if (1 + len > sizeof(buf)) { |
3818 |
++ dev_warn(&priv->i2c->dev, |
3819 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
3820 |
++ KBUILD_MODNAME, reg, len); |
3821 |
++ return -EINVAL; |
3822 |
++ } |
3823 |
++ |
3824 |
+ buf[0] = reg; |
3825 |
+ memcpy(&buf[1], val, len); |
3826 |
+ |
3827 |
+diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c |
3828 |
+index facb8484..b8dd0a13 100644 |
3829 |
+--- a/drivers/media/dvb-frontends/rtl2832.c |
3830 |
++++ b/drivers/media/dvb-frontends/rtl2832.c |
3831 |
+@@ -22,6 +22,9 @@ |
3832 |
+ #include "dvb_math.h" |
3833 |
+ #include <linux/bitops.h> |
3834 |
+ |
3835 |
++/* Max transfer size done by I2C transfer functions */ |
3836 |
++#define MAX_XFER_SIZE 64 |
3837 |
++ |
3838 |
+ int rtl2832_debug; |
3839 |
+ module_param_named(debug, rtl2832_debug, int, 0644); |
3840 |
+ MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); |
3841 |
+@@ -162,16 +165,23 @@ static const struct rtl2832_reg_entry registers[] = { |
3842 |
+ static int rtl2832_wr(struct rtl2832_priv *priv, u8 reg, u8 *val, int len) |
3843 |
+ { |
3844 |
+ int ret; |
3845 |
+- u8 buf[1+len]; |
3846 |
++ u8 buf[MAX_XFER_SIZE]; |
3847 |
+ struct i2c_msg msg[1] = { |
3848 |
+ { |
3849 |
+ .addr = priv->cfg.i2c_addr, |
3850 |
+ .flags = 0, |
3851 |
+- .len = 1+len, |
3852 |
++ .len = 1 + len, |
3853 |
+ .buf = buf, |
3854 |
+ } |
3855 |
+ }; |
3856 |
+ |
3857 |
++ if (1 + len > sizeof(buf)) { |
3858 |
++ dev_warn(&priv->i2c->dev, |
3859 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
3860 |
++ KBUILD_MODNAME, reg, len); |
3861 |
++ return -EINVAL; |
3862 |
++ } |
3863 |
++ |
3864 |
+ buf[0] = reg; |
3865 |
+ memcpy(&buf[1], val, len); |
3866 |
+ |
3867 |
+diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c |
3868 |
+index e2fec9eb..93eeaf71 100644 |
3869 |
+--- a/drivers/media/dvb-frontends/s5h1420.c |
3870 |
++++ b/drivers/media/dvb-frontends/s5h1420.c |
3871 |
+@@ -836,9 +836,16 @@ static u32 s5h1420_tuner_i2c_func(struct i2c_adapter *adapter) |
3872 |
+ static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num) |
3873 |
+ { |
3874 |
+ struct s5h1420_state *state = i2c_get_adapdata(i2c_adap); |
3875 |
+- struct i2c_msg m[1 + num]; |
3876 |
++ struct i2c_msg m[3]; |
3877 |
+ u8 tx_open[2] = { CON_1, state->CON_1_val | 1 }; /* repeater stops once there was a stop condition */ |
3878 |
+ |
3879 |
++ if (1 + num > ARRAY_SIZE(m)) { |
3880 |
++ printk(KERN_WARNING |
3881 |
++ "%s: i2c xfer: num=%d is too big!\n", |
3882 |
++ KBUILD_MODNAME, num); |
3883 |
++ return -EOPNOTSUPP; |
3884 |
++ } |
3885 |
++ |
3886 |
+ memset(m, 0, sizeof(struct i2c_msg) * (1 + num)); |
3887 |
+ |
3888 |
+ m[0].addr = state->config->demod_address; |
3889 |
+@@ -847,7 +854,7 @@ static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c |
3890 |
+ |
3891 |
+ memcpy(&m[1], msg, sizeof(struct i2c_msg) * num); |
3892 |
+ |
3893 |
+- return i2c_transfer(state->i2c, m, 1+num) == 1 + num ? num : -EIO; |
3894 |
++ return i2c_transfer(state->i2c, m, 1 + num) == 1 + num ? num : -EIO; |
3895 |
+ } |
3896 |
+ |
3897 |
+ static struct i2c_algorithm s5h1420_tuner_i2c_algo = { |
3898 |
+diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c |
3899 |
+index 3dd5714e..07cd5ea7 100644 |
3900 |
+--- a/drivers/media/dvb-frontends/stb0899_drv.c |
3901 |
++++ b/drivers/media/dvb-frontends/stb0899_drv.c |
3902 |
+@@ -32,6 +32,9 @@ |
3903 |
+ #include "stb0899_priv.h" |
3904 |
+ #include "stb0899_reg.h" |
3905 |
+ |
3906 |
++/* Max transfer size done by I2C transfer functions */ |
3907 |
++#define MAX_XFER_SIZE 64 |
3908 |
++ |
3909 |
+ static unsigned int verbose = 0;//1; |
3910 |
+ module_param(verbose, int, 0644); |
3911 |
+ |
3912 |
+@@ -499,7 +502,7 @@ err: |
3913 |
+ int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data, u32 count) |
3914 |
+ { |
3915 |
+ int ret; |
3916 |
+- u8 buf[2 + count]; |
3917 |
++ u8 buf[MAX_XFER_SIZE]; |
3918 |
+ struct i2c_msg i2c_msg = { |
3919 |
+ .addr = state->config->demod_address, |
3920 |
+ .flags = 0, |
3921 |
+@@ -507,6 +510,13 @@ int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data, |
3922 |
+ .len = 2 + count |
3923 |
+ }; |
3924 |
+ |
3925 |
++ if (2 + count > sizeof(buf)) { |
3926 |
++ printk(KERN_WARNING |
3927 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
3928 |
++ KBUILD_MODNAME, reg, count); |
3929 |
++ return -EINVAL; |
3930 |
++ } |
3931 |
++ |
3932 |
+ buf[0] = reg >> 8; |
3933 |
+ buf[1] = reg & 0xff; |
3934 |
+ memcpy(&buf[2], data, count); |
3935 |
+diff --git a/drivers/media/dvb-frontends/stb6100.c b/drivers/media/dvb-frontends/stb6100.c |
3936 |
+index 45f9523f..cea175d1 100644 |
3937 |
+--- a/drivers/media/dvb-frontends/stb6100.c |
3938 |
++++ b/drivers/media/dvb-frontends/stb6100.c |
3939 |
+@@ -31,6 +31,8 @@ |
3940 |
+ static unsigned int verbose; |
3941 |
+ module_param(verbose, int, 0644); |
3942 |
+ |
3943 |
++/* Max transfer size done by I2C transfer functions */ |
3944 |
++#define MAX_XFER_SIZE 64 |
3945 |
+ |
3946 |
+ #define FE_ERROR 0 |
3947 |
+ #define FE_NOTICE 1 |
3948 |
+@@ -183,7 +185,7 @@ static int stb6100_read_reg(struct stb6100_state *state, u8 reg) |
3949 |
+ static int stb6100_write_reg_range(struct stb6100_state *state, u8 buf[], int start, int len) |
3950 |
+ { |
3951 |
+ int rc; |
3952 |
+- u8 cmdbuf[len + 1]; |
3953 |
++ u8 cmdbuf[MAX_XFER_SIZE]; |
3954 |
+ struct i2c_msg msg = { |
3955 |
+ .addr = state->config->tuner_address, |
3956 |
+ .flags = 0, |
3957 |
+@@ -191,6 +193,13 @@ static int stb6100_write_reg_range(struct stb6100_state *state, u8 buf[], int st |
3958 |
+ .len = len + 1 |
3959 |
+ }; |
3960 |
+ |
3961 |
++ if (1 + len > sizeof(buf)) { |
3962 |
++ printk(KERN_WARNING |
3963 |
++ "%s: i2c wr: len=%d is too big!\n", |
3964 |
++ KBUILD_MODNAME, len); |
3965 |
++ return -EINVAL; |
3966 |
++ } |
3967 |
++ |
3968 |
+ if (unlikely(start < 1 || start + len > STB6100_NUMREGS)) { |
3969 |
+ dprintk(verbose, FE_ERROR, 1, "Invalid register range %d:%d", |
3970 |
+ start, len); |
3971 |
+diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c |
3972 |
+index 7b6dba3c..45877273 100644 |
3973 |
+--- a/drivers/media/dvb-frontends/stv0367.c |
3974 |
++++ b/drivers/media/dvb-frontends/stv0367.c |
3975 |
+@@ -33,6 +33,9 @@ |
3976 |
+ #include "stv0367_regs.h" |
3977 |
+ #include "stv0367_priv.h" |
3978 |
+ |
3979 |
++/* Max transfer size done by I2C transfer functions */ |
3980 |
++#define MAX_XFER_SIZE 64 |
3981 |
++ |
3982 |
+ static int stvdebug; |
3983 |
+ module_param_named(debug, stvdebug, int, 0644); |
3984 |
+ |
3985 |
+@@ -767,7 +770,7 @@ static struct st_register def0367cab[STV0367CAB_NBREGS] = { |
3986 |
+ static |
3987 |
+ int stv0367_writeregs(struct stv0367_state *state, u16 reg, u8 *data, int len) |
3988 |
+ { |
3989 |
+- u8 buf[len + 2]; |
3990 |
++ u8 buf[MAX_XFER_SIZE]; |
3991 |
+ struct i2c_msg msg = { |
3992 |
+ .addr = state->config->demod_address, |
3993 |
+ .flags = 0, |
3994 |
+@@ -776,6 +779,14 @@ int stv0367_writeregs(struct stv0367_state *state, u16 reg, u8 *data, int len) |
3995 |
+ }; |
3996 |
+ int ret; |
3997 |
+ |
3998 |
++ if (2 + len > sizeof(buf)) { |
3999 |
++ printk(KERN_WARNING |
4000 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4001 |
++ KBUILD_MODNAME, reg, len); |
4002 |
++ return -EINVAL; |
4003 |
++ } |
4004 |
++ |
4005 |
++ |
4006 |
+ buf[0] = MSB(reg); |
4007 |
+ buf[1] = LSB(reg); |
4008 |
+ memcpy(buf + 2, data, len); |
4009 |
+diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c |
4010 |
+index 56d470ad..23e872f8 100644 |
4011 |
+--- a/drivers/media/dvb-frontends/stv090x.c |
4012 |
++++ b/drivers/media/dvb-frontends/stv090x.c |
4013 |
+@@ -35,6 +35,9 @@ |
4014 |
+ #include "stv090x.h" |
4015 |
+ #include "stv090x_priv.h" |
4016 |
+ |
4017 |
++/* Max transfer size done by I2C transfer functions */ |
4018 |
++#define MAX_XFER_SIZE 64 |
4019 |
++ |
4020 |
+ static unsigned int verbose; |
4021 |
+ module_param(verbose, int, 0644); |
4022 |
+ |
4023 |
+@@ -722,9 +725,16 @@ static int stv090x_write_regs(struct stv090x_state *state, unsigned int reg, u8 |
4024 |
+ { |
4025 |
+ const struct stv090x_config *config = state->config; |
4026 |
+ int ret; |
4027 |
+- u8 buf[2 + count]; |
4028 |
++ u8 buf[MAX_XFER_SIZE]; |
4029 |
+ struct i2c_msg i2c_msg = { .addr = config->address, .flags = 0, .buf = buf, .len = 2 + count }; |
4030 |
+ |
4031 |
++ if (2 + count > sizeof(buf)) { |
4032 |
++ printk(KERN_WARNING |
4033 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4034 |
++ KBUILD_MODNAME, reg, count); |
4035 |
++ return -EINVAL; |
4036 |
++ } |
4037 |
++ |
4038 |
+ buf[0] = reg >> 8; |
4039 |
+ buf[1] = reg & 0xff; |
4040 |
+ memcpy(&buf[2], data, count); |
4041 |
+diff --git a/drivers/media/dvb-frontends/stv6110.c b/drivers/media/dvb-frontends/stv6110.c |
4042 |
+index 20b5fa92..b1425830 100644 |
4043 |
+--- a/drivers/media/dvb-frontends/stv6110.c |
4044 |
++++ b/drivers/media/dvb-frontends/stv6110.c |
4045 |
+@@ -30,6 +30,9 @@ |
4046 |
+ |
4047 |
+ #include "stv6110.h" |
4048 |
+ |
4049 |
++/* Max transfer size done by I2C transfer functions */ |
4050 |
++#define MAX_XFER_SIZE 64 |
4051 |
++ |
4052 |
+ static int debug; |
4053 |
+ |
4054 |
+ struct stv6110_priv { |
4055 |
+@@ -68,7 +71,7 @@ static int stv6110_write_regs(struct dvb_frontend *fe, u8 buf[], |
4056 |
+ { |
4057 |
+ struct stv6110_priv *priv = fe->tuner_priv; |
4058 |
+ int rc; |
4059 |
+- u8 cmdbuf[len + 1]; |
4060 |
++ u8 cmdbuf[MAX_XFER_SIZE]; |
4061 |
+ struct i2c_msg msg = { |
4062 |
+ .addr = priv->i2c_address, |
4063 |
+ .flags = 0, |
4064 |
+@@ -78,6 +81,13 @@ static int stv6110_write_regs(struct dvb_frontend *fe, u8 buf[], |
4065 |
+ |
4066 |
+ dprintk("%s\n", __func__); |
4067 |
+ |
4068 |
++ if (1 + len > sizeof(cmdbuf)) { |
4069 |
++ printk(KERN_WARNING |
4070 |
++ "%s: i2c wr: len=%d is too big!\n", |
4071 |
++ KBUILD_MODNAME, len); |
4072 |
++ return -EINVAL; |
4073 |
++ } |
4074 |
++ |
4075 |
+ if (start + len > 8) |
4076 |
+ return -EINVAL; |
4077 |
+ |
4078 |
+diff --git a/drivers/media/dvb-frontends/stv6110x.c b/drivers/media/dvb-frontends/stv6110x.c |
4079 |
+index f36cab12..e66154e5 100644 |
4080 |
+--- a/drivers/media/dvb-frontends/stv6110x.c |
4081 |
++++ b/drivers/media/dvb-frontends/stv6110x.c |
4082 |
+@@ -32,6 +32,9 @@ |
4083 |
+ #include "stv6110x.h" |
4084 |
+ #include "stv6110x_priv.h" |
4085 |
+ |
4086 |
++/* Max transfer size done by I2C transfer functions */ |
4087 |
++#define MAX_XFER_SIZE 64 |
4088 |
++ |
4089 |
+ static unsigned int verbose; |
4090 |
+ module_param(verbose, int, 0644); |
4091 |
+ MODULE_PARM_DESC(verbose, "Set Verbosity level"); |
4092 |
+@@ -61,7 +64,8 @@ static int stv6110x_write_regs(struct stv6110x_state *stv6110x, int start, u8 da |
4093 |
+ { |
4094 |
+ int ret; |
4095 |
+ const struct stv6110x_config *config = stv6110x->config; |
4096 |
+- u8 buf[len + 1]; |
4097 |
++ u8 buf[MAX_XFER_SIZE]; |
4098 |
++ |
4099 |
+ struct i2c_msg msg = { |
4100 |
+ .addr = config->addr, |
4101 |
+ .flags = 0, |
4102 |
+@@ -69,6 +73,13 @@ static int stv6110x_write_regs(struct stv6110x_state *stv6110x, int start, u8 da |
4103 |
+ .len = len + 1 |
4104 |
+ }; |
4105 |
+ |
4106 |
++ if (1 + len > sizeof(buf)) { |
4107 |
++ printk(KERN_WARNING |
4108 |
++ "%s: i2c wr: len=%d is too big!\n", |
4109 |
++ KBUILD_MODNAME, len); |
4110 |
++ return -EINVAL; |
4111 |
++ } |
4112 |
++ |
4113 |
+ if (start + len > 8) |
4114 |
+ return -EINVAL; |
4115 |
+ |
4116 |
+diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c |
4117 |
+index e79749cf..8ad3a57c 100644 |
4118 |
+--- a/drivers/media/dvb-frontends/tda10071.c |
4119 |
++++ b/drivers/media/dvb-frontends/tda10071.c |
4120 |
+@@ -20,6 +20,9 @@ |
4121 |
+ |
4122 |
+ #include "tda10071_priv.h" |
4123 |
+ |
4124 |
++/* Max transfer size done by I2C transfer functions */ |
4125 |
++#define MAX_XFER_SIZE 64 |
4126 |
++ |
4127 |
+ static struct dvb_frontend_ops tda10071_ops; |
4128 |
+ |
4129 |
+ /* write multiple registers */ |
4130 |
+@@ -27,16 +30,23 @@ static int tda10071_wr_regs(struct tda10071_priv *priv, u8 reg, u8 *val, |
4131 |
+ int len) |
4132 |
+ { |
4133 |
+ int ret; |
4134 |
+- u8 buf[len+1]; |
4135 |
++ u8 buf[MAX_XFER_SIZE]; |
4136 |
+ struct i2c_msg msg[1] = { |
4137 |
+ { |
4138 |
+ .addr = priv->cfg.demod_i2c_addr, |
4139 |
+ .flags = 0, |
4140 |
+- .len = sizeof(buf), |
4141 |
++ .len = 1 + len, |
4142 |
+ .buf = buf, |
4143 |
+ } |
4144 |
+ }; |
4145 |
+ |
4146 |
++ if (1 + len > sizeof(buf)) { |
4147 |
++ dev_warn(&priv->i2c->dev, |
4148 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4149 |
++ KBUILD_MODNAME, reg, len); |
4150 |
++ return -EINVAL; |
4151 |
++ } |
4152 |
++ |
4153 |
+ buf[0] = reg; |
4154 |
+ memcpy(&buf[1], val, len); |
4155 |
+ |
4156 |
+@@ -56,7 +66,7 @@ static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val, |
4157 |
+ int len) |
4158 |
+ { |
4159 |
+ int ret; |
4160 |
+- u8 buf[len]; |
4161 |
++ u8 buf[MAX_XFER_SIZE]; |
4162 |
+ struct i2c_msg msg[2] = { |
4163 |
+ { |
4164 |
+ .addr = priv->cfg.demod_i2c_addr, |
4165 |
+@@ -66,11 +76,18 @@ static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val, |
4166 |
+ }, { |
4167 |
+ .addr = priv->cfg.demod_i2c_addr, |
4168 |
+ .flags = I2C_M_RD, |
4169 |
+- .len = sizeof(buf), |
4170 |
++ .len = len, |
4171 |
+ .buf = buf, |
4172 |
+ } |
4173 |
+ }; |
4174 |
+ |
4175 |
++ if (len > sizeof(buf)) { |
4176 |
++ dev_warn(&priv->i2c->dev, |
4177 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4178 |
++ KBUILD_MODNAME, reg, len); |
4179 |
++ return -EINVAL; |
4180 |
++ } |
4181 |
++ |
4182 |
+ ret = i2c_transfer(priv->i2c, msg, 2); |
4183 |
+ if (ret == 2) { |
4184 |
+ memcpy(val, buf, len); |
4185 |
+diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c |
4186 |
+index d281f77d..2c54586a 100644 |
4187 |
+--- a/drivers/media/dvb-frontends/tda18271c2dd.c |
4188 |
++++ b/drivers/media/dvb-frontends/tda18271c2dd.c |
4189 |
+@@ -34,6 +34,9 @@ |
4190 |
+ #include "dvb_frontend.h" |
4191 |
+ #include "tda18271c2dd.h" |
4192 |
+ |
4193 |
++/* Max transfer size done by I2C transfer functions */ |
4194 |
++#define MAX_XFER_SIZE 64 |
4195 |
++ |
4196 |
+ struct SStandardParam { |
4197 |
+ s32 m_IFFrequency; |
4198 |
+ u32 m_BandWidth; |
4199 |
+@@ -139,11 +142,18 @@ static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len) |
4200 |
+ static int WriteRegs(struct tda_state *state, |
4201 |
+ u8 SubAddr, u8 *Regs, u16 nRegs) |
4202 |
+ { |
4203 |
+- u8 data[nRegs+1]; |
4204 |
++ u8 data[MAX_XFER_SIZE]; |
4205 |
++ |
4206 |
++ if (1 + nRegs > sizeof(data)) { |
4207 |
++ printk(KERN_WARNING |
4208 |
++ "%s: i2c wr: len=%d is too big!\n", |
4209 |
++ KBUILD_MODNAME, nRegs); |
4210 |
++ return -EINVAL; |
4211 |
++ } |
4212 |
+ |
4213 |
+ data[0] = SubAddr; |
4214 |
+ memcpy(data + 1, Regs, nRegs); |
4215 |
+- return i2c_write(state->i2c, state->adr, data, nRegs+1); |
4216 |
++ return i2c_write(state->i2c, state->adr, data, nRegs + 1); |
4217 |
+ } |
4218 |
+ |
4219 |
+ static int WriteReg(struct tda_state *state, u8 SubAddr, u8 Reg) |
4220 |
+diff --git a/drivers/media/dvb-frontends/zl10039.c b/drivers/media/dvb-frontends/zl10039.c |
4221 |
+index eff9c5fd..91b6b2e9 100644 |
4222 |
+--- a/drivers/media/dvb-frontends/zl10039.c |
4223 |
++++ b/drivers/media/dvb-frontends/zl10039.c |
4224 |
+@@ -30,6 +30,9 @@ |
4225 |
+ |
4226 |
+ static int debug; |
4227 |
+ |
4228 |
++/* Max transfer size done by I2C transfer functions */ |
4229 |
++#define MAX_XFER_SIZE 64 |
4230 |
++ |
4231 |
+ #define dprintk(args...) \ |
4232 |
+ do { \ |
4233 |
+ if (debug) \ |
4234 |
+@@ -98,7 +101,7 @@ static int zl10039_write(struct zl10039_state *state, |
4235 |
+ const enum zl10039_reg_addr reg, const u8 *src, |
4236 |
+ const size_t count) |
4237 |
+ { |
4238 |
+- u8 buf[count + 1]; |
4239 |
++ u8 buf[MAX_XFER_SIZE]; |
4240 |
+ struct i2c_msg msg = { |
4241 |
+ .addr = state->i2c_addr, |
4242 |
+ .flags = 0, |
4243 |
+@@ -106,6 +109,13 @@ static int zl10039_write(struct zl10039_state *state, |
4244 |
+ .len = count + 1, |
4245 |
+ }; |
4246 |
+ |
4247 |
++ if (1 + count > sizeof(buf)) { |
4248 |
++ printk(KERN_WARNING |
4249 |
++ "%s: i2c wr reg=%04x: len=%zd is too big!\n", |
4250 |
++ KBUILD_MODNAME, reg, count); |
4251 |
++ return -EINVAL; |
4252 |
++ } |
4253 |
++ |
4254 |
+ dprintk("%s\n", __func__); |
4255 |
+ /* Write register address and data in one go */ |
4256 |
+ buf[0] = reg; |
4257 |
+diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c |
4258 |
+index 004d8ace..6386ced9 100644 |
4259 |
+--- a/drivers/media/pci/cx18/cx18-driver.c |
4260 |
++++ b/drivers/media/pci/cx18/cx18-driver.c |
4261 |
+@@ -324,23 +324,24 @@ static void cx18_eeprom_dump(struct cx18 *cx, unsigned char *eedata, int len) |
4262 |
+ /* Hauppauge card? get values from tveeprom */ |
4263 |
+ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) |
4264 |
+ { |
4265 |
+- struct i2c_client c; |
4266 |
++ struct i2c_client *c; |
4267 |
+ u8 eedata[256]; |
4268 |
+ |
4269 |
+- memset(&c, 0, sizeof(c)); |
4270 |
+- strlcpy(c.name, "cx18 tveeprom tmp", sizeof(c.name)); |
4271 |
+- c.adapter = &cx->i2c_adap[0]; |
4272 |
+- c.addr = 0xA0 >> 1; |
4273 |
++ c = kzalloc(sizeof(*c), GFP_KERNEL); |
4274 |
++ |
4275 |
++ strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); |
4276 |
++ c->adapter = &cx->i2c_adap[0]; |
4277 |
++ c->addr = 0xa0 >> 1; |
4278 |
+ |
4279 |
+ memset(tv, 0, sizeof(*tv)); |
4280 |
+- if (tveeprom_read(&c, eedata, sizeof(eedata))) |
4281 |
+- return; |
4282 |
++ if (tveeprom_read(c, eedata, sizeof(eedata))) |
4283 |
++ goto ret; |
4284 |
+ |
4285 |
+ switch (cx->card->type) { |
4286 |
+ case CX18_CARD_HVR_1600_ESMT: |
4287 |
+ case CX18_CARD_HVR_1600_SAMSUNG: |
4288 |
+ case CX18_CARD_HVR_1600_S5H1411: |
4289 |
+- tveeprom_hauppauge_analog(&c, tv, eedata); |
4290 |
++ tveeprom_hauppauge_analog(c, tv, eedata); |
4291 |
+ break; |
4292 |
+ case CX18_CARD_YUAN_MPC718: |
4293 |
+ case CX18_CARD_GOTVIEW_PCI_DVD3: |
4294 |
+@@ -354,6 +355,9 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) |
4295 |
+ cx18_eeprom_dump(cx, eedata, sizeof(eedata)); |
4296 |
+ break; |
4297 |
+ } |
4298 |
++ |
4299 |
++ret: |
4300 |
++ kfree(c); |
4301 |
+ } |
4302 |
+ |
4303 |
+ static void cx18_process_eeprom(struct cx18 *cx) |
4304 |
+diff --git a/drivers/media/pci/cx23885/cimax2.c b/drivers/media/pci/cx23885/cimax2.c |
4305 |
+index 73448491..16fa7ea4 100644 |
4306 |
+--- a/drivers/media/pci/cx23885/cimax2.c |
4307 |
++++ b/drivers/media/pci/cx23885/cimax2.c |
4308 |
+@@ -26,6 +26,10 @@ |
4309 |
+ #include "cx23885.h" |
4310 |
+ #include "cimax2.h" |
4311 |
+ #include "dvb_ca_en50221.h" |
4312 |
++ |
4313 |
++/* Max transfer size done by I2C transfer functions */ |
4314 |
++#define MAX_XFER_SIZE 64 |
4315 |
++ |
4316 |
+ /**** Bit definitions for MC417_RWD and MC417_OEN registers *** |
4317 |
+ bits 31-16 |
4318 |
+ +-----------+ |
4319 |
+@@ -125,7 +129,7 @@ static int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, |
4320 |
+ u8 *buf, int len) |
4321 |
+ { |
4322 |
+ int ret; |
4323 |
+- u8 buffer[len + 1]; |
4324 |
++ u8 buffer[MAX_XFER_SIZE]; |
4325 |
+ |
4326 |
+ struct i2c_msg msg = { |
4327 |
+ .addr = addr, |
4328 |
+@@ -134,6 +138,13 @@ static int netup_write_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, |
4329 |
+ .len = len + 1 |
4330 |
+ }; |
4331 |
+ |
4332 |
++ if (1 + len > sizeof(buffer)) { |
4333 |
++ printk(KERN_WARNING |
4334 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4335 |
++ KBUILD_MODNAME, reg, len); |
4336 |
++ return -EINVAL; |
4337 |
++ } |
4338 |
++ |
4339 |
+ buffer[0] = reg; |
4340 |
+ memcpy(&buffer[1], buf, len); |
4341 |
+ |
4342 |
+diff --git a/drivers/media/pci/ttpci/av7110_hw.c b/drivers/media/pci/ttpci/av7110_hw.c |
4343 |
+index f1cbfe52..6299d5da 100644 |
4344 |
+--- a/drivers/media/pci/ttpci/av7110_hw.c |
4345 |
++++ b/drivers/media/pci/ttpci/av7110_hw.c |
4346 |
+@@ -22,7 +22,7 @@ |
4347 |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
4348 |
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html |
4349 |
+ * |
4350 |
+- * the project's page is at http://www.linuxtv.org/ |
4351 |
++ * the project's page is at http://www.linuxtv.org/ |
4352 |
+ */ |
4353 |
+ |
4354 |
+ /* for debugging ARM communication: */ |
4355 |
+@@ -40,6 +40,14 @@ |
4356 |
+ |
4357 |
+ #define _NOHANDSHAKE |
4358 |
+ |
4359 |
++/* |
4360 |
++ * Max transfer size done by av7110_fw_cmd() |
4361 |
++ * |
4362 |
++ * The maximum size passed to this function is 6 bytes. The buffer also |
4363 |
++ * uses two additional ones for type and size. So, 8 bytes is enough. |
4364 |
++ */ |
4365 |
++#define MAX_XFER_SIZE 8 |
4366 |
++ |
4367 |
+ /**************************************************************************** |
4368 |
+ * DEBI functions |
4369 |
+ ****************************************************************************/ |
4370 |
+@@ -488,11 +496,18 @@ static int av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length) |
4371 |
+ int av7110_fw_cmd(struct av7110 *av7110, int type, int com, int num, ...) |
4372 |
+ { |
4373 |
+ va_list args; |
4374 |
+- u16 buf[num + 2]; |
4375 |
++ u16 buf[MAX_XFER_SIZE]; |
4376 |
+ int i, ret; |
4377 |
+ |
4378 |
+ // dprintk(4, "%p\n", av7110); |
4379 |
+ |
4380 |
++ if (2 + num > sizeof(buf)) { |
4381 |
++ printk(KERN_WARNING |
4382 |
++ "%s: %s len=%d is too big!\n", |
4383 |
++ KBUILD_MODNAME, __func__, num); |
4384 |
++ return -EINVAL; |
4385 |
++ } |
4386 |
++ |
4387 |
+ buf[0] = ((type << 8) | com); |
4388 |
+ buf[1] = num; |
4389 |
+ |
4390 |
+diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c |
4391 |
+index 6c96e489..72971a8d 100644 |
4392 |
+--- a/drivers/media/tuners/e4000.c |
4393 |
++++ b/drivers/media/tuners/e4000.c |
4394 |
+@@ -21,20 +21,30 @@ |
4395 |
+ #include "e4000_priv.h" |
4396 |
+ #include <linux/math64.h> |
4397 |
+ |
4398 |
++/* Max transfer size done by I2C transfer functions */ |
4399 |
++#define MAX_XFER_SIZE 64 |
4400 |
++ |
4401 |
+ /* write multiple registers */ |
4402 |
+ static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) |
4403 |
+ { |
4404 |
+ int ret; |
4405 |
+- u8 buf[1 + len]; |
4406 |
++ u8 buf[MAX_XFER_SIZE]; |
4407 |
+ struct i2c_msg msg[1] = { |
4408 |
+ { |
4409 |
+ .addr = priv->cfg->i2c_addr, |
4410 |
+ .flags = 0, |
4411 |
+- .len = sizeof(buf), |
4412 |
++ .len = 1 + len, |
4413 |
+ .buf = buf, |
4414 |
+ } |
4415 |
+ }; |
4416 |
+ |
4417 |
++ if (1 + len > sizeof(buf)) { |
4418 |
++ dev_warn(&priv->i2c->dev, |
4419 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4420 |
++ KBUILD_MODNAME, reg, len); |
4421 |
++ return -EINVAL; |
4422 |
++ } |
4423 |
++ |
4424 |
+ buf[0] = reg; |
4425 |
+ memcpy(&buf[1], val, len); |
4426 |
+ |
4427 |
+@@ -54,7 +64,7 @@ static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) |
4428 |
+ static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) |
4429 |
+ { |
4430 |
+ int ret; |
4431 |
+- u8 buf[len]; |
4432 |
++ u8 buf[MAX_XFER_SIZE]; |
4433 |
+ struct i2c_msg msg[2] = { |
4434 |
+ { |
4435 |
+ .addr = priv->cfg->i2c_addr, |
4436 |
+@@ -64,11 +74,18 @@ static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) |
4437 |
+ }, { |
4438 |
+ .addr = priv->cfg->i2c_addr, |
4439 |
+ .flags = I2C_M_RD, |
4440 |
+- .len = sizeof(buf), |
4441 |
++ .len = len, |
4442 |
+ .buf = buf, |
4443 |
+ } |
4444 |
+ }; |
4445 |
+ |
4446 |
++ if (len > sizeof(buf)) { |
4447 |
++ dev_warn(&priv->i2c->dev, |
4448 |
++ "%s: i2c rd reg=%04x: len=%d is too big!\n", |
4449 |
++ KBUILD_MODNAME, reg, len); |
4450 |
++ return -EINVAL; |
4451 |
++ } |
4452 |
++ |
4453 |
+ ret = i2c_transfer(priv->i2c, msg, 2); |
4454 |
+ if (ret == 2) { |
4455 |
+ memcpy(val, buf, len); |
4456 |
+diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c |
4457 |
+index 81f38aae..3aecaf46 100644 |
4458 |
+--- a/drivers/media/tuners/fc2580.c |
4459 |
++++ b/drivers/media/tuners/fc2580.c |
4460 |
+@@ -20,6 +20,9 @@ |
4461 |
+ |
4462 |
+ #include "fc2580_priv.h" |
4463 |
+ |
4464 |
++/* Max transfer size done by I2C transfer functions */ |
4465 |
++#define MAX_XFER_SIZE 64 |
4466 |
++ |
4467 |
+ /* |
4468 |
+ * TODO: |
4469 |
+ * I2C write and read works only for one single register. Multiple registers |
4470 |
+@@ -41,16 +44,23 @@ |
4471 |
+ static int fc2580_wr_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) |
4472 |
+ { |
4473 |
+ int ret; |
4474 |
+- u8 buf[1 + len]; |
4475 |
++ u8 buf[MAX_XFER_SIZE]; |
4476 |
+ struct i2c_msg msg[1] = { |
4477 |
+ { |
4478 |
+ .addr = priv->cfg->i2c_addr, |
4479 |
+ .flags = 0, |
4480 |
+- .len = sizeof(buf), |
4481 |
++ .len = 1 + len, |
4482 |
+ .buf = buf, |
4483 |
+ } |
4484 |
+ }; |
4485 |
+ |
4486 |
++ if (1 + len > sizeof(buf)) { |
4487 |
++ dev_warn(&priv->i2c->dev, |
4488 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4489 |
++ KBUILD_MODNAME, reg, len); |
4490 |
++ return -EINVAL; |
4491 |
++ } |
4492 |
++ |
4493 |
+ buf[0] = reg; |
4494 |
+ memcpy(&buf[1], val, len); |
4495 |
+ |
4496 |
+@@ -69,7 +79,7 @@ static int fc2580_wr_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) |
4497 |
+ static int fc2580_rd_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) |
4498 |
+ { |
4499 |
+ int ret; |
4500 |
+- u8 buf[len]; |
4501 |
++ u8 buf[MAX_XFER_SIZE]; |
4502 |
+ struct i2c_msg msg[2] = { |
4503 |
+ { |
4504 |
+ .addr = priv->cfg->i2c_addr, |
4505 |
+@@ -79,11 +89,18 @@ static int fc2580_rd_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) |
4506 |
+ }, { |
4507 |
+ .addr = priv->cfg->i2c_addr, |
4508 |
+ .flags = I2C_M_RD, |
4509 |
+- .len = sizeof(buf), |
4510 |
++ .len = len, |
4511 |
+ .buf = buf, |
4512 |
+ } |
4513 |
+ }; |
4514 |
+ |
4515 |
++ if (len > sizeof(buf)) { |
4516 |
++ dev_warn(&priv->i2c->dev, |
4517 |
++ "%s: i2c rd reg=%04x: len=%d is too big!\n", |
4518 |
++ KBUILD_MODNAME, reg, len); |
4519 |
++ return -EINVAL; |
4520 |
++ } |
4521 |
++ |
4522 |
+ ret = i2c_transfer(priv->i2c, msg, 2); |
4523 |
+ if (ret == 2) { |
4524 |
+ memcpy(val, buf, len); |
4525 |
+diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c |
4526 |
+index e4a84ee2..abe256e1 100644 |
4527 |
+--- a/drivers/media/tuners/tda18212.c |
4528 |
++++ b/drivers/media/tuners/tda18212.c |
4529 |
+@@ -20,6 +20,9 @@ |
4530 |
+ |
4531 |
+ #include "tda18212.h" |
4532 |
+ |
4533 |
++/* Max transfer size done by I2C transfer functions */ |
4534 |
++#define MAX_XFER_SIZE 64 |
4535 |
++ |
4536 |
+ struct tda18212_priv { |
4537 |
+ struct tda18212_config *cfg; |
4538 |
+ struct i2c_adapter *i2c; |
4539 |
+@@ -32,16 +35,23 @@ static int tda18212_wr_regs(struct tda18212_priv *priv, u8 reg, u8 *val, |
4540 |
+ int len) |
4541 |
+ { |
4542 |
+ int ret; |
4543 |
+- u8 buf[len+1]; |
4544 |
++ u8 buf[MAX_XFER_SIZE]; |
4545 |
+ struct i2c_msg msg[1] = { |
4546 |
+ { |
4547 |
+ .addr = priv->cfg->i2c_address, |
4548 |
+ .flags = 0, |
4549 |
+- .len = sizeof(buf), |
4550 |
++ .len = 1 + len, |
4551 |
+ .buf = buf, |
4552 |
+ } |
4553 |
+ }; |
4554 |
+ |
4555 |
++ if (1 + len > sizeof(buf)) { |
4556 |
++ dev_warn(&priv->i2c->dev, |
4557 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4558 |
++ KBUILD_MODNAME, reg, len); |
4559 |
++ return -EINVAL; |
4560 |
++ } |
4561 |
++ |
4562 |
+ buf[0] = reg; |
4563 |
+ memcpy(&buf[1], val, len); |
4564 |
+ |
4565 |
+@@ -61,7 +71,7 @@ static int tda18212_rd_regs(struct tda18212_priv *priv, u8 reg, u8 *val, |
4566 |
+ int len) |
4567 |
+ { |
4568 |
+ int ret; |
4569 |
+- u8 buf[len]; |
4570 |
++ u8 buf[MAX_XFER_SIZE]; |
4571 |
+ struct i2c_msg msg[2] = { |
4572 |
+ { |
4573 |
+ .addr = priv->cfg->i2c_address, |
4574 |
+@@ -71,11 +81,18 @@ static int tda18212_rd_regs(struct tda18212_priv *priv, u8 reg, u8 *val, |
4575 |
+ }, { |
4576 |
+ .addr = priv->cfg->i2c_address, |
4577 |
+ .flags = I2C_M_RD, |
4578 |
+- .len = sizeof(buf), |
4579 |
++ .len = len, |
4580 |
+ .buf = buf, |
4581 |
+ } |
4582 |
+ }; |
4583 |
+ |
4584 |
++ if (len > sizeof(buf)) { |
4585 |
++ dev_warn(&priv->i2c->dev, |
4586 |
++ "%s: i2c rd reg=%04x: len=%d is too big!\n", |
4587 |
++ KBUILD_MODNAME, reg, len); |
4588 |
++ return -EINVAL; |
4589 |
++ } |
4590 |
++ |
4591 |
+ ret = i2c_transfer(priv->i2c, msg, 2); |
4592 |
+ if (ret == 2) { |
4593 |
+ memcpy(val, buf, len); |
4594 |
+diff --git a/drivers/media/tuners/tda18218.c b/drivers/media/tuners/tda18218.c |
4595 |
+index 2d31aeb6..9300e936 100644 |
4596 |
+--- a/drivers/media/tuners/tda18218.c |
4597 |
++++ b/drivers/media/tuners/tda18218.c |
4598 |
+@@ -20,11 +20,14 @@ |
4599 |
+ |
4600 |
+ #include "tda18218_priv.h" |
4601 |
+ |
4602 |
++/* Max transfer size done by I2C transfer functions */ |
4603 |
++#define MAX_XFER_SIZE 64 |
4604 |
++ |
4605 |
+ /* write multiple registers */ |
4606 |
+ static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) |
4607 |
+ { |
4608 |
+ int ret = 0, len2, remaining; |
4609 |
+- u8 buf[1 + len]; |
4610 |
++ u8 buf[MAX_XFER_SIZE]; |
4611 |
+ struct i2c_msg msg[1] = { |
4612 |
+ { |
4613 |
+ .addr = priv->cfg->i2c_address, |
4614 |
+@@ -33,6 +36,13 @@ static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) |
4615 |
+ } |
4616 |
+ }; |
4617 |
+ |
4618 |
++ if (1 + len > sizeof(buf)) { |
4619 |
++ dev_warn(&priv->i2c->dev, |
4620 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4621 |
++ KBUILD_MODNAME, reg, len); |
4622 |
++ return -EINVAL; |
4623 |
++ } |
4624 |
++ |
4625 |
+ for (remaining = len; remaining > 0; |
4626 |
+ remaining -= (priv->cfg->i2c_wr_max - 1)) { |
4627 |
+ len2 = remaining; |
4628 |
+@@ -63,7 +73,7 @@ static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) |
4629 |
+ static int tda18218_rd_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) |
4630 |
+ { |
4631 |
+ int ret; |
4632 |
+- u8 buf[reg+len]; /* we must start read always from reg 0x00 */ |
4633 |
++ u8 buf[MAX_XFER_SIZE]; /* we must start read always from reg 0x00 */ |
4634 |
+ struct i2c_msg msg[2] = { |
4635 |
+ { |
4636 |
+ .addr = priv->cfg->i2c_address, |
4637 |
+@@ -73,11 +83,18 @@ static int tda18218_rd_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) |
4638 |
+ }, { |
4639 |
+ .addr = priv->cfg->i2c_address, |
4640 |
+ .flags = I2C_M_RD, |
4641 |
+- .len = sizeof(buf), |
4642 |
++ .len = reg + len, |
4643 |
+ .buf = buf, |
4644 |
+ } |
4645 |
+ }; |
4646 |
+ |
4647 |
++ if (reg + len > sizeof(buf)) { |
4648 |
++ dev_warn(&priv->i2c->dev, |
4649 |
++ "%s: i2c wr reg=%04x: len=%d is too big!\n", |
4650 |
++ KBUILD_MODNAME, reg, len); |
4651 |
++ return -EINVAL; |
4652 |
++ } |
4653 |
++ |
4654 |
+ ret = i2c_transfer(priv->i2c, msg, 2); |
4655 |
+ if (ret == 2) { |
4656 |
+ memcpy(val, &buf[reg], len); |
4657 |
+diff --git a/drivers/media/tuners/tuner-xc2028.c b/drivers/media/tuners/tuner-xc2028.c |
4658 |
+index 878d2c4d..9771cd83 100644 |
4659 |
+--- a/drivers/media/tuners/tuner-xc2028.c |
4660 |
++++ b/drivers/media/tuners/tuner-xc2028.c |
4661 |
+@@ -24,6 +24,9 @@ |
4662 |
+ #include <linux/dvb/frontend.h> |
4663 |
+ #include "dvb_frontend.h" |
4664 |
+ |
4665 |
++/* Max transfer size done by I2C transfer functions */ |
4666 |
++#define MAX_XFER_SIZE 80 |
4667 |
++ |
4668 |
+ /* Registers (Write-only) */ |
4669 |
+ #define XREG_INIT 0x00 |
4670 |
+ #define XREG_RF_FREQ 0x02 |
4671 |
+@@ -547,7 +550,10 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, |
4672 |
+ { |
4673 |
+ struct xc2028_data *priv = fe->tuner_priv; |
4674 |
+ int pos, rc; |
4675 |
+- unsigned char *p, *endp, buf[priv->ctrl.max_len]; |
4676 |
++ unsigned char *p, *endp, buf[MAX_XFER_SIZE]; |
4677 |
++ |
4678 |
++ if (priv->ctrl.max_len > sizeof(buf)) |
4679 |
++ priv->ctrl.max_len = sizeof(buf); |
4680 |
+ |
4681 |
+ tuner_dbg("%s called\n", __func__); |
4682 |
+ |
4683 |
+diff --git a/drivers/media/usb/dvb-usb-v2/af9015.c b/drivers/media/usb/dvb-usb-v2/af9015.c |
4684 |
+index d556042c..da47d239 100644 |
4685 |
+--- a/drivers/media/usb/dvb-usb-v2/af9015.c |
4686 |
++++ b/drivers/media/usb/dvb-usb-v2/af9015.c |
4687 |
+@@ -397,12 +397,13 @@ error: |
4688 |
+ return ret; |
4689 |
+ } |
4690 |
+ |
4691 |
++#define AF9015_EEPROM_SIZE 256 |
4692 |
++ |
4693 |
+ /* hash (and dump) eeprom */ |
4694 |
+ static int af9015_eeprom_hash(struct dvb_usb_device *d) |
4695 |
+ { |
4696 |
+ struct af9015_state *state = d_to_priv(d); |
4697 |
+ int ret, i; |
4698 |
+- static const unsigned int AF9015_EEPROM_SIZE = 256; |
4699 |
+ u8 buf[AF9015_EEPROM_SIZE]; |
4700 |
+ struct req_t req = {READ_I2C, AF9015_I2C_EEPROM, 0, 0, 1, 1, NULL}; |
4701 |
+ |
4702 |
+diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c |
4703 |
+index 1ea17dc2..c8fcd784 100644 |
4704 |
+--- a/drivers/media/usb/dvb-usb-v2/af9035.c |
4705 |
++++ b/drivers/media/usb/dvb-usb-v2/af9035.c |
4706 |
+@@ -21,6 +21,9 @@ |
4707 |
+ |
4708 |
+ #include "af9035.h" |
4709 |
+ |
4710 |
++/* Max transfer size done by I2C transfer functions */ |
4711 |
++#define MAX_XFER_SIZE 64 |
4712 |
++ |
4713 |
+ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
4714 |
+ |
4715 |
+ static u16 af9035_checksum(const u8 *buf, size_t len) |
4716 |
+@@ -126,10 +129,16 @@ exit: |
4717 |
+ /* write multiple registers */ |
4718 |
+ static int af9035_wr_regs(struct dvb_usb_device *d, u32 reg, u8 *val, int len) |
4719 |
+ { |
4720 |
+- u8 wbuf[6 + len]; |
4721 |
++ u8 wbuf[MAX_XFER_SIZE]; |
4722 |
+ u8 mbox = (reg >> 16) & 0xff; |
4723 |
+ struct usb_req req = { CMD_MEM_WR, mbox, sizeof(wbuf), wbuf, 0, NULL }; |
4724 |
+ |
4725 |
++ if (6 + len > sizeof(wbuf)) { |
4726 |
++ dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n", |
4727 |
++ KBUILD_MODNAME, len); |
4728 |
++ return -EOPNOTSUPP; |
4729 |
++ } |
4730 |
++ |
4731 |
+ wbuf[0] = len; |
4732 |
+ wbuf[1] = 2; |
4733 |
+ wbuf[2] = 0; |
4734 |
+@@ -228,9 +237,16 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, |
4735 |
+ msg[1].len); |
4736 |
+ } else { |
4737 |
+ /* I2C */ |
4738 |
+- u8 buf[5 + msg[0].len]; |
4739 |
++ u8 buf[MAX_XFER_SIZE]; |
4740 |
+ struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf), |
4741 |
+ buf, msg[1].len, msg[1].buf }; |
4742 |
++ |
4743 |
++ if (5 + msg[0].len > sizeof(buf)) { |
4744 |
++ dev_warn(&d->udev->dev, |
4745 |
++ "%s: i2c xfer: len=%d is too big!\n", |
4746 |
++ KBUILD_MODNAME, msg[0].len); |
4747 |
++ return -EOPNOTSUPP; |
4748 |
++ } |
4749 |
+ req.mbox |= ((msg[0].addr & 0x80) >> 3); |
4750 |
+ buf[0] = msg[1].len; |
4751 |
+ buf[1] = msg[0].addr << 1; |
4752 |
+@@ -257,9 +273,16 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, |
4753 |
+ msg[0].len - 3); |
4754 |
+ } else { |
4755 |
+ /* I2C */ |
4756 |
+- u8 buf[5 + msg[0].len]; |
4757 |
++ u8 buf[MAX_XFER_SIZE]; |
4758 |
+ struct usb_req req = { CMD_I2C_WR, 0, sizeof(buf), buf, |
4759 |
+ 0, NULL }; |
4760 |
++ |
4761 |
++ if (5 + msg[0].len > sizeof(buf)) { |
4762 |
++ dev_warn(&d->udev->dev, |
4763 |
++ "%s: i2c xfer: len=%d is too big!\n", |
4764 |
++ KBUILD_MODNAME, msg[0].len); |
4765 |
++ return -EOPNOTSUPP; |
4766 |
++ } |
4767 |
+ req.mbox |= ((msg[0].addr & 0x80) >> 3); |
4768 |
+ buf[0] = msg[0].len; |
4769 |
+ buf[1] = msg[0].addr << 1; |
4770 |
+diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c |
4771 |
+index e97964ef..2627553f 100644 |
4772 |
+--- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c |
4773 |
++++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c |
4774 |
+@@ -23,6 +23,9 @@ |
4775 |
+ #include "lgdt3305.h" |
4776 |
+ #include "lg2160.h" |
4777 |
+ |
4778 |
++/* Max transfer size done by I2C transfer functions */ |
4779 |
++#define MAX_XFER_SIZE 64 |
4780 |
++ |
4781 |
+ int dvb_usb_mxl111sf_debug; |
4782 |
+ module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644); |
4783 |
+ MODULE_PARM_DESC(debug, "set debugging level " |
4784 |
+@@ -57,7 +60,12 @@ int mxl111sf_ctrl_msg(struct dvb_usb_device *d, |
4785 |
+ { |
4786 |
+ int wo = (rbuf == NULL || rlen == 0); /* write-only */ |
4787 |
+ int ret; |
4788 |
+- u8 sndbuf[1+wlen]; |
4789 |
++ u8 sndbuf[MAX_XFER_SIZE]; |
4790 |
++ |
4791 |
++ if (1 + wlen > sizeof(sndbuf)) { |
4792 |
++ pr_warn("%s: len=%d is too big!\n", __func__, wlen); |
4793 |
++ return -EOPNOTSUPP; |
4794 |
++ } |
4795 |
+ |
4796 |
+ pr_debug("%s(wlen = %d, rlen = %d)\n", __func__, wlen, rlen); |
4797 |
+ |
4798 |
+diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c |
4799 |
+index 3940bb0f..20e345d9 100644 |
4800 |
+--- a/drivers/media/usb/dvb-usb/cxusb.c |
4801 |
++++ b/drivers/media/usb/dvb-usb/cxusb.c |
4802 |
+@@ -43,6 +43,9 @@ |
4803 |
+ #include "lgs8gxx.h" |
4804 |
+ #include "atbm8830.h" |
4805 |
+ |
4806 |
++/* Max transfer size done by I2C transfer functions */ |
4807 |
++#define MAX_XFER_SIZE 64 |
4808 |
++ |
4809 |
+ /* debug */ |
4810 |
+ static int dvb_usb_cxusb_debug; |
4811 |
+ module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); |
4812 |
+@@ -57,7 +60,14 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d, |
4813 |
+ u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) |
4814 |
+ { |
4815 |
+ int wo = (rbuf == NULL || rlen == 0); /* write-only */ |
4816 |
+- u8 sndbuf[1+wlen]; |
4817 |
++ u8 sndbuf[MAX_XFER_SIZE]; |
4818 |
++ |
4819 |
++ if (1 + wlen > sizeof(sndbuf)) { |
4820 |
++ warn("i2c wr: len=%d is too big!\n", |
4821 |
++ wlen); |
4822 |
++ return -EOPNOTSUPP; |
4823 |
++ } |
4824 |
++ |
4825 |
+ memset(sndbuf, 0, 1+wlen); |
4826 |
+ |
4827 |
+ sndbuf[0] = cmd; |
4828 |
+@@ -158,7 +168,13 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
4829 |
+ |
4830 |
+ if (msg[i].flags & I2C_M_RD) { |
4831 |
+ /* read only */ |
4832 |
+- u8 obuf[3], ibuf[1+msg[i].len]; |
4833 |
++ u8 obuf[3], ibuf[MAX_XFER_SIZE]; |
4834 |
++ |
4835 |
++ if (1 + msg[i].len > sizeof(ibuf)) { |
4836 |
++ warn("i2c rd: len=%d is too big!\n", |
4837 |
++ msg[i].len); |
4838 |
++ return -EOPNOTSUPP; |
4839 |
++ } |
4840 |
+ obuf[0] = 0; |
4841 |
+ obuf[1] = msg[i].len; |
4842 |
+ obuf[2] = msg[i].addr; |
4843 |
+@@ -172,7 +188,18 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
4844 |
+ } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) && |
4845 |
+ msg[i].addr == msg[i+1].addr) { |
4846 |
+ /* write to then read from same address */ |
4847 |
+- u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; |
4848 |
++ u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE]; |
4849 |
++ |
4850 |
++ if (3 + msg[i].len > sizeof(obuf)) { |
4851 |
++ warn("i2c wr: len=%d is too big!\n", |
4852 |
++ msg[i].len); |
4853 |
++ return -EOPNOTSUPP; |
4854 |
++ } |
4855 |
++ if (1 + msg[i + 1].len > sizeof(ibuf)) { |
4856 |
++ warn("i2c rd: len=%d is too big!\n", |
4857 |
++ msg[i + 1].len); |
4858 |
++ return -EOPNOTSUPP; |
4859 |
++ } |
4860 |
+ obuf[0] = msg[i].len; |
4861 |
+ obuf[1] = msg[i+1].len; |
4862 |
+ obuf[2] = msg[i].addr; |
4863 |
+@@ -191,7 +218,13 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
4864 |
+ i++; |
4865 |
+ } else { |
4866 |
+ /* write only */ |
4867 |
+- u8 obuf[2+msg[i].len], ibuf; |
4868 |
++ u8 obuf[MAX_XFER_SIZE], ibuf; |
4869 |
++ |
4870 |
++ if (2 + msg[i].len > sizeof(obuf)) { |
4871 |
++ warn("i2c wr: len=%d is too big!\n", |
4872 |
++ msg[i].len); |
4873 |
++ return -EOPNOTSUPP; |
4874 |
++ } |
4875 |
+ obuf[0] = msg[i].addr; |
4876 |
+ obuf[1] = msg[i].len; |
4877 |
+ memcpy(&obuf[2], msg[i].buf, msg[i].len); |
4878 |
+diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c |
4879 |
+index c2dded92..6d68af0c 100644 |
4880 |
+--- a/drivers/media/usb/dvb-usb/dibusb-common.c |
4881 |
++++ b/drivers/media/usb/dvb-usb/dibusb-common.c |
4882 |
+@@ -12,6 +12,9 @@ |
4883 |
+ #include <linux/kconfig.h> |
4884 |
+ #include "dibusb.h" |
4885 |
+ |
4886 |
++/* Max transfer size done by I2C transfer functions */ |
4887 |
++#define MAX_XFER_SIZE 64 |
4888 |
++ |
4889 |
+ static int debug; |
4890 |
+ module_param(debug, int, 0644); |
4891 |
+ MODULE_PARM_DESC(debug, "set debugging level (1=info (|-able))." DVB_USB_DEBUG_STATUS); |
4892 |
+@@ -105,11 +108,16 @@ EXPORT_SYMBOL(dibusb2_0_power_ctrl); |
4893 |
+ static int dibusb_i2c_msg(struct dvb_usb_device *d, u8 addr, |
4894 |
+ u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) |
4895 |
+ { |
4896 |
+- u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ |
4897 |
++ u8 sndbuf[MAX_XFER_SIZE]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ |
4898 |
+ /* write only ? */ |
4899 |
+ int wo = (rbuf == NULL || rlen == 0), |
4900 |
+ len = 2 + wlen + (wo ? 0 : 2); |
4901 |
+ |
4902 |
++ if (4 + wlen > sizeof(sndbuf)) { |
4903 |
++ warn("i2c wr: len=%d is too big!\n", wlen); |
4904 |
++ return -EOPNOTSUPP; |
4905 |
++ } |
4906 |
++ |
4907 |
+ sndbuf[0] = wo ? DIBUSB_REQ_I2C_WRITE : DIBUSB_REQ_I2C_READ; |
4908 |
+ sndbuf[1] = (addr << 1) | (wo ? 0 : 1); |
4909 |
+ |
4910 |
+diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c |
4911 |
+index 6e237b6d..71b22f5a 100644 |
4912 |
+--- a/drivers/media/usb/dvb-usb/dw2102.c |
4913 |
++++ b/drivers/media/usb/dvb-usb/dw2102.c |
4914 |
+@@ -30,6 +30,9 @@ |
4915 |
+ #include "stb6100_proc.h" |
4916 |
+ #include "m88rs2000.h" |
4917 |
+ |
4918 |
++/* Max transfer size done by I2C transfer functions */ |
4919 |
++#define MAX_XFER_SIZE 64 |
4920 |
++ |
4921 |
+ #ifndef USB_PID_DW2102 |
4922 |
+ #define USB_PID_DW2102 0x2102 |
4923 |
+ #endif |
4924 |
+@@ -308,7 +311,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms |
4925 |
+ case 2: { |
4926 |
+ /* read */ |
4927 |
+ /* first write first register number */ |
4928 |
+- u8 ibuf[msg[1].len + 2], obuf[3]; |
4929 |
++ u8 ibuf[MAX_XFER_SIZE], obuf[3]; |
4930 |
++ |
4931 |
++ if (2 + msg[1].len > sizeof(ibuf)) { |
4932 |
++ warn("i2c rd: len=%d is too big!\n", |
4933 |
++ msg[1].len); |
4934 |
++ return -EOPNOTSUPP; |
4935 |
++ } |
4936 |
++ |
4937 |
+ obuf[0] = msg[0].addr << 1; |
4938 |
+ obuf[1] = msg[0].len; |
4939 |
+ obuf[2] = msg[0].buf[0]; |
4940 |
+@@ -325,7 +335,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms |
4941 |
+ switch (msg[0].addr) { |
4942 |
+ case 0x68: { |
4943 |
+ /* write to register */ |
4944 |
+- u8 obuf[msg[0].len + 2]; |
4945 |
++ u8 obuf[MAX_XFER_SIZE]; |
4946 |
++ |
4947 |
++ if (2 + msg[0].len > sizeof(obuf)) { |
4948 |
++ warn("i2c wr: len=%d is too big!\n", |
4949 |
++ msg[1].len); |
4950 |
++ return -EOPNOTSUPP; |
4951 |
++ } |
4952 |
++ |
4953 |
+ obuf[0] = msg[0].addr << 1; |
4954 |
+ obuf[1] = msg[0].len; |
4955 |
+ memcpy(obuf + 2, msg[0].buf, msg[0].len); |
4956 |
+@@ -335,7 +352,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms |
4957 |
+ } |
4958 |
+ case 0x61: { |
4959 |
+ /* write to tuner */ |
4960 |
+- u8 obuf[msg[0].len + 2]; |
4961 |
++ u8 obuf[MAX_XFER_SIZE]; |
4962 |
++ |
4963 |
++ if (2 + msg[0].len > sizeof(obuf)) { |
4964 |
++ warn("i2c wr: len=%d is too big!\n", |
4965 |
++ msg[1].len); |
4966 |
++ return -EOPNOTSUPP; |
4967 |
++ } |
4968 |
++ |
4969 |
+ obuf[0] = msg[0].addr << 1; |
4970 |
+ obuf[1] = msg[0].len; |
4971 |
+ memcpy(obuf + 2, msg[0].buf, msg[0].len); |
4972 |
+@@ -401,7 +425,14 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i |
4973 |
+ default: { |
4974 |
+ if (msg[j].flags == I2C_M_RD) { |
4975 |
+ /* read registers */ |
4976 |
+- u8 ibuf[msg[j].len + 2]; |
4977 |
++ u8 ibuf[MAX_XFER_SIZE]; |
4978 |
++ |
4979 |
++ if (2 + msg[j].len > sizeof(ibuf)) { |
4980 |
++ warn("i2c rd: len=%d is too big!\n", |
4981 |
++ msg[j].len); |
4982 |
++ return -EOPNOTSUPP; |
4983 |
++ } |
4984 |
++ |
4985 |
+ dw210x_op_rw(d->udev, 0xc3, |
4986 |
+ (msg[j].addr << 1) + 1, 0, |
4987 |
+ ibuf, msg[j].len + 2, |
4988 |
+@@ -430,7 +461,14 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i |
4989 |
+ } while (len > 0); |
4990 |
+ } else { |
4991 |
+ /* write registers */ |
4992 |
+- u8 obuf[msg[j].len + 2]; |
4993 |
++ u8 obuf[MAX_XFER_SIZE]; |
4994 |
++ |
4995 |
++ if (2 + msg[j].len > sizeof(obuf)) { |
4996 |
++ warn("i2c wr: len=%d is too big!\n", |
4997 |
++ msg[j].len); |
4998 |
++ return -EOPNOTSUPP; |
4999 |
++ } |
5000 |
++ |
5001 |
+ obuf[0] = msg[j].addr << 1; |
5002 |
+ obuf[1] = msg[j].len; |
5003 |
+ memcpy(obuf + 2, msg[j].buf, msg[j].len); |
5004 |
+@@ -463,7 +501,13 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
5005 |
+ case 2: { |
5006 |
+ /* read */ |
5007 |
+ /* first write first register number */ |
5008 |
+- u8 ibuf[msg[1].len + 2], obuf[3]; |
5009 |
++ u8 ibuf[MAX_XFER_SIZE], obuf[3]; |
5010 |
++ |
5011 |
++ if (2 + msg[1].len > sizeof(ibuf)) { |
5012 |
++ warn("i2c rd: len=%d is too big!\n", |
5013 |
++ msg[1].len); |
5014 |
++ return -EOPNOTSUPP; |
5015 |
++ } |
5016 |
+ obuf[0] = msg[0].addr << 1; |
5017 |
+ obuf[1] = msg[0].len; |
5018 |
+ obuf[2] = msg[0].buf[0]; |
5019 |
+@@ -481,7 +525,13 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
5020 |
+ case 0x60: |
5021 |
+ case 0x0c: { |
5022 |
+ /* write to register */ |
5023 |
+- u8 obuf[msg[0].len + 2]; |
5024 |
++ u8 obuf[MAX_XFER_SIZE]; |
5025 |
++ |
5026 |
++ if (2 + msg[0].len > sizeof(obuf)) { |
5027 |
++ warn("i2c wr: len=%d is too big!\n", |
5028 |
++ msg[0].len); |
5029 |
++ return -EOPNOTSUPP; |
5030 |
++ } |
5031 |
+ obuf[0] = msg[0].addr << 1; |
5032 |
+ obuf[1] = msg[0].len; |
5033 |
+ memcpy(obuf + 2, msg[0].buf, msg[0].len); |
5034 |
+@@ -563,7 +613,14 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
5035 |
+ default: { |
5036 |
+ if (msg[j].flags == I2C_M_RD) { |
5037 |
+ /* read registers */ |
5038 |
+- u8 ibuf[msg[j].len]; |
5039 |
++ u8 ibuf[MAX_XFER_SIZE]; |
5040 |
++ |
5041 |
++ if (msg[j].len > sizeof(ibuf)) { |
5042 |
++ warn("i2c rd: len=%d is too big!\n", |
5043 |
++ msg[j].len); |
5044 |
++ return -EOPNOTSUPP; |
5045 |
++ } |
5046 |
++ |
5047 |
+ dw210x_op_rw(d->udev, 0x91, 0, 0, |
5048 |
+ ibuf, msg[j].len, |
5049 |
+ DW210X_READ_MSG); |
5050 |
+@@ -590,7 +647,14 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
5051 |
+ } while (len > 0); |
5052 |
+ } else if (j < (num - 1)) { |
5053 |
+ /* write register addr before read */ |
5054 |
+- u8 obuf[msg[j].len + 2]; |
5055 |
++ u8 obuf[MAX_XFER_SIZE]; |
5056 |
++ |
5057 |
++ if (2 + msg[j].len > sizeof(obuf)) { |
5058 |
++ warn("i2c wr: len=%d is too big!\n", |
5059 |
++ msg[j].len); |
5060 |
++ return -EOPNOTSUPP; |
5061 |
++ } |
5062 |
++ |
5063 |
+ obuf[0] = msg[j + 1].len; |
5064 |
+ obuf[1] = (msg[j].addr << 1); |
5065 |
+ memcpy(obuf + 2, msg[j].buf, msg[j].len); |
5066 |
+@@ -602,7 +666,13 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
5067 |
+ break; |
5068 |
+ } else { |
5069 |
+ /* write registers */ |
5070 |
+- u8 obuf[msg[j].len + 2]; |
5071 |
++ u8 obuf[MAX_XFER_SIZE]; |
5072 |
++ |
5073 |
++ if (2 + msg[j].len > sizeof(obuf)) { |
5074 |
++ warn("i2c wr: len=%d is too big!\n", |
5075 |
++ msg[j].len); |
5076 |
++ return -EOPNOTSUPP; |
5077 |
++ } |
5078 |
+ obuf[0] = msg[j].len + 1; |
5079 |
+ obuf[1] = (msg[j].addr << 1); |
5080 |
+ memcpy(obuf + 2, msg[j].buf, msg[j].len); |
5081 |
+diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c |
5082 |
+index c85d69da..85a6a341 100644 |
5083 |
+--- a/drivers/media/v4l2-core/v4l2-async.c |
5084 |
++++ b/drivers/media/v4l2-core/v4l2-async.c |
5085 |
+@@ -189,30 +189,53 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) |
5086 |
+ struct v4l2_subdev *sd, *tmp; |
5087 |
+ unsigned int notif_n_subdev = notifier->num_subdevs; |
5088 |
+ unsigned int n_subdev = min(notif_n_subdev, V4L2_MAX_SUBDEVS); |
5089 |
+- struct device *dev[n_subdev]; |
5090 |
++ struct device **dev; |
5091 |
+ int i = 0; |
5092 |
+ |
5093 |
+ if (!notifier->v4l2_dev) |
5094 |
+ return; |
5095 |
+ |
5096 |
++ dev = kmalloc(n_subdev * sizeof(*dev), GFP_KERNEL); |
5097 |
++ if (!dev) { |
5098 |
++ dev_err(notifier->v4l2_dev->dev, |
5099 |
++ "Failed to allocate device cache!\n"); |
5100 |
++ } |
5101 |
++ |
5102 |
+ mutex_lock(&list_lock); |
5103 |
+ |
5104 |
+ list_del(¬ifier->list); |
5105 |
+ |
5106 |
+ list_for_each_entry_safe(sd, tmp, ¬ifier->done, async_list) { |
5107 |
+- dev[i] = get_device(sd->dev); |
5108 |
++ struct device *d; |
5109 |
++ |
5110 |
++ d = get_device(sd->dev); |
5111 |
+ |
5112 |
+ v4l2_async_cleanup(sd); |
5113 |
+ |
5114 |
+ /* If we handled USB devices, we'd have to lock the parent too */ |
5115 |
+- device_release_driver(dev[i++]); |
5116 |
++ device_release_driver(d); |
5117 |
+ |
5118 |
+ if (notifier->unbind) |
5119 |
+ notifier->unbind(notifier, sd, sd->asd); |
5120 |
++ |
5121 |
++ /* |
5122 |
++ * Store device at the device cache, in order to call |
5123 |
++ * put_device() on the final step |
5124 |
++ */ |
5125 |
++ if (dev) |
5126 |
++ dev[i++] = d; |
5127 |
++ else |
5128 |
++ put_device(d); |
5129 |
+ } |
5130 |
+ |
5131 |
+ mutex_unlock(&list_lock); |
5132 |
+ |
5133 |
++ /* |
5134 |
++ * Call device_attach() to reprobe devices |
5135 |
++ * |
5136 |
++ * NOTE: If dev allocation fails, i is 0, and the whole loop won't be |
5137 |
++ * executed. |
5138 |
++ */ |
5139 |
+ while (i--) { |
5140 |
+ struct device *d = dev[i]; |
5141 |
+ |
5142 |
+@@ -228,6 +251,7 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) |
5143 |
+ } |
5144 |
+ put_device(d); |
5145 |
+ } |
5146 |
++ kfree(dev); |
5147 |
+ |
5148 |
+ notifier->v4l2_dev = NULL; |
5149 |
+ |
5150 |
+diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c |
5151 |
+index 9483bc84..e775bfbc 100644 |
5152 |
+--- a/drivers/mfd/lpc_ich.c |
5153 |
++++ b/drivers/mfd/lpc_ich.c |
5154 |
+@@ -53,6 +53,7 @@ |
5155 |
+ * document number TBD : Wellsburg |
5156 |
+ * document number TBD : Avoton SoC |
5157 |
+ * document number TBD : Coleto Creek |
5158 |
++ * document number TBD : Wildcat Point-LP |
5159 |
+ */ |
5160 |
+ |
5161 |
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
5162 |
+@@ -211,6 +212,7 @@ enum lpc_chipsets { |
5163 |
+ LPC_WBG, /* Wellsburg */ |
5164 |
+ LPC_AVN, /* Avoton SoC */ |
5165 |
+ LPC_COLETO, /* Coleto Creek */ |
5166 |
++ LPC_WPT_LP, /* Wildcat Point-LP */ |
5167 |
+ }; |
5168 |
+ |
5169 |
+ static struct lpc_ich_info lpc_chipset_info[] = { |
5170 |
+@@ -503,6 +505,10 @@ static struct lpc_ich_info lpc_chipset_info[] = { |
5171 |
+ .name = "Coleto Creek", |
5172 |
+ .iTCO_version = 2, |
5173 |
+ }, |
5174 |
++ [LPC_WPT_LP] = { |
5175 |
++ .name = "Lynx Point_LP", |
5176 |
++ .iTCO_version = 2, |
5177 |
++ }, |
5178 |
+ }; |
5179 |
+ |
5180 |
+ /* |
5181 |
+@@ -721,6 +727,13 @@ static DEFINE_PCI_DEVICE_TABLE(lpc_ich_ids) = { |
5182 |
+ { PCI_VDEVICE(INTEL, 0x1f3a), LPC_AVN}, |
5183 |
+ { PCI_VDEVICE(INTEL, 0x1f3b), LPC_AVN}, |
5184 |
+ { PCI_VDEVICE(INTEL, 0x2390), LPC_COLETO}, |
5185 |
++ { PCI_VDEVICE(INTEL, 0x9cc1), LPC_WPT_LP}, |
5186 |
++ { PCI_VDEVICE(INTEL, 0x9cc2), LPC_WPT_LP}, |
5187 |
++ { PCI_VDEVICE(INTEL, 0x9cc3), LPC_WPT_LP}, |
5188 |
++ { PCI_VDEVICE(INTEL, 0x9cc5), LPC_WPT_LP}, |
5189 |
++ { PCI_VDEVICE(INTEL, 0x9cc6), LPC_WPT_LP}, |
5190 |
++ { PCI_VDEVICE(INTEL, 0x9cc7), LPC_WPT_LP}, |
5191 |
++ { PCI_VDEVICE(INTEL, 0x9cc9), LPC_WPT_LP}, |
5192 |
+ { 0, }, /* End of list */ |
5193 |
+ }; |
5194 |
+ MODULE_DEVICE_TABLE(pci, lpc_ich_ids); |
5195 |
+diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c |
5196 |
+index 3b835f59..573de7bf 100644 |
5197 |
+--- a/drivers/mfd/rts5249.c |
5198 |
++++ b/drivers/mfd/rts5249.c |
5199 |
+@@ -130,13 +130,57 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr) |
5200 |
+ { |
5201 |
+ int err; |
5202 |
+ |
5203 |
+- err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, 0xFE46); |
5204 |
++ err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV, |
5205 |
++ PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED | |
5206 |
++ PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN | |
5207 |
++ PHY_REG_REV_RX_PWST | PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 | |
5208 |
++ PHY_REG_REV_STOP_CLKRD | PHY_REG_REV_STOP_CLKWR); |
5209 |
+ if (err < 0) |
5210 |
+ return err; |
5211 |
+ |
5212 |
+ msleep(1); |
5213 |
+ |
5214 |
+- return rtsx_pci_write_phy_register(pcr, PHY_BPCR, 0x05C0); |
5215 |
++ err = rtsx_pci_write_phy_register(pcr, PHY_BPCR, |
5216 |
++ PHY_BPCR_IBRXSEL | PHY_BPCR_IBTXSEL | |
5217 |
++ PHY_BPCR_IB_FILTER | PHY_BPCR_CMIRROR_EN); |
5218 |
++ if (err < 0) |
5219 |
++ return err; |
5220 |
++ err = rtsx_pci_write_phy_register(pcr, PHY_PCR, |
5221 |
++ PHY_PCR_FORCE_CODE | PHY_PCR_OOBS_CALI_50 | |
5222 |
++ PHY_PCR_OOBS_VCM_08 | PHY_PCR_OOBS_SEN_90 | |
5223 |
++ PHY_PCR_RSSI_EN); |
5224 |
++ if (err < 0) |
5225 |
++ return err; |
5226 |
++ err = rtsx_pci_write_phy_register(pcr, PHY_RCR2, |
5227 |
++ PHY_RCR2_EMPHASE_EN | PHY_RCR2_NADJR | |
5228 |
++ PHY_RCR2_CDR_CP_10 | PHY_RCR2_CDR_SR_2 | |
5229 |
++ PHY_RCR2_FREQSEL_12 | PHY_RCR2_CPADJEN | |
5230 |
++ PHY_RCR2_CDR_SC_8 | PHY_RCR2_CALIB_LATE); |
5231 |
++ if (err < 0) |
5232 |
++ return err; |
5233 |
++ err = rtsx_pci_write_phy_register(pcr, PHY_FLD4, |
5234 |
++ PHY_FLD4_FLDEN_SEL | PHY_FLD4_REQ_REF | |
5235 |
++ PHY_FLD4_RXAMP_OFF | PHY_FLD4_REQ_ADDA | |
5236 |
++ PHY_FLD4_BER_COUNT | PHY_FLD4_BER_TIMER | |
5237 |
++ PHY_FLD4_BER_CHK_EN); |
5238 |
++ if (err < 0) |
5239 |
++ return err; |
5240 |
++ err = rtsx_pci_write_phy_register(pcr, PHY_RDR, PHY_RDR_RXDSEL_1_9); |
5241 |
++ if (err < 0) |
5242 |
++ return err; |
5243 |
++ err = rtsx_pci_write_phy_register(pcr, PHY_RCR1, |
5244 |
++ PHY_RCR1_ADP_TIME | PHY_RCR1_VCO_COARSE); |
5245 |
++ if (err < 0) |
5246 |
++ return err; |
5247 |
++ err = rtsx_pci_write_phy_register(pcr, PHY_FLD3, |
5248 |
++ PHY_FLD3_TIMER_4 | PHY_FLD3_TIMER_6 | |
5249 |
++ PHY_FLD3_RXDELINK); |
5250 |
++ if (err < 0) |
5251 |
++ return err; |
5252 |
++ return rtsx_pci_write_phy_register(pcr, PHY_TUNE, |
5253 |
++ PHY_TUNE_TUNEREF_1_0 | PHY_TUNE_VBGSEL_1252 | |
5254 |
++ PHY_TUNE_SDBUS_33 | PHY_TUNE_TUNED18 | |
5255 |
++ PHY_TUNE_TUNED12); |
5256 |
+ } |
5257 |
+ |
5258 |
+ static int rts5249_turn_on_led(struct rtsx_pcr *pcr) |
5259 |
+diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c |
5260 |
+index 69e438ee..92c18779 100644 |
5261 |
+--- a/drivers/mmc/host/atmel-mci.c |
5262 |
++++ b/drivers/mmc/host/atmel-mci.c |
5263 |
+@@ -589,6 +589,13 @@ static void atmci_timeout_timer(unsigned long data) |
5264 |
+ if (host->mrq->cmd->data) { |
5265 |
+ host->mrq->cmd->data->error = -ETIMEDOUT; |
5266 |
+ host->data = NULL; |
5267 |
++ /* |
5268 |
++ * With some SDIO modules, sometimes DMA transfer hangs. If |
5269 |
++ * stop_transfer() is not called then the DMA request is not |
5270 |
++ * removed, following ones are queued and never computed. |
5271 |
++ */ |
5272 |
++ if (host->state == STATE_DATA_XFER) |
5273 |
++ host->stop_transfer(host); |
5274 |
+ } else { |
5275 |
+ host->mrq->cmd->error = -ETIMEDOUT; |
5276 |
+ host->cmd = NULL; |
5277 |
+@@ -1803,12 +1810,14 @@ static void atmci_tasklet_func(unsigned long priv) |
5278 |
+ if (unlikely(status)) { |
5279 |
+ host->stop_transfer(host); |
5280 |
+ host->data = NULL; |
5281 |
+- if (status & ATMCI_DTOE) { |
5282 |
+- data->error = -ETIMEDOUT; |
5283 |
+- } else if (status & ATMCI_DCRCE) { |
5284 |
+- data->error = -EILSEQ; |
5285 |
+- } else { |
5286 |
+- data->error = -EIO; |
5287 |
++ if (data) { |
5288 |
++ if (status & ATMCI_DTOE) { |
5289 |
++ data->error = -ETIMEDOUT; |
5290 |
++ } else if (status & ATMCI_DCRCE) { |
5291 |
++ data->error = -EILSEQ; |
5292 |
++ } else { |
5293 |
++ data->error = -EIO; |
5294 |
++ } |
5295 |
+ } |
5296 |
+ } |
5297 |
+ |
5298 |
+diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c |
5299 |
+index 6bc9618a..f111f04f 100644 |
5300 |
+--- a/drivers/mtd/devices/m25p80.c |
5301 |
++++ b/drivers/mtd/devices/m25p80.c |
5302 |
+@@ -78,7 +78,7 @@ |
5303 |
+ |
5304 |
+ /* Define max times to check status register before we give up. */ |
5305 |
+ #define MAX_READY_WAIT_JIFFIES (40 * HZ) /* M25P16 specs 40s max chip erase */ |
5306 |
+-#define MAX_CMD_SIZE 5 |
5307 |
++#define MAX_CMD_SIZE 6 |
5308 |
+ |
5309 |
+ #define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) |
5310 |
+ |
5311 |
+@@ -992,15 +992,13 @@ static int m25p_probe(struct spi_device *spi) |
5312 |
+ } |
5313 |
+ } |
5314 |
+ |
5315 |
+- flash = kzalloc(sizeof *flash, GFP_KERNEL); |
5316 |
++ flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); |
5317 |
+ if (!flash) |
5318 |
+ return -ENOMEM; |
5319 |
+- flash->command = kmalloc(MAX_CMD_SIZE + (flash->fast_read ? 1 : 0), |
5320 |
+- GFP_KERNEL); |
5321 |
+- if (!flash->command) { |
5322 |
+- kfree(flash); |
5323 |
++ |
5324 |
++ flash->command = devm_kzalloc(&spi->dev, MAX_CMD_SIZE, GFP_KERNEL); |
5325 |
++ if (!flash->command) |
5326 |
+ return -ENOMEM; |
5327 |
+- } |
5328 |
+ |
5329 |
+ flash->spi = spi; |
5330 |
+ mutex_init(&flash->lock); |
5331 |
+@@ -1133,14 +1131,10 @@ static int m25p_probe(struct spi_device *spi) |
5332 |
+ static int m25p_remove(struct spi_device *spi) |
5333 |
+ { |
5334 |
+ struct m25p *flash = spi_get_drvdata(spi); |
5335 |
+- int status; |
5336 |
+ |
5337 |
+ /* Clean up MTD stuff. */ |
5338 |
+- status = mtd_device_unregister(&flash->mtd); |
5339 |
+- if (status == 0) { |
5340 |
+- kfree(flash->command); |
5341 |
+- kfree(flash); |
5342 |
+- } |
5343 |
++ mtd_device_unregister(&flash->mtd); |
5344 |
++ |
5345 |
+ return 0; |
5346 |
+ } |
5347 |
+ |
5348 |
+diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c |
5349 |
+index 060feeaf..9be07922 100644 |
5350 |
+--- a/drivers/mtd/nand/atmel_nand.c |
5351 |
++++ b/drivers/mtd/nand/atmel_nand.c |
5352 |
+@@ -2177,7 +2177,6 @@ err_no_card: |
5353 |
+ if (host->dma_chan) |
5354 |
+ dma_release_channel(host->dma_chan); |
5355 |
+ err_nand_ioremap: |
5356 |
+- platform_driver_unregister(&atmel_nand_nfc_driver); |
5357 |
+ return res; |
5358 |
+ } |
5359 |
+ |
5360 |
+diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c |
5361 |
+index a9830ff8..a9260178 100644 |
5362 |
+--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c |
5363 |
++++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c |
5364 |
+@@ -392,8 +392,6 @@ static void dma_irq_callback(void *param) |
5365 |
+ struct gpmi_nand_data *this = param; |
5366 |
+ struct completion *dma_c = &this->dma_done; |
5367 |
+ |
5368 |
+- complete(dma_c); |
5369 |
+- |
5370 |
+ switch (this->dma_type) { |
5371 |
+ case DMA_FOR_COMMAND: |
5372 |
+ dma_unmap_sg(this->dev, &this->cmd_sgl, 1, DMA_TO_DEVICE); |
5373 |
+@@ -418,6 +416,8 @@ static void dma_irq_callback(void *param) |
5374 |
+ default: |
5375 |
+ pr_err("in wrong DMA operation.\n"); |
5376 |
+ } |
5377 |
++ |
5378 |
++ complete(dma_c); |
5379 |
+ } |
5380 |
+ |
5381 |
+ int start_dma_without_bch_irq(struct gpmi_nand_data *this, |
5382 |
+@@ -1568,8 +1568,6 @@ static int gpmi_set_geometry(struct gpmi_nand_data *this) |
5383 |
+ |
5384 |
+ static int gpmi_pre_bbt_scan(struct gpmi_nand_data *this) |
5385 |
+ { |
5386 |
+- int ret; |
5387 |
+- |
5388 |
+ /* Set up swap_block_mark, must be set before the gpmi_set_geometry() */ |
5389 |
+ if (GPMI_IS_MX23(this)) |
5390 |
+ this->swap_block_mark = false; |
5391 |
+@@ -1577,12 +1575,8 @@ static int gpmi_pre_bbt_scan(struct gpmi_nand_data *this) |
5392 |
+ this->swap_block_mark = true; |
5393 |
+ |
5394 |
+ /* Set up the medium geometry */ |
5395 |
+- ret = gpmi_set_geometry(this); |
5396 |
+- if (ret) |
5397 |
+- return ret; |
5398 |
++ return gpmi_set_geometry(this); |
5399 |
+ |
5400 |
+- /* NAND boot init, depends on the gpmi_set_geometry(). */ |
5401 |
+- return nand_boot_init(this); |
5402 |
+ } |
5403 |
+ |
5404 |
+ static void gpmi_nfc_exit(struct gpmi_nand_data *this) |
5405 |
+@@ -1672,10 +1666,16 @@ static int gpmi_nfc_init(struct gpmi_nand_data *this) |
5406 |
+ if (ret) |
5407 |
+ goto err_out; |
5408 |
+ |
5409 |
++ chip->options |= NAND_SKIP_BBTSCAN; |
5410 |
+ ret = nand_scan_tail(mtd); |
5411 |
+ if (ret) |
5412 |
+ goto err_out; |
5413 |
+ |
5414 |
++ ret = nand_boot_init(this); |
5415 |
++ if (ret) |
5416 |
++ goto err_out; |
5417 |
++ chip->scan_bbt(mtd); |
5418 |
++ |
5419 |
+ ppdata.of_node = this->pdev->dev.of_node; |
5420 |
+ ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0); |
5421 |
+ if (ret) |
5422 |
+diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c |
5423 |
+index d340b2f1..d92d94bb 100644 |
5424 |
+--- a/drivers/mtd/nand/nand_base.c |
5425 |
++++ b/drivers/mtd/nand/nand_base.c |
5426 |
+@@ -2981,10 +2981,21 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, |
5427 |
+ sanitize_string(p->model, sizeof(p->model)); |
5428 |
+ if (!mtd->name) |
5429 |
+ mtd->name = p->model; |
5430 |
++ |
5431 |
+ mtd->writesize = le32_to_cpu(p->byte_per_page); |
5432 |
+- mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize; |
5433 |
++ |
5434 |
++ /* |
5435 |
++ * pages_per_block and blocks_per_lun may not be a power-of-2 size |
5436 |
++ * (don't ask me who thought of this...). MTD assumes that these |
5437 |
++ * dimensions will be power-of-2, so just truncate the remaining area. |
5438 |
++ */ |
5439 |
++ mtd->erasesize = 1 << (fls(le32_to_cpu(p->pages_per_block)) - 1); |
5440 |
++ mtd->erasesize *= mtd->writesize; |
5441 |
++ |
5442 |
+ mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page); |
5443 |
+- chip->chipsize = le32_to_cpu(p->blocks_per_lun); |
5444 |
++ |
5445 |
++ /* See erasesize comment */ |
5446 |
++ chip->chipsize = 1 << (fls(le32_to_cpu(p->blocks_per_lun)) - 1); |
5447 |
+ chip->chipsize *= (uint64_t)mtd->erasesize * p->lun_count; |
5448 |
+ |
5449 |
+ if (onfi_feature(chip) & ONFI_FEATURE_16_BIT_BUS) |
5450 |
+diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c |
5451 |
+index 48161ede..69f58b07 100644 |
5452 |
+--- a/drivers/net/wireless/ath/ath5k/base.c |
5453 |
++++ b/drivers/net/wireless/ath/ath5k/base.c |
5454 |
+@@ -1663,15 +1663,15 @@ ath5k_tx_frame_completed(struct ath5k_hw *ah, struct sk_buff *skb, |
5455 |
+ ah->stats.tx_bytes_count += skb->len; |
5456 |
+ info = IEEE80211_SKB_CB(skb); |
5457 |
+ |
5458 |
++ size = min_t(int, sizeof(info->status.rates), sizeof(bf->rates)); |
5459 |
++ memcpy(info->status.rates, bf->rates, size); |
5460 |
++ |
5461 |
+ tries[0] = info->status.rates[0].count; |
5462 |
+ tries[1] = info->status.rates[1].count; |
5463 |
+ tries[2] = info->status.rates[2].count; |
5464 |
+ |
5465 |
+ ieee80211_tx_info_clear_status(info); |
5466 |
+ |
5467 |
+- size = min_t(int, sizeof(info->status.rates), sizeof(bf->rates)); |
5468 |
+- memcpy(info->status.rates, bf->rates, size); |
5469 |
+- |
5470 |
+ for (i = 0; i < ts->ts_final_idx; i++) { |
5471 |
+ struct ieee80211_tx_rate *r = |
5472 |
+ &info->status.rates[i]; |
5473 |
+diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c |
5474 |
+index 1576104e..9bf88987 100644 |
5475 |
+--- a/drivers/net/wireless/mwifiex/sdio.c |
5476 |
++++ b/drivers/net/wireless/mwifiex/sdio.c |
5477 |
+@@ -1029,7 +1029,10 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter, |
5478 |
+ struct sk_buff *skb, u32 upld_typ) |
5479 |
+ { |
5480 |
+ u8 *cmd_buf; |
5481 |
++ __le16 *curr_ptr = (__le16 *)skb->data; |
5482 |
++ u16 pkt_len = le16_to_cpu(*curr_ptr); |
5483 |
+ |
5484 |
++ skb_trim(skb, pkt_len); |
5485 |
+ skb_pull(skb, INTF_HEADER_LEN); |
5486 |
+ |
5487 |
+ switch (upld_typ) { |
5488 |
+diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c |
5489 |
+index 1cfe5a73..92f76d65 100644 |
5490 |
+--- a/drivers/net/wireless/mwifiex/uap_txrx.c |
5491 |
++++ b/drivers/net/wireless/mwifiex/uap_txrx.c |
5492 |
+@@ -97,6 +97,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, |
5493 |
+ struct mwifiex_txinfo *tx_info; |
5494 |
+ int hdr_chop; |
5495 |
+ struct timeval tv; |
5496 |
++ struct ethhdr *p_ethhdr; |
5497 |
+ u8 rfc1042_eth_hdr[ETH_ALEN] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; |
5498 |
+ |
5499 |
+ uap_rx_pd = (struct uap_rxpd *)(skb->data); |
5500 |
+@@ -112,14 +113,36 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, |
5501 |
+ } |
5502 |
+ |
5503 |
+ if (!memcmp(&rx_pkt_hdr->rfc1042_hdr, |
5504 |
+- rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) |
5505 |
++ rfc1042_eth_hdr, sizeof(rfc1042_eth_hdr))) { |
5506 |
++ /* Replace the 803 header and rfc1042 header (llc/snap) with |
5507 |
++ * an Ethernet II header, keep the src/dst and snap_type |
5508 |
++ * (ethertype). |
5509 |
++ * |
5510 |
++ * The firmware only passes up SNAP frames converting all RX |
5511 |
++ * data from 802.11 to 802.2/LLC/SNAP frames. |
5512 |
++ * |
5513 |
++ * To create the Ethernet II, just move the src, dst address |
5514 |
++ * right before the snap_type. |
5515 |
++ */ |
5516 |
++ p_ethhdr = (struct ethhdr *) |
5517 |
++ ((u8 *)(&rx_pkt_hdr->eth803_hdr) |
5518 |
++ + sizeof(rx_pkt_hdr->eth803_hdr) |
5519 |
++ + sizeof(rx_pkt_hdr->rfc1042_hdr) |
5520 |
++ - sizeof(rx_pkt_hdr->eth803_hdr.h_dest) |
5521 |
++ - sizeof(rx_pkt_hdr->eth803_hdr.h_source) |
5522 |
++ - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type)); |
5523 |
++ memcpy(p_ethhdr->h_source, rx_pkt_hdr->eth803_hdr.h_source, |
5524 |
++ sizeof(p_ethhdr->h_source)); |
5525 |
++ memcpy(p_ethhdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest, |
5526 |
++ sizeof(p_ethhdr->h_dest)); |
5527 |
+ /* Chop off the rxpd + the excess memory from |
5528 |
+ * 802.2/llc/snap header that was removed. |
5529 |
+ */ |
5530 |
+- hdr_chop = (u8 *)eth_hdr - (u8 *)uap_rx_pd; |
5531 |
+- else |
5532 |
++ hdr_chop = (u8 *)p_ethhdr - (u8 *)uap_rx_pd; |
5533 |
++ } else { |
5534 |
+ /* Chop off the rxpd */ |
5535 |
+ hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd; |
5536 |
++ } |
5537 |
+ |
5538 |
+ /* Chop off the leading header bytes so the it points |
5539 |
+ * to the start of either the reconstructed EthII frame |
5540 |
+diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c |
5541 |
+index 5970ff6f..d498b02f 100644 |
5542 |
+--- a/drivers/net/wireless/prism54/islpci_dev.c |
5543 |
++++ b/drivers/net/wireless/prism54/islpci_dev.c |
5544 |
+@@ -811,6 +811,10 @@ static const struct net_device_ops islpci_netdev_ops = { |
5545 |
+ .ndo_validate_addr = eth_validate_addr, |
5546 |
+ }; |
5547 |
+ |
5548 |
++static struct device_type wlan_type = { |
5549 |
++ .name = "wlan", |
5550 |
++}; |
5551 |
++ |
5552 |
+ struct net_device * |
5553 |
+ islpci_setup(struct pci_dev *pdev) |
5554 |
+ { |
5555 |
+@@ -821,9 +825,8 @@ islpci_setup(struct pci_dev *pdev) |
5556 |
+ return ndev; |
5557 |
+ |
5558 |
+ pci_set_drvdata(pdev, ndev); |
5559 |
+-#if defined(SET_NETDEV_DEV) |
5560 |
+ SET_NETDEV_DEV(ndev, &pdev->dev); |
5561 |
+-#endif |
5562 |
++ SET_NETDEV_DEVTYPE(ndev, &wlan_type); |
5563 |
+ |
5564 |
+ /* setup the structure members */ |
5565 |
+ ndev->base_addr = pci_resource_start(pdev, 0); |
5566 |
+diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c |
5567 |
+index 3d53a09d..38ed9a3e 100644 |
5568 |
+--- a/drivers/net/wireless/rt2x00/rt2400pci.c |
5569 |
++++ b/drivers/net/wireless/rt2x00/rt2400pci.c |
5570 |
+@@ -1261,7 +1261,7 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry, |
5571 |
+ */ |
5572 |
+ rxdesc->timestamp = ((u64)rx_high << 32) | rx_low; |
5573 |
+ rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL) & ~0x08; |
5574 |
+- rxdesc->rssi = rt2x00_get_field32(word2, RXD_W3_RSSI) - |
5575 |
++ rxdesc->rssi = rt2x00_get_field32(word3, RXD_W3_RSSI) - |
5576 |
+ entry->queue->rt2x00dev->rssi_offset; |
5577 |
+ rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); |
5578 |
+ |
5579 |
+diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c |
5580 |
+index 8bb4a9a0..9fa90a25 100644 |
5581 |
+--- a/drivers/net/wireless/rtlwifi/base.c |
5582 |
++++ b/drivers/net/wireless/rtlwifi/base.c |
5583 |
+@@ -37,6 +37,7 @@ |
5584 |
+ |
5585 |
+ #include <linux/ip.h> |
5586 |
+ #include <linux/module.h> |
5587 |
++#include <linux/udp.h> |
5588 |
+ |
5589 |
+ /* |
5590 |
+ *NOTICE!!!: This file will be very big, we should |
5591 |
+@@ -1074,64 +1075,52 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) |
5592 |
+ if (!ieee80211_is_data(fc)) |
5593 |
+ return false; |
5594 |
+ |
5595 |
++ ip = (const struct iphdr *)(skb->data + mac_hdr_len + |
5596 |
++ SNAP_SIZE + PROTOC_TYPE_SIZE); |
5597 |
++ ether_type = be16_to_cpup((__be16 *) |
5598 |
++ (skb->data + mac_hdr_len + SNAP_SIZE)); |
5599 |
+ |
5600 |
+- ip = (struct iphdr *)((u8 *) skb->data + mac_hdr_len + |
5601 |
+- SNAP_SIZE + PROTOC_TYPE_SIZE); |
5602 |
+- ether_type = *(u16 *) ((u8 *) skb->data + mac_hdr_len + SNAP_SIZE); |
5603 |
+- /* ether_type = ntohs(ether_type); */ |
5604 |
+- |
5605 |
+- if (ETH_P_IP == ether_type) { |
5606 |
+- if (IPPROTO_UDP == ip->protocol) { |
5607 |
+- struct udphdr *udp = (struct udphdr *)((u8 *) ip + |
5608 |
+- (ip->ihl << 2)); |
5609 |
+- if (((((u8 *) udp)[1] == 68) && |
5610 |
+- (((u8 *) udp)[3] == 67)) || |
5611 |
+- ((((u8 *) udp)[1] == 67) && |
5612 |
+- (((u8 *) udp)[3] == 68))) { |
5613 |
+- /* |
5614 |
+- * 68 : UDP BOOTP client |
5615 |
+- * 67 : UDP BOOTP server |
5616 |
+- */ |
5617 |
+- RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), |
5618 |
+- DBG_DMESG, "dhcp %s !!\n", |
5619 |
+- is_tx ? "Tx" : "Rx"); |
5620 |
+- |
5621 |
+- if (is_tx) { |
5622 |
+- rtlpriv->enter_ps = false; |
5623 |
+- schedule_work(&rtlpriv-> |
5624 |
+- works.lps_change_work); |
5625 |
+- ppsc->last_delaylps_stamp_jiffies = |
5626 |
+- jiffies; |
5627 |
+- } |
5628 |
++ switch (ether_type) { |
5629 |
++ case ETH_P_IP: { |
5630 |
++ struct udphdr *udp; |
5631 |
++ u16 src; |
5632 |
++ u16 dst; |
5633 |
+ |
5634 |
+- return true; |
5635 |
+- } |
5636 |
+- } |
5637 |
+- } else if (ETH_P_ARP == ether_type) { |
5638 |
+- if (is_tx) { |
5639 |
+- rtlpriv->enter_ps = false; |
5640 |
+- schedule_work(&rtlpriv->works.lps_change_work); |
5641 |
+- ppsc->last_delaylps_stamp_jiffies = jiffies; |
5642 |
+- } |
5643 |
++ if (ip->protocol != IPPROTO_UDP) |
5644 |
++ return false; |
5645 |
++ udp = (struct udphdr *)((u8 *)ip + (ip->ihl << 2)); |
5646 |
++ src = be16_to_cpu(udp->source); |
5647 |
++ dst = be16_to_cpu(udp->dest); |
5648 |
+ |
5649 |
+- return true; |
5650 |
+- } else if (ETH_P_PAE == ether_type) { |
5651 |
++ /* If this case involves port 68 (UDP BOOTP client) connecting |
5652 |
++ * with port 67 (UDP BOOTP server), then return true so that |
5653 |
++ * the lowest speed is used. |
5654 |
++ */ |
5655 |
++ if (!((src == 68 && dst == 67) || (src == 67 && dst == 68))) |
5656 |
++ return false; |
5657 |
++ |
5658 |
++ RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, |
5659 |
++ "dhcp %s !!\n", is_tx ? "Tx" : "Rx"); |
5660 |
++ break; |
5661 |
++ } |
5662 |
++ case ETH_P_ARP: |
5663 |
++ break; |
5664 |
++ case ETH_P_PAE: |
5665 |
+ RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG, |
5666 |
+ "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx"); |
5667 |
+- |
5668 |
+- if (is_tx) { |
5669 |
+- rtlpriv->enter_ps = false; |
5670 |
+- schedule_work(&rtlpriv->works.lps_change_work); |
5671 |
+- ppsc->last_delaylps_stamp_jiffies = jiffies; |
5672 |
+- } |
5673 |
+- |
5674 |
+- return true; |
5675 |
+- } else if (ETH_P_IPV6 == ether_type) { |
5676 |
+- /* IPv6 */ |
5677 |
+- return true; |
5678 |
++ break; |
5679 |
++ case ETH_P_IPV6: |
5680 |
++ /* TODO: Is this right? */ |
5681 |
++ return false; |
5682 |
++ default: |
5683 |
++ return false; |
5684 |
+ } |
5685 |
+- |
5686 |
+- return false; |
5687 |
++ if (is_tx) { |
5688 |
++ rtlpriv->enter_ps = false; |
5689 |
++ schedule_work(&rtlpriv->works.lps_change_work); |
5690 |
++ ppsc->last_delaylps_stamp_jiffies = jiffies; |
5691 |
++ } |
5692 |
++ return true; |
5693 |
+ } |
5694 |
+ EXPORT_SYMBOL_GPL(rtl_is_special_data); |
5695 |
+ |
5696 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c |
5697 |
+index b68cae30..e06971be 100644 |
5698 |
+--- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c |
5699 |
++++ b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c |
5700 |
+@@ -143,6 +143,7 @@ static void _rtl88ee_set_fw_clock_on(struct ieee80211_hw *hw, |
5701 |
+ } else { |
5702 |
+ rtlhal->fw_clk_change_in_progress = false; |
5703 |
+ spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); |
5704 |
++ break; |
5705 |
+ } |
5706 |
+ } |
5707 |
+ |
5708 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c |
5709 |
+index da4f5871..2c68c138 100644 |
5710 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c |
5711 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c |
5712 |
+@@ -778,7 +778,7 @@ static long _rtl92c_signal_scale_mapping(struct ieee80211_hw *hw, |
5713 |
+ |
5714 |
+ static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw, |
5715 |
+ struct rtl_stats *pstats, |
5716 |
+- struct rx_desc_92c *pdesc, |
5717 |
++ struct rx_desc_92c *p_desc, |
5718 |
+ struct rx_fwinfo_92c *p_drvinfo, |
5719 |
+ bool packet_match_bssid, |
5720 |
+ bool packet_toself, |
5721 |
+@@ -793,11 +793,11 @@ static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw, |
5722 |
+ u32 rssi, total_rssi = 0; |
5723 |
+ bool in_powersavemode = false; |
5724 |
+ bool is_cck_rate; |
5725 |
++ u8 *pdesc = (u8 *)p_desc; |
5726 |
+ |
5727 |
+- is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc); |
5728 |
++ is_cck_rate = RX_HAL_IS_CCK_RATE(p_desc); |
5729 |
+ pstats->packet_matchbssid = packet_match_bssid; |
5730 |
+ pstats->packet_toself = packet_toself; |
5731 |
+- pstats->is_cck = is_cck_rate; |
5732 |
+ pstats->packet_beacon = packet_beacon; |
5733 |
+ pstats->is_cck = is_cck_rate; |
5734 |
+ pstats->RX_SIGQ[0] = -1; |
5735 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c |
5736 |
+index 5a060e53..5c52a8ac 100644 |
5737 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c |
5738 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c |
5739 |
+@@ -303,10 +303,10 @@ out: |
5740 |
+ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, |
5741 |
+ struct rtl_stats *stats, |
5742 |
+ struct ieee80211_rx_status *rx_status, |
5743 |
+- u8 *p_desc, struct sk_buff *skb) |
5744 |
++ u8 *pdesc, struct sk_buff *skb) |
5745 |
+ { |
5746 |
+ struct rx_fwinfo_92c *p_drvinfo; |
5747 |
+- struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc; |
5748 |
++ struct rx_desc_92c *p_desc = (struct rx_desc_92c *)pdesc; |
5749 |
+ u32 phystatus = GET_RX_DESC_PHY_STATUS(pdesc); |
5750 |
+ |
5751 |
+ stats->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); |
5752 |
+@@ -345,11 +345,11 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, |
5753 |
+ if (phystatus) { |
5754 |
+ p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + |
5755 |
+ stats->rx_bufshift); |
5756 |
+- rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc, |
5757 |
++ rtl92c_translate_rx_signal_stuff(hw, skb, stats, p_desc, |
5758 |
+ p_drvinfo); |
5759 |
+ } |
5760 |
+ /*rx_status->qual = stats->signal; */ |
5761 |
+- rx_status->signal = stats->rssi + 10; |
5762 |
++ rx_status->signal = stats->recvsignalpower + 10; |
5763 |
+ /*rx_status->noise = -stats->noise; */ |
5764 |
+ return true; |
5765 |
+ } |
5766 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c |
5767 |
+index b8ec718a..542394c8 100644 |
5768 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c |
5769 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c |
5770 |
+@@ -525,7 +525,7 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, |
5771 |
+ p_drvinfo); |
5772 |
+ } |
5773 |
+ /*rx_status->qual = stats->signal; */ |
5774 |
+- rx_status->signal = stats->rssi + 10; |
5775 |
++ rx_status->signal = stats->recvsignalpower + 10; |
5776 |
+ /*rx_status->noise = -stats->noise; */ |
5777 |
+ return true; |
5778 |
+ } |
5779 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c |
5780 |
+index 5061f1db..92d38ab3 100644 |
5781 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c |
5782 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c |
5783 |
+@@ -265,7 +265,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, |
5784 |
+ rtlefuse->pwrgroup_ht40 |
5785 |
+ [RF90_PATH_A][chnl - 1]) { |
5786 |
+ pwrdiff_limit[i] = |
5787 |
+- rtlefuse->pwrgroup_ht20 |
5788 |
++ rtlefuse->pwrgroup_ht40 |
5789 |
+ [RF90_PATH_A][chnl - 1]; |
5790 |
+ } |
5791 |
+ } else { |
5792 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c |
5793 |
+index c7095118..7d0f2e20 100644 |
5794 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c |
5795 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c |
5796 |
+@@ -329,7 +329,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, |
5797 |
+ } |
5798 |
+ |
5799 |
+ /*rx_status->qual = stats->signal; */ |
5800 |
+- rx_status->signal = stats->rssi + 10; |
5801 |
++ rx_status->signal = stats->recvsignalpower + 10; |
5802 |
+ /*rx_status->noise = -stats->noise; */ |
5803 |
+ |
5804 |
+ return true; |
5805 |
+diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h |
5806 |
+index 70325874..ad9c37a4 100644 |
5807 |
+--- a/drivers/net/wireless/rtlwifi/wifi.h |
5808 |
++++ b/drivers/net/wireless/rtlwifi/wifi.h |
5809 |
+@@ -77,11 +77,7 @@ |
5810 |
+ #define RTL_SLOT_TIME_9 9 |
5811 |
+ #define RTL_SLOT_TIME_20 20 |
5812 |
+ |
5813 |
+-/*related with tcp/ip. */ |
5814 |
+-/*if_ehther.h*/ |
5815 |
+-#define ETH_P_PAE 0x888E /*Port Access Entity (IEEE 802.1X) */ |
5816 |
+-#define ETH_P_IP 0x0800 /*Internet Protocol packet */ |
5817 |
+-#define ETH_P_ARP 0x0806 /*Address Resolution packet */ |
5818 |
++/*related to tcp/ip. */ |
5819 |
+ #define SNAP_SIZE 6 |
5820 |
+ #define PROTOC_TYPE_SIZE 2 |
5821 |
+ |
5822 |
+diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c |
5823 |
+index 696caed5..ce8acc71 100644 |
5824 |
+--- a/drivers/pci/pcie/portdrv_pci.c |
5825 |
++++ b/drivers/pci/pcie/portdrv_pci.c |
5826 |
+@@ -223,7 +223,6 @@ static int pcie_portdrv_probe(struct pci_dev *dev, |
5827 |
+ static void pcie_portdrv_remove(struct pci_dev *dev) |
5828 |
+ { |
5829 |
+ pcie_port_device_remove(dev); |
5830 |
+- pci_disable_device(dev); |
5831 |
+ } |
5832 |
+ |
5833 |
+ static int error_detected_iter(struct device *device, void *data) |
5834 |
+diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c |
5835 |
+index 29f7e4fc..360b9b23 100644 |
5836 |
+--- a/drivers/pinctrl/mvebu/pinctrl-dove.c |
5837 |
++++ b/drivers/pinctrl/mvebu/pinctrl-dove.c |
5838 |
+@@ -335,7 +335,7 @@ static int dove_twsi_ctrl_set(struct mvebu_mpp_ctrl *ctrl, |
5839 |
+ unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2); |
5840 |
+ |
5841 |
+ gcfg1 &= ~DOVE_TWSI_ENABLE_OPTION1; |
5842 |
+- gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION2); |
5843 |
++ gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION3); |
5844 |
+ |
5845 |
+ switch (config) { |
5846 |
+ case 1: |
5847 |
+diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c |
5848 |
+index 13ec195f..3484dd29 100644 |
5849 |
+--- a/drivers/platform/x86/sony-laptop.c |
5850 |
++++ b/drivers/platform/x86/sony-laptop.c |
5851 |
+@@ -140,7 +140,6 @@ MODULE_PARM_DESC(kbd_backlight_timeout, |
5852 |
+ "on the model (default: no change from current value)"); |
5853 |
+ |
5854 |
+ #ifdef CONFIG_PM_SLEEP |
5855 |
+-static void sony_nc_kbd_backlight_resume(void); |
5856 |
+ static void sony_nc_thermal_resume(void); |
5857 |
+ #endif |
5858 |
+ static int sony_nc_kbd_backlight_setup(struct platform_device *pd, |
5859 |
+@@ -1486,13 +1485,6 @@ static void sony_nc_function_resume(void) |
5860 |
+ case 0x0135: |
5861 |
+ sony_nc_rfkill_update(); |
5862 |
+ break; |
5863 |
+- case 0x0137: |
5864 |
+- case 0x0143: |
5865 |
+- case 0x014b: |
5866 |
+- case 0x014c: |
5867 |
+- case 0x0163: |
5868 |
+- sony_nc_kbd_backlight_resume(); |
5869 |
+- break; |
5870 |
+ default: |
5871 |
+ continue; |
5872 |
+ } |
5873 |
+@@ -1894,25 +1886,6 @@ static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd) |
5874 |
+ } |
5875 |
+ } |
5876 |
+ |
5877 |
+-#ifdef CONFIG_PM_SLEEP |
5878 |
+-static void sony_nc_kbd_backlight_resume(void) |
5879 |
+-{ |
5880 |
+- int ignore = 0; |
5881 |
+- |
5882 |
+- if (!kbdbl_ctl) |
5883 |
+- return; |
5884 |
+- |
5885 |
+- if (kbdbl_ctl->mode == 0) |
5886 |
+- sony_call_snc_handle(kbdbl_ctl->handle, kbdbl_ctl->base, |
5887 |
+- &ignore); |
5888 |
+- |
5889 |
+- if (kbdbl_ctl->timeout != 0) |
5890 |
+- sony_call_snc_handle(kbdbl_ctl->handle, |
5891 |
+- (kbdbl_ctl->base + 0x200) | |
5892 |
+- (kbdbl_ctl->timeout << 0x10), &ignore); |
5893 |
+-} |
5894 |
+-#endif |
5895 |
+- |
5896 |
+ struct battery_care_control { |
5897 |
+ struct device_attribute attrs[2]; |
5898 |
+ unsigned int handle; |
5899 |
+diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c |
5900 |
+index ba67b2c4..032df379 100644 |
5901 |
+--- a/drivers/regulator/pfuze100-regulator.c |
5902 |
++++ b/drivers/regulator/pfuze100-regulator.c |
5903 |
+@@ -308,9 +308,15 @@ static int pfuze_identify(struct pfuze_chip *pfuze_chip) |
5904 |
+ if (ret) |
5905 |
+ return ret; |
5906 |
+ |
5907 |
+- if (value & 0x0f) { |
5908 |
+- dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value); |
5909 |
+- return -ENODEV; |
5910 |
++ switch (value & 0x0f) { |
5911 |
++ /* Freescale misprogrammed 1-3% of parts prior to week 8 of 2013 as ID=8 */ |
5912 |
++ case 0x8: |
5913 |
++ dev_info(pfuze_chip->dev, "Assuming misprogrammed ID=0x8"); |
5914 |
++ case 0x0: |
5915 |
++ break; |
5916 |
++ default: |
5917 |
++ dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value); |
5918 |
++ return -ENODEV; |
5919 |
+ } |
5920 |
+ |
5921 |
+ ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value); |
5922 |
+diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c |
5923 |
+index 20c271d4..b993ec57 100644 |
5924 |
+--- a/drivers/regulator/ti-abb-regulator.c |
5925 |
++++ b/drivers/regulator/ti-abb-regulator.c |
5926 |
+@@ -615,7 +615,7 @@ static int ti_abb_init_table(struct device *dev, struct ti_abb *abb, |
5927 |
+ pname, *volt_table, vset_mask); |
5928 |
+ continue; |
5929 |
+ } |
5930 |
+- info->vset = efuse_val & vset_mask >> __ffs(vset_mask); |
5931 |
++ info->vset = (efuse_val & vset_mask) >> __ffs(vset_mask); |
5932 |
+ dev_dbg(dev, "[%d]v=%d vset=%x\n", i, *volt_table, info->vset); |
5933 |
+ check_abb: |
5934 |
+ switch (info->opp_sel) { |
5935 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
5936 |
+index 0a328d0d..bd8c09e7 100644 |
5937 |
+--- a/drivers/s390/net/qeth_core_main.c |
5938 |
++++ b/drivers/s390/net/qeth_core_main.c |
5939 |
+@@ -4451,7 +4451,7 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata) |
5940 |
+ struct qeth_cmd_buffer *iob; |
5941 |
+ struct qeth_ipa_cmd *cmd; |
5942 |
+ struct qeth_snmp_ureq *ureq; |
5943 |
+- int req_len; |
5944 |
++ unsigned int req_len; |
5945 |
+ struct qeth_arp_query_info qinfo = {0, }; |
5946 |
+ int rc = 0; |
5947 |
+ |
5948 |
+@@ -4467,6 +4467,10 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata) |
5949 |
+ /* skip 4 bytes (data_len struct member) to get req_len */ |
5950 |
+ if (copy_from_user(&req_len, udata + sizeof(int), sizeof(int))) |
5951 |
+ return -EFAULT; |
5952 |
++ if (req_len > (QETH_BUFSIZE - IPA_PDU_HEADER_SIZE - |
5953 |
++ sizeof(struct qeth_ipacmd_hdr) - |
5954 |
++ sizeof(struct qeth_ipacmd_setadpparms_hdr))) |
5955 |
++ return -EINVAL; |
5956 |
+ ureq = memdup_user(udata, req_len + sizeof(struct qeth_snmp_ureq_hdr)); |
5957 |
+ if (IS_ERR(ureq)) { |
5958 |
+ QETH_CARD_TEXT(card, 2, "snmpnome"); |
5959 |
+diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c |
5960 |
+index 5dec771d..4d340f4a 100644 |
5961 |
+--- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c |
5962 |
++++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c |
5963 |
+@@ -409,8 +409,8 @@ int ptlrpc_stop_pinger(void) |
5964 |
+ struct l_wait_info lwi = { 0 }; |
5965 |
+ int rc = 0; |
5966 |
+ |
5967 |
+- if (!thread_is_init(&pinger_thread) && |
5968 |
+- !thread_is_stopped(&pinger_thread)) |
5969 |
++ if (thread_is_init(&pinger_thread) || |
5970 |
++ thread_is_stopped(&pinger_thread)) |
5971 |
+ return -EALREADY; |
5972 |
+ |
5973 |
+ ptlrpc_pinger_remove_timeouts(); |
5974 |
+diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c |
5975 |
+index 11d5338b..0feeaadf 100644 |
5976 |
+--- a/drivers/staging/media/lirc/lirc_zilog.c |
5977 |
++++ b/drivers/staging/media/lirc/lirc_zilog.c |
5978 |
+@@ -61,6 +61,9 @@ |
5979 |
+ #include <media/lirc_dev.h> |
5980 |
+ #include <media/lirc.h> |
5981 |
+ |
5982 |
++/* Max transfer size done by I2C transfer functions */ |
5983 |
++#define MAX_XFER_SIZE 64 |
5984 |
++ |
5985 |
+ struct IR; |
5986 |
+ |
5987 |
+ struct IR_rx { |
5988 |
+@@ -941,7 +944,14 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) |
5989 |
+ schedule(); |
5990 |
+ set_current_state(TASK_INTERRUPTIBLE); |
5991 |
+ } else { |
5992 |
+- unsigned char buf[rbuf->chunk_size]; |
5993 |
++ unsigned char buf[MAX_XFER_SIZE]; |
5994 |
++ |
5995 |
++ if (rbuf->chunk_size > sizeof(buf)) { |
5996 |
++ zilog_error("chunk_size is too big (%d)!\n", |
5997 |
++ rbuf->chunk_size); |
5998 |
++ ret = -EINVAL; |
5999 |
++ break; |
6000 |
++ } |
6001 |
+ m = lirc_buffer_read(rbuf, buf); |
6002 |
+ if (m == rbuf->chunk_size) { |
6003 |
+ ret = copy_to_user((void *)outbuf+written, buf, |
6004 |
+diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c |
6005 |
+index 2c73823d..2a13a41f 100644 |
6006 |
+--- a/drivers/staging/rtl8188eu/core/rtw_ap.c |
6007 |
++++ b/drivers/staging/rtl8188eu/core/rtw_ap.c |
6008 |
+@@ -1115,6 +1115,9 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) |
6009 |
+ return _FAIL; |
6010 |
+ } |
6011 |
+ |
6012 |
++ /* fix bug of flush_cam_entry at STOP AP mode */ |
6013 |
++ psta->state |= WIFI_AP_STATE; |
6014 |
++ rtw_indicate_connect(padapter); |
6015 |
+ pmlmepriv->cur_network.join_res = true;/* for check if already set beacon */ |
6016 |
+ return ret; |
6017 |
+ } |
6018 |
+diff --git a/drivers/staging/tidspbridge/Kconfig b/drivers/staging/tidspbridge/Kconfig |
6019 |
+index 165b918b..1b6d581c 100644 |
6020 |
+--- a/drivers/staging/tidspbridge/Kconfig |
6021 |
++++ b/drivers/staging/tidspbridge/Kconfig |
6022 |
+@@ -4,7 +4,7 @@ |
6023 |
+ |
6024 |
+ menuconfig TIDSPBRIDGE |
6025 |
+ tristate "DSP Bridge driver" |
6026 |
+- depends on ARCH_OMAP3 && !ARCH_MULTIPLATFORM |
6027 |
++ depends on ARCH_OMAP3 && !ARCH_MULTIPLATFORM && BROKEN |
6028 |
+ select MAILBOX |
6029 |
+ select OMAP2PLUS_MBOX |
6030 |
+ help |
6031 |
+diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c |
6032 |
+index 1e8b8412..4aa5ef54 100644 |
6033 |
+--- a/drivers/staging/vt6656/baseband.c |
6034 |
++++ b/drivers/staging/vt6656/baseband.c |
6035 |
+@@ -939,6 +939,7 @@ int BBbVT3184Init(struct vnt_private *pDevice) |
6036 |
+ u8 * pbyAgc; |
6037 |
+ u16 wLengthAgc; |
6038 |
+ u8 abyArray[256]; |
6039 |
++ u8 data; |
6040 |
+ |
6041 |
+ ntStatus = CONTROLnsRequestIn(pDevice, |
6042 |
+ MESSAGE_TYPE_READ, |
6043 |
+@@ -1104,6 +1105,16 @@ else { |
6044 |
+ ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01); |
6045 |
+ |
6046 |
+ RFbRFTableDownload(pDevice); |
6047 |
++ |
6048 |
++ /* Fix for TX USB resets from vendors driver */ |
6049 |
++ CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, USB_REG4, |
6050 |
++ MESSAGE_REQUEST_MEM, sizeof(data), &data); |
6051 |
++ |
6052 |
++ data |= 0x2; |
6053 |
++ |
6054 |
++ CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, USB_REG4, |
6055 |
++ MESSAGE_REQUEST_MEM, sizeof(data), &data); |
6056 |
++ |
6057 |
+ return true;//ntStatus; |
6058 |
+ } |
6059 |
+ |
6060 |
+diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h |
6061 |
+index 5e073062..5cf5e732 100644 |
6062 |
+--- a/drivers/staging/vt6656/rndis.h |
6063 |
++++ b/drivers/staging/vt6656/rndis.h |
6064 |
+@@ -66,6 +66,8 @@ |
6065 |
+ |
6066 |
+ #define VIAUSB20_PACKET_HEADER 0x04 |
6067 |
+ |
6068 |
++#define USB_REG4 0x604 |
6069 |
++ |
6070 |
+ typedef struct _CMD_MESSAGE |
6071 |
+ { |
6072 |
+ u8 byData[256]; |
6073 |
+diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c |
6074 |
+index 012ba15e..e06ec439 100644 |
6075 |
+--- a/drivers/staging/zram/zram_drv.c |
6076 |
++++ b/drivers/staging/zram/zram_drv.c |
6077 |
+@@ -652,21 +652,30 @@ static ssize_t reset_store(struct device *dev, |
6078 |
+ return -ENOMEM; |
6079 |
+ |
6080 |
+ /* Do not reset an active device! */ |
6081 |
+- if (bdev->bd_holders) |
6082 |
+- return -EBUSY; |
6083 |
++ if (bdev->bd_holders) { |
6084 |
++ ret = -EBUSY; |
6085 |
++ goto out; |
6086 |
++ } |
6087 |
+ |
6088 |
+ ret = kstrtou16(buf, 10, &do_reset); |
6089 |
+ if (ret) |
6090 |
+- return ret; |
6091 |
++ goto out; |
6092 |
+ |
6093 |
+- if (!do_reset) |
6094 |
+- return -EINVAL; |
6095 |
++ if (!do_reset) { |
6096 |
++ ret = -EINVAL; |
6097 |
++ goto out; |
6098 |
++ } |
6099 |
+ |
6100 |
+ /* Make sure all pending I/O is finished */ |
6101 |
+ fsync_bdev(bdev); |
6102 |
++ bdput(bdev); |
6103 |
+ |
6104 |
+ zram_reset_device(zram, true); |
6105 |
+ return len; |
6106 |
++ |
6107 |
++out: |
6108 |
++ bdput(bdev); |
6109 |
++ return ret; |
6110 |
+ } |
6111 |
+ |
6112 |
+ static void __zram_make_request(struct zram *zram, struct bio *bio, int rw) |
6113 |
+diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c |
6114 |
+index 1a67537d..3b950e5a 100644 |
6115 |
+--- a/drivers/staging/zsmalloc/zsmalloc-main.c |
6116 |
++++ b/drivers/staging/zsmalloc/zsmalloc-main.c |
6117 |
+@@ -430,7 +430,12 @@ static struct page *get_next_page(struct page *page) |
6118 |
+ return next; |
6119 |
+ } |
6120 |
+ |
6121 |
+-/* Encode <page, obj_idx> as a single handle value */ |
6122 |
++/* |
6123 |
++ * Encode <page, obj_idx> as a single handle value. |
6124 |
++ * On hardware platforms with physical memory starting at 0x0 the pfn |
6125 |
++ * could be 0 so we ensure that the handle will never be 0 by adjusting the |
6126 |
++ * encoded obj_idx value before encoding. |
6127 |
++ */ |
6128 |
+ static void *obj_location_to_handle(struct page *page, unsigned long obj_idx) |
6129 |
+ { |
6130 |
+ unsigned long handle; |
6131 |
+@@ -441,17 +446,21 @@ static void *obj_location_to_handle(struct page *page, unsigned long obj_idx) |
6132 |
+ } |
6133 |
+ |
6134 |
+ handle = page_to_pfn(page) << OBJ_INDEX_BITS; |
6135 |
+- handle |= (obj_idx & OBJ_INDEX_MASK); |
6136 |
++ handle |= ((obj_idx + 1) & OBJ_INDEX_MASK); |
6137 |
+ |
6138 |
+ return (void *)handle; |
6139 |
+ } |
6140 |
+ |
6141 |
+-/* Decode <page, obj_idx> pair from the given object handle */ |
6142 |
++/* |
6143 |
++ * Decode <page, obj_idx> pair from the given object handle. We adjust the |
6144 |
++ * decoded obj_idx back to its original value since it was adjusted in |
6145 |
++ * obj_location_to_handle(). |
6146 |
++ */ |
6147 |
+ static void obj_handle_to_location(unsigned long handle, struct page **page, |
6148 |
+ unsigned long *obj_idx) |
6149 |
+ { |
6150 |
+ *page = pfn_to_page(handle >> OBJ_INDEX_BITS); |
6151 |
+- *obj_idx = handle & OBJ_INDEX_MASK; |
6152 |
++ *obj_idx = (handle & OBJ_INDEX_MASK) - 1; |
6153 |
+ } |
6154 |
+ |
6155 |
+ static unsigned long obj_idx_to_offset(struct page *page, |
6156 |
+diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c |
6157 |
+index 7505fddc..3e801885 100644 |
6158 |
+--- a/drivers/target/iscsi/iscsi_target_auth.c |
6159 |
++++ b/drivers/target/iscsi/iscsi_target_auth.c |
6160 |
+@@ -146,6 +146,7 @@ static int chap_server_compute_md5( |
6161 |
+ unsigned char client_digest[MD5_SIGNATURE_SIZE]; |
6162 |
+ unsigned char server_digest[MD5_SIGNATURE_SIZE]; |
6163 |
+ unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; |
6164 |
++ size_t compare_len; |
6165 |
+ struct iscsi_chap *chap = conn->auth_protocol; |
6166 |
+ struct crypto_hash *tfm; |
6167 |
+ struct hash_desc desc; |
6168 |
+@@ -184,7 +185,9 @@ static int chap_server_compute_md5( |
6169 |
+ goto out; |
6170 |
+ } |
6171 |
+ |
6172 |
+- if (memcmp(chap_n, auth->userid, strlen(auth->userid)) != 0) { |
6173 |
++ /* Include the terminating NULL in the compare */ |
6174 |
++ compare_len = strlen(auth->userid) + 1; |
6175 |
++ if (strncmp(chap_n, auth->userid, compare_len) != 0) { |
6176 |
+ pr_err("CHAP_N values do not match!\n"); |
6177 |
+ goto out; |
6178 |
+ } |
6179 |
+diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c |
6180 |
+index fd145259..8a1bd1af 100644 |
6181 |
+--- a/drivers/target/iscsi/iscsi_target_configfs.c |
6182 |
++++ b/drivers/target/iscsi/iscsi_target_configfs.c |
6183 |
+@@ -1784,6 +1784,11 @@ static int lio_queue_status(struct se_cmd *se_cmd) |
6184 |
+ struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); |
6185 |
+ |
6186 |
+ cmd->i_state = ISTATE_SEND_STATUS; |
6187 |
++ |
6188 |
++ if (cmd->se_cmd.scsi_status || cmd->sense_reason) { |
6189 |
++ iscsit_add_cmd_to_response_queue(cmd, cmd->conn, cmd->i_state); |
6190 |
++ return 0; |
6191 |
++ } |
6192 |
+ cmd->conn->conn_transport->iscsit_queue_status(cmd->conn, cmd); |
6193 |
+ |
6194 |
+ return 0; |
6195 |
+diff --git a/drivers/target/iscsi/iscsi_target_device.c b/drivers/target/iscsi/iscsi_target_device.c |
6196 |
+index 6c7a5104..7087c736 100644 |
6197 |
+--- a/drivers/target/iscsi/iscsi_target_device.c |
6198 |
++++ b/drivers/target/iscsi/iscsi_target_device.c |
6199 |
+@@ -58,11 +58,7 @@ void iscsit_increment_maxcmdsn(struct iscsi_cmd *cmd, struct iscsi_session *sess |
6200 |
+ |
6201 |
+ cmd->maxcmdsn_inc = 1; |
6202 |
+ |
6203 |
+- if (!mutex_trylock(&sess->cmdsn_mutex)) { |
6204 |
+- sess->max_cmd_sn += 1; |
6205 |
+- pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn); |
6206 |
+- return; |
6207 |
+- } |
6208 |
++ mutex_lock(&sess->cmdsn_mutex); |
6209 |
+ sess->max_cmd_sn += 1; |
6210 |
+ pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn); |
6211 |
+ mutex_unlock(&sess->cmdsn_mutex); |
6212 |
+diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c |
6213 |
+index ef6d836a..a972145d 100644 |
6214 |
+--- a/drivers/target/iscsi/iscsi_target_nego.c |
6215 |
++++ b/drivers/target/iscsi/iscsi_target_nego.c |
6216 |
+@@ -88,7 +88,7 @@ int extract_param( |
6217 |
+ if (len < 0) |
6218 |
+ return -1; |
6219 |
+ |
6220 |
+- if (len > max_length) { |
6221 |
++ if (len >= max_length) { |
6222 |
+ pr_err("Length of input: %d exceeds max_length:" |
6223 |
+ " %d\n", len, max_length); |
6224 |
+ return -1; |
6225 |
+diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c |
6226 |
+index 81e945ee..0b0009b5 100644 |
6227 |
+--- a/drivers/target/target_core_transport.c |
6228 |
++++ b/drivers/target/target_core_transport.c |
6229 |
+@@ -2910,6 +2910,7 @@ int transport_check_aborted_status(struct se_cmd *cmd, int send_status) |
6230 |
+ cmd->t_task_cdb[0], cmd->se_tfo->get_task_tag(cmd)); |
6231 |
+ |
6232 |
+ cmd->se_cmd_flags |= SCF_SENT_DELAYED_TAS; |
6233 |
++ cmd->scsi_status = SAM_STAT_TASK_ABORTED; |
6234 |
+ trace_target_cmd_complete(cmd); |
6235 |
+ cmd->se_tfo->queue_status(cmd); |
6236 |
+ |
6237 |
+@@ -2938,6 +2939,7 @@ void transport_send_task_abort(struct se_cmd *cmd) |
6238 |
+ if (cmd->se_tfo->write_pending_status(cmd) != 0) { |
6239 |
+ cmd->transport_state |= CMD_T_ABORTED; |
6240 |
+ smp_mb__after_atomic_inc(); |
6241 |
++ return; |
6242 |
+ } |
6243 |
+ } |
6244 |
+ cmd->scsi_status = SAM_STAT_TASK_ABORTED; |
6245 |
+diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c |
6246 |
+index 7a744b69..ff582933 100644 |
6247 |
+--- a/drivers/tty/n_tty.c |
6248 |
++++ b/drivers/tty/n_tty.c |
6249 |
+@@ -767,8 +767,8 @@ static size_t __process_echoes(struct tty_struct *tty) |
6250 |
+ * of echo overrun before the next commit), then discard enough |
6251 |
+ * data at the tail to prevent a subsequent overrun */ |
6252 |
+ while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) { |
6253 |
+- if (echo_buf(ldata, tail == ECHO_OP_START)) { |
6254 |
+- if (echo_buf(ldata, tail) == ECHO_OP_ERASE_TAB) |
6255 |
++ if (echo_buf(ldata, tail) == ECHO_OP_START) { |
6256 |
++ if (echo_buf(ldata, tail + 1) == ECHO_OP_ERASE_TAB) |
6257 |
+ tail += 3; |
6258 |
+ else |
6259 |
+ tail += 2; |
6260 |
+@@ -2005,7 +2005,10 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, |
6261 |
+ found = 1; |
6262 |
+ |
6263 |
+ size = N_TTY_BUF_SIZE - tail; |
6264 |
+- n = (found + eol + size) & (N_TTY_BUF_SIZE - 1); |
6265 |
++ n = eol - tail; |
6266 |
++ if (n > 4096) |
6267 |
++ n += 4096; |
6268 |
++ n += found; |
6269 |
+ c = n; |
6270 |
+ |
6271 |
+ if (found && read_buf(ldata, eol) == __DISABLED_CHAR) { |
6272 |
+@@ -2250,6 +2253,9 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, |
6273 |
+ if (time) |
6274 |
+ timeout = time; |
6275 |
+ } |
6276 |
++ n_tty_set_room(tty); |
6277 |
++ up_read(&tty->termios_rwsem); |
6278 |
++ |
6279 |
+ mutex_unlock(&ldata->atomic_read_lock); |
6280 |
+ remove_wait_queue(&tty->read_wait, &wait); |
6281 |
+ |
6282 |
+@@ -2260,8 +2266,6 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, |
6283 |
+ if (b - buf) |
6284 |
+ retval = b - buf; |
6285 |
+ |
6286 |
+- n_tty_set_room(tty); |
6287 |
+- up_read(&tty->termios_rwsem); |
6288 |
+ return retval; |
6289 |
+ } |
6290 |
+ |
6291 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
6292 |
+index 3a1a01af..c74a00ad 100644 |
6293 |
+--- a/drivers/tty/tty_io.c |
6294 |
++++ b/drivers/tty/tty_io.c |
6295 |
+@@ -2086,6 +2086,7 @@ retry_open: |
6296 |
+ filp->f_op = &tty_fops; |
6297 |
+ goto retry_open; |
6298 |
+ } |
6299 |
++ clear_bit(TTY_HUPPED, &tty->flags); |
6300 |
+ tty_unlock(tty); |
6301 |
+ |
6302 |
+ |
6303 |
+diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c |
6304 |
+index f7447f70..d18da911 100644 |
6305 |
+--- a/drivers/video/backlight/atmel-pwm-bl.c |
6306 |
++++ b/drivers/video/backlight/atmel-pwm-bl.c |
6307 |
+@@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) |
6308 |
+ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) |
6309 |
+ { |
6310 |
+ struct atmel_pwm_bl *pwmbl = bl_get_data(bd); |
6311 |
+- u8 intensity; |
6312 |
++ u32 intensity; |
6313 |
+ |
6314 |
+ if (pwmbl->pdata->pwm_active_low) { |
6315 |
+ intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) - |
6316 |
+@@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) |
6317 |
+ pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY); |
6318 |
+ } |
6319 |
+ |
6320 |
+- return intensity; |
6321 |
++ return intensity & 0xffff; |
6322 |
+ } |
6323 |
+ |
6324 |
+ static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl) |
6325 |
+@@ -206,8 +206,10 @@ static int atmel_pwm_bl_remove(struct platform_device *pdev) |
6326 |
+ { |
6327 |
+ struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); |
6328 |
+ |
6329 |
+- if (pwmbl->gpio_on != -1) |
6330 |
+- gpio_set_value(pwmbl->gpio_on, 0); |
6331 |
++ if (pwmbl->gpio_on != -1) { |
6332 |
++ gpio_set_value(pwmbl->gpio_on, |
6333 |
++ 0 ^ pwmbl->pdata->on_active_low); |
6334 |
++ } |
6335 |
+ pwm_channel_disable(&pwmbl->pwmc); |
6336 |
+ pwm_channel_free(&pwmbl->pwmc); |
6337 |
+ backlight_device_unregister(pwmbl->bldev); |
6338 |
+diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c |
6339 |
+index 35687fd5..4ad24f2c 100644 |
6340 |
+--- a/drivers/video/console/sticore.c |
6341 |
++++ b/drivers/video/console/sticore.c |
6342 |
+@@ -3,7 +3,7 @@ |
6343 |
+ * core code for console driver using HP's STI firmware |
6344 |
+ * |
6345 |
+ * Copyright (C) 2000 Philipp Rumpf <prumpf@×××.org> |
6346 |
+- * Copyright (C) 2001-2003 Helge Deller <deller@×××.de> |
6347 |
++ * Copyright (C) 2001-2013 Helge Deller <deller@×××.de> |
6348 |
+ * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@×××××××××××××.de> |
6349 |
+ * |
6350 |
+ * TODO: |
6351 |
+@@ -30,7 +30,7 @@ |
6352 |
+ |
6353 |
+ #include "../sticore.h" |
6354 |
+ |
6355 |
+-#define STI_DRIVERVERSION "Version 0.9a" |
6356 |
++#define STI_DRIVERVERSION "Version 0.9b" |
6357 |
+ |
6358 |
+ static struct sti_struct *default_sti __read_mostly; |
6359 |
+ |
6360 |
+@@ -73,28 +73,34 @@ static const struct sti_init_flags default_init_flags = { |
6361 |
+ |
6362 |
+ static int sti_init_graph(struct sti_struct *sti) |
6363 |
+ { |
6364 |
+- struct sti_init_inptr_ext inptr_ext = { 0, }; |
6365 |
+- struct sti_init_inptr inptr = { |
6366 |
+- .text_planes = 3, /* # of text planes (max 3 for STI) */ |
6367 |
+- .ext_ptr = STI_PTR(&inptr_ext) |
6368 |
+- }; |
6369 |
+- struct sti_init_outptr outptr = { 0, }; |
6370 |
++ struct sti_init_inptr *inptr = &sti->sti_data->init_inptr; |
6371 |
++ struct sti_init_inptr_ext *inptr_ext = &sti->sti_data->init_inptr_ext; |
6372 |
++ struct sti_init_outptr *outptr = &sti->sti_data->init_outptr; |
6373 |
+ unsigned long flags; |
6374 |
+- int ret; |
6375 |
++ int ret, err; |
6376 |
+ |
6377 |
+ spin_lock_irqsave(&sti->lock, flags); |
6378 |
+ |
6379 |
+- ret = STI_CALL(sti->init_graph, &default_init_flags, &inptr, |
6380 |
+- &outptr, sti->glob_cfg); |
6381 |
++ memset(inptr, 0, sizeof(*inptr)); |
6382 |
++ inptr->text_planes = 3; /* # of text planes (max 3 for STI) */ |
6383 |
++ memset(inptr_ext, 0, sizeof(*inptr_ext)); |
6384 |
++ inptr->ext_ptr = STI_PTR(inptr_ext); |
6385 |
++ outptr->errno = 0; |
6386 |
++ |
6387 |
++ ret = sti_call(sti, sti->init_graph, &default_init_flags, inptr, |
6388 |
++ outptr, sti->glob_cfg); |
6389 |
++ |
6390 |
++ if (ret >= 0) |
6391 |
++ sti->text_planes = outptr->text_planes; |
6392 |
++ err = outptr->errno; |
6393 |
+ |
6394 |
+ spin_unlock_irqrestore(&sti->lock, flags); |
6395 |
+ |
6396 |
+ if (ret < 0) { |
6397 |
+- printk(KERN_ERR "STI init_graph failed (ret %d, errno %d)\n",ret,outptr.errno); |
6398 |
++ pr_err("STI init_graph failed (ret %d, errno %d)\n", ret, err); |
6399 |
+ return -1; |
6400 |
+ } |
6401 |
+ |
6402 |
+- sti->text_planes = outptr.text_planes; |
6403 |
+ return 0; |
6404 |
+ } |
6405 |
+ |
6406 |
+@@ -104,16 +110,18 @@ static const struct sti_conf_flags default_conf_flags = { |
6407 |
+ |
6408 |
+ static void sti_inq_conf(struct sti_struct *sti) |
6409 |
+ { |
6410 |
+- struct sti_conf_inptr inptr = { 0, }; |
6411 |
++ struct sti_conf_inptr *inptr = &sti->sti_data->inq_inptr; |
6412 |
++ struct sti_conf_outptr *outptr = &sti->sti_data->inq_outptr; |
6413 |
+ unsigned long flags; |
6414 |
+ s32 ret; |
6415 |
+ |
6416 |
+- sti->outptr.ext_ptr = STI_PTR(&sti->outptr_ext); |
6417 |
++ outptr->ext_ptr = STI_PTR(&sti->sti_data->inq_outptr_ext); |
6418 |
+ |
6419 |
+ do { |
6420 |
+ spin_lock_irqsave(&sti->lock, flags); |
6421 |
+- ret = STI_CALL(sti->inq_conf, &default_conf_flags, |
6422 |
+- &inptr, &sti->outptr, sti->glob_cfg); |
6423 |
++ memset(inptr, 0, sizeof(*inptr)); |
6424 |
++ ret = sti_call(sti, sti->inq_conf, &default_conf_flags, |
6425 |
++ inptr, outptr, sti->glob_cfg); |
6426 |
+ spin_unlock_irqrestore(&sti->lock, flags); |
6427 |
+ } while (ret == 1); |
6428 |
+ } |
6429 |
+@@ -126,7 +134,8 @@ static const struct sti_font_flags default_font_flags = { |
6430 |
+ void |
6431 |
+ sti_putc(struct sti_struct *sti, int c, int y, int x) |
6432 |
+ { |
6433 |
+- struct sti_font_inptr inptr = { |
6434 |
++ struct sti_font_inptr *inptr = &sti->sti_data->font_inptr; |
6435 |
++ struct sti_font_inptr inptr_default = { |
6436 |
+ .font_start_addr= STI_PTR(sti->font->raw), |
6437 |
+ .index = c_index(sti, c), |
6438 |
+ .fg_color = c_fg(sti, c), |
6439 |
+@@ -134,14 +143,15 @@ sti_putc(struct sti_struct *sti, int c, int y, int x) |
6440 |
+ .dest_x = x * sti->font_width, |
6441 |
+ .dest_y = y * sti->font_height, |
6442 |
+ }; |
6443 |
+- struct sti_font_outptr outptr = { 0, }; |
6444 |
++ struct sti_font_outptr *outptr = &sti->sti_data->font_outptr; |
6445 |
+ s32 ret; |
6446 |
+ unsigned long flags; |
6447 |
+ |
6448 |
+ do { |
6449 |
+ spin_lock_irqsave(&sti->lock, flags); |
6450 |
+- ret = STI_CALL(sti->font_unpmv, &default_font_flags, |
6451 |
+- &inptr, &outptr, sti->glob_cfg); |
6452 |
++ *inptr = inptr_default; |
6453 |
++ ret = sti_call(sti, sti->font_unpmv, &default_font_flags, |
6454 |
++ inptr, outptr, sti->glob_cfg); |
6455 |
+ spin_unlock_irqrestore(&sti->lock, flags); |
6456 |
+ } while (ret == 1); |
6457 |
+ } |
6458 |
+@@ -156,7 +166,8 @@ void |
6459 |
+ sti_set(struct sti_struct *sti, int src_y, int src_x, |
6460 |
+ int height, int width, u8 color) |
6461 |
+ { |
6462 |
+- struct sti_blkmv_inptr inptr = { |
6463 |
++ struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; |
6464 |
++ struct sti_blkmv_inptr inptr_default = { |
6465 |
+ .fg_color = color, |
6466 |
+ .bg_color = color, |
6467 |
+ .src_x = src_x, |
6468 |
+@@ -166,14 +177,15 @@ sti_set(struct sti_struct *sti, int src_y, int src_x, |
6469 |
+ .width = width, |
6470 |
+ .height = height, |
6471 |
+ }; |
6472 |
+- struct sti_blkmv_outptr outptr = { 0, }; |
6473 |
++ struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; |
6474 |
+ s32 ret; |
6475 |
+ unsigned long flags; |
6476 |
+ |
6477 |
+ do { |
6478 |
+ spin_lock_irqsave(&sti->lock, flags); |
6479 |
+- ret = STI_CALL(sti->block_move, &clear_blkmv_flags, |
6480 |
+- &inptr, &outptr, sti->glob_cfg); |
6481 |
++ *inptr = inptr_default; |
6482 |
++ ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, |
6483 |
++ inptr, outptr, sti->glob_cfg); |
6484 |
+ spin_unlock_irqrestore(&sti->lock, flags); |
6485 |
+ } while (ret == 1); |
6486 |
+ } |
6487 |
+@@ -182,7 +194,8 @@ void |
6488 |
+ sti_clear(struct sti_struct *sti, int src_y, int src_x, |
6489 |
+ int height, int width, int c) |
6490 |
+ { |
6491 |
+- struct sti_blkmv_inptr inptr = { |
6492 |
++ struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; |
6493 |
++ struct sti_blkmv_inptr inptr_default = { |
6494 |
+ .fg_color = c_fg(sti, c), |
6495 |
+ .bg_color = c_bg(sti, c), |
6496 |
+ .src_x = src_x * sti->font_width, |
6497 |
+@@ -192,14 +205,15 @@ sti_clear(struct sti_struct *sti, int src_y, int src_x, |
6498 |
+ .width = width * sti->font_width, |
6499 |
+ .height = height* sti->font_height, |
6500 |
+ }; |
6501 |
+- struct sti_blkmv_outptr outptr = { 0, }; |
6502 |
++ struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; |
6503 |
+ s32 ret; |
6504 |
+ unsigned long flags; |
6505 |
+ |
6506 |
+ do { |
6507 |
+ spin_lock_irqsave(&sti->lock, flags); |
6508 |
+- ret = STI_CALL(sti->block_move, &clear_blkmv_flags, |
6509 |
+- &inptr, &outptr, sti->glob_cfg); |
6510 |
++ *inptr = inptr_default; |
6511 |
++ ret = sti_call(sti, sti->block_move, &clear_blkmv_flags, |
6512 |
++ inptr, outptr, sti->glob_cfg); |
6513 |
+ spin_unlock_irqrestore(&sti->lock, flags); |
6514 |
+ } while (ret == 1); |
6515 |
+ } |
6516 |
+@@ -212,7 +226,8 @@ void |
6517 |
+ sti_bmove(struct sti_struct *sti, int src_y, int src_x, |
6518 |
+ int dst_y, int dst_x, int height, int width) |
6519 |
+ { |
6520 |
+- struct sti_blkmv_inptr inptr = { |
6521 |
++ struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr; |
6522 |
++ struct sti_blkmv_inptr inptr_default = { |
6523 |
+ .src_x = src_x * sti->font_width, |
6524 |
+ .src_y = src_y * sti->font_height, |
6525 |
+ .dest_x = dst_x * sti->font_width, |
6526 |
+@@ -220,14 +235,15 @@ sti_bmove(struct sti_struct *sti, int src_y, int src_x, |
6527 |
+ .width = width * sti->font_width, |
6528 |
+ .height = height* sti->font_height, |
6529 |
+ }; |
6530 |
+- struct sti_blkmv_outptr outptr = { 0, }; |
6531 |
++ struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr; |
6532 |
+ s32 ret; |
6533 |
+ unsigned long flags; |
6534 |
+ |
6535 |
+ do { |
6536 |
+ spin_lock_irqsave(&sti->lock, flags); |
6537 |
+- ret = STI_CALL(sti->block_move, &default_blkmv_flags, |
6538 |
+- &inptr, &outptr, sti->glob_cfg); |
6539 |
++ *inptr = inptr_default; |
6540 |
++ ret = sti_call(sti, sti->block_move, &default_blkmv_flags, |
6541 |
++ inptr, outptr, sti->glob_cfg); |
6542 |
+ spin_unlock_irqrestore(&sti->lock, flags); |
6543 |
+ } while (ret == 1); |
6544 |
+ } |
6545 |
+@@ -284,7 +300,7 @@ __setup("sti=", sti_setup); |
6546 |
+ |
6547 |
+ |
6548 |
+ |
6549 |
+-static char *font_name[MAX_STI_ROMS] = { "VGA8x16", }; |
6550 |
++static char *font_name[MAX_STI_ROMS]; |
6551 |
+ static int font_index[MAX_STI_ROMS], |
6552 |
+ font_height[MAX_STI_ROMS], |
6553 |
+ font_width[MAX_STI_ROMS]; |
6554 |
+@@ -389,10 +405,10 @@ static void sti_dump_outptr(struct sti_struct *sti) |
6555 |
+ "%d used bits\n" |
6556 |
+ "%d planes\n" |
6557 |
+ "attributes %08x\n", |
6558 |
+- sti->outptr.bits_per_pixel, |
6559 |
+- sti->outptr.bits_used, |
6560 |
+- sti->outptr.planes, |
6561 |
+- sti->outptr.attributes)); |
6562 |
++ sti->sti_data->inq_outptr.bits_per_pixel, |
6563 |
++ sti->sti_data->inq_outptr.bits_used, |
6564 |
++ sti->sti_data->inq_outptr.planes, |
6565 |
++ sti->sti_data->inq_outptr.attributes)); |
6566 |
+ } |
6567 |
+ |
6568 |
+ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, |
6569 |
+@@ -402,24 +418,21 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, |
6570 |
+ struct sti_glob_cfg_ext *glob_cfg_ext; |
6571 |
+ void *save_addr; |
6572 |
+ void *sti_mem_addr; |
6573 |
+- const int save_addr_size = 1024; /* XXX */ |
6574 |
+- int i; |
6575 |
++ int i, size; |
6576 |
+ |
6577 |
+- if (!sti->sti_mem_request) |
6578 |
++ if (sti->sti_mem_request < 256) |
6579 |
+ sti->sti_mem_request = 256; /* STI default */ |
6580 |
+ |
6581 |
+- glob_cfg = kzalloc(sizeof(*sti->glob_cfg), GFP_KERNEL); |
6582 |
+- glob_cfg_ext = kzalloc(sizeof(*glob_cfg_ext), GFP_KERNEL); |
6583 |
+- save_addr = kzalloc(save_addr_size, GFP_KERNEL); |
6584 |
+- sti_mem_addr = kzalloc(sti->sti_mem_request, GFP_KERNEL); |
6585 |
++ size = sizeof(struct sti_all_data) + sti->sti_mem_request - 256; |
6586 |
+ |
6587 |
+- if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) { |
6588 |
+- kfree(glob_cfg); |
6589 |
+- kfree(glob_cfg_ext); |
6590 |
+- kfree(save_addr); |
6591 |
+- kfree(sti_mem_addr); |
6592 |
++ sti->sti_data = kzalloc(size, STI_LOWMEM); |
6593 |
++ if (!sti->sti_data) |
6594 |
+ return -ENOMEM; |
6595 |
+- } |
6596 |
++ |
6597 |
++ glob_cfg = &sti->sti_data->glob_cfg; |
6598 |
++ glob_cfg_ext = &sti->sti_data->glob_cfg_ext; |
6599 |
++ save_addr = &sti->sti_data->save_addr; |
6600 |
++ sti_mem_addr = &sti->sti_data->sti_mem_addr; |
6601 |
+ |
6602 |
+ glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext); |
6603 |
+ glob_cfg->save_addr = STI_PTR(save_addr); |
6604 |
+@@ -475,32 +488,31 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address, |
6605 |
+ return 0; |
6606 |
+ } |
6607 |
+ |
6608 |
+-#ifdef CONFIG_FB |
6609 |
++#ifdef CONFIG_FONTS |
6610 |
+ static struct sti_cooked_font * |
6611 |
+ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) |
6612 |
+ { |
6613 |
+- const struct font_desc *fbfont; |
6614 |
++ const struct font_desc *fbfont = NULL; |
6615 |
+ unsigned int size, bpc; |
6616 |
+ void *dest; |
6617 |
+ struct sti_rom_font *nf; |
6618 |
+ struct sti_cooked_font *cooked_font; |
6619 |
+ |
6620 |
+- if (!fbfont_name || !strlen(fbfont_name)) |
6621 |
+- return NULL; |
6622 |
+- fbfont = find_font(fbfont_name); |
6623 |
++ if (fbfont_name && strlen(fbfont_name)) |
6624 |
++ fbfont = find_font(fbfont_name); |
6625 |
+ if (!fbfont) |
6626 |
+ fbfont = get_default_font(1024,768, ~(u32)0, ~(u32)0); |
6627 |
+ if (!fbfont) |
6628 |
+ return NULL; |
6629 |
+ |
6630 |
+- DPRINTK((KERN_DEBUG "selected %dx%d fb-font %s\n", |
6631 |
+- fbfont->width, fbfont->height, fbfont->name)); |
6632 |
++ pr_info("STI selected %dx%d framebuffer font %s for sticon\n", |
6633 |
++ fbfont->width, fbfont->height, fbfont->name); |
6634 |
+ |
6635 |
+ bpc = ((fbfont->width+7)/8) * fbfont->height; |
6636 |
+ size = bpc * 256; |
6637 |
+ size += sizeof(struct sti_rom_font); |
6638 |
+ |
6639 |
+- nf = kzalloc(size, GFP_KERNEL); |
6640 |
++ nf = kzalloc(size, STI_LOWMEM); |
6641 |
+ if (!nf) |
6642 |
+ return NULL; |
6643 |
+ |
6644 |
+@@ -637,7 +649,7 @@ static void *sti_bmode_font_raw(struct sti_cooked_font *f) |
6645 |
+ unsigned char *n, *p, *q; |
6646 |
+ int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); |
6647 |
+ |
6648 |
+- n = kzalloc (4*size, GFP_KERNEL); |
6649 |
++ n = kzalloc(4*size, STI_LOWMEM); |
6650 |
+ if (!n) |
6651 |
+ return NULL; |
6652 |
+ p = n + 3; |
6653 |
+@@ -673,7 +685,7 @@ static struct sti_rom *sti_get_bmode_rom (unsigned long address) |
6654 |
+ sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size); |
6655 |
+ |
6656 |
+ size = (size+3) / 4; |
6657 |
+- raw = kmalloc(size, GFP_KERNEL); |
6658 |
++ raw = kmalloc(size, STI_LOWMEM); |
6659 |
+ if (raw) { |
6660 |
+ sti_bmode_rom_copy(address, size, raw); |
6661 |
+ memmove (&raw->res004, &raw->type[0], 0x3c); |
6662 |
+@@ -707,7 +719,7 @@ static struct sti_rom *sti_get_wmode_rom(unsigned long address) |
6663 |
+ /* read the ROM size directly from the struct in ROM */ |
6664 |
+ size = gsc_readl(address + offsetof(struct sti_rom,last_addr)); |
6665 |
+ |
6666 |
+- raw = kmalloc(size, GFP_KERNEL); |
6667 |
++ raw = kmalloc(size, STI_LOWMEM); |
6668 |
+ if (raw) |
6669 |
+ sti_rom_copy(address, size, raw); |
6670 |
+ |
6671 |
+@@ -743,6 +755,10 @@ static int sti_read_rom(int wordmode, struct sti_struct *sti, |
6672 |
+ |
6673 |
+ address = (unsigned long) STI_PTR(raw); |
6674 |
+ |
6675 |
++ pr_info("STI ROM supports 32 %sbit firmware functions.\n", |
6676 |
++ raw->alt_code_type == ALT_CODE_TYPE_PA_RISC_64 |
6677 |
++ ? "and 64 " : ""); |
6678 |
++ |
6679 |
+ sti->font_unpmv = address + (raw->font_unpmv & 0x03ffffff); |
6680 |
+ sti->block_move = address + (raw->block_move & 0x03ffffff); |
6681 |
+ sti->init_graph = address + (raw->init_graph & 0x03ffffff); |
6682 |
+@@ -901,7 +917,8 @@ test_rom: |
6683 |
+ sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request); |
6684 |
+ sti_dump_outptr(sti); |
6685 |
+ |
6686 |
+- printk(KERN_INFO " graphics card name: %s\n", sti->outptr.dev_name ); |
6687 |
++ pr_info(" graphics card name: %s\n", |
6688 |
++ sti->sti_data->inq_outptr.dev_name); |
6689 |
+ |
6690 |
+ sti_roms[num_sti_roms] = sti; |
6691 |
+ num_sti_roms++; |
6692 |
+@@ -1073,6 +1090,29 @@ struct sti_struct * sti_get_rom(unsigned int index) |
6693 |
+ } |
6694 |
+ EXPORT_SYMBOL(sti_get_rom); |
6695 |
+ |
6696 |
++ |
6697 |
++int sti_call(const struct sti_struct *sti, unsigned long func, |
6698 |
++ const void *flags, void *inptr, void *outptr, |
6699 |
++ struct sti_glob_cfg *glob_cfg) |
6700 |
++{ |
6701 |
++ unsigned long _flags = STI_PTR(flags); |
6702 |
++ unsigned long _inptr = STI_PTR(inptr); |
6703 |
++ unsigned long _outptr = STI_PTR(outptr); |
6704 |
++ unsigned long _glob_cfg = STI_PTR(glob_cfg); |
6705 |
++ int ret; |
6706 |
++ |
6707 |
++#ifdef CONFIG_64BIT |
6708 |
++ /* Check for overflow when using 32bit STI on 64bit kernel. */ |
6709 |
++ if (WARN_ONCE(_flags>>32 || _inptr>>32 || _outptr>>32 || _glob_cfg>>32, |
6710 |
++ "Out of 32bit-range pointers!")) |
6711 |
++ return -1; |
6712 |
++#endif |
6713 |
++ |
6714 |
++ ret = pdc_sti_call(func, _flags, _inptr, _outptr, _glob_cfg); |
6715 |
++ |
6716 |
++ return ret; |
6717 |
++} |
6718 |
++ |
6719 |
+ MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); |
6720 |
+ MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines"); |
6721 |
+ MODULE_LICENSE("GPL v2"); |
6722 |
+diff --git a/drivers/video/sticore.h b/drivers/video/sticore.h |
6723 |
+index addf7b61..af161953 100644 |
6724 |
+--- a/drivers/video/sticore.h |
6725 |
++++ b/drivers/video/sticore.h |
6726 |
+@@ -18,6 +18,9 @@ |
6727 |
+ #define STI_FONT_HPROMAN8 1 |
6728 |
+ #define STI_FONT_KANA8 2 |
6729 |
+ |
6730 |
++#define ALT_CODE_TYPE_UNKNOWN 0x00 /* alt code type values */ |
6731 |
++#define ALT_CODE_TYPE_PA_RISC_64 0x01 |
6732 |
++ |
6733 |
+ /* The latency of the STI functions cannot really be reduced by setting |
6734 |
+ * this to 0; STI doesn't seem to be designed to allow calling a different |
6735 |
+ * function (or the same function with different arguments) after a |
6736 |
+@@ -40,14 +43,6 @@ |
6737 |
+ |
6738 |
+ #define STI_PTR(p) ( virt_to_phys(p) ) |
6739 |
+ #define PTR_STI(p) ( phys_to_virt((unsigned long)p) ) |
6740 |
+-#define STI_CALL(func, flags, inptr, outptr, glob_cfg) \ |
6741 |
+- ({ \ |
6742 |
+- pdc_sti_call( func, STI_PTR(flags), \ |
6743 |
+- STI_PTR(inptr), \ |
6744 |
+- STI_PTR(outptr), \ |
6745 |
+- STI_PTR(glob_cfg)); \ |
6746 |
+- }) |
6747 |
+- |
6748 |
+ |
6749 |
+ #define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x) |
6750 |
+ #define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y) |
6751 |
+@@ -56,6 +51,12 @@ |
6752 |
+ #define sti_font_x(sti) (PTR_STI(sti->font)->width) |
6753 |
+ #define sti_font_y(sti) (PTR_STI(sti->font)->height) |
6754 |
+ |
6755 |
++#ifdef CONFIG_64BIT |
6756 |
++#define STI_LOWMEM (GFP_KERNEL | GFP_DMA) |
6757 |
++#else |
6758 |
++#define STI_LOWMEM (GFP_KERNEL) |
6759 |
++#endif |
6760 |
++ |
6761 |
+ |
6762 |
+ /* STI function configuration structs */ |
6763 |
+ |
6764 |
+@@ -306,6 +307,34 @@ struct sti_blkmv_outptr { |
6765 |
+ }; |
6766 |
+ |
6767 |
+ |
6768 |
++/* sti_all_data is an internal struct which needs to be allocated in |
6769 |
++ * low memory (< 4GB) if STI is used with 32bit STI on a 64bit kernel */ |
6770 |
++ |
6771 |
++struct sti_all_data { |
6772 |
++ struct sti_glob_cfg glob_cfg; |
6773 |
++ struct sti_glob_cfg_ext glob_cfg_ext; |
6774 |
++ |
6775 |
++ struct sti_conf_inptr inq_inptr; |
6776 |
++ struct sti_conf_outptr inq_outptr; /* configuration */ |
6777 |
++ struct sti_conf_outptr_ext inq_outptr_ext; |
6778 |
++ |
6779 |
++ struct sti_init_inptr_ext init_inptr_ext; |
6780 |
++ struct sti_init_inptr init_inptr; |
6781 |
++ struct sti_init_outptr init_outptr; |
6782 |
++ |
6783 |
++ struct sti_blkmv_inptr blkmv_inptr; |
6784 |
++ struct sti_blkmv_outptr blkmv_outptr; |
6785 |
++ |
6786 |
++ struct sti_font_inptr font_inptr; |
6787 |
++ struct sti_font_outptr font_outptr; |
6788 |
++ |
6789 |
++ /* leave as last entries */ |
6790 |
++ unsigned long save_addr[1024 / sizeof(unsigned long)]; |
6791 |
++ /* min 256 bytes which is STI default, max sti->sti_mem_request */ |
6792 |
++ unsigned long sti_mem_addr[256 / sizeof(unsigned long)]; |
6793 |
++ /* do not add something below here ! */ |
6794 |
++}; |
6795 |
++ |
6796 |
+ /* internal generic STI struct */ |
6797 |
+ |
6798 |
+ struct sti_struct { |
6799 |
+@@ -330,11 +359,9 @@ struct sti_struct { |
6800 |
+ region_t regions[STI_REGION_MAX]; |
6801 |
+ unsigned long regions_phys[STI_REGION_MAX]; |
6802 |
+ |
6803 |
+- struct sti_glob_cfg *glob_cfg; |
6804 |
+- struct sti_cooked_font *font; /* ptr to selected font (cooked) */ |
6805 |
++ struct sti_glob_cfg *glob_cfg; /* points into sti_all_data */ |
6806 |
+ |
6807 |
+- struct sti_conf_outptr outptr; /* configuration */ |
6808 |
+- struct sti_conf_outptr_ext outptr_ext; |
6809 |
++ struct sti_cooked_font *font; /* ptr to selected font (cooked) */ |
6810 |
+ |
6811 |
+ struct pci_dev *pd; |
6812 |
+ |
6813 |
+@@ -343,6 +370,9 @@ struct sti_struct { |
6814 |
+ |
6815 |
+ /* pointer to the fb_info where this STI device is used */ |
6816 |
+ struct fb_info *info; |
6817 |
++ |
6818 |
++ /* pointer to all internal data */ |
6819 |
++ struct sti_all_data *sti_data; |
6820 |
+ }; |
6821 |
+ |
6822 |
+ |
6823 |
+@@ -350,6 +380,14 @@ struct sti_struct { |
6824 |
+ |
6825 |
+ struct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */ |
6826 |
+ |
6827 |
++ |
6828 |
++/* sticore main function to call STI firmware */ |
6829 |
++ |
6830 |
++int sti_call(const struct sti_struct *sti, unsigned long func, |
6831 |
++ const void *flags, void *inptr, void *outptr, |
6832 |
++ struct sti_glob_cfg *glob_cfg); |
6833 |
++ |
6834 |
++ |
6835 |
+ /* functions to call the STI ROM directly */ |
6836 |
+ |
6837 |
+ void sti_putc(struct sti_struct *sti, int c, int y, int x); |
6838 |
+diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c |
6839 |
+index 876648e1..019a1fee 100644 |
6840 |
+--- a/drivers/video/stifb.c |
6841 |
++++ b/drivers/video/stifb.c |
6842 |
+@@ -1101,6 +1101,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) |
6843 |
+ var = &info->var; |
6844 |
+ |
6845 |
+ fb->sti = sti; |
6846 |
++ dev_name = sti->sti_data->inq_outptr.dev_name; |
6847 |
+ /* store upper 32bits of the graphics id */ |
6848 |
+ fb->id = fb->sti->graphics_id[0]; |
6849 |
+ |
6850 |
+@@ -1114,11 +1115,11 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) |
6851 |
+ Since this driver only supports standard mode, we check |
6852 |
+ if the device name contains the string "DX" and tell the |
6853 |
+ user how to reconfigure the card. */ |
6854 |
+- if (strstr(sti->outptr.dev_name, "DX")) { |
6855 |
++ if (strstr(dev_name, "DX")) { |
6856 |
+ printk(KERN_WARNING |
6857 |
+ "WARNING: stifb framebuffer driver does not support '%s' in double-buffer mode.\n" |
6858 |
+ "WARNING: Please disable the double-buffer mode in IPL menu (the PARISC-BIOS).\n", |
6859 |
+- sti->outptr.dev_name); |
6860 |
++ dev_name); |
6861 |
+ goto out_err0; |
6862 |
+ } |
6863 |
+ /* fall though */ |
6864 |
+@@ -1130,7 +1131,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) |
6865 |
+ break; |
6866 |
+ default: |
6867 |
+ printk(KERN_WARNING "stifb: '%s' (id: 0x%08x) not supported.\n", |
6868 |
+- sti->outptr.dev_name, fb->id); |
6869 |
++ dev_name, fb->id); |
6870 |
+ goto out_err0; |
6871 |
+ } |
6872 |
+ |
6873 |
+@@ -1154,7 +1155,6 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) |
6874 |
+ fb->id = S9000_ID_A1659A; |
6875 |
+ break; |
6876 |
+ case S9000_ID_TIMBER: /* HP9000/710 Any (may be a grayscale device) */ |
6877 |
+- dev_name = fb->sti->outptr.dev_name; |
6878 |
+ if (strstr(dev_name, "GRAYSCALE") || |
6879 |
+ strstr(dev_name, "Grayscale") || |
6880 |
+ strstr(dev_name, "grayscale")) |
6881 |
+@@ -1290,7 +1290,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) |
6882 |
+ var->xres, |
6883 |
+ var->yres, |
6884 |
+ var->bits_per_pixel, |
6885 |
+- sti->outptr.dev_name, |
6886 |
++ dev_name, |
6887 |
+ fb->id, |
6888 |
+ fix->mmio_start); |
6889 |
+ |
6890 |
+diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h |
6891 |
+index 52b6f6c2..c8e03f8d 100644 |
6892 |
+--- a/fs/cifs/cifsglob.h |
6893 |
++++ b/fs/cifs/cifsglob.h |
6894 |
+@@ -261,7 +261,7 @@ struct smb_version_operations { |
6895 |
+ /* query path data from the server */ |
6896 |
+ int (*query_path_info)(const unsigned int, struct cifs_tcon *, |
6897 |
+ struct cifs_sb_info *, const char *, |
6898 |
+- FILE_ALL_INFO *, bool *); |
6899 |
++ FILE_ALL_INFO *, bool *, bool *); |
6900 |
+ /* query file data from the server */ |
6901 |
+ int (*query_file_info)(const unsigned int, struct cifs_tcon *, |
6902 |
+ struct cifs_fid *, FILE_ALL_INFO *); |
6903 |
+diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c |
6904 |
+index ccd31ab8..5f1f3285 100644 |
6905 |
+--- a/fs/cifs/cifssmb.c |
6906 |
++++ b/fs/cifs/cifssmb.c |
6907 |
+@@ -3315,11 +3315,13 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL, |
6908 |
+ return 0; |
6909 |
+ } |
6910 |
+ cifs_acl->version = cpu_to_le16(1); |
6911 |
+- if (acl_type == ACL_TYPE_ACCESS) |
6912 |
++ if (acl_type == ACL_TYPE_ACCESS) { |
6913 |
+ cifs_acl->access_entry_count = cpu_to_le16(count); |
6914 |
+- else if (acl_type == ACL_TYPE_DEFAULT) |
6915 |
++ cifs_acl->default_entry_count = __constant_cpu_to_le16(0xFFFF); |
6916 |
++ } else if (acl_type == ACL_TYPE_DEFAULT) { |
6917 |
+ cifs_acl->default_entry_count = cpu_to_le16(count); |
6918 |
+- else { |
6919 |
++ cifs_acl->access_entry_count = __constant_cpu_to_le16(0xFFFF); |
6920 |
++ } else { |
6921 |
+ cifs_dbg(FYI, "unknown ACL type %d\n", acl_type); |
6922 |
+ return 0; |
6923 |
+ } |
6924 |
+diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c |
6925 |
+index 867b7cdc..36f9ebb9 100644 |
6926 |
+--- a/fs/cifs/inode.c |
6927 |
++++ b/fs/cifs/inode.c |
6928 |
+@@ -542,7 +542,8 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path, |
6929 |
+ /* Fill a cifs_fattr struct with info from FILE_ALL_INFO */ |
6930 |
+ static void |
6931 |
+ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, |
6932 |
+- struct cifs_sb_info *cifs_sb, bool adjust_tz) |
6933 |
++ struct cifs_sb_info *cifs_sb, bool adjust_tz, |
6934 |
++ bool symlink) |
6935 |
+ { |
6936 |
+ struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); |
6937 |
+ |
6938 |
+@@ -569,7 +570,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, |
6939 |
+ fattr->cf_createtime = le64_to_cpu(info->CreationTime); |
6940 |
+ |
6941 |
+ fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks); |
6942 |
+- if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { |
6943 |
++ |
6944 |
++ if (symlink) { |
6945 |
++ fattr->cf_mode = S_IFLNK; |
6946 |
++ fattr->cf_dtype = DT_LNK; |
6947 |
++ } else if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { |
6948 |
+ fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; |
6949 |
+ fattr->cf_dtype = DT_DIR; |
6950 |
+ /* |
6951 |
+@@ -578,10 +583,6 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, |
6952 |
+ */ |
6953 |
+ if (!tcon->unix_ext) |
6954 |
+ fattr->cf_flags |= CIFS_FATTR_UNKNOWN_NLINK; |
6955 |
+- } else if (fattr->cf_cifsattrs & ATTR_REPARSE) { |
6956 |
+- fattr->cf_mode = S_IFLNK; |
6957 |
+- fattr->cf_dtype = DT_LNK; |
6958 |
+- fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks); |
6959 |
+ } else { |
6960 |
+ fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; |
6961 |
+ fattr->cf_dtype = DT_REG; |
6962 |
+@@ -626,7 +627,8 @@ cifs_get_file_info(struct file *filp) |
6963 |
+ rc = server->ops->query_file_info(xid, tcon, &cfile->fid, &find_data); |
6964 |
+ switch (rc) { |
6965 |
+ case 0: |
6966 |
+- cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false); |
6967 |
++ cifs_all_info_to_fattr(&fattr, &find_data, cifs_sb, false, |
6968 |
++ false); |
6969 |
+ break; |
6970 |
+ case -EREMOTE: |
6971 |
+ cifs_create_dfs_fattr(&fattr, inode->i_sb); |
6972 |
+@@ -673,6 +675,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, |
6973 |
+ bool adjust_tz = false; |
6974 |
+ struct cifs_fattr fattr; |
6975 |
+ struct cifs_search_info *srchinf = NULL; |
6976 |
++ bool symlink = false; |
6977 |
+ |
6978 |
+ tlink = cifs_sb_tlink(cifs_sb); |
6979 |
+ if (IS_ERR(tlink)) |
6980 |
+@@ -702,12 +705,12 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, |
6981 |
+ } |
6982 |
+ data = (FILE_ALL_INFO *)buf; |
6983 |
+ rc = server->ops->query_path_info(xid, tcon, cifs_sb, full_path, |
6984 |
+- data, &adjust_tz); |
6985 |
++ data, &adjust_tz, &symlink); |
6986 |
+ } |
6987 |
+ |
6988 |
+ if (!rc) { |
6989 |
+- cifs_all_info_to_fattr(&fattr, (FILE_ALL_INFO *)data, cifs_sb, |
6990 |
+- adjust_tz); |
6991 |
++ cifs_all_info_to_fattr(&fattr, data, cifs_sb, adjust_tz, |
6992 |
++ symlink); |
6993 |
+ } else if (rc == -EREMOTE) { |
6994 |
+ cifs_create_dfs_fattr(&fattr, sb); |
6995 |
+ rc = 0; |
6996 |
+diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c |
6997 |
+index 53a75f3d..5940ecab 100644 |
6998 |
+--- a/fs/cifs/readdir.c |
6999 |
++++ b/fs/cifs/readdir.c |
7000 |
+@@ -134,22 +134,6 @@ out: |
7001 |
+ dput(dentry); |
7002 |
+ } |
7003 |
+ |
7004 |
+-/* |
7005 |
+- * Is it possible that this directory might turn out to be a DFS referral |
7006 |
+- * once we go to try and use it? |
7007 |
+- */ |
7008 |
+-static bool |
7009 |
+-cifs_dfs_is_possible(struct cifs_sb_info *cifs_sb) |
7010 |
+-{ |
7011 |
+-#ifdef CONFIG_CIFS_DFS_UPCALL |
7012 |
+- struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); |
7013 |
+- |
7014 |
+- if (tcon->Flags & SMB_SHARE_IS_IN_DFS) |
7015 |
+- return true; |
7016 |
+-#endif |
7017 |
+- return false; |
7018 |
+-} |
7019 |
+- |
7020 |
+ static void |
7021 |
+ cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb) |
7022 |
+ { |
7023 |
+@@ -159,27 +143,19 @@ cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb) |
7024 |
+ if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { |
7025 |
+ fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; |
7026 |
+ fattr->cf_dtype = DT_DIR; |
7027 |
+- /* |
7028 |
+- * Windows CIFS servers generally make DFS referrals look |
7029 |
+- * like directories in FIND_* responses with the reparse |
7030 |
+- * attribute flag also set (since DFS junctions are |
7031 |
+- * reparse points). We must revalidate at least these |
7032 |
+- * directory inodes before trying to use them (if |
7033 |
+- * they are DFS we will get PATH_NOT_COVERED back |
7034 |
+- * when queried directly and can then try to connect |
7035 |
+- * to the DFS target) |
7036 |
+- */ |
7037 |
+- if (cifs_dfs_is_possible(cifs_sb) && |
7038 |
+- (fattr->cf_cifsattrs & ATTR_REPARSE)) |
7039 |
+- fattr->cf_flags |= CIFS_FATTR_NEED_REVAL; |
7040 |
+- } else if (fattr->cf_cifsattrs & ATTR_REPARSE) { |
7041 |
+- fattr->cf_mode = S_IFLNK; |
7042 |
+- fattr->cf_dtype = DT_LNK; |
7043 |
+ } else { |
7044 |
+ fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; |
7045 |
+ fattr->cf_dtype = DT_REG; |
7046 |
+ } |
7047 |
+ |
7048 |
++ /* |
7049 |
++ * We need to revalidate it further to make a decision about whether it |
7050 |
++ * is a symbolic link, DFS referral or a reparse point with a direct |
7051 |
++ * access like junctions, deduplicated files, NFS symlinks. |
7052 |
++ */ |
7053 |
++ if (fattr->cf_cifsattrs & ATTR_REPARSE) |
7054 |
++ fattr->cf_flags |= CIFS_FATTR_NEED_REVAL; |
7055 |
++ |
7056 |
+ /* non-unix readdir doesn't provide nlink */ |
7057 |
+ fattr->cf_flags |= CIFS_FATTR_UNKNOWN_NLINK; |
7058 |
+ |
7059 |
+diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c |
7060 |
+index 8233b174..e50554b7 100644 |
7061 |
+--- a/fs/cifs/smb1ops.c |
7062 |
++++ b/fs/cifs/smb1ops.c |
7063 |
+@@ -534,10 +534,12 @@ cifs_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, |
7064 |
+ static int |
7065 |
+ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, |
7066 |
+ struct cifs_sb_info *cifs_sb, const char *full_path, |
7067 |
+- FILE_ALL_INFO *data, bool *adjustTZ) |
7068 |
++ FILE_ALL_INFO *data, bool *adjustTZ, bool *symlink) |
7069 |
+ { |
7070 |
+ int rc; |
7071 |
+ |
7072 |
++ *symlink = false; |
7073 |
++ |
7074 |
+ /* could do find first instead but this returns more info */ |
7075 |
+ rc = CIFSSMBQPathInfo(xid, tcon, full_path, data, 0 /* not legacy */, |
7076 |
+ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & |
7077 |
+@@ -554,6 +556,23 @@ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, |
7078 |
+ CIFS_MOUNT_MAP_SPECIAL_CHR); |
7079 |
+ *adjustTZ = true; |
7080 |
+ } |
7081 |
++ |
7082 |
++ if (!rc && (le32_to_cpu(data->Attributes) & ATTR_REPARSE)) { |
7083 |
++ int tmprc; |
7084 |
++ int oplock = 0; |
7085 |
++ __u16 netfid; |
7086 |
++ |
7087 |
++ /* Need to check if this is a symbolic link or not */ |
7088 |
++ tmprc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN, |
7089 |
++ FILE_READ_ATTRIBUTES, 0, &netfid, &oplock, |
7090 |
++ NULL, cifs_sb->local_nls, |
7091 |
++ cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
7092 |
++ if (tmprc == -EOPNOTSUPP) |
7093 |
++ *symlink = true; |
7094 |
++ else |
7095 |
++ CIFSSMBClose(xid, tcon, netfid); |
7096 |
++ } |
7097 |
++ |
7098 |
+ return rc; |
7099 |
+ } |
7100 |
+ |
7101 |
+diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c |
7102 |
+index 78ff88c4..84c012a6 100644 |
7103 |
+--- a/fs/cifs/smb2inode.c |
7104 |
++++ b/fs/cifs/smb2inode.c |
7105 |
+@@ -123,12 +123,13 @@ move_smb2_info_to_cifs(FILE_ALL_INFO *dst, struct smb2_file_all_info *src) |
7106 |
+ int |
7107 |
+ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, |
7108 |
+ struct cifs_sb_info *cifs_sb, const char *full_path, |
7109 |
+- FILE_ALL_INFO *data, bool *adjust_tz) |
7110 |
++ FILE_ALL_INFO *data, bool *adjust_tz, bool *symlink) |
7111 |
+ { |
7112 |
+ int rc; |
7113 |
+ struct smb2_file_all_info *smb2_data; |
7114 |
+ |
7115 |
+ *adjust_tz = false; |
7116 |
++ *symlink = false; |
7117 |
+ |
7118 |
+ smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, |
7119 |
+ GFP_KERNEL); |
7120 |
+@@ -136,9 +137,16 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, |
7121 |
+ return -ENOMEM; |
7122 |
+ |
7123 |
+ rc = smb2_open_op_close(xid, tcon, cifs_sb, full_path, |
7124 |
+- FILE_READ_ATTRIBUTES, FILE_OPEN, |
7125 |
+- OPEN_REPARSE_POINT, smb2_data, |
7126 |
+- SMB2_OP_QUERY_INFO); |
7127 |
++ FILE_READ_ATTRIBUTES, FILE_OPEN, 0, |
7128 |
++ smb2_data, SMB2_OP_QUERY_INFO); |
7129 |
++ if (rc == -EOPNOTSUPP) { |
7130 |
++ *symlink = true; |
7131 |
++ /* Failed on a symbolic link - query a reparse point info */ |
7132 |
++ rc = smb2_open_op_close(xid, tcon, cifs_sb, full_path, |
7133 |
++ FILE_READ_ATTRIBUTES, FILE_OPEN, |
7134 |
++ OPEN_REPARSE_POINT, smb2_data, |
7135 |
++ SMB2_OP_QUERY_INFO); |
7136 |
++ } |
7137 |
+ if (rc) |
7138 |
+ goto out; |
7139 |
+ |
7140 |
+diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h |
7141 |
+index e3fb4801..7db5db0e 100644 |
7142 |
+--- a/fs/cifs/smb2proto.h |
7143 |
++++ b/fs/cifs/smb2proto.h |
7144 |
+@@ -61,7 +61,7 @@ extern void move_smb2_info_to_cifs(FILE_ALL_INFO *dst, |
7145 |
+ extern int smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, |
7146 |
+ struct cifs_sb_info *cifs_sb, |
7147 |
+ const char *full_path, FILE_ALL_INFO *data, |
7148 |
+- bool *adjust_tz); |
7149 |
++ bool *adjust_tz, bool *symlink); |
7150 |
+ extern int smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon, |
7151 |
+ const char *full_path, __u64 size, |
7152 |
+ struct cifs_sb_info *cifs_sb, bool set_alloc); |
7153 |
+diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c |
7154 |
+index 073d30b9..a726b9f2 100644 |
7155 |
+--- a/fs/devpts/inode.c |
7156 |
++++ b/fs/devpts/inode.c |
7157 |
+@@ -498,6 +498,7 @@ static void devpts_kill_sb(struct super_block *sb) |
7158 |
+ { |
7159 |
+ struct pts_fs_info *fsi = DEVPTS_SB(sb); |
7160 |
+ |
7161 |
++ ida_destroy(&fsi->allocated_ptys); |
7162 |
+ kfree(fsi); |
7163 |
+ kill_litter_super(sb); |
7164 |
+ } |
7165 |
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c |
7166 |
+index 03e9bebb..1423c481 100644 |
7167 |
+--- a/fs/ext4/xattr.c |
7168 |
++++ b/fs/ext4/xattr.c |
7169 |
+@@ -1352,6 +1352,7 @@ retry: |
7170 |
+ new_extra_isize = s_min_extra_isize; |
7171 |
+ kfree(is); is = NULL; |
7172 |
+ kfree(bs); bs = NULL; |
7173 |
++ brelse(bh); |
7174 |
+ goto retry; |
7175 |
+ } |
7176 |
+ error = -1; |
7177 |
+diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c |
7178 |
+index 968d4c56..12987666 100644 |
7179 |
+--- a/fs/gfs2/inode.c |
7180 |
++++ b/fs/gfs2/inode.c |
7181 |
+@@ -1168,8 +1168,11 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry, |
7182 |
+ if (d != NULL) |
7183 |
+ dentry = d; |
7184 |
+ if (dentry->d_inode) { |
7185 |
+- if (!(*opened & FILE_OPENED)) |
7186 |
++ if (!(*opened & FILE_OPENED)) { |
7187 |
++ if (d == NULL) |
7188 |
++ dget(dentry); |
7189 |
+ return finish_no_open(file, dentry); |
7190 |
++ } |
7191 |
+ dput(d); |
7192 |
+ return 0; |
7193 |
+ } |
7194 |
+diff --git a/fs/namei.c b/fs/namei.c |
7195 |
+index caa28051..23ac50f4 100644 |
7196 |
+--- a/fs/namei.c |
7197 |
++++ b/fs/namei.c |
7198 |
+@@ -2468,6 +2468,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir) |
7199 |
+ */ |
7200 |
+ static inline int may_create(struct inode *dir, struct dentry *child) |
7201 |
+ { |
7202 |
++ audit_inode_child(dir, child, AUDIT_TYPE_CHILD_CREATE); |
7203 |
+ if (child->d_inode) |
7204 |
+ return -EEXIST; |
7205 |
+ if (IS_DEADDIR(dir)) |
7206 |
+diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h |
7207 |
+index d9019821..26115778 100644 |
7208 |
+--- a/include/acpi/acpi_bus.h |
7209 |
++++ b/include/acpi/acpi_bus.h |
7210 |
+@@ -100,6 +100,7 @@ enum acpi_hotplug_mode { |
7211 |
+ struct acpi_hotplug_profile { |
7212 |
+ struct kobject kobj; |
7213 |
+ bool enabled:1; |
7214 |
++ bool ignore:1; |
7215 |
+ enum acpi_hotplug_mode mode; |
7216 |
+ }; |
7217 |
+ |
7218 |
+diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h |
7219 |
+index d1382dfb..0ce77210 100644 |
7220 |
+--- a/include/linux/mfd/rtsx_pci.h |
7221 |
++++ b/include/linux/mfd/rtsx_pci.h |
7222 |
+@@ -756,6 +756,59 @@ |
7223 |
+ #define PCR_SETTING_REG2 0x814 |
7224 |
+ #define PCR_SETTING_REG3 0x747 |
7225 |
+ |
7226 |
++/* Phy bits */ |
7227 |
++#define PHY_PCR_FORCE_CODE 0xB000 |
7228 |
++#define PHY_PCR_OOBS_CALI_50 0x0800 |
7229 |
++#define PHY_PCR_OOBS_VCM_08 0x0200 |
7230 |
++#define PHY_PCR_OOBS_SEN_90 0x0040 |
7231 |
++#define PHY_PCR_RSSI_EN 0x0002 |
7232 |
++ |
7233 |
++#define PHY_RCR1_ADP_TIME 0x0100 |
7234 |
++#define PHY_RCR1_VCO_COARSE 0x001F |
7235 |
++ |
7236 |
++#define PHY_RCR2_EMPHASE_EN 0x8000 |
7237 |
++#define PHY_RCR2_NADJR 0x4000 |
7238 |
++#define PHY_RCR2_CDR_CP_10 0x0400 |
7239 |
++#define PHY_RCR2_CDR_SR_2 0x0100 |
7240 |
++#define PHY_RCR2_FREQSEL_12 0x0040 |
7241 |
++#define PHY_RCR2_CPADJEN 0x0020 |
7242 |
++#define PHY_RCR2_CDR_SC_8 0x0008 |
7243 |
++#define PHY_RCR2_CALIB_LATE 0x0002 |
7244 |
++ |
7245 |
++#define PHY_RDR_RXDSEL_1_9 0x4000 |
7246 |
++ |
7247 |
++#define PHY_TUNE_TUNEREF_1_0 0x4000 |
7248 |
++#define PHY_TUNE_VBGSEL_1252 0x0C00 |
7249 |
++#define PHY_TUNE_SDBUS_33 0x0200 |
7250 |
++#define PHY_TUNE_TUNED18 0x01C0 |
7251 |
++#define PHY_TUNE_TUNED12 0X0020 |
7252 |
++ |
7253 |
++#define PHY_BPCR_IBRXSEL 0x0400 |
7254 |
++#define PHY_BPCR_IBTXSEL 0x0100 |
7255 |
++#define PHY_BPCR_IB_FILTER 0x0080 |
7256 |
++#define PHY_BPCR_CMIRROR_EN 0x0040 |
7257 |
++ |
7258 |
++#define PHY_REG_REV_RESV 0xE000 |
7259 |
++#define PHY_REG_REV_RXIDLE_LATCHED 0x1000 |
7260 |
++#define PHY_REG_REV_P1_EN 0x0800 |
7261 |
++#define PHY_REG_REV_RXIDLE_EN 0x0400 |
7262 |
++#define PHY_REG_REV_CLKREQ_DLY_TIMER_1_0 0x0040 |
7263 |
++#define PHY_REG_REV_STOP_CLKRD 0x0020 |
7264 |
++#define PHY_REG_REV_RX_PWST 0x0008 |
7265 |
++#define PHY_REG_REV_STOP_CLKWR 0x0004 |
7266 |
++ |
7267 |
++#define PHY_FLD3_TIMER_4 0x7800 |
7268 |
++#define PHY_FLD3_TIMER_6 0x00E0 |
7269 |
++#define PHY_FLD3_RXDELINK 0x0004 |
7270 |
++ |
7271 |
++#define PHY_FLD4_FLDEN_SEL 0x4000 |
7272 |
++#define PHY_FLD4_REQ_REF 0x2000 |
7273 |
++#define PHY_FLD4_RXAMP_OFF 0x1000 |
7274 |
++#define PHY_FLD4_REQ_ADDA 0x0800 |
7275 |
++#define PHY_FLD4_BER_COUNT 0x00E0 |
7276 |
++#define PHY_FLD4_BER_TIMER 0x000A |
7277 |
++#define PHY_FLD4_BER_CHK_EN 0x0001 |
7278 |
++ |
7279 |
+ #define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) |
7280 |
+ |
7281 |
+ struct rtsx_pcr; |
7282 |
+diff --git a/include/linux/msg.h b/include/linux/msg.h |
7283 |
+index 391af8d1..e21f9d44 100644 |
7284 |
+--- a/include/linux/msg.h |
7285 |
++++ b/include/linux/msg.h |
7286 |
+@@ -6,9 +6,9 @@ |
7287 |
+ |
7288 |
+ /* one msg_msg structure for each message */ |
7289 |
+ struct msg_msg { |
7290 |
+- struct list_head m_list; |
7291 |
+- long m_type; |
7292 |
+- int m_ts; /* message text size */ |
7293 |
++ struct list_head m_list; |
7294 |
++ long m_type; |
7295 |
++ size_t m_ts; /* message text size */ |
7296 |
+ struct msg_msgseg* next; |
7297 |
+ void *security; |
7298 |
+ /* the actual message follows immediately */ |
7299 |
+diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h |
7300 |
+index 4b02512e..5f487d77 100644 |
7301 |
+--- a/include/linux/mtd/map.h |
7302 |
++++ b/include/linux/mtd/map.h |
7303 |
+@@ -365,7 +365,7 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig |
7304 |
+ bitpos = (map_bankwidth(map)-1-i)*8; |
7305 |
+ #endif |
7306 |
+ orig.x[0] &= ~(0xff << bitpos); |
7307 |
+- orig.x[0] |= buf[i-start] << bitpos; |
7308 |
++ orig.x[0] |= (unsigned long)buf[i-start] << bitpos; |
7309 |
+ } |
7310 |
+ } |
7311 |
+ return orig; |
7312 |
+@@ -384,7 +384,7 @@ static inline map_word map_word_ff(struct map_info *map) |
7313 |
+ |
7314 |
+ if (map_bankwidth(map) < MAP_FF_LIMIT) { |
7315 |
+ int bw = 8 * map_bankwidth(map); |
7316 |
+- r.x[0] = (1 << bw) - 1; |
7317 |
++ r.x[0] = (1UL << bw) - 1; |
7318 |
+ } else { |
7319 |
+ for (i=0; i<map_words(map); i++) |
7320 |
+ r.x[i] = ~0UL; |
7321 |
+diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h |
7322 |
+index aa870a4d..57e75ae9 100644 |
7323 |
+--- a/include/linux/rbtree.h |
7324 |
++++ b/include/linux/rbtree.h |
7325 |
+@@ -85,6 +85,11 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, |
7326 |
+ *rb_link = node; |
7327 |
+ } |
7328 |
+ |
7329 |
++#define rb_entry_safe(ptr, type, member) \ |
7330 |
++ ({ typeof(ptr) ____ptr = (ptr); \ |
7331 |
++ ____ptr ? rb_entry(____ptr, type, member) : NULL; \ |
7332 |
++ }) |
7333 |
++ |
7334 |
+ /** |
7335 |
+ * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of |
7336 |
+ * given type safe against removal of rb_node entry |
7337 |
+@@ -95,12 +100,9 @@ static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, |
7338 |
+ * @field: the name of the rb_node field within 'type'. |
7339 |
+ */ |
7340 |
+ #define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \ |
7341 |
+- for (pos = rb_entry(rb_first_postorder(root), typeof(*pos), field),\ |
7342 |
+- n = rb_entry(rb_next_postorder(&pos->field), \ |
7343 |
+- typeof(*pos), field); \ |
7344 |
+- &pos->field; \ |
7345 |
+- pos = n, \ |
7346 |
+- n = rb_entry(rb_next_postorder(&pos->field), \ |
7347 |
+- typeof(*pos), field)) |
7348 |
++ for (pos = rb_entry_safe(rb_first_postorder(root), typeof(*pos), field); \ |
7349 |
++ pos && ({ n = rb_entry_safe(rb_next_postorder(&pos->field), \ |
7350 |
++ typeof(*pos), field); 1; }); \ |
7351 |
++ pos = n) |
7352 |
+ |
7353 |
+ #endif /* _LINUX_RBTREE_H */ |
7354 |
+diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h |
7355 |
+index 5c7ab17c..712ea360 100644 |
7356 |
+--- a/include/trace/ftrace.h |
7357 |
++++ b/include/trace/ftrace.h |
7358 |
+@@ -372,7 +372,8 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ |
7359 |
+ __data_size += (len) * sizeof(type); |
7360 |
+ |
7361 |
+ #undef __string |
7362 |
+-#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) |
7363 |
++#define __string(item, src) __dynamic_array(char, item, \ |
7364 |
++ strlen((src) ? (const char *)(src) : "(null)") + 1) |
7365 |
+ |
7366 |
+ #undef DECLARE_EVENT_CLASS |
7367 |
+ #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ |
7368 |
+@@ -502,7 +503,7 @@ static inline notrace int ftrace_get_offsets_##call( \ |
7369 |
+ |
7370 |
+ #undef __assign_str |
7371 |
+ #define __assign_str(dst, src) \ |
7372 |
+- strcpy(__get_str(dst), src); |
7373 |
++ strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); |
7374 |
+ |
7375 |
+ #undef TP_fast_assign |
7376 |
+ #define TP_fast_assign(args...) args |
7377 |
+diff --git a/ipc/msgutil.c b/ipc/msgutil.c |
7378 |
+index 491e71f2..7e709597 100644 |
7379 |
+--- a/ipc/msgutil.c |
7380 |
++++ b/ipc/msgutil.c |
7381 |
+@@ -41,15 +41,15 @@ struct msg_msgseg { |
7382 |
+ /* the next part of the message follows immediately */ |
7383 |
+ }; |
7384 |
+ |
7385 |
+-#define DATALEN_MSG (int)(PAGE_SIZE-sizeof(struct msg_msg)) |
7386 |
+-#define DATALEN_SEG (int)(PAGE_SIZE-sizeof(struct msg_msgseg)) |
7387 |
++#define DATALEN_MSG ((size_t)PAGE_SIZE-sizeof(struct msg_msg)) |
7388 |
++#define DATALEN_SEG ((size_t)PAGE_SIZE-sizeof(struct msg_msgseg)) |
7389 |
+ |
7390 |
+ |
7391 |
+-static struct msg_msg *alloc_msg(int len) |
7392 |
++static struct msg_msg *alloc_msg(size_t len) |
7393 |
+ { |
7394 |
+ struct msg_msg *msg; |
7395 |
+ struct msg_msgseg **pseg; |
7396 |
+- int alen; |
7397 |
++ size_t alen; |
7398 |
+ |
7399 |
+ alen = min(len, DATALEN_MSG); |
7400 |
+ msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL); |
7401 |
+@@ -80,12 +80,12 @@ out_err: |
7402 |
+ return NULL; |
7403 |
+ } |
7404 |
+ |
7405 |
+-struct msg_msg *load_msg(const void __user *src, int len) |
7406 |
++struct msg_msg *load_msg(const void __user *src, size_t len) |
7407 |
+ { |
7408 |
+ struct msg_msg *msg; |
7409 |
+ struct msg_msgseg *seg; |
7410 |
+ int err = -EFAULT; |
7411 |
+- int alen; |
7412 |
++ size_t alen; |
7413 |
+ |
7414 |
+ msg = alloc_msg(len); |
7415 |
+ if (msg == NULL) |
7416 |
+@@ -117,8 +117,8 @@ out_err: |
7417 |
+ struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) |
7418 |
+ { |
7419 |
+ struct msg_msgseg *dst_pseg, *src_pseg; |
7420 |
+- int len = src->m_ts; |
7421 |
+- int alen; |
7422 |
++ size_t len = src->m_ts; |
7423 |
++ size_t alen; |
7424 |
+ |
7425 |
+ BUG_ON(dst == NULL); |
7426 |
+ if (src->m_ts > dst->m_ts) |
7427 |
+@@ -147,9 +147,9 @@ struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) |
7428 |
+ return ERR_PTR(-ENOSYS); |
7429 |
+ } |
7430 |
+ #endif |
7431 |
+-int store_msg(void __user *dest, struct msg_msg *msg, int len) |
7432 |
++int store_msg(void __user *dest, struct msg_msg *msg, size_t len) |
7433 |
+ { |
7434 |
+- int alen; |
7435 |
++ size_t alen; |
7436 |
+ struct msg_msgseg *seg; |
7437 |
+ |
7438 |
+ alen = min(len, DATALEN_MSG); |
7439 |
+diff --git a/ipc/util.h b/ipc/util.h |
7440 |
+index f2f5036f..59d78aa9 100644 |
7441 |
+--- a/ipc/util.h |
7442 |
++++ b/ipc/util.h |
7443 |
+@@ -148,9 +148,9 @@ int ipc_parse_version (int *cmd); |
7444 |
+ #endif |
7445 |
+ |
7446 |
+ extern void free_msg(struct msg_msg *msg); |
7447 |
+-extern struct msg_msg *load_msg(const void __user *src, int len); |
7448 |
++extern struct msg_msg *load_msg(const void __user *src, size_t len); |
7449 |
+ extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst); |
7450 |
+-extern int store_msg(void __user *dest, struct msg_msg *msg, int len); |
7451 |
++extern int store_msg(void __user *dest, struct msg_msg *msg, size_t len); |
7452 |
+ |
7453 |
+ extern void recompute_msgmni(struct ipc_namespace *); |
7454 |
+ |
7455 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
7456 |
+index 7b0e23a7..7ddfd8a0 100644 |
7457 |
+--- a/kernel/audit.c |
7458 |
++++ b/kernel/audit.c |
7459 |
+@@ -613,7 +613,7 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type) |
7460 |
+ int rc = 0; |
7461 |
+ uid_t uid = from_kuid(&init_user_ns, current_uid()); |
7462 |
+ |
7463 |
+- if (!audit_enabled) { |
7464 |
++ if (!audit_enabled && msg_type != AUDIT_USER_AVC) { |
7465 |
+ *ab = NULL; |
7466 |
+ return rc; |
7467 |
+ } |
7468 |
+@@ -659,6 +659,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
7469 |
+ |
7470 |
+ switch (msg_type) { |
7471 |
+ case AUDIT_GET: |
7472 |
++ status_set.mask = 0; |
7473 |
+ status_set.enabled = audit_enabled; |
7474 |
+ status_set.failure = audit_failure; |
7475 |
+ status_set.pid = audit_pid; |
7476 |
+@@ -670,7 +671,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
7477 |
+ &status_set, sizeof(status_set)); |
7478 |
+ break; |
7479 |
+ case AUDIT_SET: |
7480 |
+- if (nlh->nlmsg_len < sizeof(struct audit_status)) |
7481 |
++ if (nlmsg_len(nlh) < sizeof(struct audit_status)) |
7482 |
+ return -EINVAL; |
7483 |
+ status_get = (struct audit_status *)data; |
7484 |
+ if (status_get->mask & AUDIT_STATUS_ENABLED) { |
7485 |
+@@ -832,7 +833,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
7486 |
+ |
7487 |
+ memset(&s, 0, sizeof(s)); |
7488 |
+ /* guard against past and future API changes */ |
7489 |
+- memcpy(&s, data, min(sizeof(s), (size_t)nlh->nlmsg_len)); |
7490 |
++ memcpy(&s, data, min_t(size_t, sizeof(s), nlmsg_len(nlh))); |
7491 |
+ if ((s.enabled != 0 && s.enabled != 1) || |
7492 |
+ (s.log_passwd != 0 && s.log_passwd != 1)) |
7493 |
+ return -EINVAL; |
7494 |
+@@ -1536,6 +1537,26 @@ void audit_log_name(struct audit_context *context, struct audit_names *n, |
7495 |
+ } |
7496 |
+ } |
7497 |
+ |
7498 |
++ /* log the audit_names record type */ |
7499 |
++ audit_log_format(ab, " nametype="); |
7500 |
++ switch(n->type) { |
7501 |
++ case AUDIT_TYPE_NORMAL: |
7502 |
++ audit_log_format(ab, "NORMAL"); |
7503 |
++ break; |
7504 |
++ case AUDIT_TYPE_PARENT: |
7505 |
++ audit_log_format(ab, "PARENT"); |
7506 |
++ break; |
7507 |
++ case AUDIT_TYPE_CHILD_DELETE: |
7508 |
++ audit_log_format(ab, "DELETE"); |
7509 |
++ break; |
7510 |
++ case AUDIT_TYPE_CHILD_CREATE: |
7511 |
++ audit_log_format(ab, "CREATE"); |
7512 |
++ break; |
7513 |
++ default: |
7514 |
++ audit_log_format(ab, "UNKNOWN"); |
7515 |
++ break; |
7516 |
++ } |
7517 |
++ |
7518 |
+ audit_log_fcaps(ab, n); |
7519 |
+ audit_log_end(ab); |
7520 |
+ } |
7521 |
+diff --git a/kernel/cgroup.c b/kernel/cgroup.c |
7522 |
+index 8bd9cfdc..5c9127dc 100644 |
7523 |
+--- a/kernel/cgroup.c |
7524 |
++++ b/kernel/cgroup.c |
7525 |
+@@ -90,6 +90,14 @@ static DEFINE_MUTEX(cgroup_mutex); |
7526 |
+ static DEFINE_MUTEX(cgroup_root_mutex); |
7527 |
+ |
7528 |
+ /* |
7529 |
++ * cgroup destruction makes heavy use of work items and there can be a lot |
7530 |
++ * of concurrent destructions. Use a separate workqueue so that cgroup |
7531 |
++ * destruction work items don't end up filling up max_active of system_wq |
7532 |
++ * which may lead to deadlock. |
7533 |
++ */ |
7534 |
++static struct workqueue_struct *cgroup_destroy_wq; |
7535 |
++ |
7536 |
++/* |
7537 |
+ * Generate an array of cgroup subsystem pointers. At boot time, this is |
7538 |
+ * populated with the built in subsystems, and modular subsystems are |
7539 |
+ * registered after that. The mutable section of this array is protected by |
7540 |
+@@ -223,6 +231,7 @@ static void cgroup_destroy_css_killed(struct cgroup *cgrp); |
7541 |
+ static int cgroup_destroy_locked(struct cgroup *cgrp); |
7542 |
+ static int cgroup_addrm_files(struct cgroup *cgrp, struct cftype cfts[], |
7543 |
+ bool is_add); |
7544 |
++static int cgroup_file_release(struct inode *inode, struct file *file); |
7545 |
+ |
7546 |
+ /** |
7547 |
+ * cgroup_css - obtain a cgroup's css for the specified subsystem |
7548 |
+@@ -908,7 +917,7 @@ static void cgroup_free_rcu(struct rcu_head *head) |
7549 |
+ struct cgroup *cgrp = container_of(head, struct cgroup, rcu_head); |
7550 |
+ |
7551 |
+ INIT_WORK(&cgrp->destroy_work, cgroup_free_fn); |
7552 |
+- schedule_work(&cgrp->destroy_work); |
7553 |
++ queue_work(cgroup_destroy_wq, &cgrp->destroy_work); |
7554 |
+ } |
7555 |
+ |
7556 |
+ static void cgroup_diput(struct dentry *dentry, struct inode *inode) |
7557 |
+@@ -2463,7 +2472,7 @@ static const struct file_operations cgroup_seqfile_operations = { |
7558 |
+ .read = seq_read, |
7559 |
+ .write = cgroup_file_write, |
7560 |
+ .llseek = seq_lseek, |
7561 |
+- .release = single_release, |
7562 |
++ .release = cgroup_file_release, |
7563 |
+ }; |
7564 |
+ |
7565 |
+ static int cgroup_file_open(struct inode *inode, struct file *file) |
7566 |
+@@ -2524,6 +2533,8 @@ static int cgroup_file_release(struct inode *inode, struct file *file) |
7567 |
+ ret = cft->release(inode, file); |
7568 |
+ if (css->ss) |
7569 |
+ css_put(css); |
7570 |
++ if (file->f_op == &cgroup_seqfile_operations) |
7571 |
++ single_release(inode, file); |
7572 |
+ return ret; |
7573 |
+ } |
7574 |
+ |
7575 |
+@@ -4306,7 +4317,7 @@ static void css_free_rcu_fn(struct rcu_head *rcu_head) |
7576 |
+ * css_put(). dput() requires process context which we don't have. |
7577 |
+ */ |
7578 |
+ INIT_WORK(&css->destroy_work, css_free_work_fn); |
7579 |
+- schedule_work(&css->destroy_work); |
7580 |
++ queue_work(cgroup_destroy_wq, &css->destroy_work); |
7581 |
+ } |
7582 |
+ |
7583 |
+ static void css_release(struct percpu_ref *ref) |
7584 |
+@@ -4603,7 +4614,7 @@ static void css_killed_ref_fn(struct percpu_ref *ref) |
7585 |
+ container_of(ref, struct cgroup_subsys_state, refcnt); |
7586 |
+ |
7587 |
+ INIT_WORK(&css->destroy_work, css_killed_work_fn); |
7588 |
+- schedule_work(&css->destroy_work); |
7589 |
++ queue_work(cgroup_destroy_wq, &css->destroy_work); |
7590 |
+ } |
7591 |
+ |
7592 |
+ /** |
7593 |
+@@ -5139,6 +5150,22 @@ out: |
7594 |
+ return err; |
7595 |
+ } |
7596 |
+ |
7597 |
++static int __init cgroup_wq_init(void) |
7598 |
++{ |
7599 |
++ /* |
7600 |
++ * There isn't much point in executing destruction path in |
7601 |
++ * parallel. Good chunk is serialized with cgroup_mutex anyway. |
7602 |
++ * Use 1 for @max_active. |
7603 |
++ * |
7604 |
++ * We would prefer to do this in cgroup_init() above, but that |
7605 |
++ * is called before init_workqueues(): so leave this until after. |
7606 |
++ */ |
7607 |
++ cgroup_destroy_wq = alloc_workqueue("cgroup_destroy", 0, 1); |
7608 |
++ BUG_ON(!cgroup_destroy_wq); |
7609 |
++ return 0; |
7610 |
++} |
7611 |
++core_initcall(cgroup_wq_init); |
7612 |
++ |
7613 |
+ /* |
7614 |
+ * proc_cgroup_show() |
7615 |
+ * - Print task's cgroup paths into seq_file, one line for each hierarchy |
7616 |
+diff --git a/kernel/cpuset.c b/kernel/cpuset.c |
7617 |
+index 6bf981e1..4772034b 100644 |
7618 |
+--- a/kernel/cpuset.c |
7619 |
++++ b/kernel/cpuset.c |
7620 |
+@@ -1033,8 +1033,10 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, |
7621 |
+ need_loop = task_has_mempolicy(tsk) || |
7622 |
+ !nodes_intersects(*newmems, tsk->mems_allowed); |
7623 |
+ |
7624 |
+- if (need_loop) |
7625 |
++ if (need_loop) { |
7626 |
++ local_irq_disable(); |
7627 |
+ write_seqcount_begin(&tsk->mems_allowed_seq); |
7628 |
++ } |
7629 |
+ |
7630 |
+ nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); |
7631 |
+ mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1); |
7632 |
+@@ -1042,8 +1044,10 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk, |
7633 |
+ mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP2); |
7634 |
+ tsk->mems_allowed = *newmems; |
7635 |
+ |
7636 |
+- if (need_loop) |
7637 |
++ if (need_loop) { |
7638 |
+ write_seqcount_end(&tsk->mems_allowed_seq); |
7639 |
++ local_irq_enable(); |
7640 |
++ } |
7641 |
+ |
7642 |
+ task_unlock(tsk); |
7643 |
+ } |
7644 |
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
7645 |
+index 514bcfd8..3e59f951 100644 |
7646 |
+--- a/kernel/irq/manage.c |
7647 |
++++ b/kernel/irq/manage.c |
7648 |
+@@ -956,7 +956,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) |
7649 |
+ goto out_mput; |
7650 |
+ } |
7651 |
+ |
7652 |
+- sched_setscheduler(t, SCHED_FIFO, ¶m); |
7653 |
++ sched_setscheduler_nocheck(t, SCHED_FIFO, ¶m); |
7654 |
+ |
7655 |
+ /* |
7656 |
+ * We keep the reference to the task struct even if |
7657 |
+diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c |
7658 |
+index 98c3b34a..b38109e2 100644 |
7659 |
+--- a/kernel/power/snapshot.c |
7660 |
++++ b/kernel/power/snapshot.c |
7661 |
+@@ -792,7 +792,8 @@ void free_basic_memory_bitmaps(void) |
7662 |
+ { |
7663 |
+ struct memory_bitmap *bm1, *bm2; |
7664 |
+ |
7665 |
+- BUG_ON(!(forbidden_pages_map && free_pages_map)); |
7666 |
++ if (WARN_ON(!(forbidden_pages_map && free_pages_map))) |
7667 |
++ return; |
7668 |
+ |
7669 |
+ bm1 = forbidden_pages_map; |
7670 |
+ bm2 = free_pages_map; |
7671 |
+@@ -1402,7 +1403,11 @@ int hibernate_preallocate_memory(void) |
7672 |
+ * highmem and non-highmem zones separately. |
7673 |
+ */ |
7674 |
+ pages_highmem = preallocate_image_highmem(highmem / 2); |
7675 |
+- alloc = (count - max_size) - pages_highmem; |
7676 |
++ alloc = count - max_size; |
7677 |
++ if (alloc > pages_highmem) |
7678 |
++ alloc -= pages_highmem; |
7679 |
++ else |
7680 |
++ alloc = 0; |
7681 |
+ pages = preallocate_image_memory(alloc, avail_normal); |
7682 |
+ if (pages < alloc) { |
7683 |
+ /* We have exhausted non-highmem pages, try highmem. */ |
7684 |
+diff --git a/kernel/power/user.c b/kernel/power/user.c |
7685 |
+index 957f0616..ffc931c3 100644 |
7686 |
+--- a/kernel/power/user.c |
7687 |
++++ b/kernel/power/user.c |
7688 |
+@@ -70,6 +70,7 @@ static int snapshot_open(struct inode *inode, struct file *filp) |
7689 |
+ data->swap = swsusp_resume_device ? |
7690 |
+ swap_type_of(swsusp_resume_device, 0, NULL) : -1; |
7691 |
+ data->mode = O_RDONLY; |
7692 |
++ data->free_bitmaps = false; |
7693 |
+ error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); |
7694 |
+ if (error) |
7695 |
+ pm_notifier_call_chain(PM_POST_HIBERNATION); |
7696 |
+diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c |
7697 |
+index eec50fce..88c9c65a 100644 |
7698 |
+--- a/kernel/time/alarmtimer.c |
7699 |
++++ b/kernel/time/alarmtimer.c |
7700 |
+@@ -490,7 +490,7 @@ static int alarm_clock_getres(const clockid_t which_clock, struct timespec *tp) |
7701 |
+ clockid_t baseid = alarm_bases[clock2alarm(which_clock)].base_clockid; |
7702 |
+ |
7703 |
+ if (!alarmtimer_get_rtcdev()) |
7704 |
+- return -ENOTSUPP; |
7705 |
++ return -EINVAL; |
7706 |
+ |
7707 |
+ return hrtimer_get_res(baseid, tp); |
7708 |
+ } |
7709 |
+@@ -507,7 +507,7 @@ static int alarm_clock_get(clockid_t which_clock, struct timespec *tp) |
7710 |
+ struct alarm_base *base = &alarm_bases[clock2alarm(which_clock)]; |
7711 |
+ |
7712 |
+ if (!alarmtimer_get_rtcdev()) |
7713 |
+- return -ENOTSUPP; |
7714 |
++ return -EINVAL; |
7715 |
+ |
7716 |
+ *tp = ktime_to_timespec(base->gettime()); |
7717 |
+ return 0; |
7718 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
7719 |
+index 03cf44ac..f3bd09ee 100644 |
7720 |
+--- a/kernel/trace/ftrace.c |
7721 |
++++ b/kernel/trace/ftrace.c |
7722 |
+@@ -367,9 +367,6 @@ static int remove_ftrace_list_ops(struct ftrace_ops **list, |
7723 |
+ |
7724 |
+ static int __register_ftrace_function(struct ftrace_ops *ops) |
7725 |
+ { |
7726 |
+- if (unlikely(ftrace_disabled)) |
7727 |
+- return -ENODEV; |
7728 |
+- |
7729 |
+ if (FTRACE_WARN_ON(ops == &global_ops)) |
7730 |
+ return -EINVAL; |
7731 |
+ |
7732 |
+@@ -428,9 +425,6 @@ static int __unregister_ftrace_function(struct ftrace_ops *ops) |
7733 |
+ { |
7734 |
+ int ret; |
7735 |
+ |
7736 |
+- if (ftrace_disabled) |
7737 |
+- return -ENODEV; |
7738 |
+- |
7739 |
+ if (WARN_ON(!(ops->flags & FTRACE_OPS_FL_ENABLED))) |
7740 |
+ return -EBUSY; |
7741 |
+ |
7742 |
+@@ -2088,10 +2082,15 @@ static void ftrace_startup_enable(int command) |
7743 |
+ static int ftrace_startup(struct ftrace_ops *ops, int command) |
7744 |
+ { |
7745 |
+ bool hash_enable = true; |
7746 |
++ int ret; |
7747 |
+ |
7748 |
+ if (unlikely(ftrace_disabled)) |
7749 |
+ return -ENODEV; |
7750 |
+ |
7751 |
++ ret = __register_ftrace_function(ops); |
7752 |
++ if (ret) |
7753 |
++ return ret; |
7754 |
++ |
7755 |
+ ftrace_start_up++; |
7756 |
+ command |= FTRACE_UPDATE_CALLS; |
7757 |
+ |
7758 |
+@@ -2113,12 +2112,17 @@ static int ftrace_startup(struct ftrace_ops *ops, int command) |
7759 |
+ return 0; |
7760 |
+ } |
7761 |
+ |
7762 |
+-static void ftrace_shutdown(struct ftrace_ops *ops, int command) |
7763 |
++static int ftrace_shutdown(struct ftrace_ops *ops, int command) |
7764 |
+ { |
7765 |
+ bool hash_disable = true; |
7766 |
++ int ret; |
7767 |
+ |
7768 |
+ if (unlikely(ftrace_disabled)) |
7769 |
+- return; |
7770 |
++ return -ENODEV; |
7771 |
++ |
7772 |
++ ret = __unregister_ftrace_function(ops); |
7773 |
++ if (ret) |
7774 |
++ return ret; |
7775 |
+ |
7776 |
+ ftrace_start_up--; |
7777 |
+ /* |
7778 |
+@@ -2153,9 +2157,10 @@ static void ftrace_shutdown(struct ftrace_ops *ops, int command) |
7779 |
+ } |
7780 |
+ |
7781 |
+ if (!command || !ftrace_enabled) |
7782 |
+- return; |
7783 |
++ return 0; |
7784 |
+ |
7785 |
+ ftrace_run_update_code(command); |
7786 |
++ return 0; |
7787 |
+ } |
7788 |
+ |
7789 |
+ static void ftrace_startup_sysctl(void) |
7790 |
+@@ -3060,16 +3065,13 @@ static void __enable_ftrace_function_probe(void) |
7791 |
+ if (i == FTRACE_FUNC_HASHSIZE) |
7792 |
+ return; |
7793 |
+ |
7794 |
+- ret = __register_ftrace_function(&trace_probe_ops); |
7795 |
+- if (!ret) |
7796 |
+- ret = ftrace_startup(&trace_probe_ops, 0); |
7797 |
++ ret = ftrace_startup(&trace_probe_ops, 0); |
7798 |
+ |
7799 |
+ ftrace_probe_registered = 1; |
7800 |
+ } |
7801 |
+ |
7802 |
+ static void __disable_ftrace_function_probe(void) |
7803 |
+ { |
7804 |
+- int ret; |
7805 |
+ int i; |
7806 |
+ |
7807 |
+ if (!ftrace_probe_registered) |
7808 |
+@@ -3082,9 +3084,7 @@ static void __disable_ftrace_function_probe(void) |
7809 |
+ } |
7810 |
+ |
7811 |
+ /* no more funcs left */ |
7812 |
+- ret = __unregister_ftrace_function(&trace_probe_ops); |
7813 |
+- if (!ret) |
7814 |
+- ftrace_shutdown(&trace_probe_ops, 0); |
7815 |
++ ftrace_shutdown(&trace_probe_ops, 0); |
7816 |
+ |
7817 |
+ ftrace_probe_registered = 0; |
7818 |
+ } |
7819 |
+@@ -4290,12 +4290,15 @@ core_initcall(ftrace_nodyn_init); |
7820 |
+ static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; } |
7821 |
+ static inline void ftrace_startup_enable(int command) { } |
7822 |
+ /* Keep as macros so we do not need to define the commands */ |
7823 |
+-# define ftrace_startup(ops, command) \ |
7824 |
+- ({ \ |
7825 |
+- (ops)->flags |= FTRACE_OPS_FL_ENABLED; \ |
7826 |
+- 0; \ |
7827 |
++# define ftrace_startup(ops, command) \ |
7828 |
++ ({ \ |
7829 |
++ int ___ret = __register_ftrace_function(ops); \ |
7830 |
++ if (!___ret) \ |
7831 |
++ (ops)->flags |= FTRACE_OPS_FL_ENABLED; \ |
7832 |
++ ___ret; \ |
7833 |
+ }) |
7834 |
+-# define ftrace_shutdown(ops, command) do { } while (0) |
7835 |
++# define ftrace_shutdown(ops, command) __unregister_ftrace_function(ops) |
7836 |
++ |
7837 |
+ # define ftrace_startup_sysctl() do { } while (0) |
7838 |
+ # define ftrace_shutdown_sysctl() do { } while (0) |
7839 |
+ |
7840 |
+@@ -4695,9 +4698,7 @@ int register_ftrace_function(struct ftrace_ops *ops) |
7841 |
+ |
7842 |
+ mutex_lock(&ftrace_lock); |
7843 |
+ |
7844 |
+- ret = __register_ftrace_function(ops); |
7845 |
+- if (!ret) |
7846 |
+- ret = ftrace_startup(ops, 0); |
7847 |
++ ret = ftrace_startup(ops, 0); |
7848 |
+ |
7849 |
+ mutex_unlock(&ftrace_lock); |
7850 |
+ |
7851 |
+@@ -4716,9 +4717,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops) |
7852 |
+ int ret; |
7853 |
+ |
7854 |
+ mutex_lock(&ftrace_lock); |
7855 |
+- ret = __unregister_ftrace_function(ops); |
7856 |
+- if (!ret) |
7857 |
+- ftrace_shutdown(ops, 0); |
7858 |
++ ret = ftrace_shutdown(ops, 0); |
7859 |
+ mutex_unlock(&ftrace_lock); |
7860 |
+ |
7861 |
+ return ret; |
7862 |
+@@ -4912,6 +4911,13 @@ ftrace_suspend_notifier_call(struct notifier_block *bl, unsigned long state, |
7863 |
+ return NOTIFY_DONE; |
7864 |
+ } |
7865 |
+ |
7866 |
++/* Just a place holder for function graph */ |
7867 |
++static struct ftrace_ops fgraph_ops __read_mostly = { |
7868 |
++ .func = ftrace_stub, |
7869 |
++ .flags = FTRACE_OPS_FL_STUB | FTRACE_OPS_FL_GLOBAL | |
7870 |
++ FTRACE_OPS_FL_RECURSION_SAFE, |
7871 |
++}; |
7872 |
++ |
7873 |
+ int register_ftrace_graph(trace_func_graph_ret_t retfunc, |
7874 |
+ trace_func_graph_ent_t entryfunc) |
7875 |
+ { |
7876 |
+@@ -4938,7 +4944,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc, |
7877 |
+ ftrace_graph_return = retfunc; |
7878 |
+ ftrace_graph_entry = entryfunc; |
7879 |
+ |
7880 |
+- ret = ftrace_startup(&global_ops, FTRACE_START_FUNC_RET); |
7881 |
++ ret = ftrace_startup(&fgraph_ops, FTRACE_START_FUNC_RET); |
7882 |
+ |
7883 |
+ out: |
7884 |
+ mutex_unlock(&ftrace_lock); |
7885 |
+@@ -4955,7 +4961,7 @@ void unregister_ftrace_graph(void) |
7886 |
+ ftrace_graph_active--; |
7887 |
+ ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; |
7888 |
+ ftrace_graph_entry = ftrace_graph_entry_stub; |
7889 |
+- ftrace_shutdown(&global_ops, FTRACE_STOP_FUNC_RET); |
7890 |
++ ftrace_shutdown(&fgraph_ops, FTRACE_STOP_FUNC_RET); |
7891 |
+ unregister_pm_notifier(&ftrace_suspend_notifier); |
7892 |
+ unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL); |
7893 |
+ |
7894 |
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
7895 |
+index 987293d0..93c26528 100644 |
7896 |
+--- a/kernel/workqueue.c |
7897 |
++++ b/kernel/workqueue.c |
7898 |
+@@ -305,6 +305,9 @@ static DEFINE_HASHTABLE(unbound_pool_hash, UNBOUND_POOL_HASH_ORDER); |
7899 |
+ /* I: attributes used when instantiating standard unbound pools on demand */ |
7900 |
+ static struct workqueue_attrs *unbound_std_wq_attrs[NR_STD_WORKER_POOLS]; |
7901 |
+ |
7902 |
++/* I: attributes used when instantiating ordered pools on demand */ |
7903 |
++static struct workqueue_attrs *ordered_wq_attrs[NR_STD_WORKER_POOLS]; |
7904 |
++ |
7905 |
+ struct workqueue_struct *system_wq __read_mostly; |
7906 |
+ EXPORT_SYMBOL(system_wq); |
7907 |
+ struct workqueue_struct *system_highpri_wq __read_mostly; |
7908 |
+@@ -4106,7 +4109,7 @@ out_unlock: |
7909 |
+ static int alloc_and_link_pwqs(struct workqueue_struct *wq) |
7910 |
+ { |
7911 |
+ bool highpri = wq->flags & WQ_HIGHPRI; |
7912 |
+- int cpu; |
7913 |
++ int cpu, ret; |
7914 |
+ |
7915 |
+ if (!(wq->flags & WQ_UNBOUND)) { |
7916 |
+ wq->cpu_pwqs = alloc_percpu(struct pool_workqueue); |
7917 |
+@@ -4126,6 +4129,13 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq) |
7918 |
+ mutex_unlock(&wq->mutex); |
7919 |
+ } |
7920 |
+ return 0; |
7921 |
++ } else if (wq->flags & __WQ_ORDERED) { |
7922 |
++ ret = apply_workqueue_attrs(wq, ordered_wq_attrs[highpri]); |
7923 |
++ /* there should only be single pwq for ordering guarantee */ |
7924 |
++ WARN(!ret && (wq->pwqs.next != &wq->dfl_pwq->pwqs_node || |
7925 |
++ wq->pwqs.prev != &wq->dfl_pwq->pwqs_node), |
7926 |
++ "ordering guarantee broken for workqueue %s\n", wq->name); |
7927 |
++ return ret; |
7928 |
+ } else { |
7929 |
+ return apply_workqueue_attrs(wq, unbound_std_wq_attrs[highpri]); |
7930 |
+ } |
7931 |
+@@ -5051,13 +5061,23 @@ static int __init init_workqueues(void) |
7932 |
+ } |
7933 |
+ } |
7934 |
+ |
7935 |
+- /* create default unbound wq attrs */ |
7936 |
++ /* create default unbound and ordered wq attrs */ |
7937 |
+ for (i = 0; i < NR_STD_WORKER_POOLS; i++) { |
7938 |
+ struct workqueue_attrs *attrs; |
7939 |
+ |
7940 |
+ BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); |
7941 |
+ attrs->nice = std_nice[i]; |
7942 |
+ unbound_std_wq_attrs[i] = attrs; |
7943 |
++ |
7944 |
++ /* |
7945 |
++ * An ordered wq should have only one pwq as ordering is |
7946 |
++ * guaranteed by max_active which is enforced by pwqs. |
7947 |
++ * Turn off NUMA so that dfl_pwq is used for all nodes. |
7948 |
++ */ |
7949 |
++ BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); |
7950 |
++ attrs->nice = std_nice[i]; |
7951 |
++ attrs->no_numa = true; |
7952 |
++ ordered_wq_attrs[i] = attrs; |
7953 |
+ } |
7954 |
+ |
7955 |
+ system_wq = alloc_workqueue("events", 0, 0); |
7956 |
+diff --git a/lib/vsprintf.c b/lib/vsprintf.c |
7957 |
+index 26559bdb..d76555c4 100644 |
7958 |
+--- a/lib/vsprintf.c |
7959 |
++++ b/lib/vsprintf.c |
7960 |
+@@ -27,6 +27,7 @@ |
7961 |
+ #include <linux/uaccess.h> |
7962 |
+ #include <linux/ioport.h> |
7963 |
+ #include <linux/dcache.h> |
7964 |
++#include <linux/cred.h> |
7965 |
+ #include <net/addrconf.h> |
7966 |
+ |
7967 |
+ #include <asm/page.h> /* for PAGE_SIZE */ |
7968 |
+@@ -1312,11 +1313,37 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, |
7969 |
+ spec.field_width = default_width; |
7970 |
+ return string(buf, end, "pK-error", spec); |
7971 |
+ } |
7972 |
+- if (!((kptr_restrict == 0) || |
7973 |
+- (kptr_restrict == 1 && |
7974 |
+- has_capability_noaudit(current, CAP_SYSLOG)))) |
7975 |
++ |
7976 |
++ switch (kptr_restrict) { |
7977 |
++ case 0: |
7978 |
++ /* Always print %pK values */ |
7979 |
++ break; |
7980 |
++ case 1: { |
7981 |
++ /* |
7982 |
++ * Only print the real pointer value if the current |
7983 |
++ * process has CAP_SYSLOG and is running with the |
7984 |
++ * same credentials it started with. This is because |
7985 |
++ * access to files is checked at open() time, but %pK |
7986 |
++ * checks permission at read() time. We don't want to |
7987 |
++ * leak pointer values if a binary opens a file using |
7988 |
++ * %pK and then elevates privileges before reading it. |
7989 |
++ */ |
7990 |
++ const struct cred *cred = current_cred(); |
7991 |
++ |
7992 |
++ if (!has_capability_noaudit(current, CAP_SYSLOG) || |
7993 |
++ !uid_eq(cred->euid, cred->uid) || |
7994 |
++ !gid_eq(cred->egid, cred->gid)) |
7995 |
++ ptr = NULL; |
7996 |
++ break; |
7997 |
++ } |
7998 |
++ case 2: |
7999 |
++ default: |
8000 |
++ /* Always print 0's for %pK */ |
8001 |
+ ptr = NULL; |
8002 |
++ break; |
8003 |
++ } |
8004 |
+ break; |
8005 |
++ |
8006 |
+ case 'N': |
8007 |
+ switch (fmt[1]) { |
8008 |
+ case 'F': |
8009 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
8010 |
+index 9d548512..362e5f13 100644 |
8011 |
+--- a/mm/mmap.c |
8012 |
++++ b/mm/mmap.c |
8013 |
+@@ -1856,7 +1856,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, |
8014 |
+ struct vm_area_struct *vma; |
8015 |
+ struct vm_unmapped_area_info info; |
8016 |
+ |
8017 |
+- if (len > TASK_SIZE) |
8018 |
++ if (len > TASK_SIZE - mmap_min_addr) |
8019 |
+ return -ENOMEM; |
8020 |
+ |
8021 |
+ if (flags & MAP_FIXED) |
8022 |
+@@ -1865,7 +1865,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, |
8023 |
+ if (addr) { |
8024 |
+ addr = PAGE_ALIGN(addr); |
8025 |
+ vma = find_vma(mm, addr); |
8026 |
+- if (TASK_SIZE - len >= addr && |
8027 |
++ if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && |
8028 |
+ (!vma || addr + len <= vma->vm_start)) |
8029 |
+ return addr; |
8030 |
+ } |
8031 |
+@@ -1895,7 +1895,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, |
8032 |
+ struct vm_unmapped_area_info info; |
8033 |
+ |
8034 |
+ /* requested length too big for entire address space */ |
8035 |
+- if (len > TASK_SIZE) |
8036 |
++ if (len > TASK_SIZE - mmap_min_addr) |
8037 |
+ return -ENOMEM; |
8038 |
+ |
8039 |
+ if (flags & MAP_FIXED) |
8040 |
+@@ -1905,14 +1905,14 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, |
8041 |
+ if (addr) { |
8042 |
+ addr = PAGE_ALIGN(addr); |
8043 |
+ vma = find_vma(mm, addr); |
8044 |
+- if (TASK_SIZE - len >= addr && |
8045 |
++ if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && |
8046 |
+ (!vma || addr + len <= vma->vm_start)) |
8047 |
+ return addr; |
8048 |
+ } |
8049 |
+ |
8050 |
+ info.flags = VM_UNMAPPED_AREA_TOPDOWN; |
8051 |
+ info.length = len; |
8052 |
+- info.low_limit = PAGE_SIZE; |
8053 |
++ info.low_limit = max(PAGE_SIZE, mmap_min_addr); |
8054 |
+ info.high_limit = mm->mmap_base; |
8055 |
+ info.align_mask = 0; |
8056 |
+ addr = vm_unmapped_area(&info); |
8057 |
+diff --git a/mm/zswap.c b/mm/zswap.c |
8058 |
+index d93510c6..6b862518 100644 |
8059 |
+--- a/mm/zswap.c |
8060 |
++++ b/mm/zswap.c |
8061 |
+@@ -387,7 +387,7 @@ static void zswap_free_entry(struct zswap_tree *tree, struct zswap_entry *entry) |
8062 |
+ enum zswap_get_swap_ret { |
8063 |
+ ZSWAP_SWAPCACHE_NEW, |
8064 |
+ ZSWAP_SWAPCACHE_EXIST, |
8065 |
+- ZSWAP_SWAPCACHE_NOMEM |
8066 |
++ ZSWAP_SWAPCACHE_FAIL, |
8067 |
+ }; |
8068 |
+ |
8069 |
+ /* |
8070 |
+@@ -401,9 +401,10 @@ enum zswap_get_swap_ret { |
8071 |
+ * added to the swap cache, and returned in retpage. |
8072 |
+ * |
8073 |
+ * If success, the swap cache page is returned in retpage |
8074 |
+- * Returns 0 if page was already in the swap cache, page is not locked |
8075 |
+- * Returns 1 if the new page needs to be populated, page is locked |
8076 |
+- * Returns <0 on error |
8077 |
++ * Returns ZSWAP_SWAPCACHE_EXIST if page was already in the swap cache |
8078 |
++ * Returns ZSWAP_SWAPCACHE_NEW if the new page needs to be populated, |
8079 |
++ * the new page is added to swapcache and locked |
8080 |
++ * Returns ZSWAP_SWAPCACHE_FAIL on error |
8081 |
+ */ |
8082 |
+ static int zswap_get_swap_cache_page(swp_entry_t entry, |
8083 |
+ struct page **retpage) |
8084 |
+@@ -475,7 +476,7 @@ static int zswap_get_swap_cache_page(swp_entry_t entry, |
8085 |
+ if (new_page) |
8086 |
+ page_cache_release(new_page); |
8087 |
+ if (!found_page) |
8088 |
+- return ZSWAP_SWAPCACHE_NOMEM; |
8089 |
++ return ZSWAP_SWAPCACHE_FAIL; |
8090 |
+ *retpage = found_page; |
8091 |
+ return ZSWAP_SWAPCACHE_EXIST; |
8092 |
+ } |
8093 |
+@@ -529,11 +530,11 @@ static int zswap_writeback_entry(struct zbud_pool *pool, unsigned long handle) |
8094 |
+ |
8095 |
+ /* try to allocate swap cache page */ |
8096 |
+ switch (zswap_get_swap_cache_page(swpentry, &page)) { |
8097 |
+- case ZSWAP_SWAPCACHE_NOMEM: /* no memory */ |
8098 |
++ case ZSWAP_SWAPCACHE_FAIL: /* no memory or invalidate happened */ |
8099 |
+ ret = -ENOMEM; |
8100 |
+ goto fail; |
8101 |
+ |
8102 |
+- case ZSWAP_SWAPCACHE_EXIST: /* page is unlocked */ |
8103 |
++ case ZSWAP_SWAPCACHE_EXIST: |
8104 |
+ /* page is already in the swap cache, ignore for now */ |
8105 |
+ page_cache_release(page); |
8106 |
+ ret = -EEXIST; |
8107 |
+@@ -591,7 +592,12 @@ static int zswap_writeback_entry(struct zbud_pool *pool, unsigned long handle) |
8108 |
+ |
8109 |
+ fail: |
8110 |
+ spin_lock(&tree->lock); |
8111 |
+- zswap_entry_put(entry); |
8112 |
++ refcount = zswap_entry_put(entry); |
8113 |
++ if (refcount <= 0) { |
8114 |
++ /* invalidate happened, consider writeback as success */ |
8115 |
++ zswap_free_entry(tree, entry); |
8116 |
++ ret = 0; |
8117 |
++ } |
8118 |
+ spin_unlock(&tree->lock); |
8119 |
+ return ret; |
8120 |
+ } |
8121 |
+diff --git a/net/wireless/scan.c b/net/wireless/scan.c |
8122 |
+index eeb71480..d4397eba 100644 |
8123 |
+--- a/net/wireless/scan.c |
8124 |
++++ b/net/wireless/scan.c |
8125 |
+@@ -254,10 +254,10 @@ void __cfg80211_sched_scan_results(struct work_struct *wk) |
8126 |
+ rdev = container_of(wk, struct cfg80211_registered_device, |
8127 |
+ sched_scan_results_wk); |
8128 |
+ |
8129 |
+- request = rdev->sched_scan_req; |
8130 |
+- |
8131 |
+ rtnl_lock(); |
8132 |
+ |
8133 |
++ request = rdev->sched_scan_req; |
8134 |
++ |
8135 |
+ /* we don't have sched_scan_req anymore if the scan is stopping */ |
8136 |
+ if (request) { |
8137 |
+ if (request->flags & NL80211_SCAN_FLAG_FLUSH) { |
8138 |
+diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c |
8139 |
+index da4b8b23..6235d052 100644 |
8140 |
+--- a/security/selinux/netlabel.c |
8141 |
++++ b/security/selinux/netlabel.c |
8142 |
+@@ -442,8 +442,7 @@ int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr) |
8143 |
+ sksec->nlbl_state != NLBL_CONNLABELED) |
8144 |
+ return 0; |
8145 |
+ |
8146 |
+- local_bh_disable(); |
8147 |
+- bh_lock_sock_nested(sk); |
8148 |
++ lock_sock(sk); |
8149 |
+ |
8150 |
+ /* connected sockets are allowed to disconnect when the address family |
8151 |
+ * is set to AF_UNSPEC, if that is what is happening we want to reset |
8152 |
+@@ -464,7 +463,6 @@ int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr) |
8153 |
+ sksec->nlbl_state = NLBL_CONNLABELED; |
8154 |
+ |
8155 |
+ socket_connect_return: |
8156 |
+- bh_unlock_sock(sk); |
8157 |
+- local_bh_enable(); |
8158 |
++ release_sock(sk); |
8159 |
+ return rc; |
8160 |
+ } |
8161 |
+diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c |
8162 |
+index 3067ed4f..c4671d00 100644 |
8163 |
+--- a/sound/pci/hda/hda_generic.c |
8164 |
++++ b/sound/pci/hda/hda_generic.c |
8165 |
+@@ -2506,12 +2506,8 @@ static int create_out_jack_modes(struct hda_codec *codec, int num_pins, |
8166 |
+ |
8167 |
+ for (i = 0; i < num_pins; i++) { |
8168 |
+ hda_nid_t pin = pins[i]; |
8169 |
+- if (pin == spec->hp_mic_pin) { |
8170 |
+- int ret = create_hp_mic_jack_mode(codec, pin); |
8171 |
+- if (ret < 0) |
8172 |
+- return ret; |
8173 |
++ if (pin == spec->hp_mic_pin) |
8174 |
+ continue; |
8175 |
+- } |
8176 |
+ if (get_out_jack_num_items(codec, pin) > 1) { |
8177 |
+ struct snd_kcontrol_new *knew; |
8178 |
+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
8179 |
+@@ -2764,7 +2760,7 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol, |
8180 |
+ val &= ~(AC_PINCTL_VREFEN | PIN_HP); |
8181 |
+ val |= get_vref_idx(vref_caps, idx) | PIN_IN; |
8182 |
+ } else |
8183 |
+- val = snd_hda_get_default_vref(codec, nid); |
8184 |
++ val = snd_hda_get_default_vref(codec, nid) | PIN_IN; |
8185 |
+ } |
8186 |
+ snd_hda_set_pin_ctl_cache(codec, nid, val); |
8187 |
+ call_hp_automute(codec, NULL); |
8188 |
+@@ -2784,9 +2780,6 @@ static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin) |
8189 |
+ struct hda_gen_spec *spec = codec->spec; |
8190 |
+ struct snd_kcontrol_new *knew; |
8191 |
+ |
8192 |
+- if (get_out_jack_num_items(codec, pin) <= 1 && |
8193 |
+- get_in_jack_num_items(codec, pin) <= 1) |
8194 |
+- return 0; /* no need */ |
8195 |
+ knew = snd_hda_gen_add_kctl(spec, "Headphone Mic Jack Mode", |
8196 |
+ &hp_mic_jack_mode_enum); |
8197 |
+ if (!knew) |
8198 |
+@@ -2815,6 +2808,42 @@ static int add_loopback_list(struct hda_gen_spec *spec, hda_nid_t mix, int idx) |
8199 |
+ return 0; |
8200 |
+ } |
8201 |
+ |
8202 |
++/* return true if either a volume or a mute amp is found for the given |
8203 |
++ * aamix path; the amp has to be either in the mixer node or its direct leaf |
8204 |
++ */ |
8205 |
++static bool look_for_mix_leaf_ctls(struct hda_codec *codec, hda_nid_t mix_nid, |
8206 |
++ hda_nid_t pin, unsigned int *mix_val, |
8207 |
++ unsigned int *mute_val) |
8208 |
++{ |
8209 |
++ int idx, num_conns; |
8210 |
++ const hda_nid_t *list; |
8211 |
++ hda_nid_t nid; |
8212 |
++ |
8213 |
++ idx = snd_hda_get_conn_index(codec, mix_nid, pin, true); |
8214 |
++ if (idx < 0) |
8215 |
++ return false; |
8216 |
++ |
8217 |
++ *mix_val = *mute_val = 0; |
8218 |
++ if (nid_has_volume(codec, mix_nid, HDA_INPUT)) |
8219 |
++ *mix_val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT); |
8220 |
++ if (nid_has_mute(codec, mix_nid, HDA_INPUT)) |
8221 |
++ *mute_val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT); |
8222 |
++ if (*mix_val && *mute_val) |
8223 |
++ return true; |
8224 |
++ |
8225 |
++ /* check leaf node */ |
8226 |
++ num_conns = snd_hda_get_conn_list(codec, mix_nid, &list); |
8227 |
++ if (num_conns < idx) |
8228 |
++ return false; |
8229 |
++ nid = list[idx]; |
8230 |
++ if (!*mix_val && nid_has_volume(codec, nid, HDA_OUTPUT)) |
8231 |
++ *mix_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
8232 |
++ if (!*mute_val && nid_has_mute(codec, nid, HDA_OUTPUT)) |
8233 |
++ *mute_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
8234 |
++ |
8235 |
++ return *mix_val || *mute_val; |
8236 |
++} |
8237 |
++ |
8238 |
+ /* create input playback/capture controls for the given pin */ |
8239 |
+ static int new_analog_input(struct hda_codec *codec, int input_idx, |
8240 |
+ hda_nid_t pin, const char *ctlname, int ctlidx, |
8241 |
+@@ -2822,12 +2851,11 @@ static int new_analog_input(struct hda_codec *codec, int input_idx, |
8242 |
+ { |
8243 |
+ struct hda_gen_spec *spec = codec->spec; |
8244 |
+ struct nid_path *path; |
8245 |
+- unsigned int val; |
8246 |
++ unsigned int mix_val, mute_val; |
8247 |
+ int err, idx; |
8248 |
+ |
8249 |
+- if (!nid_has_volume(codec, mix_nid, HDA_INPUT) && |
8250 |
+- !nid_has_mute(codec, mix_nid, HDA_INPUT)) |
8251 |
+- return 0; /* no need for analog loopback */ |
8252 |
++ if (!look_for_mix_leaf_ctls(codec, mix_nid, pin, &mix_val, &mute_val)) |
8253 |
++ return 0; |
8254 |
+ |
8255 |
+ path = snd_hda_add_new_path(codec, pin, mix_nid, 0); |
8256 |
+ if (!path) |
8257 |
+@@ -2836,20 +2864,18 @@ static int new_analog_input(struct hda_codec *codec, int input_idx, |
8258 |
+ spec->loopback_paths[input_idx] = snd_hda_get_path_idx(codec, path); |
8259 |
+ |
8260 |
+ idx = path->idx[path->depth - 1]; |
8261 |
+- if (nid_has_volume(codec, mix_nid, HDA_INPUT)) { |
8262 |
+- val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT); |
8263 |
+- err = __add_pb_vol_ctrl(spec, HDA_CTL_WIDGET_VOL, ctlname, ctlidx, val); |
8264 |
++ if (mix_val) { |
8265 |
++ err = __add_pb_vol_ctrl(spec, HDA_CTL_WIDGET_VOL, ctlname, ctlidx, mix_val); |
8266 |
+ if (err < 0) |
8267 |
+ return err; |
8268 |
+- path->ctls[NID_PATH_VOL_CTL] = val; |
8269 |
++ path->ctls[NID_PATH_VOL_CTL] = mix_val; |
8270 |
+ } |
8271 |
+ |
8272 |
+- if (nid_has_mute(codec, mix_nid, HDA_INPUT)) { |
8273 |
+- val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT); |
8274 |
+- err = __add_pb_sw_ctrl(spec, HDA_CTL_WIDGET_MUTE, ctlname, ctlidx, val); |
8275 |
++ if (mute_val) { |
8276 |
++ err = __add_pb_sw_ctrl(spec, HDA_CTL_WIDGET_MUTE, ctlname, ctlidx, mute_val); |
8277 |
+ if (err < 0) |
8278 |
+ return err; |
8279 |
+- path->ctls[NID_PATH_MUTE_CTL] = val; |
8280 |
++ path->ctls[NID_PATH_MUTE_CTL] = mute_val; |
8281 |
+ } |
8282 |
+ |
8283 |
+ path->active = true; |
8284 |
+@@ -4383,6 +4409,17 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, |
8285 |
+ if (err < 0) |
8286 |
+ return err; |
8287 |
+ |
8288 |
++ /* create "Headphone Mic Jack Mode" if no input selection is |
8289 |
++ * available (or user specifies add_jack_modes hint) |
8290 |
++ */ |
8291 |
++ if (spec->hp_mic_pin && |
8292 |
++ (spec->auto_mic || spec->input_mux.num_items == 1 || |
8293 |
++ spec->add_jack_modes)) { |
8294 |
++ err = create_hp_mic_jack_mode(codec, spec->hp_mic_pin); |
8295 |
++ if (err < 0) |
8296 |
++ return err; |
8297 |
++ } |
8298 |
++ |
8299 |
+ if (spec->add_jack_modes) { |
8300 |
+ if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
8301 |
+ err = create_out_jack_modes(codec, cfg->line_outs, |
8302 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
8303 |
+index 2f39631f..f0f54829 100644 |
8304 |
+--- a/sound/pci/hda/patch_realtek.c |
8305 |
++++ b/sound/pci/hda/patch_realtek.c |
8306 |
+@@ -1771,6 +1771,7 @@ enum { |
8307 |
+ ALC889_FIXUP_IMAC91_VREF, |
8308 |
+ ALC882_FIXUP_INV_DMIC, |
8309 |
+ ALC882_FIXUP_NO_PRIMARY_HP, |
8310 |
++ ALC887_FIXUP_ASUS_BASS, |
8311 |
+ }; |
8312 |
+ |
8313 |
+ static void alc889_fixup_coef(struct hda_codec *codec, |
8314 |
+@@ -2094,6 +2095,13 @@ static const struct hda_fixup alc882_fixups[] = { |
8315 |
+ .type = HDA_FIXUP_FUNC, |
8316 |
+ .v.func = alc882_fixup_no_primary_hp, |
8317 |
+ }, |
8318 |
++ [ALC887_FIXUP_ASUS_BASS] = { |
8319 |
++ .type = HDA_FIXUP_PINS, |
8320 |
++ .v.pins = (const struct hda_pintbl[]) { |
8321 |
++ {0x16, 0x99130130}, /* bass speaker */ |
8322 |
++ {} |
8323 |
++ }, |
8324 |
++ }, |
8325 |
+ }; |
8326 |
+ |
8327 |
+ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
8328 |
+@@ -2127,6 +2135,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
8329 |
+ SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), |
8330 |
+ SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), |
8331 |
+ SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), |
8332 |
++ SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), |
8333 |
+ SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), |
8334 |
+ SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), |
8335 |
+ SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), |
8336 |
+@@ -4864,6 +4873,7 @@ static int patch_alc662(struct hda_codec *codec) |
8337 |
+ case 0x10ec0272: |
8338 |
+ case 0x10ec0663: |
8339 |
+ case 0x10ec0665: |
8340 |
++ case 0x10ec0668: |
8341 |
+ set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
8342 |
+ break; |
8343 |
+ case 0x10ec0273: |
8344 |
+@@ -4921,6 +4931,7 @@ static int patch_alc680(struct hda_codec *codec) |
8345 |
+ */ |
8346 |
+ static const struct hda_codec_preset snd_hda_preset_realtek[] = { |
8347 |
+ { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, |
8348 |
++ { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 }, |
8349 |
+ { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 }, |
8350 |
+ { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 }, |
8351 |
+ { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
8352 |
+diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c |
8353 |
+index 9a174fc4..39d77483 100644 |
8354 |
+--- a/sound/soc/blackfin/bf5xx-i2s.c |
8355 |
++++ b/sound/soc/blackfin/bf5xx-i2s.c |
8356 |
+@@ -121,6 +121,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, |
8357 |
+ bf5xx_i2s->tcr2 |= 7; |
8358 |
+ bf5xx_i2s->rcr2 |= 7; |
8359 |
+ sport_handle->wdsize = 1; |
8360 |
++ break; |
8361 |
+ case SNDRV_PCM_FORMAT_S16_LE: |
8362 |
+ bf5xx_i2s->tcr2 |= 15; |
8363 |
+ bf5xx_i2s->rcr2 |= 15; |
8364 |
+diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c |
8365 |
+index 2d037870..687565d0 100644 |
8366 |
+--- a/sound/soc/codecs/ak4642.c |
8367 |
++++ b/sound/soc/codecs/ak4642.c |
8368 |
+@@ -257,7 +257,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, |
8369 |
+ * This operation came from example code of |
8370 |
+ * "ASAHI KASEI AK4642" (japanese) manual p94. |
8371 |
+ */ |
8372 |
+- snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); |
8373 |
++ snd_soc_update_bits(codec, SG_SL1, PMMP | MGAIN0, PMMP | MGAIN0); |
8374 |
+ snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); |
8375 |
+ snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); |
8376 |
+ snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL); |
8377 |
+diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c |
8378 |
+index 657808ba..f38ed4d2 100644 |
8379 |
+--- a/sound/soc/codecs/arizona.c |
8380 |
++++ b/sound/soc/codecs/arizona.c |
8381 |
+@@ -1525,6 +1525,8 @@ static void arizona_enable_fll(struct arizona_fll *fll, |
8382 |
+ try_wait_for_completion(&fll->ok); |
8383 |
+ |
8384 |
+ regmap_update_bits(arizona->regmap, fll->base + 1, |
8385 |
++ ARIZONA_FLL1_FREERUN, 0); |
8386 |
++ regmap_update_bits(arizona->regmap, fll->base + 1, |
8387 |
+ ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA); |
8388 |
+ if (fll->ref_src >= 0 && fll->sync_src >= 0 && |
8389 |
+ fll->ref_src != fll->sync_src) |
8390 |
+@@ -1543,6 +1545,8 @@ static void arizona_disable_fll(struct arizona_fll *fll) |
8391 |
+ struct arizona *arizona = fll->arizona; |
8392 |
+ bool change; |
8393 |
+ |
8394 |
++ regmap_update_bits(arizona->regmap, fll->base + 1, |
8395 |
++ ARIZONA_FLL1_FREERUN, ARIZONA_FLL1_FREERUN); |
8396 |
+ regmap_update_bits_check(arizona->regmap, fll->base + 1, |
8397 |
+ ARIZONA_FLL1_ENA, 0, &change); |
8398 |
+ regmap_update_bits(arizona->regmap, fll->base + 0x11, |
8399 |
+diff --git a/sound/soc/codecs/cs42l52.h b/sound/soc/codecs/cs42l52.h |
8400 |
+index 4277012c..a935d738 100644 |
8401 |
+--- a/sound/soc/codecs/cs42l52.h |
8402 |
++++ b/sound/soc/codecs/cs42l52.h |
8403 |
+@@ -179,7 +179,7 @@ |
8404 |
+ #define CS42L52_MICB_CTL 0x11 |
8405 |
+ #define CS42L52_MIC_CTL_MIC_SEL_MASK 0xBF |
8406 |
+ #define CS42L52_MIC_CTL_MIC_SEL_SHIFT 6 |
8407 |
+-#define CS42L52_MIC_CTL_TYPE_MASK 0xDF |
8408 |
++#define CS42L52_MIC_CTL_TYPE_MASK 0x20 |
8409 |
+ #define CS42L52_MIC_CTL_TYPE_SHIFT 5 |
8410 |
+ |
8411 |
+ |
8412 |
+diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c |
8413 |
+index bbd64384..0048ce5b 100644 |
8414 |
+--- a/sound/soc/codecs/wm5110.c |
8415 |
++++ b/sound/soc/codecs/wm5110.c |
8416 |
+@@ -37,6 +37,47 @@ struct wm5110_priv { |
8417 |
+ struct arizona_fll fll[2]; |
8418 |
+ }; |
8419 |
+ |
8420 |
++static const struct reg_default wm5110_sysclk_revd_patch[] = { |
8421 |
++ { 0x3093, 0x1001 }, |
8422 |
++ { 0x30E3, 0x1301 }, |
8423 |
++ { 0x3133, 0x1201 }, |
8424 |
++ { 0x3183, 0x1501 }, |
8425 |
++ { 0x31D3, 0x1401 }, |
8426 |
++}; |
8427 |
++ |
8428 |
++static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, |
8429 |
++ struct snd_kcontrol *kcontrol, int event) |
8430 |
++{ |
8431 |
++ struct snd_soc_codec *codec = w->codec; |
8432 |
++ struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
8433 |
++ struct regmap *regmap = codec->control_data; |
8434 |
++ const struct reg_default *patch = NULL; |
8435 |
++ int i, patch_size; |
8436 |
++ |
8437 |
++ switch (arizona->rev) { |
8438 |
++ case 3: |
8439 |
++ patch = wm5110_sysclk_revd_patch; |
8440 |
++ patch_size = ARRAY_SIZE(wm5110_sysclk_revd_patch); |
8441 |
++ break; |
8442 |
++ default: |
8443 |
++ return 0; |
8444 |
++ } |
8445 |
++ |
8446 |
++ switch (event) { |
8447 |
++ case SND_SOC_DAPM_POST_PMU: |
8448 |
++ if (patch) |
8449 |
++ for (i = 0; i < patch_size; i++) |
8450 |
++ regmap_write(regmap, patch[i].reg, |
8451 |
++ patch[i].def); |
8452 |
++ break; |
8453 |
++ |
8454 |
++ default: |
8455 |
++ break; |
8456 |
++ } |
8457 |
++ |
8458 |
++ return 0; |
8459 |
++} |
8460 |
++ |
8461 |
+ static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); |
8462 |
+ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
8463 |
+ static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
8464 |
+@@ -400,7 +441,7 @@ static const struct snd_kcontrol_new wm5110_aec_loopback_mux = |
8465 |
+ |
8466 |
+ static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = { |
8467 |
+ SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT, |
8468 |
+- 0, NULL, 0), |
8469 |
++ 0, wm5110_sysclk_ev, SND_SOC_DAPM_POST_PMU), |
8470 |
+ SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1, |
8471 |
+ ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0), |
8472 |
+ SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK, |
8473 |
+diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c |
8474 |
+index 11d80f3b..871f8518 100644 |
8475 |
+--- a/sound/soc/codecs/wm8962.c |
8476 |
++++ b/sound/soc/codecs/wm8962.c |
8477 |
+@@ -3722,6 +3722,8 @@ static int wm8962_i2c_probe(struct i2c_client *i2c, |
8478 |
+ if (ret < 0) |
8479 |
+ goto err_enable; |
8480 |
+ |
8481 |
++ regcache_cache_only(wm8962->regmap, true); |
8482 |
++ |
8483 |
+ /* The drivers should power up as needed */ |
8484 |
+ regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); |
8485 |
+ |
8486 |
+diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c |
8487 |
+index b38f3506..60b6b593 100644 |
8488 |
+--- a/sound/soc/codecs/wm_adsp.c |
8489 |
++++ b/sound/soc/codecs/wm_adsp.c |
8490 |
+@@ -1062,6 +1062,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) |
8491 |
+ if (i + 1 < algs) { |
8492 |
+ region->len = be32_to_cpu(adsp1_alg[i + 1].dm); |
8493 |
+ region->len -= be32_to_cpu(adsp1_alg[i].dm); |
8494 |
++ region->len *= 4; |
8495 |
+ wm_adsp_create_control(dsp, region); |
8496 |
+ } else { |
8497 |
+ adsp_warn(dsp, "Missing length info for region DM with ID %x\n", |
8498 |
+@@ -1079,6 +1080,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) |
8499 |
+ if (i + 1 < algs) { |
8500 |
+ region->len = be32_to_cpu(adsp1_alg[i + 1].zm); |
8501 |
+ region->len -= be32_to_cpu(adsp1_alg[i].zm); |
8502 |
++ region->len *= 4; |
8503 |
+ wm_adsp_create_control(dsp, region); |
8504 |
+ } else { |
8505 |
+ adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", |
8506 |
+@@ -1108,6 +1110,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) |
8507 |
+ if (i + 1 < algs) { |
8508 |
+ region->len = be32_to_cpu(adsp2_alg[i + 1].xm); |
8509 |
+ region->len -= be32_to_cpu(adsp2_alg[i].xm); |
8510 |
++ region->len *= 4; |
8511 |
+ wm_adsp_create_control(dsp, region); |
8512 |
+ } else { |
8513 |
+ adsp_warn(dsp, "Missing length info for region XM with ID %x\n", |
8514 |
+@@ -1125,6 +1128,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) |
8515 |
+ if (i + 1 < algs) { |
8516 |
+ region->len = be32_to_cpu(adsp2_alg[i + 1].ym); |
8517 |
+ region->len -= be32_to_cpu(adsp2_alg[i].ym); |
8518 |
++ region->len *= 4; |
8519 |
+ wm_adsp_create_control(dsp, region); |
8520 |
+ } else { |
8521 |
+ adsp_warn(dsp, "Missing length info for region YM with ID %x\n", |
8522 |
+@@ -1142,6 +1146,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) |
8523 |
+ if (i + 1 < algs) { |
8524 |
+ region->len = be32_to_cpu(adsp2_alg[i + 1].zm); |
8525 |
+ region->len -= be32_to_cpu(adsp2_alg[i].zm); |
8526 |
++ region->len *= 4; |
8527 |
+ wm_adsp_create_control(dsp, region); |
8528 |
+ } else { |
8529 |
+ adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", |
8530 |
+diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c |
8531 |
+index 34043c55..2fc872b2 100644 |
8532 |
+--- a/sound/soc/fsl/imx-pcm-fiq.c |
8533 |
++++ b/sound/soc/fsl/imx-pcm-fiq.c |
8534 |
+@@ -44,7 +44,8 @@ struct imx_pcm_runtime_data { |
8535 |
+ struct hrtimer hrt; |
8536 |
+ int poll_time_ns; |
8537 |
+ struct snd_pcm_substream *substream; |
8538 |
+- atomic_t running; |
8539 |
++ atomic_t playing; |
8540 |
++ atomic_t capturing; |
8541 |
+ }; |
8542 |
+ |
8543 |
+ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) |
8544 |
+@@ -56,7 +57,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) |
8545 |
+ struct pt_regs regs; |
8546 |
+ unsigned long delta; |
8547 |
+ |
8548 |
+- if (!atomic_read(&iprtd->running)) |
8549 |
++ if (!atomic_read(&iprtd->playing) && !atomic_read(&iprtd->capturing)) |
8550 |
+ return HRTIMER_NORESTART; |
8551 |
+ |
8552 |
+ get_fiq_regs(®s); |
8553 |
+@@ -124,7 +125,6 @@ static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) |
8554 |
+ return 0; |
8555 |
+ } |
8556 |
+ |
8557 |
+-static int fiq_enable; |
8558 |
+ static int imx_pcm_fiq; |
8559 |
+ |
8560 |
+ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
8561 |
+@@ -136,23 +136,27 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
8562 |
+ case SNDRV_PCM_TRIGGER_START: |
8563 |
+ case SNDRV_PCM_TRIGGER_RESUME: |
8564 |
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
8565 |
+- atomic_set(&iprtd->running, 1); |
8566 |
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
8567 |
++ atomic_set(&iprtd->playing, 1); |
8568 |
++ else |
8569 |
++ atomic_set(&iprtd->capturing, 1); |
8570 |
+ hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns), |
8571 |
+ HRTIMER_MODE_REL); |
8572 |
+- if (++fiq_enable == 1) |
8573 |
+- enable_fiq(imx_pcm_fiq); |
8574 |
+- |
8575 |
++ enable_fiq(imx_pcm_fiq); |
8576 |
+ break; |
8577 |
+ |
8578 |
+ case SNDRV_PCM_TRIGGER_STOP: |
8579 |
+ case SNDRV_PCM_TRIGGER_SUSPEND: |
8580 |
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
8581 |
+- atomic_set(&iprtd->running, 0); |
8582 |
+- |
8583 |
+- if (--fiq_enable == 0) |
8584 |
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
8585 |
++ atomic_set(&iprtd->playing, 0); |
8586 |
++ else |
8587 |
++ atomic_set(&iprtd->capturing, 0); |
8588 |
++ if (!atomic_read(&iprtd->playing) && |
8589 |
++ !atomic_read(&iprtd->capturing)) |
8590 |
+ disable_fiq(imx_pcm_fiq); |
8591 |
+- |
8592 |
+ break; |
8593 |
++ |
8594 |
+ default: |
8595 |
+ return -EINVAL; |
8596 |
+ } |
8597 |
+@@ -200,7 +204,8 @@ static int snd_imx_open(struct snd_pcm_substream *substream) |
8598 |
+ |
8599 |
+ iprtd->substream = substream; |
8600 |
+ |
8601 |
+- atomic_set(&iprtd->running, 0); |
8602 |
++ atomic_set(&iprtd->playing, 0); |
8603 |
++ atomic_set(&iprtd->capturing, 0); |
8604 |
+ hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
8605 |
+ iprtd->hrt.function = snd_hrtimer_callback; |
8606 |
+ |
8607 |
+diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c |
8608 |
+index 0a193281..78f4c92e 100644 |
8609 |
+--- a/tools/perf/ui/hist.c |
8610 |
++++ b/tools/perf/ui/hist.c |
8611 |
+@@ -117,7 +117,7 @@ static int hpp__color_##_type(struct perf_hpp_fmt *fmt __maybe_unused, \ |
8612 |
+ struct perf_hpp *hpp, struct hist_entry *he) \ |
8613 |
+ { \ |
8614 |
+ return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%", \ |
8615 |
+- (hpp_snprint_fn)percent_color_snprintf, true); \ |
8616 |
++ percent_color_snprintf, true); \ |
8617 |
+ } |
8618 |
+ |
8619 |
+ #define __HPP_ENTRY_PERCENT_FN(_type, _field) \ |
8620 |
+diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c |
8621 |
+index 11e46da1..66e44a50 100644 |
8622 |
+--- a/tools/perf/util/color.c |
8623 |
++++ b/tools/perf/util/color.c |
8624 |
+@@ -318,8 +318,15 @@ int percent_color_fprintf(FILE *fp, const char *fmt, double percent) |
8625 |
+ return r; |
8626 |
+ } |
8627 |
+ |
8628 |
+-int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent) |
8629 |
++int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...) |
8630 |
+ { |
8631 |
+- const char *color = get_percent_color(percent); |
8632 |
++ va_list args; |
8633 |
++ double percent; |
8634 |
++ const char *color; |
8635 |
++ |
8636 |
++ va_start(args, fmt); |
8637 |
++ percent = va_arg(args, double); |
8638 |
++ va_end(args); |
8639 |
++ color = get_percent_color(percent); |
8640 |
+ return color_snprintf(bf, size, color, fmt, percent); |
8641 |
+ } |
8642 |
+diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h |
8643 |
+index dea082b7..fced3840 100644 |
8644 |
+--- a/tools/perf/util/color.h |
8645 |
++++ b/tools/perf/util/color.h |
8646 |
+@@ -39,7 +39,7 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...); |
8647 |
+ int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...); |
8648 |
+ int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...); |
8649 |
+ int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf); |
8650 |
+-int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent); |
8651 |
++int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...); |
8652 |
+ int percent_color_fprintf(FILE *fp, const char *fmt, double percent); |
8653 |
+ const char *get_percent_color(double percent); |
8654 |
+ |
8655 |
+diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c |
8656 |
+index 49096ea5..1ae1b082 100644 |
8657 |
+--- a/tools/perf/util/event.c |
8658 |
++++ b/tools/perf/util/event.c |
8659 |
+@@ -212,8 +212,10 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, |
8660 |
+ &event->mmap.start, &event->mmap.len, prot, |
8661 |
+ &event->mmap.pgoff, |
8662 |
+ execname); |
8663 |
+- |
8664 |
+- if (n != 5) |
8665 |
++ /* |
8666 |
++ * Anon maps don't have the execname. |
8667 |
++ */ |
8668 |
++ if (n < 4) |
8669 |
+ continue; |
8670 |
+ |
8671 |
+ if (prot[2] != 'x') |