Annotation of /trunk/kernel-alx/patches-4.4/0141-4.4.42-all-fixes.patch
Parent Directory | Revision Log
Revision 2877 -
(hide annotations)
(download)
Mon Mar 27 13:49:18 2017 UTC (7 years, 6 months ago) by niro
File size: 116129 byte(s)
Mon Mar 27 13:49:18 2017 UTC (7 years, 6 months ago) by niro
File size: 116129 byte(s)
linux-4.4.42
1 | niro | 2877 | diff --git a/Makefile b/Makefile |
2 | index 855e71066174..b8a90f9a463d 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 4 | ||
7 | PATCHLEVEL = 4 | ||
8 | -SUBLEVEL = 41 | ||
9 | +SUBLEVEL = 42 | ||
10 | EXTRAVERSION = | ||
11 | NAME = Blurry Fish Butt | ||
12 | |||
13 | diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi | ||
14 | index a9977d6ee81a..169653586a9f 100644 | ||
15 | --- a/arch/arm/boot/dts/r8a7794.dtsi | ||
16 | +++ b/arch/arm/boot/dts/r8a7794.dtsi | ||
17 | @@ -1023,7 +1023,7 @@ | ||
18 | mstp7_clks: mstp7_clks@e615014c { | ||
19 | compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
20 | reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>; | ||
21 | - clocks = <&mp_clk>, <&mp_clk>, | ||
22 | + clocks = <&mp_clk>, <&hp_clk>, | ||
23 | <&zs_clk>, <&p_clk>, <&p_clk>, <&zs_clk>, | ||
24 | <&zs_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>; | ||
25 | #clock-cells = <1>; | ||
26 | diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c | ||
27 | index 593da7ffb449..679c589c4828 100644 | ||
28 | --- a/arch/arm/crypto/aes-ce-glue.c | ||
29 | +++ b/arch/arm/crypto/aes-ce-glue.c | ||
30 | @@ -87,8 +87,13 @@ static int ce_aes_expandkey(struct crypto_aes_ctx *ctx, const u8 *in_key, | ||
31 | u32 *rki = ctx->key_enc + (i * kwords); | ||
32 | u32 *rko = rki + kwords; | ||
33 | |||
34 | +#ifndef CONFIG_CPU_BIG_ENDIAN | ||
35 | rko[0] = ror32(ce_aes_sub(rki[kwords - 1]), 8); | ||
36 | rko[0] = rko[0] ^ rki[0] ^ rcon[i]; | ||
37 | +#else | ||
38 | + rko[0] = rol32(ce_aes_sub(rki[kwords - 1]), 8); | ||
39 | + rko[0] = rko[0] ^ rki[0] ^ (rcon[i] << 24); | ||
40 | +#endif | ||
41 | rko[1] = rko[0] ^ rki[1]; | ||
42 | rko[2] = rko[1] ^ rki[2]; | ||
43 | rko[3] = rko[2] ^ rki[3]; | ||
44 | diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c | ||
45 | index 676997895e13..f5f81a107309 100644 | ||
46 | --- a/arch/arm/mach-davinci/da850.c | ||
47 | +++ b/arch/arm/mach-davinci/da850.c | ||
48 | @@ -298,6 +298,16 @@ static struct clk emac_clk = { | ||
49 | .gpsc = 1, | ||
50 | }; | ||
51 | |||
52 | +/* | ||
53 | + * In order to avoid adding the emac_clk to the clock lookup table twice (and | ||
54 | + * screwing up the linked list in the process) create a separate clock for | ||
55 | + * mdio inheriting the rate from emac_clk. | ||
56 | + */ | ||
57 | +static struct clk mdio_clk = { | ||
58 | + .name = "mdio", | ||
59 | + .parent = &emac_clk, | ||
60 | +}; | ||
61 | + | ||
62 | static struct clk mcasp_clk = { | ||
63 | .name = "mcasp", | ||
64 | .parent = &pll0_sysclk2, | ||
65 | @@ -462,7 +472,7 @@ static struct clk_lookup da850_clks[] = { | ||
66 | CLK(NULL, "arm", &arm_clk), | ||
67 | CLK(NULL, "rmii", &rmii_clk), | ||
68 | CLK("davinci_emac.1", NULL, &emac_clk), | ||
69 | - CLK("davinci_mdio.0", "fck", &emac_clk), | ||
70 | + CLK("davinci_mdio.0", "fck", &mdio_clk), | ||
71 | CLK("davinci-mcasp.0", NULL, &mcasp_clk), | ||
72 | CLK("da8xx_lcdc.0", "fck", &lcdc_clk), | ||
73 | CLK("da830-mmc.0", NULL, &mmcsd0_clk), | ||
74 | diff --git a/arch/arm64/crypto/aes-ce-ccm-core.S b/arch/arm64/crypto/aes-ce-ccm-core.S | ||
75 | index a2a7fbcacc14..3363560c79b7 100644 | ||
76 | --- a/arch/arm64/crypto/aes-ce-ccm-core.S | ||
77 | +++ b/arch/arm64/crypto/aes-ce-ccm-core.S | ||
78 | @@ -9,6 +9,7 @@ | ||
79 | */ | ||
80 | |||
81 | #include <linux/linkage.h> | ||
82 | +#include <asm/assembler.h> | ||
83 | |||
84 | .text | ||
85 | .arch armv8-a+crypto | ||
86 | @@ -19,7 +20,7 @@ | ||
87 | */ | ||
88 | ENTRY(ce_aes_ccm_auth_data) | ||
89 | ldr w8, [x3] /* leftover from prev round? */ | ||
90 | - ld1 {v0.2d}, [x0] /* load mac */ | ||
91 | + ld1 {v0.16b}, [x0] /* load mac */ | ||
92 | cbz w8, 1f | ||
93 | sub w8, w8, #16 | ||
94 | eor v1.16b, v1.16b, v1.16b | ||
95 | @@ -31,7 +32,7 @@ ENTRY(ce_aes_ccm_auth_data) | ||
96 | beq 8f /* out of input? */ | ||
97 | cbnz w8, 0b | ||
98 | eor v0.16b, v0.16b, v1.16b | ||
99 | -1: ld1 {v3.2d}, [x4] /* load first round key */ | ||
100 | +1: ld1 {v3.16b}, [x4] /* load first round key */ | ||
101 | prfm pldl1strm, [x1] | ||
102 | cmp w5, #12 /* which key size? */ | ||
103 | add x6, x4, #16 | ||
104 | @@ -41,17 +42,17 @@ ENTRY(ce_aes_ccm_auth_data) | ||
105 | mov v5.16b, v3.16b | ||
106 | b 4f | ||
107 | 2: mov v4.16b, v3.16b | ||
108 | - ld1 {v5.2d}, [x6], #16 /* load 2nd round key */ | ||
109 | + ld1 {v5.16b}, [x6], #16 /* load 2nd round key */ | ||
110 | 3: aese v0.16b, v4.16b | ||
111 | aesmc v0.16b, v0.16b | ||
112 | -4: ld1 {v3.2d}, [x6], #16 /* load next round key */ | ||
113 | +4: ld1 {v3.16b}, [x6], #16 /* load next round key */ | ||
114 | aese v0.16b, v5.16b | ||
115 | aesmc v0.16b, v0.16b | ||
116 | -5: ld1 {v4.2d}, [x6], #16 /* load next round key */ | ||
117 | +5: ld1 {v4.16b}, [x6], #16 /* load next round key */ | ||
118 | subs w7, w7, #3 | ||
119 | aese v0.16b, v3.16b | ||
120 | aesmc v0.16b, v0.16b | ||
121 | - ld1 {v5.2d}, [x6], #16 /* load next round key */ | ||
122 | + ld1 {v5.16b}, [x6], #16 /* load next round key */ | ||
123 | bpl 3b | ||
124 | aese v0.16b, v4.16b | ||
125 | subs w2, w2, #16 /* last data? */ | ||
126 | @@ -60,7 +61,7 @@ ENTRY(ce_aes_ccm_auth_data) | ||
127 | ld1 {v1.16b}, [x1], #16 /* load next input block */ | ||
128 | eor v0.16b, v0.16b, v1.16b /* xor with mac */ | ||
129 | bne 1b | ||
130 | -6: st1 {v0.2d}, [x0] /* store mac */ | ||
131 | +6: st1 {v0.16b}, [x0] /* store mac */ | ||
132 | beq 10f | ||
133 | adds w2, w2, #16 | ||
134 | beq 10f | ||
135 | @@ -79,7 +80,7 @@ ENTRY(ce_aes_ccm_auth_data) | ||
136 | adds w7, w7, #1 | ||
137 | bne 9b | ||
138 | eor v0.16b, v0.16b, v1.16b | ||
139 | - st1 {v0.2d}, [x0] | ||
140 | + st1 {v0.16b}, [x0] | ||
141 | 10: str w8, [x3] | ||
142 | ret | ||
143 | ENDPROC(ce_aes_ccm_auth_data) | ||
144 | @@ -89,27 +90,27 @@ ENDPROC(ce_aes_ccm_auth_data) | ||
145 | * u32 rounds); | ||
146 | */ | ||
147 | ENTRY(ce_aes_ccm_final) | ||
148 | - ld1 {v3.2d}, [x2], #16 /* load first round key */ | ||
149 | - ld1 {v0.2d}, [x0] /* load mac */ | ||
150 | + ld1 {v3.16b}, [x2], #16 /* load first round key */ | ||
151 | + ld1 {v0.16b}, [x0] /* load mac */ | ||
152 | cmp w3, #12 /* which key size? */ | ||
153 | sub w3, w3, #2 /* modified # of rounds */ | ||
154 | - ld1 {v1.2d}, [x1] /* load 1st ctriv */ | ||
155 | + ld1 {v1.16b}, [x1] /* load 1st ctriv */ | ||
156 | bmi 0f | ||
157 | bne 3f | ||
158 | mov v5.16b, v3.16b | ||
159 | b 2f | ||
160 | 0: mov v4.16b, v3.16b | ||
161 | -1: ld1 {v5.2d}, [x2], #16 /* load next round key */ | ||
162 | +1: ld1 {v5.16b}, [x2], #16 /* load next round key */ | ||
163 | aese v0.16b, v4.16b | ||
164 | aesmc v0.16b, v0.16b | ||
165 | aese v1.16b, v4.16b | ||
166 | aesmc v1.16b, v1.16b | ||
167 | -2: ld1 {v3.2d}, [x2], #16 /* load next round key */ | ||
168 | +2: ld1 {v3.16b}, [x2], #16 /* load next round key */ | ||
169 | aese v0.16b, v5.16b | ||
170 | aesmc v0.16b, v0.16b | ||
171 | aese v1.16b, v5.16b | ||
172 | aesmc v1.16b, v1.16b | ||
173 | -3: ld1 {v4.2d}, [x2], #16 /* load next round key */ | ||
174 | +3: ld1 {v4.16b}, [x2], #16 /* load next round key */ | ||
175 | subs w3, w3, #3 | ||
176 | aese v0.16b, v3.16b | ||
177 | aesmc v0.16b, v0.16b | ||
178 | @@ -120,47 +121,47 @@ ENTRY(ce_aes_ccm_final) | ||
179 | aese v1.16b, v4.16b | ||
180 | /* final round key cancels out */ | ||
181 | eor v0.16b, v0.16b, v1.16b /* en-/decrypt the mac */ | ||
182 | - st1 {v0.2d}, [x0] /* store result */ | ||
183 | + st1 {v0.16b}, [x0] /* store result */ | ||
184 | ret | ||
185 | ENDPROC(ce_aes_ccm_final) | ||
186 | |||
187 | .macro aes_ccm_do_crypt,enc | ||
188 | ldr x8, [x6, #8] /* load lower ctr */ | ||
189 | - ld1 {v0.2d}, [x5] /* load mac */ | ||
190 | - rev x8, x8 /* keep swabbed ctr in reg */ | ||
191 | + ld1 {v0.16b}, [x5] /* load mac */ | ||
192 | +CPU_LE( rev x8, x8 ) /* keep swabbed ctr in reg */ | ||
193 | 0: /* outer loop */ | ||
194 | - ld1 {v1.1d}, [x6] /* load upper ctr */ | ||
195 | + ld1 {v1.8b}, [x6] /* load upper ctr */ | ||
196 | prfm pldl1strm, [x1] | ||
197 | add x8, x8, #1 | ||
198 | rev x9, x8 | ||
199 | cmp w4, #12 /* which key size? */ | ||
200 | sub w7, w4, #2 /* get modified # of rounds */ | ||
201 | ins v1.d[1], x9 /* no carry in lower ctr */ | ||
202 | - ld1 {v3.2d}, [x3] /* load first round key */ | ||
203 | + ld1 {v3.16b}, [x3] /* load first round key */ | ||
204 | add x10, x3, #16 | ||
205 | bmi 1f | ||
206 | bne 4f | ||
207 | mov v5.16b, v3.16b | ||
208 | b 3f | ||
209 | 1: mov v4.16b, v3.16b | ||
210 | - ld1 {v5.2d}, [x10], #16 /* load 2nd round key */ | ||
211 | + ld1 {v5.16b}, [x10], #16 /* load 2nd round key */ | ||
212 | 2: /* inner loop: 3 rounds, 2x interleaved */ | ||
213 | aese v0.16b, v4.16b | ||
214 | aesmc v0.16b, v0.16b | ||
215 | aese v1.16b, v4.16b | ||
216 | aesmc v1.16b, v1.16b | ||
217 | -3: ld1 {v3.2d}, [x10], #16 /* load next round key */ | ||
218 | +3: ld1 {v3.16b}, [x10], #16 /* load next round key */ | ||
219 | aese v0.16b, v5.16b | ||
220 | aesmc v0.16b, v0.16b | ||
221 | aese v1.16b, v5.16b | ||
222 | aesmc v1.16b, v1.16b | ||
223 | -4: ld1 {v4.2d}, [x10], #16 /* load next round key */ | ||
224 | +4: ld1 {v4.16b}, [x10], #16 /* load next round key */ | ||
225 | subs w7, w7, #3 | ||
226 | aese v0.16b, v3.16b | ||
227 | aesmc v0.16b, v0.16b | ||
228 | aese v1.16b, v3.16b | ||
229 | aesmc v1.16b, v1.16b | ||
230 | - ld1 {v5.2d}, [x10], #16 /* load next round key */ | ||
231 | + ld1 {v5.16b}, [x10], #16 /* load next round key */ | ||
232 | bpl 2b | ||
233 | aese v0.16b, v4.16b | ||
234 | aese v1.16b, v4.16b | ||
235 | @@ -177,14 +178,14 @@ ENDPROC(ce_aes_ccm_final) | ||
236 | eor v0.16b, v0.16b, v2.16b /* xor mac with pt ^ rk[last] */ | ||
237 | st1 {v1.16b}, [x0], #16 /* write output block */ | ||
238 | bne 0b | ||
239 | - rev x8, x8 | ||
240 | - st1 {v0.2d}, [x5] /* store mac */ | ||
241 | +CPU_LE( rev x8, x8 ) | ||
242 | + st1 {v0.16b}, [x5] /* store mac */ | ||
243 | str x8, [x6, #8] /* store lsb end of ctr (BE) */ | ||
244 | 5: ret | ||
245 | |||
246 | 6: eor v0.16b, v0.16b, v5.16b /* final round mac */ | ||
247 | eor v1.16b, v1.16b, v5.16b /* final round enc */ | ||
248 | - st1 {v0.2d}, [x5] /* store mac */ | ||
249 | + st1 {v0.16b}, [x5] /* store mac */ | ||
250 | add w2, w2, #16 /* process partial tail block */ | ||
251 | 7: ldrb w9, [x1], #1 /* get 1 byte of input */ | ||
252 | umov w6, v1.b[0] /* get top crypted ctr byte */ | ||
253 | diff --git a/arch/arm64/crypto/aes-ce-cipher.c b/arch/arm64/crypto/aes-ce-cipher.c | ||
254 | index f7bd9bf0bbb3..50d9fe11d0c8 100644 | ||
255 | --- a/arch/arm64/crypto/aes-ce-cipher.c | ||
256 | +++ b/arch/arm64/crypto/aes-ce-cipher.c | ||
257 | @@ -47,24 +47,24 @@ static void aes_cipher_encrypt(struct crypto_tfm *tfm, u8 dst[], u8 const src[]) | ||
258 | kernel_neon_begin_partial(4); | ||
259 | |||
260 | __asm__(" ld1 {v0.16b}, %[in] ;" | ||
261 | - " ld1 {v1.2d}, [%[key]], #16 ;" | ||
262 | + " ld1 {v1.16b}, [%[key]], #16 ;" | ||
263 | " cmp %w[rounds], #10 ;" | ||
264 | " bmi 0f ;" | ||
265 | " bne 3f ;" | ||
266 | " mov v3.16b, v1.16b ;" | ||
267 | " b 2f ;" | ||
268 | "0: mov v2.16b, v1.16b ;" | ||
269 | - " ld1 {v3.2d}, [%[key]], #16 ;" | ||
270 | + " ld1 {v3.16b}, [%[key]], #16 ;" | ||
271 | "1: aese v0.16b, v2.16b ;" | ||
272 | " aesmc v0.16b, v0.16b ;" | ||
273 | - "2: ld1 {v1.2d}, [%[key]], #16 ;" | ||
274 | + "2: ld1 {v1.16b}, [%[key]], #16 ;" | ||
275 | " aese v0.16b, v3.16b ;" | ||
276 | " aesmc v0.16b, v0.16b ;" | ||
277 | - "3: ld1 {v2.2d}, [%[key]], #16 ;" | ||
278 | + "3: ld1 {v2.16b}, [%[key]], #16 ;" | ||
279 | " subs %w[rounds], %w[rounds], #3 ;" | ||
280 | " aese v0.16b, v1.16b ;" | ||
281 | " aesmc v0.16b, v0.16b ;" | ||
282 | - " ld1 {v3.2d}, [%[key]], #16 ;" | ||
283 | + " ld1 {v3.16b}, [%[key]], #16 ;" | ||
284 | " bpl 1b ;" | ||
285 | " aese v0.16b, v2.16b ;" | ||
286 | " eor v0.16b, v0.16b, v3.16b ;" | ||
287 | @@ -92,24 +92,24 @@ static void aes_cipher_decrypt(struct crypto_tfm *tfm, u8 dst[], u8 const src[]) | ||
288 | kernel_neon_begin_partial(4); | ||
289 | |||
290 | __asm__(" ld1 {v0.16b}, %[in] ;" | ||
291 | - " ld1 {v1.2d}, [%[key]], #16 ;" | ||
292 | + " ld1 {v1.16b}, [%[key]], #16 ;" | ||
293 | " cmp %w[rounds], #10 ;" | ||
294 | " bmi 0f ;" | ||
295 | " bne 3f ;" | ||
296 | " mov v3.16b, v1.16b ;" | ||
297 | " b 2f ;" | ||
298 | "0: mov v2.16b, v1.16b ;" | ||
299 | - " ld1 {v3.2d}, [%[key]], #16 ;" | ||
300 | + " ld1 {v3.16b}, [%[key]], #16 ;" | ||
301 | "1: aesd v0.16b, v2.16b ;" | ||
302 | " aesimc v0.16b, v0.16b ;" | ||
303 | - "2: ld1 {v1.2d}, [%[key]], #16 ;" | ||
304 | + "2: ld1 {v1.16b}, [%[key]], #16 ;" | ||
305 | " aesd v0.16b, v3.16b ;" | ||
306 | " aesimc v0.16b, v0.16b ;" | ||
307 | - "3: ld1 {v2.2d}, [%[key]], #16 ;" | ||
308 | + "3: ld1 {v2.16b}, [%[key]], #16 ;" | ||
309 | " subs %w[rounds], %w[rounds], #3 ;" | ||
310 | " aesd v0.16b, v1.16b ;" | ||
311 | " aesimc v0.16b, v0.16b ;" | ||
312 | - " ld1 {v3.2d}, [%[key]], #16 ;" | ||
313 | + " ld1 {v3.16b}, [%[key]], #16 ;" | ||
314 | " bpl 1b ;" | ||
315 | " aesd v0.16b, v2.16b ;" | ||
316 | " eor v0.16b, v0.16b, v3.16b ;" | ||
317 | @@ -173,7 +173,12 @@ int ce_aes_expandkey(struct crypto_aes_ctx *ctx, const u8 *in_key, | ||
318 | u32 *rki = ctx->key_enc + (i * kwords); | ||
319 | u32 *rko = rki + kwords; | ||
320 | |||
321 | +#ifndef CONFIG_CPU_BIG_ENDIAN | ||
322 | rko[0] = ror32(aes_sub(rki[kwords - 1]), 8) ^ rcon[i] ^ rki[0]; | ||
323 | +#else | ||
324 | + rko[0] = rol32(aes_sub(rki[kwords - 1]), 8) ^ (rcon[i] << 24) ^ | ||
325 | + rki[0]; | ||
326 | +#endif | ||
327 | rko[1] = rko[0] ^ rki[1]; | ||
328 | rko[2] = rko[1] ^ rki[2]; | ||
329 | rko[3] = rko[2] ^ rki[3]; | ||
330 | diff --git a/arch/arm64/crypto/aes-ce.S b/arch/arm64/crypto/aes-ce.S | ||
331 | index 78f3cfe92c08..b46093d567e5 100644 | ||
332 | --- a/arch/arm64/crypto/aes-ce.S | ||
333 | +++ b/arch/arm64/crypto/aes-ce.S | ||
334 | @@ -10,6 +10,7 @@ | ||
335 | */ | ||
336 | |||
337 | #include <linux/linkage.h> | ||
338 | +#include <asm/assembler.h> | ||
339 | |||
340 | #define AES_ENTRY(func) ENTRY(ce_ ## func) | ||
341 | #define AES_ENDPROC(func) ENDPROC(ce_ ## func) | ||
342 | diff --git a/arch/arm64/crypto/aes-modes.S b/arch/arm64/crypto/aes-modes.S | ||
343 | index f6e372c528eb..c53dbeae79f2 100644 | ||
344 | --- a/arch/arm64/crypto/aes-modes.S | ||
345 | +++ b/arch/arm64/crypto/aes-modes.S | ||
346 | @@ -386,7 +386,8 @@ AES_ENDPROC(aes_ctr_encrypt) | ||
347 | .endm | ||
348 | |||
349 | .Lxts_mul_x: | ||
350 | - .word 1, 0, 0x87, 0 | ||
351 | +CPU_LE( .quad 1, 0x87 ) | ||
352 | +CPU_BE( .quad 0x87, 1 ) | ||
353 | |||
354 | AES_ENTRY(aes_xts_encrypt) | ||
355 | FRAME_PUSH | ||
356 | diff --git a/arch/arm64/crypto/aes-neon.S b/arch/arm64/crypto/aes-neon.S | ||
357 | index b93170e1cc93..85f07ead7c5c 100644 | ||
358 | --- a/arch/arm64/crypto/aes-neon.S | ||
359 | +++ b/arch/arm64/crypto/aes-neon.S | ||
360 | @@ -9,6 +9,7 @@ | ||
361 | */ | ||
362 | |||
363 | #include <linux/linkage.h> | ||
364 | +#include <asm/assembler.h> | ||
365 | |||
366 | #define AES_ENTRY(func) ENTRY(neon_ ## func) | ||
367 | #define AES_ENDPROC(func) ENDPROC(neon_ ## func) | ||
368 | @@ -83,13 +84,13 @@ | ||
369 | .endm | ||
370 | |||
371 | .macro do_block, enc, in, rounds, rk, rkp, i | ||
372 | - ld1 {v15.16b}, [\rk] | ||
373 | + ld1 {v15.4s}, [\rk] | ||
374 | add \rkp, \rk, #16 | ||
375 | mov \i, \rounds | ||
376 | 1111: eor \in\().16b, \in\().16b, v15.16b /* ^round key */ | ||
377 | tbl \in\().16b, {\in\().16b}, v13.16b /* ShiftRows */ | ||
378 | sub_bytes \in | ||
379 | - ld1 {v15.16b}, [\rkp], #16 | ||
380 | + ld1 {v15.4s}, [\rkp], #16 | ||
381 | subs \i, \i, #1 | ||
382 | beq 2222f | ||
383 | .if \enc == 1 | ||
384 | @@ -229,7 +230,7 @@ | ||
385 | .endm | ||
386 | |||
387 | .macro do_block_2x, enc, in0, in1 rounds, rk, rkp, i | ||
388 | - ld1 {v15.16b}, [\rk] | ||
389 | + ld1 {v15.4s}, [\rk] | ||
390 | add \rkp, \rk, #16 | ||
391 | mov \i, \rounds | ||
392 | 1111: eor \in0\().16b, \in0\().16b, v15.16b /* ^round key */ | ||
393 | @@ -237,7 +238,7 @@ | ||
394 | sub_bytes_2x \in0, \in1 | ||
395 | tbl \in0\().16b, {\in0\().16b}, v13.16b /* ShiftRows */ | ||
396 | tbl \in1\().16b, {\in1\().16b}, v13.16b /* ShiftRows */ | ||
397 | - ld1 {v15.16b}, [\rkp], #16 | ||
398 | + ld1 {v15.4s}, [\rkp], #16 | ||
399 | subs \i, \i, #1 | ||
400 | beq 2222f | ||
401 | .if \enc == 1 | ||
402 | @@ -254,7 +255,7 @@ | ||
403 | .endm | ||
404 | |||
405 | .macro do_block_4x, enc, in0, in1, in2, in3, rounds, rk, rkp, i | ||
406 | - ld1 {v15.16b}, [\rk] | ||
407 | + ld1 {v15.4s}, [\rk] | ||
408 | add \rkp, \rk, #16 | ||
409 | mov \i, \rounds | ||
410 | 1111: eor \in0\().16b, \in0\().16b, v15.16b /* ^round key */ | ||
411 | @@ -266,7 +267,7 @@ | ||
412 | tbl \in1\().16b, {\in1\().16b}, v13.16b /* ShiftRows */ | ||
413 | tbl \in2\().16b, {\in2\().16b}, v13.16b /* ShiftRows */ | ||
414 | tbl \in3\().16b, {\in3\().16b}, v13.16b /* ShiftRows */ | ||
415 | - ld1 {v15.16b}, [\rkp], #16 | ||
416 | + ld1 {v15.4s}, [\rkp], #16 | ||
417 | subs \i, \i, #1 | ||
418 | beq 2222f | ||
419 | .if \enc == 1 | ||
420 | @@ -306,12 +307,16 @@ | ||
421 | .text | ||
422 | .align 4 | ||
423 | .LForward_ShiftRows: | ||
424 | - .byte 0x0, 0x5, 0xa, 0xf, 0x4, 0x9, 0xe, 0x3 | ||
425 | - .byte 0x8, 0xd, 0x2, 0x7, 0xc, 0x1, 0x6, 0xb | ||
426 | +CPU_LE( .byte 0x0, 0x5, 0xa, 0xf, 0x4, 0x9, 0xe, 0x3 ) | ||
427 | +CPU_LE( .byte 0x8, 0xd, 0x2, 0x7, 0xc, 0x1, 0x6, 0xb ) | ||
428 | +CPU_BE( .byte 0xb, 0x6, 0x1, 0xc, 0x7, 0x2, 0xd, 0x8 ) | ||
429 | +CPU_BE( .byte 0x3, 0xe, 0x9, 0x4, 0xf, 0xa, 0x5, 0x0 ) | ||
430 | |||
431 | .LReverse_ShiftRows: | ||
432 | - .byte 0x0, 0xd, 0xa, 0x7, 0x4, 0x1, 0xe, 0xb | ||
433 | - .byte 0x8, 0x5, 0x2, 0xf, 0xc, 0x9, 0x6, 0x3 | ||
434 | +CPU_LE( .byte 0x0, 0xd, 0xa, 0x7, 0x4, 0x1, 0xe, 0xb ) | ||
435 | +CPU_LE( .byte 0x8, 0x5, 0x2, 0xf, 0xc, 0x9, 0x6, 0x3 ) | ||
436 | +CPU_BE( .byte 0x3, 0x6, 0x9, 0xc, 0xf, 0x2, 0x5, 0x8 ) | ||
437 | +CPU_BE( .byte 0xb, 0xe, 0x1, 0x4, 0x7, 0xa, 0xd, 0x0 ) | ||
438 | |||
439 | .LForward_Sbox: | ||
440 | .byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5 | ||
441 | diff --git a/arch/arm64/crypto/ghash-ce-core.S b/arch/arm64/crypto/ghash-ce-core.S | ||
442 | index dc457015884e..f0bb9f0b524f 100644 | ||
443 | --- a/arch/arm64/crypto/ghash-ce-core.S | ||
444 | +++ b/arch/arm64/crypto/ghash-ce-core.S | ||
445 | @@ -29,8 +29,8 @@ | ||
446 | * struct ghash_key const *k, const char *head) | ||
447 | */ | ||
448 | ENTRY(pmull_ghash_update) | ||
449 | - ld1 {SHASH.16b}, [x3] | ||
450 | - ld1 {XL.16b}, [x1] | ||
451 | + ld1 {SHASH.2d}, [x3] | ||
452 | + ld1 {XL.2d}, [x1] | ||
453 | movi MASK.16b, #0xe1 | ||
454 | ext SHASH2.16b, SHASH.16b, SHASH.16b, #8 | ||
455 | shl MASK.2d, MASK.2d, #57 | ||
456 | @@ -74,6 +74,6 @@ CPU_LE( rev64 T1.16b, T1.16b ) | ||
457 | |||
458 | cbnz w0, 0b | ||
459 | |||
460 | - st1 {XL.16b}, [x1] | ||
461 | + st1 {XL.2d}, [x1] | ||
462 | ret | ||
463 | ENDPROC(pmull_ghash_update) | ||
464 | diff --git a/arch/arm64/crypto/sha1-ce-core.S b/arch/arm64/crypto/sha1-ce-core.S | ||
465 | index 033aae6d732a..c98e7e849f06 100644 | ||
466 | --- a/arch/arm64/crypto/sha1-ce-core.S | ||
467 | +++ b/arch/arm64/crypto/sha1-ce-core.S | ||
468 | @@ -78,7 +78,7 @@ ENTRY(sha1_ce_transform) | ||
469 | ld1r {k3.4s}, [x6] | ||
470 | |||
471 | /* load state */ | ||
472 | - ldr dga, [x0] | ||
473 | + ld1 {dgav.4s}, [x0] | ||
474 | ldr dgb, [x0, #16] | ||
475 | |||
476 | /* load sha1_ce_state::finalize */ | ||
477 | @@ -144,7 +144,7 @@ CPU_LE( rev32 v11.16b, v11.16b ) | ||
478 | b 1b | ||
479 | |||
480 | /* store new state */ | ||
481 | -3: str dga, [x0] | ||
482 | +3: st1 {dgav.4s}, [x0] | ||
483 | str dgb, [x0, #16] | ||
484 | ret | ||
485 | ENDPROC(sha1_ce_transform) | ||
486 | diff --git a/arch/arm64/crypto/sha2-ce-core.S b/arch/arm64/crypto/sha2-ce-core.S | ||
487 | index 5df9d9d470ad..01cfee066837 100644 | ||
488 | --- a/arch/arm64/crypto/sha2-ce-core.S | ||
489 | +++ b/arch/arm64/crypto/sha2-ce-core.S | ||
490 | @@ -85,7 +85,7 @@ ENTRY(sha2_ce_transform) | ||
491 | ld1 {v12.4s-v15.4s}, [x8] | ||
492 | |||
493 | /* load state */ | ||
494 | - ldp dga, dgb, [x0] | ||
495 | + ld1 {dgav.4s, dgbv.4s}, [x0] | ||
496 | |||
497 | /* load sha256_ce_state::finalize */ | ||
498 | ldr w4, [x0, #:lo12:sha256_ce_offsetof_finalize] | ||
499 | @@ -148,6 +148,6 @@ CPU_LE( rev32 v19.16b, v19.16b ) | ||
500 | b 1b | ||
501 | |||
502 | /* store new state */ | ||
503 | -3: stp dga, dgb, [x0] | ||
504 | +3: st1 {dgav.4s, dgbv.4s}, [x0] | ||
505 | ret | ||
506 | ENDPROC(sha2_ce_transform) | ||
507 | diff --git a/arch/cris/boot/rescue/Makefile b/arch/cris/boot/rescue/Makefile | ||
508 | index 52bd0bd1dd22..d98edbb30a18 100644 | ||
509 | --- a/arch/cris/boot/rescue/Makefile | ||
510 | +++ b/arch/cris/boot/rescue/Makefile | ||
511 | @@ -10,6 +10,9 @@ | ||
512 | |||
513 | asflags-y += $(LINUXINCLUDE) | ||
514 | ccflags-y += -O2 $(LINUXINCLUDE) | ||
515 | + | ||
516 | +ifdef CONFIG_ETRAX_AXISFLASHMAP | ||
517 | + | ||
518 | arch-$(CONFIG_ETRAX_ARCH_V10) = v10 | ||
519 | arch-$(CONFIG_ETRAX_ARCH_V32) = v32 | ||
520 | |||
521 | @@ -28,6 +31,11 @@ $(obj)/rescue.bin: $(obj)/rescue.o FORCE | ||
522 | $(call if_changed,objcopy) | ||
523 | cp -p $(obj)/rescue.bin $(objtree) | ||
524 | |||
525 | +else | ||
526 | +$(obj)/rescue.bin: | ||
527 | + | ||
528 | +endif | ||
529 | + | ||
530 | $(obj)/testrescue.bin: $(obj)/testrescue.o | ||
531 | $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin | ||
532 | # Pad it to 784 bytes | ||
533 | diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c | ||
534 | index e86b7499921a..a017b23ee4aa 100644 | ||
535 | --- a/arch/mips/kvm/mips.c | ||
536 | +++ b/arch/mips/kvm/mips.c | ||
537 | @@ -324,8 +324,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) | ||
538 | #endif | ||
539 | |||
540 | /* Invalidate the icache for these ranges */ | ||
541 | - local_flush_icache_range((unsigned long)gebase, | ||
542 | - (unsigned long)gebase + ALIGN(size, PAGE_SIZE)); | ||
543 | + flush_icache_range((unsigned long)gebase, | ||
544 | + (unsigned long)gebase + ALIGN(size, PAGE_SIZE)); | ||
545 | |||
546 | /* | ||
547 | * Allocate comm page for guest kernel, a TLB will be reserved for | ||
548 | diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c | ||
549 | index d750cc0dfe30..683a966b5b16 100644 | ||
550 | --- a/arch/s390/crypto/prng.c | ||
551 | +++ b/arch/s390/crypto/prng.c | ||
552 | @@ -565,8 +565,10 @@ static ssize_t prng_tdes_read(struct file *file, char __user *ubuf, | ||
553 | prng_data->prngws.byte_counter += n; | ||
554 | prng_data->prngws.reseed_counter += n; | ||
555 | |||
556 | - if (copy_to_user(ubuf, prng_data->buf, chunk)) | ||
557 | - return -EFAULT; | ||
558 | + if (copy_to_user(ubuf, prng_data->buf, chunk)) { | ||
559 | + ret = -EFAULT; | ||
560 | + break; | ||
561 | + } | ||
562 | |||
563 | nbytes -= chunk; | ||
564 | ret += chunk; | ||
565 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c | ||
566 | index 7429d481a311..b3c2ae7aa213 100644 | ||
567 | --- a/arch/x86/kvm/x86.c | ||
568 | +++ b/arch/x86/kvm/x86.c | ||
569 | @@ -2949,6 +2949,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, | ||
570 | memset(&events->reserved, 0, sizeof(events->reserved)); | ||
571 | } | ||
572 | |||
573 | +static void kvm_set_hflags(struct kvm_vcpu *vcpu, unsigned emul_flags); | ||
574 | + | ||
575 | static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, | ||
576 | struct kvm_vcpu_events *events) | ||
577 | { | ||
578 | @@ -2981,10 +2983,13 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, | ||
579 | vcpu->arch.apic->sipi_vector = events->sipi_vector; | ||
580 | |||
581 | if (events->flags & KVM_VCPUEVENT_VALID_SMM) { | ||
582 | + u32 hflags = vcpu->arch.hflags; | ||
583 | if (events->smi.smm) | ||
584 | - vcpu->arch.hflags |= HF_SMM_MASK; | ||
585 | + hflags |= HF_SMM_MASK; | ||
586 | else | ||
587 | - vcpu->arch.hflags &= ~HF_SMM_MASK; | ||
588 | + hflags &= ~HF_SMM_MASK; | ||
589 | + kvm_set_hflags(vcpu, hflags); | ||
590 | + | ||
591 | vcpu->arch.smi_pending = events->smi.pending; | ||
592 | if (events->smi.smm_inside_nmi) | ||
593 | vcpu->arch.hflags |= HF_SMM_INSIDE_NMI_MASK; | ||
594 | diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h | ||
595 | index 998fa6b23084..01ac5b1aeaeb 100644 | ||
596 | --- a/drivers/base/power/power.h | ||
597 | +++ b/drivers/base/power/power.h | ||
598 | @@ -20,14 +20,22 @@ static inline void pm_runtime_early_init(struct device *dev) | ||
599 | extern void pm_runtime_init(struct device *dev); | ||
600 | extern void pm_runtime_remove(struct device *dev); | ||
601 | |||
602 | +#define WAKE_IRQ_DEDICATED_ALLOCATED BIT(0) | ||
603 | +#define WAKE_IRQ_DEDICATED_MANAGED BIT(1) | ||
604 | +#define WAKE_IRQ_DEDICATED_MASK (WAKE_IRQ_DEDICATED_ALLOCATED | \ | ||
605 | + WAKE_IRQ_DEDICATED_MANAGED) | ||
606 | + | ||
607 | struct wake_irq { | ||
608 | struct device *dev; | ||
609 | + unsigned int status; | ||
610 | int irq; | ||
611 | - bool dedicated_irq:1; | ||
612 | }; | ||
613 | |||
614 | extern void dev_pm_arm_wake_irq(struct wake_irq *wirq); | ||
615 | extern void dev_pm_disarm_wake_irq(struct wake_irq *wirq); | ||
616 | +extern void dev_pm_enable_wake_irq_check(struct device *dev, | ||
617 | + bool can_change_status); | ||
618 | +extern void dev_pm_disable_wake_irq_check(struct device *dev); | ||
619 | |||
620 | #ifdef CONFIG_PM_SLEEP | ||
621 | |||
622 | @@ -102,6 +110,15 @@ static inline void dev_pm_disarm_wake_irq(struct wake_irq *wirq) | ||
623 | { | ||
624 | } | ||
625 | |||
626 | +static inline void dev_pm_enable_wake_irq_check(struct device *dev, | ||
627 | + bool can_change_status) | ||
628 | +{ | ||
629 | +} | ||
630 | + | ||
631 | +static inline void dev_pm_disable_wake_irq_check(struct device *dev) | ||
632 | +{ | ||
633 | +} | ||
634 | + | ||
635 | #endif | ||
636 | |||
637 | #ifdef CONFIG_PM_SLEEP | ||
638 | diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c | ||
639 | index 9796a1a15ef6..3252429f96af 100644 | ||
640 | --- a/drivers/base/power/runtime.c | ||
641 | +++ b/drivers/base/power/runtime.c | ||
642 | @@ -515,7 +515,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | ||
643 | |||
644 | callback = RPM_GET_CALLBACK(dev, runtime_suspend); | ||
645 | |||
646 | - dev_pm_enable_wake_irq(dev); | ||
647 | + dev_pm_enable_wake_irq_check(dev, true); | ||
648 | retval = rpm_callback(callback, dev); | ||
649 | if (retval) | ||
650 | goto fail; | ||
651 | @@ -554,7 +554,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | ||
652 | return retval; | ||
653 | |||
654 | fail: | ||
655 | - dev_pm_disable_wake_irq(dev); | ||
656 | + dev_pm_disable_wake_irq_check(dev); | ||
657 | __update_runtime_status(dev, RPM_ACTIVE); | ||
658 | dev->power.deferred_resume = false; | ||
659 | wake_up_all(&dev->power.wait_queue); | ||
660 | @@ -737,12 +737,12 @@ static int rpm_resume(struct device *dev, int rpmflags) | ||
661 | |||
662 | callback = RPM_GET_CALLBACK(dev, runtime_resume); | ||
663 | |||
664 | - dev_pm_disable_wake_irq(dev); | ||
665 | + dev_pm_disable_wake_irq_check(dev); | ||
666 | retval = rpm_callback(callback, dev); | ||
667 | if (retval) { | ||
668 | __update_runtime_status(dev, RPM_SUSPENDED); | ||
669 | pm_runtime_cancel_pending(dev); | ||
670 | - dev_pm_enable_wake_irq(dev); | ||
671 | + dev_pm_enable_wake_irq_check(dev, false); | ||
672 | } else { | ||
673 | no_callback: | ||
674 | __update_runtime_status(dev, RPM_ACTIVE); | ||
675 | diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c | ||
676 | index 0d77cd6fd8d1..404d94c6c8bc 100644 | ||
677 | --- a/drivers/base/power/wakeirq.c | ||
678 | +++ b/drivers/base/power/wakeirq.c | ||
679 | @@ -110,8 +110,10 @@ void dev_pm_clear_wake_irq(struct device *dev) | ||
680 | dev->power.wakeirq = NULL; | ||
681 | spin_unlock_irqrestore(&dev->power.lock, flags); | ||
682 | |||
683 | - if (wirq->dedicated_irq) | ||
684 | + if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED) { | ||
685 | free_irq(wirq->irq, wirq); | ||
686 | + wirq->status &= ~WAKE_IRQ_DEDICATED_MASK; | ||
687 | + } | ||
688 | kfree(wirq); | ||
689 | } | ||
690 | EXPORT_SYMBOL_GPL(dev_pm_clear_wake_irq); | ||
691 | @@ -179,7 +181,6 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) | ||
692 | |||
693 | wirq->dev = dev; | ||
694 | wirq->irq = irq; | ||
695 | - wirq->dedicated_irq = true; | ||
696 | irq_set_status_flags(irq, IRQ_NOAUTOEN); | ||
697 | |||
698 | /* | ||
699 | @@ -195,6 +196,8 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) | ||
700 | if (err) | ||
701 | goto err_free_irq; | ||
702 | |||
703 | + wirq->status = WAKE_IRQ_DEDICATED_ALLOCATED; | ||
704 | + | ||
705 | return err; | ||
706 | |||
707 | err_free_irq: | ||
708 | @@ -210,9 +213,9 @@ EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_wake_irq); | ||
709 | * dev_pm_enable_wake_irq - Enable device wake-up interrupt | ||
710 | * @dev: Device | ||
711 | * | ||
712 | - * Called from the bus code or the device driver for | ||
713 | - * runtime_suspend() to enable the wake-up interrupt while | ||
714 | - * the device is running. | ||
715 | + * Optionally called from the bus code or the device driver for | ||
716 | + * runtime_resume() to override the PM runtime core managed wake-up | ||
717 | + * interrupt handling to enable the wake-up interrupt. | ||
718 | * | ||
719 | * Note that for runtime_suspend()) the wake-up interrupts | ||
720 | * should be unconditionally enabled unlike for suspend() | ||
721 | @@ -222,7 +225,7 @@ void dev_pm_enable_wake_irq(struct device *dev) | ||
722 | { | ||
723 | struct wake_irq *wirq = dev->power.wakeirq; | ||
724 | |||
725 | - if (wirq && wirq->dedicated_irq) | ||
726 | + if (wirq && (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED)) | ||
727 | enable_irq(wirq->irq); | ||
728 | } | ||
729 | EXPORT_SYMBOL_GPL(dev_pm_enable_wake_irq); | ||
730 | @@ -231,20 +234,73 @@ EXPORT_SYMBOL_GPL(dev_pm_enable_wake_irq); | ||
731 | * dev_pm_disable_wake_irq - Disable device wake-up interrupt | ||
732 | * @dev: Device | ||
733 | * | ||
734 | - * Called from the bus code or the device driver for | ||
735 | - * runtime_resume() to disable the wake-up interrupt while | ||
736 | - * the device is running. | ||
737 | + * Optionally called from the bus code or the device driver for | ||
738 | + * runtime_suspend() to override the PM runtime core managed wake-up | ||
739 | + * interrupt handling to disable the wake-up interrupt. | ||
740 | */ | ||
741 | void dev_pm_disable_wake_irq(struct device *dev) | ||
742 | { | ||
743 | struct wake_irq *wirq = dev->power.wakeirq; | ||
744 | |||
745 | - if (wirq && wirq->dedicated_irq) | ||
746 | + if (wirq && (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED)) | ||
747 | disable_irq_nosync(wirq->irq); | ||
748 | } | ||
749 | EXPORT_SYMBOL_GPL(dev_pm_disable_wake_irq); | ||
750 | |||
751 | /** | ||
752 | + * dev_pm_enable_wake_irq_check - Checks and enables wake-up interrupt | ||
753 | + * @dev: Device | ||
754 | + * @can_change_status: Can change wake-up interrupt status | ||
755 | + * | ||
756 | + * Enables wakeirq conditionally. We need to enable wake-up interrupt | ||
757 | + * lazily on the first rpm_suspend(). This is needed as the consumer device | ||
758 | + * starts in RPM_SUSPENDED state, and the the first pm_runtime_get() would | ||
759 | + * otherwise try to disable already disabled wakeirq. The wake-up interrupt | ||
760 | + * starts disabled with IRQ_NOAUTOEN set. | ||
761 | + * | ||
762 | + * Should be only called from rpm_suspend() and rpm_resume() path. | ||
763 | + * Caller must hold &dev->power.lock to change wirq->status | ||
764 | + */ | ||
765 | +void dev_pm_enable_wake_irq_check(struct device *dev, | ||
766 | + bool can_change_status) | ||
767 | +{ | ||
768 | + struct wake_irq *wirq = dev->power.wakeirq; | ||
769 | + | ||
770 | + if (!wirq || !((wirq->status & WAKE_IRQ_DEDICATED_MASK))) | ||
771 | + return; | ||
772 | + | ||
773 | + if (likely(wirq->status & WAKE_IRQ_DEDICATED_MANAGED)) { | ||
774 | + goto enable; | ||
775 | + } else if (can_change_status) { | ||
776 | + wirq->status |= WAKE_IRQ_DEDICATED_MANAGED; | ||
777 | + goto enable; | ||
778 | + } | ||
779 | + | ||
780 | + return; | ||
781 | + | ||
782 | +enable: | ||
783 | + enable_irq(wirq->irq); | ||
784 | +} | ||
785 | + | ||
786 | +/** | ||
787 | + * dev_pm_disable_wake_irq_check - Checks and disables wake-up interrupt | ||
788 | + * @dev: Device | ||
789 | + * | ||
790 | + * Disables wake-up interrupt conditionally based on status. | ||
791 | + * Should be only called from rpm_suspend() and rpm_resume() path. | ||
792 | + */ | ||
793 | +void dev_pm_disable_wake_irq_check(struct device *dev) | ||
794 | +{ | ||
795 | + struct wake_irq *wirq = dev->power.wakeirq; | ||
796 | + | ||
797 | + if (!wirq || !((wirq->status & WAKE_IRQ_DEDICATED_MASK))) | ||
798 | + return; | ||
799 | + | ||
800 | + if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED) | ||
801 | + disable_irq_nosync(wirq->irq); | ||
802 | +} | ||
803 | + | ||
804 | +/** | ||
805 | * dev_pm_arm_wake_irq - Arm device wake-up | ||
806 | * @wirq: Device wake-up interrupt | ||
807 | * | ||
808 | diff --git a/drivers/clk/clk-wm831x.c b/drivers/clk/clk-wm831x.c | ||
809 | index 43f9d15255f4..763aed2de893 100644 | ||
810 | --- a/drivers/clk/clk-wm831x.c | ||
811 | +++ b/drivers/clk/clk-wm831x.c | ||
812 | @@ -247,7 +247,7 @@ static int wm831x_clkout_is_prepared(struct clk_hw *hw) | ||
813 | if (ret < 0) { | ||
814 | dev_err(wm831x->dev, "Unable to read CLOCK_CONTROL_1: %d\n", | ||
815 | ret); | ||
816 | - return true; | ||
817 | + return false; | ||
818 | } | ||
819 | |||
820 | return (ret & WM831X_CLKOUT_ENA) != 0; | ||
821 | diff --git a/drivers/clk/imx/clk-imx31.c b/drivers/clk/imx/clk-imx31.c | ||
822 | index 6a964144a5b5..6a49ba2b9671 100644 | ||
823 | --- a/drivers/clk/imx/clk-imx31.c | ||
824 | +++ b/drivers/clk/imx/clk-imx31.c | ||
825 | @@ -157,10 +157,8 @@ static void __init _mx31_clocks_init(unsigned long fref) | ||
826 | } | ||
827 | } | ||
828 | |||
829 | -int __init mx31_clocks_init(void) | ||
830 | +int __init mx31_clocks_init(unsigned long fref) | ||
831 | { | ||
832 | - u32 fref = 26000000; /* default */ | ||
833 | - | ||
834 | _mx31_clocks_init(fref); | ||
835 | |||
836 | clk_register_clkdev(clk[gpt_gate], "per", "imx-gpt.0"); | ||
837 | diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c | ||
838 | index b5b9cb911111..04cec0da5d1e 100644 | ||
839 | --- a/drivers/gpu/drm/radeon/radeon_cursor.c | ||
840 | +++ b/drivers/gpu/drm/radeon/radeon_cursor.c | ||
841 | @@ -146,6 +146,9 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y) | ||
842 | int xorigin = 0, yorigin = 0; | ||
843 | int w = radeon_crtc->cursor_width; | ||
844 | |||
845 | + radeon_crtc->cursor_x = x; | ||
846 | + radeon_crtc->cursor_y = y; | ||
847 | + | ||
848 | if (ASIC_IS_AVIVO(rdev)) { | ||
849 | /* avivo cursor are offset into the total surface */ | ||
850 | x += crtc->x; | ||
851 | @@ -240,9 +243,6 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y) | ||
852 | yorigin * 256); | ||
853 | } | ||
854 | |||
855 | - radeon_crtc->cursor_x = x; | ||
856 | - radeon_crtc->cursor_y = y; | ||
857 | - | ||
858 | if (radeon_crtc->cursor_out_of_bounds) { | ||
859 | radeon_crtc->cursor_out_of_bounds = false; | ||
860 | if (radeon_crtc->cursor_bo) | ||
861 | diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c | ||
862 | index 12e851a5af48..46b4e35fd555 100644 | ||
863 | --- a/drivers/hwmon/amc6821.c | ||
864 | +++ b/drivers/hwmon/amc6821.c | ||
865 | @@ -188,8 +188,8 @@ static struct amc6821_data *amc6821_update_device(struct device *dev) | ||
866 | !data->valid) { | ||
867 | |||
868 | for (i = 0; i < TEMP_IDX_LEN; i++) | ||
869 | - data->temp[i] = i2c_smbus_read_byte_data(client, | ||
870 | - temp_reg[i]); | ||
871 | + data->temp[i] = (int8_t)i2c_smbus_read_byte_data( | ||
872 | + client, temp_reg[i]); | ||
873 | |||
874 | data->stat1 = i2c_smbus_read_byte_data(client, | ||
875 | AMC6821_REG_STAT1); | ||
876 | diff --git a/drivers/hwmon/ds620.c b/drivers/hwmon/ds620.c | ||
877 | index edf550fc4eef..0043a4c02b85 100644 | ||
878 | --- a/drivers/hwmon/ds620.c | ||
879 | +++ b/drivers/hwmon/ds620.c | ||
880 | @@ -166,7 +166,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, | ||
881 | if (res) | ||
882 | return res; | ||
883 | |||
884 | - val = (val * 10 / 625) * 8; | ||
885 | + val = (clamp_val(val, -128000, 128000) * 10 / 625) * 8; | ||
886 | |||
887 | mutex_lock(&data->update_lock); | ||
888 | data->temp[attr->index] = val; | ||
889 | diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c | ||
890 | index b96a2a9e4df7..628be9c95ff9 100644 | ||
891 | --- a/drivers/hwmon/g762.c | ||
892 | +++ b/drivers/hwmon/g762.c | ||
893 | @@ -193,14 +193,17 @@ static inline unsigned int rpm_from_cnt(u8 cnt, u32 clk_freq, u16 p, | ||
894 | * Convert fan RPM value from sysfs into count value for fan controller | ||
895 | * register (FAN_SET_CNT). | ||
896 | */ | ||
897 | -static inline unsigned char cnt_from_rpm(u32 rpm, u32 clk_freq, u16 p, | ||
898 | +static inline unsigned char cnt_from_rpm(unsigned long rpm, u32 clk_freq, u16 p, | ||
899 | u8 clk_div, u8 gear_mult) | ||
900 | { | ||
901 | - if (!rpm) /* to stop the fan, set cnt to 255 */ | ||
902 | + unsigned long f1 = clk_freq * 30 * gear_mult; | ||
903 | + unsigned long f2 = p * clk_div; | ||
904 | + | ||
905 | + if (!rpm) /* to stop the fan, set cnt to 255 */ | ||
906 | return 0xff; | ||
907 | |||
908 | - return clamp_val(((clk_freq * 30 * gear_mult) / (rpm * p * clk_div)), | ||
909 | - 0, 255); | ||
910 | + rpm = clamp_val(rpm, f1 / (255 * f2), ULONG_MAX / f2); | ||
911 | + return DIV_ROUND_CLOSEST(f1, rpm * f2); | ||
912 | } | ||
913 | |||
914 | /* helper to grab and cache data, at most one time per second */ | ||
915 | diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c | ||
916 | index 3ce33d244cc0..12b94b094c0d 100644 | ||
917 | --- a/drivers/hwmon/nct7802.c | ||
918 | +++ b/drivers/hwmon/nct7802.c | ||
919 | @@ -259,13 +259,15 @@ static int nct7802_read_fan_min(struct nct7802_data *data, u8 reg_fan_low, | ||
920 | ret = 0; | ||
921 | else if (ret) | ||
922 | ret = DIV_ROUND_CLOSEST(1350000U, ret); | ||
923 | + else | ||
924 | + ret = 1350000U; | ||
925 | abort: | ||
926 | mutex_unlock(&data->access_lock); | ||
927 | return ret; | ||
928 | } | ||
929 | |||
930 | static int nct7802_write_fan_min(struct nct7802_data *data, u8 reg_fan_low, | ||
931 | - u8 reg_fan_high, unsigned int limit) | ||
932 | + u8 reg_fan_high, unsigned long limit) | ||
933 | { | ||
934 | int err; | ||
935 | |||
936 | @@ -326,8 +328,8 @@ static int nct7802_write_voltage(struct nct7802_data *data, int nr, int index, | ||
937 | int shift = 8 - REG_VOLTAGE_LIMIT_MSB_SHIFT[index - 1][nr]; | ||
938 | int err; | ||
939 | |||
940 | + voltage = clamp_val(voltage, 0, 0x3ff * nct7802_vmul[nr]); | ||
941 | voltage = DIV_ROUND_CLOSEST(voltage, nct7802_vmul[nr]); | ||
942 | - voltage = clamp_val(voltage, 0, 0x3ff); | ||
943 | |||
944 | mutex_lock(&data->access_lock); | ||
945 | err = regmap_write(data->regmap, | ||
946 | @@ -402,7 +404,7 @@ static ssize_t store_temp(struct device *dev, struct device_attribute *attr, | ||
947 | if (err < 0) | ||
948 | return err; | ||
949 | |||
950 | - val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -128, 127); | ||
951 | + val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000); | ||
952 | |||
953 | err = regmap_write(data->regmap, nr, val & 0xff); | ||
954 | return err ? : count; | ||
955 | diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c | ||
956 | index 7e20567bc369..6827169c82d4 100644 | ||
957 | --- a/drivers/hwmon/scpi-hwmon.c | ||
958 | +++ b/drivers/hwmon/scpi-hwmon.c | ||
959 | @@ -272,6 +272,7 @@ static const struct of_device_id scpi_of_match[] = { | ||
960 | {.compatible = "arm,scpi-sensors"}, | ||
961 | {}, | ||
962 | }; | ||
963 | +MODULE_DEVICE_TABLE(of, scpi_of_match); | ||
964 | |||
965 | static struct platform_driver scpi_hwmon_platdrv = { | ||
966 | .driver = { | ||
967 | diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c | ||
968 | index 5975d76ce755..a0ef57483ebb 100644 | ||
969 | --- a/drivers/iommu/amd_iommu.c | ||
970 | +++ b/drivers/iommu/amd_iommu.c | ||
971 | @@ -926,7 +926,7 @@ again: | ||
972 | next_tail = (tail + sizeof(*cmd)) % CMD_BUFFER_SIZE; | ||
973 | left = (head - next_tail) % CMD_BUFFER_SIZE; | ||
974 | |||
975 | - if (left <= 2) { | ||
976 | + if (left <= 0x20) { | ||
977 | struct iommu_cmd sync_cmd; | ||
978 | volatile u64 sem = 0; | ||
979 | int ret; | ||
980 | diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c | ||
981 | index 7caf2fa237f2..4831eb910fc7 100644 | ||
982 | --- a/drivers/iommu/amd_iommu_v2.c | ||
983 | +++ b/drivers/iommu/amd_iommu_v2.c | ||
984 | @@ -809,8 +809,10 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids) | ||
985 | goto out_free_domain; | ||
986 | |||
987 | group = iommu_group_get(&pdev->dev); | ||
988 | - if (!group) | ||
989 | + if (!group) { | ||
990 | + ret = -EINVAL; | ||
991 | goto out_free_domain; | ||
992 | + } | ||
993 | |||
994 | ret = iommu_attach_group(dev_state->domain, group); | ||
995 | if (ret != 0) | ||
996 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c | ||
997 | index 59e9abd3345e..9413b0726237 100644 | ||
998 | --- a/drivers/iommu/intel-iommu.c | ||
999 | +++ b/drivers/iommu/intel-iommu.c | ||
1000 | @@ -1993,6 +1993,25 @@ static int domain_context_mapping_one(struct dmar_domain *domain, | ||
1001 | if (context_present(context)) | ||
1002 | goto out_unlock; | ||
1003 | |||
1004 | + /* | ||
1005 | + * For kdump cases, old valid entries may be cached due to the | ||
1006 | + * in-flight DMA and copied pgtable, but there is no unmapping | ||
1007 | + * behaviour for them, thus we need an explicit cache flush for | ||
1008 | + * the newly-mapped device. For kdump, at this point, the device | ||
1009 | + * is supposed to finish reset at its driver probe stage, so no | ||
1010 | + * in-flight DMA will exist, and we don't need to worry anymore | ||
1011 | + * hereafter. | ||
1012 | + */ | ||
1013 | + if (context_copied(context)) { | ||
1014 | + u16 did_old = context_domain_id(context); | ||
1015 | + | ||
1016 | + if (did_old >= 0 && did_old < cap_ndoms(iommu->cap)) | ||
1017 | + iommu->flush.flush_context(iommu, did_old, | ||
1018 | + (((u16)bus) << 8) | devfn, | ||
1019 | + DMA_CCMD_MASK_NOBIT, | ||
1020 | + DMA_CCMD_DEVICE_INVL); | ||
1021 | + } | ||
1022 | + | ||
1023 | pgd = domain->pgd; | ||
1024 | |||
1025 | context_clear_entry(context); | ||
1026 | @@ -5020,6 +5039,25 @@ static void intel_iommu_remove_device(struct device *dev) | ||
1027 | } | ||
1028 | |||
1029 | #ifdef CONFIG_INTEL_IOMMU_SVM | ||
1030 | +#define MAX_NR_PASID_BITS (20) | ||
1031 | +static inline unsigned long intel_iommu_get_pts(struct intel_iommu *iommu) | ||
1032 | +{ | ||
1033 | + /* | ||
1034 | + * Convert ecap_pss to extend context entry pts encoding, also | ||
1035 | + * respect the soft pasid_max value set by the iommu. | ||
1036 | + * - number of PASID bits = ecap_pss + 1 | ||
1037 | + * - number of PASID table entries = 2^(pts + 5) | ||
1038 | + * Therefore, pts = ecap_pss - 4 | ||
1039 | + * e.g. KBL ecap_pss = 0x13, PASID has 20 bits, pts = 15 | ||
1040 | + */ | ||
1041 | + if (ecap_pss(iommu->ecap) < 5) | ||
1042 | + return 0; | ||
1043 | + | ||
1044 | + /* pasid_max is encoded as actual number of entries not the bits */ | ||
1045 | + return find_first_bit((unsigned long *)&iommu->pasid_max, | ||
1046 | + MAX_NR_PASID_BITS) - 5; | ||
1047 | +} | ||
1048 | + | ||
1049 | int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sdev) | ||
1050 | { | ||
1051 | struct device_domain_info *info; | ||
1052 | @@ -5052,7 +5090,9 @@ int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sd | ||
1053 | |||
1054 | if (!(ctx_lo & CONTEXT_PASIDE)) { | ||
1055 | context[1].hi = (u64)virt_to_phys(iommu->pasid_state_table); | ||
1056 | - context[1].lo = (u64)virt_to_phys(iommu->pasid_table) | ecap_pss(iommu->ecap); | ||
1057 | + context[1].lo = (u64)virt_to_phys(iommu->pasid_table) | | ||
1058 | + intel_iommu_get_pts(iommu); | ||
1059 | + | ||
1060 | wmb(); | ||
1061 | /* CONTEXT_TT_MULTI_LEVEL and CONTEXT_TT_DEV_IOTLB are both | ||
1062 | * extended to permit requests-with-PASID if the PASIDE bit | ||
1063 | diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c | ||
1064 | index 0fea985ef1dc..d7af88534971 100644 | ||
1065 | --- a/drivers/irqchip/irq-bcm7038-l1.c | ||
1066 | +++ b/drivers/irqchip/irq-bcm7038-l1.c | ||
1067 | @@ -216,6 +216,31 @@ static int bcm7038_l1_set_affinity(struct irq_data *d, | ||
1068 | return 0; | ||
1069 | } | ||
1070 | |||
1071 | +static void bcm7038_l1_cpu_offline(struct irq_data *d) | ||
1072 | +{ | ||
1073 | + struct cpumask *mask = irq_data_get_affinity_mask(d); | ||
1074 | + int cpu = smp_processor_id(); | ||
1075 | + cpumask_t new_affinity; | ||
1076 | + | ||
1077 | + /* This CPU was not on the affinity mask */ | ||
1078 | + if (!cpumask_test_cpu(cpu, mask)) | ||
1079 | + return; | ||
1080 | + | ||
1081 | + if (cpumask_weight(mask) > 1) { | ||
1082 | + /* | ||
1083 | + * Multiple CPU affinity, remove this CPU from the affinity | ||
1084 | + * mask | ||
1085 | + */ | ||
1086 | + cpumask_copy(&new_affinity, mask); | ||
1087 | + cpumask_clear_cpu(cpu, &new_affinity); | ||
1088 | + } else { | ||
1089 | + /* Only CPU, put on the lowest online CPU */ | ||
1090 | + cpumask_clear(&new_affinity); | ||
1091 | + cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity); | ||
1092 | + } | ||
1093 | + irq_set_affinity_locked(d, &new_affinity, false); | ||
1094 | +} | ||
1095 | + | ||
1096 | static int __init bcm7038_l1_init_one(struct device_node *dn, | ||
1097 | unsigned int idx, | ||
1098 | struct bcm7038_l1_chip *intc) | ||
1099 | @@ -267,6 +292,7 @@ static struct irq_chip bcm7038_l1_irq_chip = { | ||
1100 | .irq_mask = bcm7038_l1_mask, | ||
1101 | .irq_unmask = bcm7038_l1_unmask, | ||
1102 | .irq_set_affinity = bcm7038_l1_set_affinity, | ||
1103 | + .irq_cpu_offline = bcm7038_l1_cpu_offline, | ||
1104 | }; | ||
1105 | |||
1106 | static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq, | ||
1107 | diff --git a/drivers/md/md.c b/drivers/md/md.c | ||
1108 | index c1c7d4fb4b77..eff554a12fb4 100644 | ||
1109 | --- a/drivers/md/md.c | ||
1110 | +++ b/drivers/md/md.c | ||
1111 | @@ -6771,7 +6771,7 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, | ||
1112 | /* need to ensure recovery thread has run */ | ||
1113 | wait_event_interruptible_timeout(mddev->sb_wait, | ||
1114 | !test_bit(MD_RECOVERY_NEEDED, | ||
1115 | - &mddev->flags), | ||
1116 | + &mddev->recovery), | ||
1117 | msecs_to_jiffies(5000)); | ||
1118 | if (cmd == STOP_ARRAY || cmd == STOP_ARRAY_RO) { | ||
1119 | /* Need to flush page cache, and ensure no-one else opens | ||
1120 | diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c | ||
1121 | index c4307ad8594c..e543cbbf2ec4 100644 | ||
1122 | --- a/drivers/media/pci/cx23885/cx23885-dvb.c | ||
1123 | +++ b/drivers/media/pci/cx23885/cx23885-dvb.c | ||
1124 | @@ -2168,11 +2168,12 @@ static int dvb_register(struct cx23885_tsport *port) | ||
1125 | } | ||
1126 | port->i2c_client_tuner = client_tuner; | ||
1127 | break; | ||
1128 | - case CX23885_BOARD_HAUPPAUGE_HVR5525: | ||
1129 | - switch (port->nr) { | ||
1130 | + case CX23885_BOARD_HAUPPAUGE_HVR5525: { | ||
1131 | struct m88rs6000t_config m88rs6000t_config; | ||
1132 | struct a8293_platform_data a8293_pdata = {}; | ||
1133 | |||
1134 | + switch (port->nr) { | ||
1135 | + | ||
1136 | /* port b - satellite */ | ||
1137 | case 1: | ||
1138 | /* attach frontend */ | ||
1139 | @@ -2267,6 +2268,7 @@ static int dvb_register(struct cx23885_tsport *port) | ||
1140 | break; | ||
1141 | } | ||
1142 | break; | ||
1143 | + } | ||
1144 | default: | ||
1145 | printk(KERN_INFO "%s: The frontend of your DVB/ATSC card " | ||
1146 | " isn't supported yet\n", | ||
1147 | diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c | ||
1148 | index e59838231703..be74a25708b2 100644 | ||
1149 | --- a/drivers/misc/mei/bus.c | ||
1150 | +++ b/drivers/misc/mei/bus.c | ||
1151 | @@ -399,7 +399,7 @@ bool mei_cldev_enabled(struct mei_cl_device *cldev) | ||
1152 | EXPORT_SYMBOL_GPL(mei_cldev_enabled); | ||
1153 | |||
1154 | /** | ||
1155 | - * mei_cldev_enable_device - enable me client device | ||
1156 | + * mei_cldev_enable - enable me client device | ||
1157 | * create connection with me client | ||
1158 | * | ||
1159 | * @cldev: me client device | ||
1160 | diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c | ||
1161 | index 7fc9174d4619..9a11aaa6e985 100644 | ||
1162 | --- a/drivers/mmc/card/mmc_test.c | ||
1163 | +++ b/drivers/mmc/card/mmc_test.c | ||
1164 | @@ -791,7 +791,7 @@ static int mmc_test_nonblock_transfer(struct mmc_test_card *test, | ||
1165 | struct mmc_async_req *cur_areq = &test_areq[0].areq; | ||
1166 | struct mmc_async_req *other_areq = &test_areq[1].areq; | ||
1167 | int i; | ||
1168 | - int ret; | ||
1169 | + int ret = RESULT_OK; | ||
1170 | |||
1171 | test_areq[0].test = test; | ||
1172 | test_areq[1].test = test; | ||
1173 | diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c | ||
1174 | index 50d5604833ed..e0993eba5df3 100644 | ||
1175 | --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c | ||
1176 | +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c | ||
1177 | @@ -2223,8 +2223,6 @@ static irqreturn_t vxge_isr_napi(int irq, void *dev_id) | ||
1178 | return IRQ_NONE; | ||
1179 | } | ||
1180 | |||
1181 | -#ifdef CONFIG_PCI_MSI | ||
1182 | - | ||
1183 | static irqreturn_t vxge_tx_msix_handle(int irq, void *dev_id) | ||
1184 | { | ||
1185 | struct vxge_fifo *fifo = (struct vxge_fifo *)dev_id; | ||
1186 | @@ -2442,16 +2440,13 @@ static void vxge_rem_msix_isr(struct vxgedev *vdev) | ||
1187 | if (vdev->config.intr_type == MSI_X) | ||
1188 | pci_disable_msix(vdev->pdev); | ||
1189 | } | ||
1190 | -#endif | ||
1191 | |||
1192 | static void vxge_rem_isr(struct vxgedev *vdev) | ||
1193 | { | ||
1194 | -#ifdef CONFIG_PCI_MSI | ||
1195 | - if (vdev->config.intr_type == MSI_X) { | ||
1196 | + if (IS_ENABLED(CONFIG_PCI_MSI) && | ||
1197 | + vdev->config.intr_type == MSI_X) { | ||
1198 | vxge_rem_msix_isr(vdev); | ||
1199 | - } else | ||
1200 | -#endif | ||
1201 | - if (vdev->config.intr_type == INTA) { | ||
1202 | + } else if (vdev->config.intr_type == INTA) { | ||
1203 | synchronize_irq(vdev->pdev->irq); | ||
1204 | free_irq(vdev->pdev->irq, vdev); | ||
1205 | } | ||
1206 | @@ -2460,11 +2455,10 @@ static void vxge_rem_isr(struct vxgedev *vdev) | ||
1207 | static int vxge_add_isr(struct vxgedev *vdev) | ||
1208 | { | ||
1209 | int ret = 0; | ||
1210 | -#ifdef CONFIG_PCI_MSI | ||
1211 | int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0; | ||
1212 | int pci_fun = PCI_FUNC(vdev->pdev->devfn); | ||
1213 | |||
1214 | - if (vdev->config.intr_type == MSI_X) | ||
1215 | + if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X) | ||
1216 | ret = vxge_enable_msix(vdev); | ||
1217 | |||
1218 | if (ret) { | ||
1219 | @@ -2475,7 +2469,7 @@ static int vxge_add_isr(struct vxgedev *vdev) | ||
1220 | vdev->config.intr_type = INTA; | ||
1221 | } | ||
1222 | |||
1223 | - if (vdev->config.intr_type == MSI_X) { | ||
1224 | + if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X) { | ||
1225 | for (intr_idx = 0; | ||
1226 | intr_idx < (vdev->no_of_vpath * | ||
1227 | VXGE_HW_VPATH_MSIX_ACTIVE); intr_idx++) { | ||
1228 | @@ -2576,9 +2570,8 @@ static int vxge_add_isr(struct vxgedev *vdev) | ||
1229 | vdev->vxge_entries[intr_cnt].in_use = 1; | ||
1230 | vdev->vxge_entries[intr_cnt].arg = &vdev->vpaths[0]; | ||
1231 | } | ||
1232 | -INTA_MODE: | ||
1233 | -#endif | ||
1234 | |||
1235 | +INTA_MODE: | ||
1236 | if (vdev->config.intr_type == INTA) { | ||
1237 | snprintf(vdev->desc[0], VXGE_INTR_STRLEN, | ||
1238 | "%s:vxge:INTA", vdev->ndev->name); | ||
1239 | @@ -3889,12 +3882,12 @@ static void vxge_device_config_init(struct vxge_hw_device_config *device_config, | ||
1240 | if (max_mac_vpath > VXGE_MAX_MAC_ADDR_COUNT) | ||
1241 | max_mac_vpath = VXGE_MAX_MAC_ADDR_COUNT; | ||
1242 | |||
1243 | -#ifndef CONFIG_PCI_MSI | ||
1244 | - vxge_debug_init(VXGE_ERR, | ||
1245 | - "%s: This Kernel does not support " | ||
1246 | - "MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME); | ||
1247 | - *intr_type = INTA; | ||
1248 | -#endif | ||
1249 | + if (!IS_ENABLED(CONFIG_PCI_MSI)) { | ||
1250 | + vxge_debug_init(VXGE_ERR, | ||
1251 | + "%s: This Kernel does not support " | ||
1252 | + "MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME); | ||
1253 | + *intr_type = INTA; | ||
1254 | + } | ||
1255 | |||
1256 | /* Configure whether MSI-X or IRQL. */ | ||
1257 | switch (*intr_type) { | ||
1258 | diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c | ||
1259 | index 77d26fe286c0..d52ea3008946 100644 | ||
1260 | --- a/drivers/net/ethernet/ti/cpmac.c | ||
1261 | +++ b/drivers/net/ethernet/ti/cpmac.c | ||
1262 | @@ -549,7 +549,8 @@ fatal_error: | ||
1263 | |||
1264 | static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
1265 | { | ||
1266 | - int queue, len; | ||
1267 | + int queue; | ||
1268 | + unsigned int len; | ||
1269 | struct cpmac_desc *desc; | ||
1270 | struct cpmac_priv *priv = netdev_priv(dev); | ||
1271 | |||
1272 | @@ -559,7 +560,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
1273 | if (unlikely(skb_padto(skb, ETH_ZLEN))) | ||
1274 | return NETDEV_TX_OK; | ||
1275 | |||
1276 | - len = max(skb->len, ETH_ZLEN); | ||
1277 | + len = max_t(unsigned int, skb->len, ETH_ZLEN); | ||
1278 | queue = skb_get_queue_mapping(skb); | ||
1279 | netif_stop_subqueue(dev, queue); | ||
1280 | |||
1281 | diff --git a/drivers/net/wireless/ath/ath10k/spectral.c b/drivers/net/wireless/ath/ath10k/spectral.c | ||
1282 | index 4671cfbcd8f7..a0e7eebc206a 100644 | ||
1283 | --- a/drivers/net/wireless/ath/ath10k/spectral.c | ||
1284 | +++ b/drivers/net/wireless/ath/ath10k/spectral.c | ||
1285 | @@ -338,7 +338,7 @@ static ssize_t write_file_spec_scan_ctl(struct file *file, | ||
1286 | } else { | ||
1287 | res = -EINVAL; | ||
1288 | } | ||
1289 | - } else if (strncmp("background", buf, 9) == 0) { | ||
1290 | + } else if (strncmp("background", buf, 10) == 0) { | ||
1291 | res = ath10k_spectral_scan_config(ar, SPECTRAL_BACKGROUND); | ||
1292 | } else if (strncmp("manual", buf, 6) == 0) { | ||
1293 | res = ath10k_spectral_scan_config(ar, SPECTRAL_MANUAL); | ||
1294 | diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c | ||
1295 | index e12bafdc42e0..f2fcbe944d94 100644 | ||
1296 | --- a/drivers/pci/hotplug/rpadlpar_core.c | ||
1297 | +++ b/drivers/pci/hotplug/rpadlpar_core.c | ||
1298 | @@ -258,8 +258,13 @@ static int dlpar_add_phb(char *drc_name, struct device_node *dn) | ||
1299 | |||
1300 | static int dlpar_add_vio_slot(char *drc_name, struct device_node *dn) | ||
1301 | { | ||
1302 | - if (vio_find_node(dn)) | ||
1303 | + struct vio_dev *vio_dev; | ||
1304 | + | ||
1305 | + vio_dev = vio_find_node(dn); | ||
1306 | + if (vio_dev) { | ||
1307 | + put_device(&vio_dev->dev); | ||
1308 | return -EINVAL; | ||
1309 | + } | ||
1310 | |||
1311 | if (!vio_register_device_node(dn)) { | ||
1312 | printk(KERN_ERR | ||
1313 | @@ -335,6 +340,9 @@ static int dlpar_remove_vio_slot(char *drc_name, struct device_node *dn) | ||
1314 | return -EINVAL; | ||
1315 | |||
1316 | vio_unregister_device(vio_dev); | ||
1317 | + | ||
1318 | + put_device(&vio_dev->dev); | ||
1319 | + | ||
1320 | return 0; | ||
1321 | } | ||
1322 | |||
1323 | diff --git a/drivers/scsi/mvsas/mv_94xx.c b/drivers/scsi/mvsas/mv_94xx.c | ||
1324 | index 9270d15ff1a4..7353ac8d0d39 100644 | ||
1325 | --- a/drivers/scsi/mvsas/mv_94xx.c | ||
1326 | +++ b/drivers/scsi/mvsas/mv_94xx.c | ||
1327 | @@ -621,7 +621,7 @@ static void mvs_94xx_command_active(struct mvs_info *mvi, u32 slot_idx) | ||
1328 | { | ||
1329 | u32 tmp; | ||
1330 | tmp = mvs_cr32(mvi, MVS_COMMAND_ACTIVE+(slot_idx >> 3)); | ||
1331 | - if (tmp && 1 << (slot_idx % 32)) { | ||
1332 | + if (tmp & 1 << (slot_idx % 32)) { | ||
1333 | mv_printk("command active %08X, slot [%x].\n", tmp, slot_idx); | ||
1334 | mvs_cw32(mvi, MVS_COMMAND_ACTIVE + (slot_idx >> 3), | ||
1335 | 1 << (slot_idx % 32)); | ||
1336 | diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c | ||
1337 | index 5a536a00066f..b63472de761a 100644 | ||
1338 | --- a/drivers/staging/comedi/drivers/dt282x.c | ||
1339 | +++ b/drivers/staging/comedi/drivers/dt282x.c | ||
1340 | @@ -69,48 +69,49 @@ | ||
1341 | * Register map | ||
1342 | */ | ||
1343 | #define DT2821_ADCSR_REG 0x00 | ||
1344 | -#define DT2821_ADCSR_ADERR (1 << 15) | ||
1345 | -#define DT2821_ADCSR_ADCLK (1 << 9) | ||
1346 | -#define DT2821_ADCSR_MUXBUSY (1 << 8) | ||
1347 | -#define DT2821_ADCSR_ADDONE (1 << 7) | ||
1348 | -#define DT2821_ADCSR_IADDONE (1 << 6) | ||
1349 | +#define DT2821_ADCSR_ADERR BIT(15) | ||
1350 | +#define DT2821_ADCSR_ADCLK BIT(9) | ||
1351 | +#define DT2821_ADCSR_MUXBUSY BIT(8) | ||
1352 | +#define DT2821_ADCSR_ADDONE BIT(7) | ||
1353 | +#define DT2821_ADCSR_IADDONE BIT(6) | ||
1354 | #define DT2821_ADCSR_GS(x) (((x) & 0x3) << 4) | ||
1355 | #define DT2821_ADCSR_CHAN(x) (((x) & 0xf) << 0) | ||
1356 | #define DT2821_CHANCSR_REG 0x02 | ||
1357 | -#define DT2821_CHANCSR_LLE (1 << 15) | ||
1358 | -#define DT2821_CHANCSR_PRESLA(x) (((x) & 0xf) >> 8) | ||
1359 | +#define DT2821_CHANCSR_LLE BIT(15) | ||
1360 | +#define DT2821_CHANCSR_TO_PRESLA(x) (((x) >> 8) & 0xf) | ||
1361 | #define DT2821_CHANCSR_NUMB(x) ((((x) - 1) & 0xf) << 0) | ||
1362 | #define DT2821_ADDAT_REG 0x04 | ||
1363 | #define DT2821_DACSR_REG 0x06 | ||
1364 | -#define DT2821_DACSR_DAERR (1 << 15) | ||
1365 | +#define DT2821_DACSR_DAERR BIT(15) | ||
1366 | #define DT2821_DACSR_YSEL(x) ((x) << 9) | ||
1367 | -#define DT2821_DACSR_SSEL (1 << 8) | ||
1368 | -#define DT2821_DACSR_DACRDY (1 << 7) | ||
1369 | -#define DT2821_DACSR_IDARDY (1 << 6) | ||
1370 | -#define DT2821_DACSR_DACLK (1 << 5) | ||
1371 | -#define DT2821_DACSR_HBOE (1 << 1) | ||
1372 | -#define DT2821_DACSR_LBOE (1 << 0) | ||
1373 | +#define DT2821_DACSR_SSEL BIT(8) | ||
1374 | +#define DT2821_DACSR_DACRDY BIT(7) | ||
1375 | +#define DT2821_DACSR_IDARDY BIT(6) | ||
1376 | +#define DT2821_DACSR_DACLK BIT(5) | ||
1377 | +#define DT2821_DACSR_HBOE BIT(1) | ||
1378 | +#define DT2821_DACSR_LBOE BIT(0) | ||
1379 | #define DT2821_DADAT_REG 0x08 | ||
1380 | #define DT2821_DIODAT_REG 0x0a | ||
1381 | #define DT2821_SUPCSR_REG 0x0c | ||
1382 | -#define DT2821_SUPCSR_DMAD (1 << 15) | ||
1383 | -#define DT2821_SUPCSR_ERRINTEN (1 << 14) | ||
1384 | -#define DT2821_SUPCSR_CLRDMADNE (1 << 13) | ||
1385 | -#define DT2821_SUPCSR_DDMA (1 << 12) | ||
1386 | -#define DT2821_SUPCSR_DS_PIO (0 << 10) | ||
1387 | -#define DT2821_SUPCSR_DS_AD_CLK (1 << 10) | ||
1388 | -#define DT2821_SUPCSR_DS_DA_CLK (2 << 10) | ||
1389 | -#define DT2821_SUPCSR_DS_AD_TRIG (3 << 10) | ||
1390 | -#define DT2821_SUPCSR_BUFFB (1 << 9) | ||
1391 | -#define DT2821_SUPCSR_SCDN (1 << 8) | ||
1392 | -#define DT2821_SUPCSR_DACON (1 << 7) | ||
1393 | -#define DT2821_SUPCSR_ADCINIT (1 << 6) | ||
1394 | -#define DT2821_SUPCSR_DACINIT (1 << 5) | ||
1395 | -#define DT2821_SUPCSR_PRLD (1 << 4) | ||
1396 | -#define DT2821_SUPCSR_STRIG (1 << 3) | ||
1397 | -#define DT2821_SUPCSR_XTRIG (1 << 2) | ||
1398 | -#define DT2821_SUPCSR_XCLK (1 << 1) | ||
1399 | -#define DT2821_SUPCSR_BDINIT (1 << 0) | ||
1400 | +#define DT2821_SUPCSR_DMAD BIT(15) | ||
1401 | +#define DT2821_SUPCSR_ERRINTEN BIT(14) | ||
1402 | +#define DT2821_SUPCSR_CLRDMADNE BIT(13) | ||
1403 | +#define DT2821_SUPCSR_DDMA BIT(12) | ||
1404 | +#define DT2821_SUPCSR_DS(x) (((x) & 0x3) << 10) | ||
1405 | +#define DT2821_SUPCSR_DS_PIO DT2821_SUPCSR_DS(0) | ||
1406 | +#define DT2821_SUPCSR_DS_AD_CLK DT2821_SUPCSR_DS(1) | ||
1407 | +#define DT2821_SUPCSR_DS_DA_CLK DT2821_SUPCSR_DS(2) | ||
1408 | +#define DT2821_SUPCSR_DS_AD_TRIG DT2821_SUPCSR_DS(3) | ||
1409 | +#define DT2821_SUPCSR_BUFFB BIT(9) | ||
1410 | +#define DT2821_SUPCSR_SCDN BIT(8) | ||
1411 | +#define DT2821_SUPCSR_DACON BIT(7) | ||
1412 | +#define DT2821_SUPCSR_ADCINIT BIT(6) | ||
1413 | +#define DT2821_SUPCSR_DACINIT BIT(5) | ||
1414 | +#define DT2821_SUPCSR_PRLD BIT(4) | ||
1415 | +#define DT2821_SUPCSR_STRIG BIT(3) | ||
1416 | +#define DT2821_SUPCSR_XTRIG BIT(2) | ||
1417 | +#define DT2821_SUPCSR_XCLK BIT(1) | ||
1418 | +#define DT2821_SUPCSR_BDINIT BIT(0) | ||
1419 | #define DT2821_TMRCTR_REG 0x0e | ||
1420 | |||
1421 | static const struct comedi_lrange range_dt282x_ai_lo_bipolar = { | ||
1422 | diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c | ||
1423 | index 5796ed2409d0..39bbbaaff07c 100644 | ||
1424 | --- a/drivers/staging/iio/adc/ad7606_core.c | ||
1425 | +++ b/drivers/staging/iio/adc/ad7606_core.c | ||
1426 | @@ -189,7 +189,7 @@ static ssize_t ad7606_store_oversampling_ratio(struct device *dev, | ||
1427 | mutex_lock(&indio_dev->mlock); | ||
1428 | gpio_set_value(st->pdata->gpio_os0, (ret >> 0) & 1); | ||
1429 | gpio_set_value(st->pdata->gpio_os1, (ret >> 1) & 1); | ||
1430 | - gpio_set_value(st->pdata->gpio_os1, (ret >> 2) & 1); | ||
1431 | + gpio_set_value(st->pdata->gpio_os2, (ret >> 2) & 1); | ||
1432 | st->oversampling = lval; | ||
1433 | mutex_unlock(&indio_dev->mlock); | ||
1434 | |||
1435 | diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c | ||
1436 | index 23c95cd14167..68261b7dcefe 100644 | ||
1437 | --- a/drivers/target/iscsi/iscsi_target_tpg.c | ||
1438 | +++ b/drivers/target/iscsi/iscsi_target_tpg.c | ||
1439 | @@ -260,7 +260,6 @@ err_out: | ||
1440 | iscsi_release_param_list(tpg->param_list); | ||
1441 | tpg->param_list = NULL; | ||
1442 | } | ||
1443 | - kfree(tpg); | ||
1444 | return -ENOMEM; | ||
1445 | } | ||
1446 | |||
1447 | diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c | ||
1448 | index ff44cfa26af8..ac30a051ad71 100644 | ||
1449 | --- a/drivers/usb/core/config.c | ||
1450 | +++ b/drivers/usb/core/config.c | ||
1451 | @@ -205,6 +205,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | ||
1452 | if (ifp->desc.bNumEndpoints >= num_ep) | ||
1453 | goto skip_to_next_endpoint_or_interface_descriptor; | ||
1454 | |||
1455 | + /* Check for duplicate endpoint addresses */ | ||
1456 | + for (i = 0; i < ifp->desc.bNumEndpoints; ++i) { | ||
1457 | + if (ifp->endpoint[i].desc.bEndpointAddress == | ||
1458 | + d->bEndpointAddress) { | ||
1459 | + dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n", | ||
1460 | + cfgno, inum, asnum, d->bEndpointAddress); | ||
1461 | + goto skip_to_next_endpoint_or_interface_descriptor; | ||
1462 | + } | ||
1463 | + } | ||
1464 | + | ||
1465 | endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints]; | ||
1466 | ++ifp->desc.bNumEndpoints; | ||
1467 | |||
1468 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
1469 | index 496d6a558793..780db8bb2262 100644 | ||
1470 | --- a/drivers/usb/core/hub.c | ||
1471 | +++ b/drivers/usb/core/hub.c | ||
1472 | @@ -101,8 +101,7 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); | ||
1473 | |||
1474 | static void hub_release(struct kref *kref); | ||
1475 | static int usb_reset_and_verify_device(struct usb_device *udev); | ||
1476 | -static void hub_usb3_port_prepare_disable(struct usb_hub *hub, | ||
1477 | - struct usb_port *port_dev); | ||
1478 | +static int hub_port_disable(struct usb_hub *hub, int port1, int set_state); | ||
1479 | |||
1480 | static inline char *portspeed(struct usb_hub *hub, int portstatus) | ||
1481 | { | ||
1482 | @@ -885,34 +884,6 @@ static int hub_set_port_link_state(struct usb_hub *hub, int port1, | ||
1483 | } | ||
1484 | |||
1485 | /* | ||
1486 | - * USB-3 does not have a similar link state as USB-2 that will avoid negotiating | ||
1487 | - * a connection with a plugged-in cable but will signal the host when the cable | ||
1488 | - * is unplugged. Disable remote wake and set link state to U3 for USB-3 devices | ||
1489 | - */ | ||
1490 | -static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | ||
1491 | -{ | ||
1492 | - struct usb_port *port_dev = hub->ports[port1 - 1]; | ||
1493 | - struct usb_device *hdev = hub->hdev; | ||
1494 | - int ret = 0; | ||
1495 | - | ||
1496 | - if (!hub->error) { | ||
1497 | - if (hub_is_superspeed(hub->hdev)) { | ||
1498 | - hub_usb3_port_prepare_disable(hub, port_dev); | ||
1499 | - ret = hub_set_port_link_state(hub, port_dev->portnum, | ||
1500 | - USB_SS_PORT_LS_U3); | ||
1501 | - } else { | ||
1502 | - ret = usb_clear_port_feature(hdev, port1, | ||
1503 | - USB_PORT_FEAT_ENABLE); | ||
1504 | - } | ||
1505 | - } | ||
1506 | - if (port_dev->child && set_state) | ||
1507 | - usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED); | ||
1508 | - if (ret && ret != -ENODEV) | ||
1509 | - dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret); | ||
1510 | - return ret; | ||
1511 | -} | ||
1512 | - | ||
1513 | -/* | ||
1514 | * Disable a port and mark a logical connect-change event, so that some | ||
1515 | * time later hub_wq will disconnect() any existing usb_device on the port | ||
1516 | * and will re-enumerate if there actually is a device attached. | ||
1517 | @@ -4086,6 +4057,34 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port, | ||
1518 | |||
1519 | #endif /* CONFIG_PM */ | ||
1520 | |||
1521 | +/* | ||
1522 | + * USB-3 does not have a similar link state as USB-2 that will avoid negotiating | ||
1523 | + * a connection with a plugged-in cable but will signal the host when the cable | ||
1524 | + * is unplugged. Disable remote wake and set link state to U3 for USB-3 devices | ||
1525 | + */ | ||
1526 | +static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | ||
1527 | +{ | ||
1528 | + struct usb_port *port_dev = hub->ports[port1 - 1]; | ||
1529 | + struct usb_device *hdev = hub->hdev; | ||
1530 | + int ret = 0; | ||
1531 | + | ||
1532 | + if (!hub->error) { | ||
1533 | + if (hub_is_superspeed(hub->hdev)) { | ||
1534 | + hub_usb3_port_prepare_disable(hub, port_dev); | ||
1535 | + ret = hub_set_port_link_state(hub, port_dev->portnum, | ||
1536 | + USB_SS_PORT_LS_U3); | ||
1537 | + } else { | ||
1538 | + ret = usb_clear_port_feature(hdev, port1, | ||
1539 | + USB_PORT_FEAT_ENABLE); | ||
1540 | + } | ||
1541 | + } | ||
1542 | + if (port_dev->child && set_state) | ||
1543 | + usb_set_device_state(port_dev->child, USB_STATE_NOTATTACHED); | ||
1544 | + if (ret && ret != -ENODEV) | ||
1545 | + dev_err(&port_dev->dev, "cannot disable (err = %d)\n", ret); | ||
1546 | + return ret; | ||
1547 | +} | ||
1548 | + | ||
1549 | |||
1550 | /* USB 2.0 spec, 7.1.7.3 / fig 7-29: | ||
1551 | * | ||
1552 | diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h | ||
1553 | index 78be201d81f4..68d11d7d4028 100644 | ||
1554 | --- a/drivers/usb/dwc3/core.h | ||
1555 | +++ b/drivers/usb/dwc3/core.h | ||
1556 | @@ -42,9 +42,7 @@ | ||
1557 | #define DWC3_XHCI_RESOURCES_NUM 2 | ||
1558 | |||
1559 | #define DWC3_SCRATCHBUF_SIZE 4096 /* each buffer is assumed to be 4KiB */ | ||
1560 | -#define DWC3_EVENT_SIZE 4 /* bytes */ | ||
1561 | -#define DWC3_EVENT_MAX_NUM 64 /* 2 events/endpoint */ | ||
1562 | -#define DWC3_EVENT_BUFFERS_SIZE (DWC3_EVENT_SIZE * DWC3_EVENT_MAX_NUM) | ||
1563 | +#define DWC3_EVENT_BUFFERS_SIZE 4096 | ||
1564 | #define DWC3_EVENT_TYPE_MASK 0xfe | ||
1565 | |||
1566 | #define DWC3_EVENT_TYPE_DEV 0 | ||
1567 | diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c | ||
1568 | index 3d731d1b5c60..d2c0c1a8d979 100644 | ||
1569 | --- a/drivers/usb/dwc3/dwc3-pci.c | ||
1570 | +++ b/drivers/usb/dwc3/dwc3-pci.c | ||
1571 | @@ -37,6 +37,7 @@ | ||
1572 | #define PCI_DEVICE_ID_INTEL_BXT 0x0aaa | ||
1573 | #define PCI_DEVICE_ID_INTEL_APL 0x5aaa | ||
1574 | #define PCI_DEVICE_ID_INTEL_KBP 0xa2b0 | ||
1575 | +#define PCI_DEVICE_ID_INTEL_GLK 0x31aa | ||
1576 | |||
1577 | static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; | ||
1578 | static const struct acpi_gpio_params cs_gpios = { 1, 0, false }; | ||
1579 | @@ -216,6 +217,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | ||
1580 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), }, | ||
1581 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, | ||
1582 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), }, | ||
1583 | + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), }, | ||
1584 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, | ||
1585 | { } /* Terminating Entry */ | ||
1586 | }; | ||
1587 | diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c | ||
1588 | index b13912d5fa99..f13e9e9fb834 100644 | ||
1589 | --- a/drivers/usb/dwc3/ep0.c | ||
1590 | +++ b/drivers/usb/dwc3/ep0.c | ||
1591 | @@ -55,20 +55,13 @@ static const char *dwc3_ep0_state_string(enum dwc3_ep0_state state) | ||
1592 | } | ||
1593 | } | ||
1594 | |||
1595 | -static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma, | ||
1596 | - u32 len, u32 type, bool chain) | ||
1597 | +static void dwc3_ep0_prepare_one_trb(struct dwc3 *dwc, u8 epnum, | ||
1598 | + dma_addr_t buf_dma, u32 len, u32 type, bool chain) | ||
1599 | { | ||
1600 | - struct dwc3_gadget_ep_cmd_params params; | ||
1601 | struct dwc3_trb *trb; | ||
1602 | struct dwc3_ep *dep; | ||
1603 | |||
1604 | - int ret; | ||
1605 | - | ||
1606 | dep = dwc->eps[epnum]; | ||
1607 | - if (dep->flags & DWC3_EP_BUSY) { | ||
1608 | - dwc3_trace(trace_dwc3_ep0, "%s still busy", dep->name); | ||
1609 | - return 0; | ||
1610 | - } | ||
1611 | |||
1612 | trb = &dwc->ep0_trb[dep->free_slot]; | ||
1613 | |||
1614 | @@ -89,15 +82,25 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma, | ||
1615 | trb->ctrl |= (DWC3_TRB_CTRL_IOC | ||
1616 | | DWC3_TRB_CTRL_LST); | ||
1617 | |||
1618 | - if (chain) | ||
1619 | + trace_dwc3_prepare_trb(dep, trb); | ||
1620 | +} | ||
1621 | + | ||
1622 | +static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum) | ||
1623 | +{ | ||
1624 | + struct dwc3_gadget_ep_cmd_params params; | ||
1625 | + struct dwc3_ep *dep; | ||
1626 | + int ret; | ||
1627 | + | ||
1628 | + dep = dwc->eps[epnum]; | ||
1629 | + if (dep->flags & DWC3_EP_BUSY) { | ||
1630 | + dwc3_trace(trace_dwc3_ep0, "%s still busy", dep->name); | ||
1631 | return 0; | ||
1632 | + } | ||
1633 | |||
1634 | memset(¶ms, 0, sizeof(params)); | ||
1635 | params.param0 = upper_32_bits(dwc->ep0_trb_addr); | ||
1636 | params.param1 = lower_32_bits(dwc->ep0_trb_addr); | ||
1637 | |||
1638 | - trace_dwc3_prepare_trb(dep, trb); | ||
1639 | - | ||
1640 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, | ||
1641 | DWC3_DEPCMD_STARTTRANSFER, ¶ms); | ||
1642 | if (ret < 0) { | ||
1643 | @@ -311,8 +314,9 @@ void dwc3_ep0_out_start(struct dwc3 *dwc) | ||
1644 | { | ||
1645 | int ret; | ||
1646 | |||
1647 | - ret = dwc3_ep0_start_trans(dwc, 0, dwc->ctrl_req_addr, 8, | ||
1648 | + dwc3_ep0_prepare_one_trb(dwc, 0, dwc->ctrl_req_addr, 8, | ||
1649 | DWC3_TRBCTL_CONTROL_SETUP, false); | ||
1650 | + ret = dwc3_ep0_start_trans(dwc, 0); | ||
1651 | WARN_ON(ret < 0); | ||
1652 | } | ||
1653 | |||
1654 | @@ -871,9 +875,9 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | ||
1655 | |||
1656 | dwc->ep0_next_event = DWC3_EP0_COMPLETE; | ||
1657 | |||
1658 | - ret = dwc3_ep0_start_trans(dwc, epnum, | ||
1659 | - dwc->ctrl_req_addr, 0, | ||
1660 | - DWC3_TRBCTL_CONTROL_DATA, false); | ||
1661 | + dwc3_ep0_prepare_one_trb(dwc, epnum, dwc->ctrl_req_addr, | ||
1662 | + 0, DWC3_TRBCTL_CONTROL_DATA, false); | ||
1663 | + ret = dwc3_ep0_start_trans(dwc, epnum); | ||
1664 | WARN_ON(ret < 0); | ||
1665 | } | ||
1666 | } | ||
1667 | @@ -955,9 +959,10 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | ||
1668 | req->direction = !!dep->number; | ||
1669 | |||
1670 | if (req->request.length == 0) { | ||
1671 | - ret = dwc3_ep0_start_trans(dwc, dep->number, | ||
1672 | + dwc3_ep0_prepare_one_trb(dwc, dep->number, | ||
1673 | dwc->ctrl_req_addr, 0, | ||
1674 | DWC3_TRBCTL_CONTROL_DATA, false); | ||
1675 | + ret = dwc3_ep0_start_trans(dwc, dep->number); | ||
1676 | } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) | ||
1677 | && (dep->number == 0)) { | ||
1678 | u32 transfer_size = 0; | ||
1679 | @@ -975,7 +980,7 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | ||
1680 | if (req->request.length > DWC3_EP0_BOUNCE_SIZE) { | ||
1681 | transfer_size = ALIGN(req->request.length - maxpacket, | ||
1682 | maxpacket); | ||
1683 | - ret = dwc3_ep0_start_trans(dwc, dep->number, | ||
1684 | + dwc3_ep0_prepare_one_trb(dwc, dep->number, | ||
1685 | req->request.dma, | ||
1686 | transfer_size, | ||
1687 | DWC3_TRBCTL_CONTROL_DATA, | ||
1688 | @@ -987,9 +992,10 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | ||
1689 | |||
1690 | dwc->ep0_bounced = true; | ||
1691 | |||
1692 | - ret = dwc3_ep0_start_trans(dwc, dep->number, | ||
1693 | + dwc3_ep0_prepare_one_trb(dwc, dep->number, | ||
1694 | dwc->ep0_bounce_addr, transfer_size, | ||
1695 | DWC3_TRBCTL_CONTROL_DATA, false); | ||
1696 | + ret = dwc3_ep0_start_trans(dwc, dep->number); | ||
1697 | } else { | ||
1698 | ret = usb_gadget_map_request(&dwc->gadget, &req->request, | ||
1699 | dep->number); | ||
1700 | @@ -998,9 +1004,10 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | ||
1701 | return; | ||
1702 | } | ||
1703 | |||
1704 | - ret = dwc3_ep0_start_trans(dwc, dep->number, req->request.dma, | ||
1705 | + dwc3_ep0_prepare_one_trb(dwc, dep->number, req->request.dma, | ||
1706 | req->request.length, DWC3_TRBCTL_CONTROL_DATA, | ||
1707 | false); | ||
1708 | + ret = dwc3_ep0_start_trans(dwc, dep->number); | ||
1709 | } | ||
1710 | |||
1711 | WARN_ON(ret < 0); | ||
1712 | @@ -1014,8 +1021,9 @@ static int dwc3_ep0_start_control_status(struct dwc3_ep *dep) | ||
1713 | type = dwc->three_stage_setup ? DWC3_TRBCTL_CONTROL_STATUS3 | ||
1714 | : DWC3_TRBCTL_CONTROL_STATUS2; | ||
1715 | |||
1716 | - return dwc3_ep0_start_trans(dwc, dep->number, | ||
1717 | + dwc3_ep0_prepare_one_trb(dwc, dep->number, | ||
1718 | dwc->ctrl_req_addr, 0, type, false); | ||
1719 | + return dwc3_ep0_start_trans(dwc, dep->number); | ||
1720 | } | ||
1721 | |||
1722 | static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) | ||
1723 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c | ||
1724 | index 5ae2b7d3a74a..210ff64857e1 100644 | ||
1725 | --- a/drivers/usb/dwc3/gadget.c | ||
1726 | +++ b/drivers/usb/dwc3/gadget.c | ||
1727 | @@ -259,11 +259,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, | ||
1728 | if (req->request.status == -EINPROGRESS) | ||
1729 | req->request.status = status; | ||
1730 | |||
1731 | - if (dwc->ep0_bounced && dep->number == 0) | ||
1732 | + if (dwc->ep0_bounced && dep->number <= 1) | ||
1733 | dwc->ep0_bounced = false; | ||
1734 | - else | ||
1735 | - usb_gadget_unmap_request(&dwc->gadget, &req->request, | ||
1736 | - req->direction); | ||
1737 | + | ||
1738 | + usb_gadget_unmap_request(&dwc->gadget, &req->request, | ||
1739 | + req->direction); | ||
1740 | |||
1741 | dev_dbg(dwc->dev, "request %p from %s completed %d/%d ===> %d\n", | ||
1742 | req, dep->name, req->request.actual, | ||
1743 | diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c | ||
1744 | index 739b5e2d8adb..e2641d4dfdd6 100644 | ||
1745 | --- a/drivers/usb/gadget/composite.c | ||
1746 | +++ b/drivers/usb/gadget/composite.c | ||
1747 | @@ -152,7 +152,7 @@ ep_found: | ||
1748 | |||
1749 | if (g->speed == USB_SPEED_HIGH && (usb_endpoint_xfer_isoc(_ep->desc) || | ||
1750 | usb_endpoint_xfer_int(_ep->desc))) | ||
1751 | - _ep->mult = usb_endpoint_maxp(_ep->desc) & 0x7ff; | ||
1752 | + _ep->mult = ((usb_endpoint_maxp(_ep->desc) & 0x1800) >> 11) + 1; | ||
1753 | |||
1754 | if (!want_comp_desc) | ||
1755 | return 0; | ||
1756 | @@ -1601,9 +1601,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | ||
1757 | value = min(w_length, (u16) 1); | ||
1758 | break; | ||
1759 | |||
1760 | - /* function drivers must handle get/set altsetting; if there's | ||
1761 | - * no get() method, we know only altsetting zero works. | ||
1762 | - */ | ||
1763 | + /* function drivers must handle get/set altsetting */ | ||
1764 | case USB_REQ_SET_INTERFACE: | ||
1765 | if (ctrl->bRequestType != USB_RECIP_INTERFACE) | ||
1766 | goto unknown; | ||
1767 | @@ -1612,7 +1610,13 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | ||
1768 | f = cdev->config->interface[intf]; | ||
1769 | if (!f) | ||
1770 | break; | ||
1771 | - if (w_value && !f->set_alt) | ||
1772 | + | ||
1773 | + /* | ||
1774 | + * If there's no get_alt() method, we know only altsetting zero | ||
1775 | + * works. There is no need to check if set_alt() is not NULL | ||
1776 | + * as we check this in usb_add_function(). | ||
1777 | + */ | ||
1778 | + if (w_value && !f->get_alt) | ||
1779 | break; | ||
1780 | value = f->set_alt(f, w_index, w_value); | ||
1781 | if (value == USB_GADGET_DELAYED_STATUS) { | ||
1782 | diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c | ||
1783 | index e57f48f9528f..de014436fb22 100644 | ||
1784 | --- a/drivers/usb/gadget/legacy/inode.c | ||
1785 | +++ b/drivers/usb/gadget/legacy/inode.c | ||
1786 | @@ -1125,7 +1125,7 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | ||
1787 | /* data and/or status stage for control request */ | ||
1788 | } else if (dev->state == STATE_DEV_SETUP) { | ||
1789 | |||
1790 | - /* IN DATA+STATUS caller makes len <= wLength */ | ||
1791 | + len = min_t(size_t, len, dev->setup_wLength); | ||
1792 | if (dev->setup_in) { | ||
1793 | retval = setup_req (dev->gadget->ep0, dev->req, len); | ||
1794 | if (retval == 0) { | ||
1795 | @@ -1755,10 +1755,12 @@ static struct usb_gadget_driver probe_driver = { | ||
1796 | * such as configuration notifications. | ||
1797 | */ | ||
1798 | |||
1799 | -static int is_valid_config (struct usb_config_descriptor *config) | ||
1800 | +static int is_valid_config(struct usb_config_descriptor *config, | ||
1801 | + unsigned int total) | ||
1802 | { | ||
1803 | return config->bDescriptorType == USB_DT_CONFIG | ||
1804 | && config->bLength == USB_DT_CONFIG_SIZE | ||
1805 | + && total >= USB_DT_CONFIG_SIZE | ||
1806 | && config->bConfigurationValue != 0 | ||
1807 | && (config->bmAttributes & USB_CONFIG_ATT_ONE) != 0 | ||
1808 | && (config->bmAttributes & USB_CONFIG_ATT_WAKEUP) == 0; | ||
1809 | @@ -1783,7 +1785,8 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | ||
1810 | } | ||
1811 | spin_unlock_irq(&dev->lock); | ||
1812 | |||
1813 | - if (len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) | ||
1814 | + if ((len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) || | ||
1815 | + (len > PAGE_SIZE * 4)) | ||
1816 | return -EINVAL; | ||
1817 | |||
1818 | /* we might need to change message format someday */ | ||
1819 | @@ -1807,7 +1810,8 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | ||
1820 | /* full or low speed config */ | ||
1821 | dev->config = (void *) kbuf; | ||
1822 | total = le16_to_cpu(dev->config->wTotalLength); | ||
1823 | - if (!is_valid_config (dev->config) || total >= length) | ||
1824 | + if (!is_valid_config(dev->config, total) || | ||
1825 | + total > length - USB_DT_DEVICE_SIZE) | ||
1826 | goto fail; | ||
1827 | kbuf += total; | ||
1828 | length -= total; | ||
1829 | @@ -1816,10 +1820,13 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | ||
1830 | if (kbuf [1] == USB_DT_CONFIG) { | ||
1831 | dev->hs_config = (void *) kbuf; | ||
1832 | total = le16_to_cpu(dev->hs_config->wTotalLength); | ||
1833 | - if (!is_valid_config (dev->hs_config) || total >= length) | ||
1834 | + if (!is_valid_config(dev->hs_config, total) || | ||
1835 | + total > length - USB_DT_DEVICE_SIZE) | ||
1836 | goto fail; | ||
1837 | kbuf += total; | ||
1838 | length -= total; | ||
1839 | + } else { | ||
1840 | + dev->hs_config = NULL; | ||
1841 | } | ||
1842 | |||
1843 | /* could support multiple configs, using another encoding! */ | ||
1844 | diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c | ||
1845 | index dde44450dfa9..22d067cd5aa3 100644 | ||
1846 | --- a/drivers/usb/gadget/udc/dummy_hcd.c | ||
1847 | +++ b/drivers/usb/gadget/udc/dummy_hcd.c | ||
1848 | @@ -330,7 +330,7 @@ static void nuke(struct dummy *dum, struct dummy_ep *ep) | ||
1849 | /* caller must hold lock */ | ||
1850 | static void stop_activity(struct dummy *dum) | ||
1851 | { | ||
1852 | - struct dummy_ep *ep; | ||
1853 | + int i; | ||
1854 | |||
1855 | /* prevent any more requests */ | ||
1856 | dum->address = 0; | ||
1857 | @@ -338,8 +338,8 @@ static void stop_activity(struct dummy *dum) | ||
1858 | /* The timer is left running so that outstanding URBs can fail */ | ||
1859 | |||
1860 | /* nuke any pending requests first, so driver i/o is quiesced */ | ||
1861 | - list_for_each_entry(ep, &dum->gadget.ep_list, ep.ep_list) | ||
1862 | - nuke(dum, ep); | ||
1863 | + for (i = 0; i < DUMMY_ENDPOINTS; ++i) | ||
1864 | + nuke(dum, &dum->ep[i]); | ||
1865 | |||
1866 | /* driver now does any non-usb quiescing necessary */ | ||
1867 | } | ||
1868 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c | ||
1869 | index b9d6940479da..e9675e8f0e54 100644 | ||
1870 | --- a/drivers/usb/host/xhci-hub.c | ||
1871 | +++ b/drivers/usb/host/xhci-hub.c | ||
1872 | @@ -1346,6 +1346,35 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | ||
1873 | return 0; | ||
1874 | } | ||
1875 | |||
1876 | +/* | ||
1877 | + * Workaround for missing Cold Attach Status (CAS) if device re-plugged in S3. | ||
1878 | + * warm reset a USB3 device stuck in polling or compliance mode after resume. | ||
1879 | + * See Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8 | ||
1880 | + */ | ||
1881 | +static bool xhci_port_missing_cas_quirk(int port_index, | ||
1882 | + __le32 __iomem **port_array) | ||
1883 | +{ | ||
1884 | + u32 portsc; | ||
1885 | + | ||
1886 | + portsc = readl(port_array[port_index]); | ||
1887 | + | ||
1888 | + /* if any of these are set we are not stuck */ | ||
1889 | + if (portsc & (PORT_CONNECT | PORT_CAS)) | ||
1890 | + return false; | ||
1891 | + | ||
1892 | + if (((portsc & PORT_PLS_MASK) != XDEV_POLLING) && | ||
1893 | + ((portsc & PORT_PLS_MASK) != XDEV_COMP_MODE)) | ||
1894 | + return false; | ||
1895 | + | ||
1896 | + /* clear wakeup/change bits, and do a warm port reset */ | ||
1897 | + portsc &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS); | ||
1898 | + portsc |= PORT_WR; | ||
1899 | + writel(portsc, port_array[port_index]); | ||
1900 | + /* flush write */ | ||
1901 | + readl(port_array[port_index]); | ||
1902 | + return true; | ||
1903 | +} | ||
1904 | + | ||
1905 | int xhci_bus_resume(struct usb_hcd *hcd) | ||
1906 | { | ||
1907 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | ||
1908 | @@ -1383,6 +1412,14 @@ int xhci_bus_resume(struct usb_hcd *hcd) | ||
1909 | u32 temp; | ||
1910 | |||
1911 | temp = readl(port_array[port_index]); | ||
1912 | + | ||
1913 | + /* warm reset CAS limited ports stuck in polling/compliance */ | ||
1914 | + if ((xhci->quirks & XHCI_MISSING_CAS) && | ||
1915 | + (hcd->speed >= HCD_USB3) && | ||
1916 | + xhci_port_missing_cas_quirk(port_index, port_array)) { | ||
1917 | + xhci_dbg(xhci, "reset stuck port %d\n", port_index); | ||
1918 | + continue; | ||
1919 | + } | ||
1920 | if (DEV_SUPERSPEED_ANY(temp)) | ||
1921 | temp &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS); | ||
1922 | else | ||
1923 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c | ||
1924 | index 8ea2c05beca2..998a738e6359 100644 | ||
1925 | --- a/drivers/usb/host/xhci-mem.c | ||
1926 | +++ b/drivers/usb/host/xhci-mem.c | ||
1927 | @@ -964,6 +964,40 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id) | ||
1928 | xhci->devs[slot_id] = NULL; | ||
1929 | } | ||
1930 | |||
1931 | +/* | ||
1932 | + * Free a virt_device structure. | ||
1933 | + * If the virt_device added a tt_info (a hub) and has children pointing to | ||
1934 | + * that tt_info, then free the child first. Recursive. | ||
1935 | + * We can't rely on udev at this point to find child-parent relationships. | ||
1936 | + */ | ||
1937 | +void xhci_free_virt_devices_depth_first(struct xhci_hcd *xhci, int slot_id) | ||
1938 | +{ | ||
1939 | + struct xhci_virt_device *vdev; | ||
1940 | + struct list_head *tt_list_head; | ||
1941 | + struct xhci_tt_bw_info *tt_info, *next; | ||
1942 | + int i; | ||
1943 | + | ||
1944 | + vdev = xhci->devs[slot_id]; | ||
1945 | + if (!vdev) | ||
1946 | + return; | ||
1947 | + | ||
1948 | + tt_list_head = &(xhci->rh_bw[vdev->real_port - 1].tts); | ||
1949 | + list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) { | ||
1950 | + /* is this a hub device that added a tt_info to the tts list */ | ||
1951 | + if (tt_info->slot_id == slot_id) { | ||
1952 | + /* are any devices using this tt_info? */ | ||
1953 | + for (i = 1; i < HCS_MAX_SLOTS(xhci->hcs_params1); i++) { | ||
1954 | + vdev = xhci->devs[i]; | ||
1955 | + if (vdev && (vdev->tt_info == tt_info)) | ||
1956 | + xhci_free_virt_devices_depth_first( | ||
1957 | + xhci, i); | ||
1958 | + } | ||
1959 | + } | ||
1960 | + } | ||
1961 | + /* we are now at a leaf device */ | ||
1962 | + xhci_free_virt_device(xhci, slot_id); | ||
1963 | +} | ||
1964 | + | ||
1965 | int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, | ||
1966 | struct usb_device *udev, gfp_t flags) | ||
1967 | { | ||
1968 | @@ -1795,7 +1829,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | ||
1969 | int size; | ||
1970 | int i, j, num_ports; | ||
1971 | |||
1972 | - del_timer_sync(&xhci->cmd_timer); | ||
1973 | + cancel_delayed_work_sync(&xhci->cmd_timer); | ||
1974 | |||
1975 | /* Free the Event Ring Segment Table and the actual Event Ring */ | ||
1976 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | ||
1977 | @@ -1828,8 +1862,8 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | ||
1978 | } | ||
1979 | } | ||
1980 | |||
1981 | - for (i = 1; i < MAX_HC_SLOTS; ++i) | ||
1982 | - xhci_free_virt_device(xhci, i); | ||
1983 | + for (i = HCS_MAX_SLOTS(xhci->hcs_params1); i > 0; i--) | ||
1984 | + xhci_free_virt_devices_depth_first(xhci, i); | ||
1985 | |||
1986 | dma_pool_destroy(xhci->segment_pool); | ||
1987 | xhci->segment_pool = NULL; | ||
1988 | @@ -2361,9 +2395,9 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | ||
1989 | |||
1990 | INIT_LIST_HEAD(&xhci->cmd_list); | ||
1991 | |||
1992 | - /* init command timeout timer */ | ||
1993 | - setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout, | ||
1994 | - (unsigned long)xhci); | ||
1995 | + /* init command timeout work */ | ||
1996 | + INIT_DELAYED_WORK(&xhci->cmd_timer, xhci_handle_command_timeout); | ||
1997 | + init_completion(&xhci->cmd_ring_stop_completion); | ||
1998 | |||
1999 | page_size = readl(&xhci->op_regs->page_size); | ||
2000 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, | ||
2001 | @@ -2402,7 +2436,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | ||
2002 | * "physically contiguous and 64-byte (cache line) aligned". | ||
2003 | */ | ||
2004 | xhci->dcbaa = dma_alloc_coherent(dev, sizeof(*xhci->dcbaa), &dma, | ||
2005 | - GFP_KERNEL); | ||
2006 | + flags); | ||
2007 | if (!xhci->dcbaa) | ||
2008 | goto fail; | ||
2009 | memset(xhci->dcbaa, 0, sizeof *(xhci->dcbaa)); | ||
2010 | @@ -2498,7 +2532,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | ||
2011 | |||
2012 | xhci->erst.entries = dma_alloc_coherent(dev, | ||
2013 | sizeof(struct xhci_erst_entry) * ERST_NUM_SEGS, &dma, | ||
2014 | - GFP_KERNEL); | ||
2015 | + flags); | ||
2016 | if (!xhci->erst.entries) | ||
2017 | goto fail; | ||
2018 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, | ||
2019 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c | ||
2020 | index cf147ccac7d3..dd262f418140 100644 | ||
2021 | --- a/drivers/usb/host/xhci-pci.c | ||
2022 | +++ b/drivers/usb/host/xhci-pci.c | ||
2023 | @@ -51,6 +51,7 @@ | ||
2024 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f | ||
2025 | #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 | ||
2026 | #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 | ||
2027 | +#define PCI_DEVICE_ID_INTEL_APL_XHCI 0x5aa8 | ||
2028 | |||
2029 | static const char hcd_name[] = "xhci_hcd"; | ||
2030 | |||
2031 | @@ -165,9 +166,15 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | ||
2032 | pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || | ||
2033 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || | ||
2034 | pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || | ||
2035 | - pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) { | ||
2036 | + pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI || | ||
2037 | + pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) { | ||
2038 | xhci->quirks |= XHCI_PME_STUCK_QUIRK; | ||
2039 | } | ||
2040 | + if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
2041 | + (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || | ||
2042 | + pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) | ||
2043 | + xhci->quirks |= XHCI_MISSING_CAS; | ||
2044 | + | ||
2045 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && | ||
2046 | pdev->device == PCI_DEVICE_ID_EJ168) { | ||
2047 | xhci->quirks |= XHCI_RESET_ON_RESUME; | ||
2048 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c | ||
2049 | index 62a5c8d5e028..fa5d8c2f6982 100644 | ||
2050 | --- a/drivers/usb/host/xhci-ring.c | ||
2051 | +++ b/drivers/usb/host/xhci-ring.c | ||
2052 | @@ -280,23 +280,76 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci) | ||
2053 | readl(&xhci->dba->doorbell[0]); | ||
2054 | } | ||
2055 | |||
2056 | -static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | ||
2057 | +static bool xhci_mod_cmd_timer(struct xhci_hcd *xhci, unsigned long delay) | ||
2058 | +{ | ||
2059 | + return mod_delayed_work(system_wq, &xhci->cmd_timer, delay); | ||
2060 | +} | ||
2061 | + | ||
2062 | +static struct xhci_command *xhci_next_queued_cmd(struct xhci_hcd *xhci) | ||
2063 | +{ | ||
2064 | + return list_first_entry_or_null(&xhci->cmd_list, struct xhci_command, | ||
2065 | + cmd_list); | ||
2066 | +} | ||
2067 | + | ||
2068 | +/* | ||
2069 | + * Turn all commands on command ring with status set to "aborted" to no-op trbs. | ||
2070 | + * If there are other commands waiting then restart the ring and kick the timer. | ||
2071 | + * This must be called with command ring stopped and xhci->lock held. | ||
2072 | + */ | ||
2073 | +static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, | ||
2074 | + struct xhci_command *cur_cmd) | ||
2075 | +{ | ||
2076 | + struct xhci_command *i_cmd; | ||
2077 | + u32 cycle_state; | ||
2078 | + | ||
2079 | + /* Turn all aborted commands in list to no-ops, then restart */ | ||
2080 | + list_for_each_entry(i_cmd, &xhci->cmd_list, cmd_list) { | ||
2081 | + | ||
2082 | + if (i_cmd->status != COMP_CMD_ABORT) | ||
2083 | + continue; | ||
2084 | + | ||
2085 | + i_cmd->status = COMP_CMD_STOP; | ||
2086 | + | ||
2087 | + xhci_dbg(xhci, "Turn aborted command %p to no-op\n", | ||
2088 | + i_cmd->command_trb); | ||
2089 | + /* get cycle state from the original cmd trb */ | ||
2090 | + cycle_state = le32_to_cpu( | ||
2091 | + i_cmd->command_trb->generic.field[3]) & TRB_CYCLE; | ||
2092 | + /* modify the command trb to no-op command */ | ||
2093 | + i_cmd->command_trb->generic.field[0] = 0; | ||
2094 | + i_cmd->command_trb->generic.field[1] = 0; | ||
2095 | + i_cmd->command_trb->generic.field[2] = 0; | ||
2096 | + i_cmd->command_trb->generic.field[3] = cpu_to_le32( | ||
2097 | + TRB_TYPE(TRB_CMD_NOOP) | cycle_state); | ||
2098 | + | ||
2099 | + /* | ||
2100 | + * caller waiting for completion is called when command | ||
2101 | + * completion event is received for these no-op commands | ||
2102 | + */ | ||
2103 | + } | ||
2104 | + | ||
2105 | + xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; | ||
2106 | + | ||
2107 | + /* ring command ring doorbell to restart the command ring */ | ||
2108 | + if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && | ||
2109 | + !(xhci->xhc_state & XHCI_STATE_DYING)) { | ||
2110 | + xhci->current_cmd = cur_cmd; | ||
2111 | + xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT); | ||
2112 | + xhci_ring_cmd_db(xhci); | ||
2113 | + } | ||
2114 | +} | ||
2115 | + | ||
2116 | +/* Must be called with xhci->lock held, releases and aquires lock back */ | ||
2117 | +static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags) | ||
2118 | { | ||
2119 | u64 temp_64; | ||
2120 | int ret; | ||
2121 | |||
2122 | xhci_dbg(xhci, "Abort command ring\n"); | ||
2123 | |||
2124 | - temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | ||
2125 | - xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; | ||
2126 | + reinit_completion(&xhci->cmd_ring_stop_completion); | ||
2127 | |||
2128 | - /* | ||
2129 | - * Writing the CMD_RING_ABORT bit should cause a cmd completion event, | ||
2130 | - * however on some host hw the CMD_RING_RUNNING bit is correctly cleared | ||
2131 | - * but the completion event in never sent. Use the cmd timeout timer to | ||
2132 | - * handle those cases. Use twice the time to cover the bit polling retry | ||
2133 | - */ | ||
2134 | - mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT)); | ||
2135 | + temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | ||
2136 | xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, | ||
2137 | &xhci->op_regs->cmd_ring); | ||
2138 | |||
2139 | @@ -316,16 +369,30 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) | ||
2140 | udelay(1000); | ||
2141 | ret = xhci_handshake(&xhci->op_regs->cmd_ring, | ||
2142 | CMD_RING_RUNNING, 0, 3 * 1000 * 1000); | ||
2143 | - if (ret == 0) | ||
2144 | - return 0; | ||
2145 | - | ||
2146 | - xhci_err(xhci, "Stopped the command ring failed, " | ||
2147 | - "maybe the host is dead\n"); | ||
2148 | - del_timer(&xhci->cmd_timer); | ||
2149 | - xhci->xhc_state |= XHCI_STATE_DYING; | ||
2150 | - xhci_quiesce(xhci); | ||
2151 | - xhci_halt(xhci); | ||
2152 | - return -ESHUTDOWN; | ||
2153 | + if (ret < 0) { | ||
2154 | + xhci_err(xhci, "Stopped the command ring failed, " | ||
2155 | + "maybe the host is dead\n"); | ||
2156 | + xhci->xhc_state |= XHCI_STATE_DYING; | ||
2157 | + xhci_quiesce(xhci); | ||
2158 | + xhci_halt(xhci); | ||
2159 | + return -ESHUTDOWN; | ||
2160 | + } | ||
2161 | + } | ||
2162 | + /* | ||
2163 | + * Writing the CMD_RING_ABORT bit should cause a cmd completion event, | ||
2164 | + * however on some host hw the CMD_RING_RUNNING bit is correctly cleared | ||
2165 | + * but the completion event in never sent. Wait 2 secs (arbitrary | ||
2166 | + * number) to handle those cases after negation of CMD_RING_RUNNING. | ||
2167 | + */ | ||
2168 | + spin_unlock_irqrestore(&xhci->lock, flags); | ||
2169 | + ret = wait_for_completion_timeout(&xhci->cmd_ring_stop_completion, | ||
2170 | + msecs_to_jiffies(2000)); | ||
2171 | + spin_lock_irqsave(&xhci->lock, flags); | ||
2172 | + if (!ret) { | ||
2173 | + xhci_dbg(xhci, "No stop event for abort, ring start fail?\n"); | ||
2174 | + xhci_cleanup_command_queue(xhci); | ||
2175 | + } else { | ||
2176 | + xhci_handle_stopped_cmd_ring(xhci, xhci_next_queued_cmd(xhci)); | ||
2177 | } | ||
2178 | |||
2179 | return 0; | ||
2180 | @@ -1208,101 +1275,62 @@ void xhci_cleanup_command_queue(struct xhci_hcd *xhci) | ||
2181 | xhci_complete_del_and_free_cmd(cur_cmd, COMP_CMD_ABORT); | ||
2182 | } | ||
2183 | |||
2184 | -/* | ||
2185 | - * Turn all commands on command ring with status set to "aborted" to no-op trbs. | ||
2186 | - * If there are other commands waiting then restart the ring and kick the timer. | ||
2187 | - * This must be called with command ring stopped and xhci->lock held. | ||
2188 | - */ | ||
2189 | -static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, | ||
2190 | - struct xhci_command *cur_cmd) | ||
2191 | -{ | ||
2192 | - struct xhci_command *i_cmd, *tmp_cmd; | ||
2193 | - u32 cycle_state; | ||
2194 | - | ||
2195 | - /* Turn all aborted commands in list to no-ops, then restart */ | ||
2196 | - list_for_each_entry_safe(i_cmd, tmp_cmd, &xhci->cmd_list, | ||
2197 | - cmd_list) { | ||
2198 | - | ||
2199 | - if (i_cmd->status != COMP_CMD_ABORT) | ||
2200 | - continue; | ||
2201 | - | ||
2202 | - i_cmd->status = COMP_CMD_STOP; | ||
2203 | - | ||
2204 | - xhci_dbg(xhci, "Turn aborted command %p to no-op\n", | ||
2205 | - i_cmd->command_trb); | ||
2206 | - /* get cycle state from the original cmd trb */ | ||
2207 | - cycle_state = le32_to_cpu( | ||
2208 | - i_cmd->command_trb->generic.field[3]) & TRB_CYCLE; | ||
2209 | - /* modify the command trb to no-op command */ | ||
2210 | - i_cmd->command_trb->generic.field[0] = 0; | ||
2211 | - i_cmd->command_trb->generic.field[1] = 0; | ||
2212 | - i_cmd->command_trb->generic.field[2] = 0; | ||
2213 | - i_cmd->command_trb->generic.field[3] = cpu_to_le32( | ||
2214 | - TRB_TYPE(TRB_CMD_NOOP) | cycle_state); | ||
2215 | - | ||
2216 | - /* | ||
2217 | - * caller waiting for completion is called when command | ||
2218 | - * completion event is received for these no-op commands | ||
2219 | - */ | ||
2220 | - } | ||
2221 | - | ||
2222 | - xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; | ||
2223 | - | ||
2224 | - /* ring command ring doorbell to restart the command ring */ | ||
2225 | - if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) && | ||
2226 | - !(xhci->xhc_state & XHCI_STATE_DYING)) { | ||
2227 | - xhci->current_cmd = cur_cmd; | ||
2228 | - mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT); | ||
2229 | - xhci_ring_cmd_db(xhci); | ||
2230 | - } | ||
2231 | - return; | ||
2232 | -} | ||
2233 | - | ||
2234 | - | ||
2235 | -void xhci_handle_command_timeout(unsigned long data) | ||
2236 | +void xhci_handle_command_timeout(struct work_struct *work) | ||
2237 | { | ||
2238 | struct xhci_hcd *xhci; | ||
2239 | int ret; | ||
2240 | unsigned long flags; | ||
2241 | u64 hw_ring_state; | ||
2242 | - bool second_timeout = false; | ||
2243 | - xhci = (struct xhci_hcd *) data; | ||
2244 | |||
2245 | - /* mark this command to be cancelled */ | ||
2246 | + xhci = container_of(to_delayed_work(work), struct xhci_hcd, cmd_timer); | ||
2247 | + | ||
2248 | spin_lock_irqsave(&xhci->lock, flags); | ||
2249 | - if (xhci->current_cmd) { | ||
2250 | - if (xhci->current_cmd->status == COMP_CMD_ABORT) | ||
2251 | - second_timeout = true; | ||
2252 | - xhci->current_cmd->status = COMP_CMD_ABORT; | ||
2253 | + | ||
2254 | + /* | ||
2255 | + * If timeout work is pending, or current_cmd is NULL, it means we | ||
2256 | + * raced with command completion. Command is handled so just return. | ||
2257 | + */ | ||
2258 | + if (!xhci->current_cmd || delayed_work_pending(&xhci->cmd_timer)) { | ||
2259 | + spin_unlock_irqrestore(&xhci->lock, flags); | ||
2260 | + return; | ||
2261 | } | ||
2262 | + /* mark this command to be cancelled */ | ||
2263 | + xhci->current_cmd->status = COMP_CMD_ABORT; | ||
2264 | |||
2265 | /* Make sure command ring is running before aborting it */ | ||
2266 | hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | ||
2267 | if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) && | ||
2268 | (hw_ring_state & CMD_RING_RUNNING)) { | ||
2269 | - spin_unlock_irqrestore(&xhci->lock, flags); | ||
2270 | + /* Prevent new doorbell, and start command abort */ | ||
2271 | + xhci->cmd_ring_state = CMD_RING_STATE_ABORTED; | ||
2272 | xhci_dbg(xhci, "Command timeout\n"); | ||
2273 | - ret = xhci_abort_cmd_ring(xhci); | ||
2274 | + ret = xhci_abort_cmd_ring(xhci, flags); | ||
2275 | if (unlikely(ret == -ESHUTDOWN)) { | ||
2276 | xhci_err(xhci, "Abort command ring failed\n"); | ||
2277 | xhci_cleanup_command_queue(xhci); | ||
2278 | + spin_unlock_irqrestore(&xhci->lock, flags); | ||
2279 | usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); | ||
2280 | xhci_dbg(xhci, "xHCI host controller is dead.\n"); | ||
2281 | + | ||
2282 | + return; | ||
2283 | } | ||
2284 | - return; | ||
2285 | + | ||
2286 | + goto time_out_completed; | ||
2287 | } | ||
2288 | |||
2289 | - /* command ring failed to restart, or host removed. Bail out */ | ||
2290 | - if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) { | ||
2291 | - spin_unlock_irqrestore(&xhci->lock, flags); | ||
2292 | - xhci_dbg(xhci, "command timed out twice, ring start fail?\n"); | ||
2293 | + /* host removed. Bail out */ | ||
2294 | + if (xhci->xhc_state & XHCI_STATE_REMOVING) { | ||
2295 | + xhci_dbg(xhci, "host removed, ring start fail?\n"); | ||
2296 | xhci_cleanup_command_queue(xhci); | ||
2297 | - return; | ||
2298 | + | ||
2299 | + goto time_out_completed; | ||
2300 | } | ||
2301 | |||
2302 | /* command timeout on stopped ring, ring can't be aborted */ | ||
2303 | xhci_dbg(xhci, "Command timeout on stopped ring\n"); | ||
2304 | xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd); | ||
2305 | + | ||
2306 | +time_out_completed: | ||
2307 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
2308 | return; | ||
2309 | } | ||
2310 | @@ -1335,7 +1363,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | ||
2311 | |||
2312 | cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list); | ||
2313 | |||
2314 | - del_timer(&xhci->cmd_timer); | ||
2315 | + cancel_delayed_work(&xhci->cmd_timer); | ||
2316 | |||
2317 | trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event); | ||
2318 | |||
2319 | @@ -1343,7 +1371,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | ||
2320 | |||
2321 | /* If CMD ring stopped we own the trbs between enqueue and dequeue */ | ||
2322 | if (cmd_comp_code == COMP_CMD_STOP) { | ||
2323 | - xhci_handle_stopped_cmd_ring(xhci, cmd); | ||
2324 | + complete_all(&xhci->cmd_ring_stop_completion); | ||
2325 | return; | ||
2326 | } | ||
2327 | |||
2328 | @@ -1361,8 +1389,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | ||
2329 | */ | ||
2330 | if (cmd_comp_code == COMP_CMD_ABORT) { | ||
2331 | xhci->cmd_ring_state = CMD_RING_STATE_STOPPED; | ||
2332 | - if (cmd->status == COMP_CMD_ABORT) | ||
2333 | + if (cmd->status == COMP_CMD_ABORT) { | ||
2334 | + if (xhci->current_cmd == cmd) | ||
2335 | + xhci->current_cmd = NULL; | ||
2336 | goto event_handled; | ||
2337 | + } | ||
2338 | } | ||
2339 | |||
2340 | cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3])); | ||
2341 | @@ -1423,7 +1454,9 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | ||
2342 | if (cmd->cmd_list.next != &xhci->cmd_list) { | ||
2343 | xhci->current_cmd = list_entry(cmd->cmd_list.next, | ||
2344 | struct xhci_command, cmd_list); | ||
2345 | - mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT); | ||
2346 | + xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT); | ||
2347 | + } else if (xhci->current_cmd == cmd) { | ||
2348 | + xhci->current_cmd = NULL; | ||
2349 | } | ||
2350 | |||
2351 | event_handled: | ||
2352 | @@ -4056,9 +4089,9 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd, | ||
2353 | |||
2354 | /* if there are no other commands queued we start the timeout timer */ | ||
2355 | if (xhci->cmd_list.next == &cmd->cmd_list && | ||
2356 | - !timer_pending(&xhci->cmd_timer)) { | ||
2357 | + !delayed_work_pending(&xhci->cmd_timer)) { | ||
2358 | xhci->current_cmd = cmd; | ||
2359 | - mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT); | ||
2360 | + xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT); | ||
2361 | } | ||
2362 | |||
2363 | queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3, | ||
2364 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | ||
2365 | index adc169d2fd76..a8b3c0fc11fb 100644 | ||
2366 | --- a/drivers/usb/host/xhci.c | ||
2367 | +++ b/drivers/usb/host/xhci.c | ||
2368 | @@ -3808,8 +3808,10 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | ||
2369 | |||
2370 | mutex_lock(&xhci->mutex); | ||
2371 | |||
2372 | - if (xhci->xhc_state) /* dying, removing or halted */ | ||
2373 | + if (xhci->xhc_state) { /* dying, removing or halted */ | ||
2374 | + ret = -ESHUTDOWN; | ||
2375 | goto out; | ||
2376 | + } | ||
2377 | |||
2378 | if (!udev->slot_id) { | ||
2379 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, | ||
2380 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h | ||
2381 | index 99ac2289dbf3..fc2ee6c272c4 100644 | ||
2382 | --- a/drivers/usb/host/xhci.h | ||
2383 | +++ b/drivers/usb/host/xhci.h | ||
2384 | @@ -312,6 +312,8 @@ struct xhci_op_regs { | ||
2385 | #define XDEV_U2 (0x2 << 5) | ||
2386 | #define XDEV_U3 (0x3 << 5) | ||
2387 | #define XDEV_INACTIVE (0x6 << 5) | ||
2388 | +#define XDEV_POLLING (0x7 << 5) | ||
2389 | +#define XDEV_COMP_MODE (0xa << 5) | ||
2390 | #define XDEV_RESUME (0xf << 5) | ||
2391 | /* true: port has power (see HCC_PPC) */ | ||
2392 | #define PORT_POWER (1 << 9) | ||
2393 | @@ -1550,7 +1552,8 @@ struct xhci_hcd { | ||
2394 | #define CMD_RING_STATE_STOPPED (1 << 2) | ||
2395 | struct list_head cmd_list; | ||
2396 | unsigned int cmd_ring_reserved_trbs; | ||
2397 | - struct timer_list cmd_timer; | ||
2398 | + struct delayed_work cmd_timer; | ||
2399 | + struct completion cmd_ring_stop_completion; | ||
2400 | struct xhci_command *current_cmd; | ||
2401 | struct xhci_ring *event_ring; | ||
2402 | struct xhci_erst erst; | ||
2403 | @@ -1631,6 +1634,7 @@ struct xhci_hcd { | ||
2404 | /* For controllers with a broken beyond repair streams implementation */ | ||
2405 | #define XHCI_BROKEN_STREAMS (1 << 19) | ||
2406 | #define XHCI_PME_STUCK_QUIRK (1 << 20) | ||
2407 | +#define XHCI_MISSING_CAS (1 << 24) | ||
2408 | unsigned int num_active_eps; | ||
2409 | unsigned int limit_active_eps; | ||
2410 | /* There are two roothubs to keep track of bus suspend info for */ | ||
2411 | @@ -1912,7 +1916,7 @@ void xhci_queue_config_ep_quirk(struct xhci_hcd *xhci, | ||
2412 | unsigned int slot_id, unsigned int ep_index, | ||
2413 | struct xhci_dequeue_state *deq_state); | ||
2414 | void xhci_stop_endpoint_command_watchdog(unsigned long arg); | ||
2415 | -void xhci_handle_command_timeout(unsigned long data); | ||
2416 | +void xhci_handle_command_timeout(struct work_struct *work); | ||
2417 | |||
2418 | void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, | ||
2419 | unsigned int ep_index, unsigned int stream_id); | ||
2420 | diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c | ||
2421 | index 310238c6b5cd..896798071817 100644 | ||
2422 | --- a/drivers/usb/musb/blackfin.c | ||
2423 | +++ b/drivers/usb/musb/blackfin.c | ||
2424 | @@ -469,6 +469,7 @@ static const struct musb_platform_ops bfin_ops = { | ||
2425 | .init = bfin_musb_init, | ||
2426 | .exit = bfin_musb_exit, | ||
2427 | |||
2428 | + .fifo_offset = bfin_fifo_offset, | ||
2429 | .readb = bfin_readb, | ||
2430 | .writeb = bfin_writeb, | ||
2431 | .readw = bfin_readw, | ||
2432 | diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h | ||
2433 | index 2337d7a7d62d..90de7900e4b8 100644 | ||
2434 | --- a/drivers/usb/musb/musb_core.h | ||
2435 | +++ b/drivers/usb/musb/musb_core.h | ||
2436 | @@ -214,6 +214,7 @@ struct musb_platform_ops { | ||
2437 | dma_addr_t *dma_addr, u32 *len); | ||
2438 | void (*pre_root_reset_end)(struct musb *musb); | ||
2439 | void (*post_root_reset_end)(struct musb *musb); | ||
2440 | + void (*clear_ep_rxintr)(struct musb *musb, int epnum); | ||
2441 | }; | ||
2442 | |||
2443 | /* | ||
2444 | @@ -612,4 +613,10 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb) | ||
2445 | musb->ops->post_root_reset_end(musb); | ||
2446 | } | ||
2447 | |||
2448 | +static inline void musb_platform_clear_ep_rxintr(struct musb *musb, int epnum) | ||
2449 | +{ | ||
2450 | + if (musb->ops->clear_ep_rxintr) | ||
2451 | + musb->ops->clear_ep_rxintr(musb, epnum); | ||
2452 | +} | ||
2453 | + | ||
2454 | #endif /* __MUSB_CORE_H__ */ | ||
2455 | diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c | ||
2456 | index eeb7d9ecf7df..5a021b26d7d2 100644 | ||
2457 | --- a/drivers/usb/musb/musb_dsps.c | ||
2458 | +++ b/drivers/usb/musb/musb_dsps.c | ||
2459 | @@ -301,6 +301,17 @@ static void otg_timer(unsigned long _musb) | ||
2460 | spin_unlock_irqrestore(&musb->lock, flags); | ||
2461 | } | ||
2462 | |||
2463 | +void dsps_musb_clear_ep_rxintr(struct musb *musb, int epnum) | ||
2464 | +{ | ||
2465 | + u32 epintr; | ||
2466 | + struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent); | ||
2467 | + const struct dsps_musb_wrapper *wrp = glue->wrp; | ||
2468 | + | ||
2469 | + /* musb->lock might already been held */ | ||
2470 | + epintr = (1 << epnum) << wrp->rxep_shift; | ||
2471 | + musb_writel(musb->ctrl_base, wrp->epintr_status, epintr); | ||
2472 | +} | ||
2473 | + | ||
2474 | static irqreturn_t dsps_interrupt(int irq, void *hci) | ||
2475 | { | ||
2476 | struct musb *musb = hci; | ||
2477 | @@ -647,6 +658,7 @@ static struct musb_platform_ops dsps_ops = { | ||
2478 | .try_idle = dsps_musb_try_idle, | ||
2479 | .set_mode = dsps_musb_set_mode, | ||
2480 | .recover = dsps_musb_recover, | ||
2481 | + .clear_ep_rxintr = dsps_musb_clear_ep_rxintr, | ||
2482 | }; | ||
2483 | |||
2484 | static u64 musb_dmamask = DMA_BIT_MASK(32); | ||
2485 | diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c | ||
2486 | index e0a083f6ab68..13d5614f37f1 100644 | ||
2487 | --- a/drivers/usb/musb/musb_host.c | ||
2488 | +++ b/drivers/usb/musb/musb_host.c | ||
2489 | @@ -2390,12 +2390,11 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) | ||
2490 | int is_in = usb_pipein(urb->pipe); | ||
2491 | int status = 0; | ||
2492 | u16 csr; | ||
2493 | + struct dma_channel *dma = NULL; | ||
2494 | |||
2495 | musb_ep_select(regs, hw_end); | ||
2496 | |||
2497 | if (is_dma_capable()) { | ||
2498 | - struct dma_channel *dma; | ||
2499 | - | ||
2500 | dma = is_in ? ep->rx_channel : ep->tx_channel; | ||
2501 | if (dma) { | ||
2502 | status = ep->musb->dma_controller->channel_abort(dma); | ||
2503 | @@ -2412,10 +2411,9 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) | ||
2504 | /* giveback saves bulk toggle */ | ||
2505 | csr = musb_h_flush_rxfifo(ep, 0); | ||
2506 | |||
2507 | - /* REVISIT we still get an irq; should likely clear the | ||
2508 | - * endpoint's irq status here to avoid bogus irqs. | ||
2509 | - * clearing that status is platform-specific... | ||
2510 | - */ | ||
2511 | + /* clear the endpoint's irq status here to avoid bogus irqs */ | ||
2512 | + if (is_dma_capable() && dma) | ||
2513 | + musb_platform_clear_ep_rxintr(musb, ep->epnum); | ||
2514 | } else if (ep->epnum) { | ||
2515 | musb_h_tx_flush_fifo(ep); | ||
2516 | csr = musb_readw(epio, MUSB_TXCSR); | ||
2517 | diff --git a/drivers/usb/musb/musbhsdma.h b/drivers/usb/musb/musbhsdma.h | ||
2518 | index f7b13fd25257..a3dcbd55e436 100644 | ||
2519 | --- a/drivers/usb/musb/musbhsdma.h | ||
2520 | +++ b/drivers/usb/musb/musbhsdma.h | ||
2521 | @@ -157,5 +157,5 @@ struct musb_dma_controller { | ||
2522 | void __iomem *base; | ||
2523 | u8 channel_count; | ||
2524 | u8 used_channels; | ||
2525 | - u8 irq; | ||
2526 | + int irq; | ||
2527 | }; | ||
2528 | diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c | ||
2529 | index 7b3035ff9434..1b4d742a2397 100644 | ||
2530 | --- a/drivers/usb/phy/phy-am335x-control.c | ||
2531 | +++ b/drivers/usb/phy/phy-am335x-control.c | ||
2532 | @@ -126,10 +126,12 @@ struct phy_control *am335x_get_phy_control(struct device *dev) | ||
2533 | return NULL; | ||
2534 | |||
2535 | dev = bus_find_device(&platform_bus_type, NULL, node, match); | ||
2536 | + of_node_put(node); | ||
2537 | if (!dev) | ||
2538 | return NULL; | ||
2539 | |||
2540 | ctrl_usb = dev_get_drvdata(dev); | ||
2541 | + put_device(dev); | ||
2542 | if (!ctrl_usb) | ||
2543 | return NULL; | ||
2544 | return &ctrl_usb->phy_ctrl; | ||
2545 | diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c | ||
2546 | index 2916dea3ede8..8948f375e75d 100644 | ||
2547 | --- a/drivers/usb/serial/cyberjack.c | ||
2548 | +++ b/drivers/usb/serial/cyberjack.c | ||
2549 | @@ -50,6 +50,7 @@ | ||
2550 | #define CYBERJACK_PRODUCT_ID 0x0100 | ||
2551 | |||
2552 | /* Function prototypes */ | ||
2553 | +static int cyberjack_attach(struct usb_serial *serial); | ||
2554 | static int cyberjack_port_probe(struct usb_serial_port *port); | ||
2555 | static int cyberjack_port_remove(struct usb_serial_port *port); | ||
2556 | static int cyberjack_open(struct tty_struct *tty, | ||
2557 | @@ -77,6 +78,7 @@ static struct usb_serial_driver cyberjack_device = { | ||
2558 | .description = "Reiner SCT Cyberjack USB card reader", | ||
2559 | .id_table = id_table, | ||
2560 | .num_ports = 1, | ||
2561 | + .attach = cyberjack_attach, | ||
2562 | .port_probe = cyberjack_port_probe, | ||
2563 | .port_remove = cyberjack_port_remove, | ||
2564 | .open = cyberjack_open, | ||
2565 | @@ -100,6 +102,14 @@ struct cyberjack_private { | ||
2566 | short wrsent; /* Data already sent */ | ||
2567 | }; | ||
2568 | |||
2569 | +static int cyberjack_attach(struct usb_serial *serial) | ||
2570 | +{ | ||
2571 | + if (serial->num_bulk_out < serial->num_ports) | ||
2572 | + return -ENODEV; | ||
2573 | + | ||
2574 | + return 0; | ||
2575 | +} | ||
2576 | + | ||
2577 | static int cyberjack_port_probe(struct usb_serial_port *port) | ||
2578 | { | ||
2579 | struct cyberjack_private *priv; | ||
2580 | diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c | ||
2581 | index db591d19d416..37d0e8cc7af6 100644 | ||
2582 | --- a/drivers/usb/serial/garmin_gps.c | ||
2583 | +++ b/drivers/usb/serial/garmin_gps.c | ||
2584 | @@ -1044,6 +1044,7 @@ static int garmin_write_bulk(struct usb_serial_port *port, | ||
2585 | "%s - usb_submit_urb(write bulk) failed with status = %d\n", | ||
2586 | __func__, status); | ||
2587 | count = status; | ||
2588 | + kfree(buffer); | ||
2589 | } | ||
2590 | |||
2591 | /* we are done with this urb, so let the host driver | ||
2592 | diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c | ||
2593 | index 1947ea0e0988..b63a6c3899c5 100644 | ||
2594 | --- a/drivers/usb/serial/io_edgeport.c | ||
2595 | +++ b/drivers/usb/serial/io_edgeport.c | ||
2596 | @@ -2761,6 +2761,11 @@ static int edge_startup(struct usb_serial *serial) | ||
2597 | EDGE_COMPATIBILITY_MASK1, | ||
2598 | EDGE_COMPATIBILITY_MASK2 }; | ||
2599 | |||
2600 | + if (serial->num_bulk_in < 1 || serial->num_interrupt_in < 1) { | ||
2601 | + dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
2602 | + return -ENODEV; | ||
2603 | + } | ||
2604 | + | ||
2605 | dev = serial->dev; | ||
2606 | |||
2607 | /* create our private serial structure */ | ||
2608 | diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c | ||
2609 | index fce82fd79f77..c02808a30436 100644 | ||
2610 | --- a/drivers/usb/serial/io_ti.c | ||
2611 | +++ b/drivers/usb/serial/io_ti.c | ||
2612 | @@ -1499,8 +1499,7 @@ static int do_boot_mode(struct edgeport_serial *serial, | ||
2613 | |||
2614 | dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__); | ||
2615 | |||
2616 | - /* return an error on purpose */ | ||
2617 | - return -ENODEV; | ||
2618 | + return 1; | ||
2619 | } | ||
2620 | |||
2621 | stayinbootmode: | ||
2622 | @@ -1508,7 +1507,7 @@ stayinbootmode: | ||
2623 | dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__); | ||
2624 | serial->product_info.TiMode = TI_MODE_BOOT; | ||
2625 | |||
2626 | - return 0; | ||
2627 | + return 1; | ||
2628 | } | ||
2629 | |||
2630 | static int ti_do_config(struct edgeport_port *port, int feature, int on) | ||
2631 | @@ -2549,6 +2548,13 @@ static int edge_startup(struct usb_serial *serial) | ||
2632 | int status; | ||
2633 | u16 product_id; | ||
2634 | |||
2635 | + /* Make sure we have the required endpoints when in download mode. */ | ||
2636 | + if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) { | ||
2637 | + if (serial->num_bulk_in < serial->num_ports || | ||
2638 | + serial->num_bulk_out < serial->num_ports) | ||
2639 | + return -ENODEV; | ||
2640 | + } | ||
2641 | + | ||
2642 | /* create our private serial structure */ | ||
2643 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); | ||
2644 | if (!edge_serial) | ||
2645 | @@ -2556,14 +2562,18 @@ static int edge_startup(struct usb_serial *serial) | ||
2646 | |||
2647 | mutex_init(&edge_serial->es_lock); | ||
2648 | edge_serial->serial = serial; | ||
2649 | + INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work); | ||
2650 | usb_set_serial_data(serial, edge_serial); | ||
2651 | |||
2652 | status = download_fw(edge_serial); | ||
2653 | - if (status) { | ||
2654 | + if (status < 0) { | ||
2655 | kfree(edge_serial); | ||
2656 | return status; | ||
2657 | } | ||
2658 | |||
2659 | + if (status > 0) | ||
2660 | + return 1; /* bind but do not register any ports */ | ||
2661 | + | ||
2662 | product_id = le16_to_cpu( | ||
2663 | edge_serial->serial->dev->descriptor.idProduct); | ||
2664 | |||
2665 | @@ -2575,7 +2585,6 @@ static int edge_startup(struct usb_serial *serial) | ||
2666 | } | ||
2667 | } | ||
2668 | |||
2669 | - INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work); | ||
2670 | edge_heartbeat_schedule(edge_serial); | ||
2671 | |||
2672 | return 0; | ||
2673 | @@ -2583,6 +2592,9 @@ static int edge_startup(struct usb_serial *serial) | ||
2674 | |||
2675 | static void edge_disconnect(struct usb_serial *serial) | ||
2676 | { | ||
2677 | + struct edgeport_serial *edge_serial = usb_get_serial_data(serial); | ||
2678 | + | ||
2679 | + cancel_delayed_work_sync(&edge_serial->heartbeat_work); | ||
2680 | } | ||
2681 | |||
2682 | static void edge_release(struct usb_serial *serial) | ||
2683 | diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c | ||
2684 | index 5ad4a0fb4b26..7ed7d33d6c10 100644 | ||
2685 | --- a/drivers/usb/serial/iuu_phoenix.c | ||
2686 | +++ b/drivers/usb/serial/iuu_phoenix.c | ||
2687 | @@ -68,6 +68,16 @@ struct iuu_private { | ||
2688 | u32 clk; | ||
2689 | }; | ||
2690 | |||
2691 | +static int iuu_attach(struct usb_serial *serial) | ||
2692 | +{ | ||
2693 | + unsigned char num_ports = serial->num_ports; | ||
2694 | + | ||
2695 | + if (serial->num_bulk_in < num_ports || serial->num_bulk_out < num_ports) | ||
2696 | + return -ENODEV; | ||
2697 | + | ||
2698 | + return 0; | ||
2699 | +} | ||
2700 | + | ||
2701 | static int iuu_port_probe(struct usb_serial_port *port) | ||
2702 | { | ||
2703 | struct iuu_private *priv; | ||
2704 | @@ -1196,6 +1206,7 @@ static struct usb_serial_driver iuu_device = { | ||
2705 | .tiocmset = iuu_tiocmset, | ||
2706 | .set_termios = iuu_set_termios, | ||
2707 | .init_termios = iuu_init_termios, | ||
2708 | + .attach = iuu_attach, | ||
2709 | .port_probe = iuu_port_probe, | ||
2710 | .port_remove = iuu_port_remove, | ||
2711 | }; | ||
2712 | diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c | ||
2713 | index 4f7e072e4e00..930be98d59b3 100644 | ||
2714 | --- a/drivers/usb/serial/keyspan_pda.c | ||
2715 | +++ b/drivers/usb/serial/keyspan_pda.c | ||
2716 | @@ -699,6 +699,19 @@ MODULE_FIRMWARE("keyspan_pda/keyspan_pda.fw"); | ||
2717 | MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw"); | ||
2718 | #endif | ||
2719 | |||
2720 | +static int keyspan_pda_attach(struct usb_serial *serial) | ||
2721 | +{ | ||
2722 | + unsigned char num_ports = serial->num_ports; | ||
2723 | + | ||
2724 | + if (serial->num_bulk_out < num_ports || | ||
2725 | + serial->num_interrupt_in < num_ports) { | ||
2726 | + dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
2727 | + return -ENODEV; | ||
2728 | + } | ||
2729 | + | ||
2730 | + return 0; | ||
2731 | +} | ||
2732 | + | ||
2733 | static int keyspan_pda_port_probe(struct usb_serial_port *port) | ||
2734 | { | ||
2735 | |||
2736 | @@ -776,6 +789,7 @@ static struct usb_serial_driver keyspan_pda_device = { | ||
2737 | .break_ctl = keyspan_pda_break_ctl, | ||
2738 | .tiocmget = keyspan_pda_tiocmget, | ||
2739 | .tiocmset = keyspan_pda_tiocmset, | ||
2740 | + .attach = keyspan_pda_attach, | ||
2741 | .port_probe = keyspan_pda_port_probe, | ||
2742 | .port_remove = keyspan_pda_port_remove, | ||
2743 | }; | ||
2744 | diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c | ||
2745 | index 53c90131764d..cd0322502ab1 100644 | ||
2746 | --- a/drivers/usb/serial/kl5kusb105.c | ||
2747 | +++ b/drivers/usb/serial/kl5kusb105.c | ||
2748 | @@ -311,6 +311,7 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port) | ||
2749 | if (rc < 0) { | ||
2750 | dev_err(&port->dev, "Enabling read failed (error = %d)\n", rc); | ||
2751 | retval = rc; | ||
2752 | + goto err_generic_close; | ||
2753 | } else | ||
2754 | dev_dbg(&port->dev, "%s - enabled reading\n", __func__); | ||
2755 | |||
2756 | @@ -337,6 +338,7 @@ err_disable_read: | ||
2757 | 0, /* index */ | ||
2758 | NULL, 0, | ||
2759 | KLSI_TIMEOUT); | ||
2760 | +err_generic_close: | ||
2761 | usb_serial_generic_close(port); | ||
2762 | err_free_cfg: | ||
2763 | kfree(cfg); | ||
2764 | diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c | ||
2765 | index 2363654cafc9..813035f51fe7 100644 | ||
2766 | --- a/drivers/usb/serial/kobil_sct.c | ||
2767 | +++ b/drivers/usb/serial/kobil_sct.c | ||
2768 | @@ -51,6 +51,7 @@ | ||
2769 | |||
2770 | |||
2771 | /* Function prototypes */ | ||
2772 | +static int kobil_attach(struct usb_serial *serial); | ||
2773 | static int kobil_port_probe(struct usb_serial_port *probe); | ||
2774 | static int kobil_port_remove(struct usb_serial_port *probe); | ||
2775 | static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port); | ||
2776 | @@ -86,6 +87,7 @@ static struct usb_serial_driver kobil_device = { | ||
2777 | .description = "KOBIL USB smart card terminal", | ||
2778 | .id_table = id_table, | ||
2779 | .num_ports = 1, | ||
2780 | + .attach = kobil_attach, | ||
2781 | .port_probe = kobil_port_probe, | ||
2782 | .port_remove = kobil_port_remove, | ||
2783 | .ioctl = kobil_ioctl, | ||
2784 | @@ -113,6 +115,16 @@ struct kobil_private { | ||
2785 | }; | ||
2786 | |||
2787 | |||
2788 | +static int kobil_attach(struct usb_serial *serial) | ||
2789 | +{ | ||
2790 | + if (serial->num_interrupt_out < serial->num_ports) { | ||
2791 | + dev_err(&serial->interface->dev, "missing interrupt-out endpoint\n"); | ||
2792 | + return -ENODEV; | ||
2793 | + } | ||
2794 | + | ||
2795 | + return 0; | ||
2796 | +} | ||
2797 | + | ||
2798 | static int kobil_port_probe(struct usb_serial_port *port) | ||
2799 | { | ||
2800 | struct usb_serial *serial = port->serial; | ||
2801 | diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c | ||
2802 | index 63db004af21f..e56cdb436de3 100644 | ||
2803 | --- a/drivers/usb/serial/mos7720.c | ||
2804 | +++ b/drivers/usb/serial/mos7720.c | ||
2805 | @@ -65,8 +65,6 @@ struct moschip_port { | ||
2806 | struct urb *write_urb_pool[NUM_URBS]; | ||
2807 | }; | ||
2808 | |||
2809 | -static struct usb_serial_driver moschip7720_2port_driver; | ||
2810 | - | ||
2811 | #define USB_VENDOR_ID_MOSCHIP 0x9710 | ||
2812 | #define MOSCHIP_DEVICE_ID_7720 0x7720 | ||
2813 | #define MOSCHIP_DEVICE_ID_7715 0x7715 | ||
2814 | @@ -970,25 +968,6 @@ static void mos7720_bulk_out_data_callback(struct urb *urb) | ||
2815 | tty_port_tty_wakeup(&mos7720_port->port->port); | ||
2816 | } | ||
2817 | |||
2818 | -/* | ||
2819 | - * mos77xx_probe | ||
2820 | - * this function installs the appropriate read interrupt endpoint callback | ||
2821 | - * depending on whether the device is a 7720 or 7715, thus avoiding costly | ||
2822 | - * run-time checks in the high-frequency callback routine itself. | ||
2823 | - */ | ||
2824 | -static int mos77xx_probe(struct usb_serial *serial, | ||
2825 | - const struct usb_device_id *id) | ||
2826 | -{ | ||
2827 | - if (id->idProduct == MOSCHIP_DEVICE_ID_7715) | ||
2828 | - moschip7720_2port_driver.read_int_callback = | ||
2829 | - mos7715_interrupt_callback; | ||
2830 | - else | ||
2831 | - moschip7720_2port_driver.read_int_callback = | ||
2832 | - mos7720_interrupt_callback; | ||
2833 | - | ||
2834 | - return 0; | ||
2835 | -} | ||
2836 | - | ||
2837 | static int mos77xx_calc_num_ports(struct usb_serial *serial) | ||
2838 | { | ||
2839 | u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); | ||
2840 | @@ -1920,6 +1899,11 @@ static int mos7720_startup(struct usb_serial *serial) | ||
2841 | u16 product; | ||
2842 | int ret_val; | ||
2843 | |||
2844 | + if (serial->num_bulk_in < 2 || serial->num_bulk_out < 2) { | ||
2845 | + dev_err(&serial->interface->dev, "missing bulk endpoints\n"); | ||
2846 | + return -ENODEV; | ||
2847 | + } | ||
2848 | + | ||
2849 | product = le16_to_cpu(serial->dev->descriptor.idProduct); | ||
2850 | dev = serial->dev; | ||
2851 | |||
2852 | @@ -1944,19 +1928,18 @@ static int mos7720_startup(struct usb_serial *serial) | ||
2853 | tmp->interrupt_in_endpointAddress; | ||
2854 | serial->port[1]->interrupt_in_urb = NULL; | ||
2855 | serial->port[1]->interrupt_in_buffer = NULL; | ||
2856 | + | ||
2857 | + if (serial->port[0]->interrupt_in_urb) { | ||
2858 | + struct urb *urb = serial->port[0]->interrupt_in_urb; | ||
2859 | + | ||
2860 | + urb->complete = mos7715_interrupt_callback; | ||
2861 | + } | ||
2862 | } | ||
2863 | |||
2864 | /* setting configuration feature to one */ | ||
2865 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | ||
2866 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000); | ||
2867 | |||
2868 | - /* start the interrupt urb */ | ||
2869 | - ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); | ||
2870 | - if (ret_val) | ||
2871 | - dev_err(&dev->dev, | ||
2872 | - "%s - Error %d submitting control urb\n", | ||
2873 | - __func__, ret_val); | ||
2874 | - | ||
2875 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT | ||
2876 | if (product == MOSCHIP_DEVICE_ID_7715) { | ||
2877 | ret_val = mos7715_parport_init(serial); | ||
2878 | @@ -1964,6 +1947,13 @@ static int mos7720_startup(struct usb_serial *serial) | ||
2879 | return ret_val; | ||
2880 | } | ||
2881 | #endif | ||
2882 | + /* start the interrupt urb */ | ||
2883 | + ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); | ||
2884 | + if (ret_val) { | ||
2885 | + dev_err(&dev->dev, "failed to submit interrupt urb: %d\n", | ||
2886 | + ret_val); | ||
2887 | + } | ||
2888 | + | ||
2889 | /* LSR For Port 1 */ | ||
2890 | read_mos_reg(serial, 0, MOS7720_LSR, &data); | ||
2891 | dev_dbg(&dev->dev, "LSR:%x\n", data); | ||
2892 | @@ -1973,6 +1963,8 @@ static int mos7720_startup(struct usb_serial *serial) | ||
2893 | |||
2894 | static void mos7720_release(struct usb_serial *serial) | ||
2895 | { | ||
2896 | + usb_kill_urb(serial->port[0]->interrupt_in_urb); | ||
2897 | + | ||
2898 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT | ||
2899 | /* close the parallel port */ | ||
2900 | |||
2901 | @@ -2056,7 +2048,6 @@ static struct usb_serial_driver moschip7720_2port_driver = { | ||
2902 | .close = mos7720_close, | ||
2903 | .throttle = mos7720_throttle, | ||
2904 | .unthrottle = mos7720_unthrottle, | ||
2905 | - .probe = mos77xx_probe, | ||
2906 | .attach = mos7720_startup, | ||
2907 | .release = mos7720_release, | ||
2908 | .port_probe = mos7720_port_probe, | ||
2909 | @@ -2070,7 +2061,7 @@ static struct usb_serial_driver moschip7720_2port_driver = { | ||
2910 | .chars_in_buffer = mos7720_chars_in_buffer, | ||
2911 | .break_ctl = mos7720_break, | ||
2912 | .read_bulk_callback = mos7720_bulk_in_callback, | ||
2913 | - .read_int_callback = NULL /* dynamically assigned in probe() */ | ||
2914 | + .read_int_callback = mos7720_interrupt_callback, | ||
2915 | }; | ||
2916 | |||
2917 | static struct usb_serial_driver * const serial_drivers[] = { | ||
2918 | diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c | ||
2919 | index 7f3ddd7ba2ce..97ea52b5cfd4 100644 | ||
2920 | --- a/drivers/usb/serial/mos7840.c | ||
2921 | +++ b/drivers/usb/serial/mos7840.c | ||
2922 | @@ -2116,6 +2116,17 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | ||
2923 | return mos7840_num_ports; | ||
2924 | } | ||
2925 | |||
2926 | +static int mos7840_attach(struct usb_serial *serial) | ||
2927 | +{ | ||
2928 | + if (serial->num_bulk_in < serial->num_ports || | ||
2929 | + serial->num_bulk_out < serial->num_ports) { | ||
2930 | + dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
2931 | + return -ENODEV; | ||
2932 | + } | ||
2933 | + | ||
2934 | + return 0; | ||
2935 | +} | ||
2936 | + | ||
2937 | static int mos7840_port_probe(struct usb_serial_port *port) | ||
2938 | { | ||
2939 | struct usb_serial *serial = port->serial; | ||
2940 | @@ -2391,6 +2402,7 @@ static struct usb_serial_driver moschip7840_4port_device = { | ||
2941 | .tiocmset = mos7840_tiocmset, | ||
2942 | .tiocmiwait = usb_serial_generic_tiocmiwait, | ||
2943 | .get_icount = usb_serial_generic_get_icount, | ||
2944 | + .attach = mos7840_attach, | ||
2945 | .port_probe = mos7840_port_probe, | ||
2946 | .port_remove = mos7840_port_remove, | ||
2947 | .read_bulk_callback = mos7840_bulk_in_callback, | ||
2948 | diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c | ||
2949 | index f6c6900bccf0..a180b17d2432 100644 | ||
2950 | --- a/drivers/usb/serial/omninet.c | ||
2951 | +++ b/drivers/usb/serial/omninet.c | ||
2952 | @@ -38,6 +38,7 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | ||
2953 | const unsigned char *buf, int count); | ||
2954 | static int omninet_write_room(struct tty_struct *tty); | ||
2955 | static void omninet_disconnect(struct usb_serial *serial); | ||
2956 | +static int omninet_attach(struct usb_serial *serial); | ||
2957 | static int omninet_port_probe(struct usb_serial_port *port); | ||
2958 | static int omninet_port_remove(struct usb_serial_port *port); | ||
2959 | |||
2960 | @@ -56,6 +57,7 @@ static struct usb_serial_driver zyxel_omninet_device = { | ||
2961 | .description = "ZyXEL - omni.net lcd plus usb", | ||
2962 | .id_table = id_table, | ||
2963 | .num_ports = 1, | ||
2964 | + .attach = omninet_attach, | ||
2965 | .port_probe = omninet_port_probe, | ||
2966 | .port_remove = omninet_port_remove, | ||
2967 | .open = omninet_open, | ||
2968 | @@ -104,6 +106,17 @@ struct omninet_data { | ||
2969 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ | ||
2970 | }; | ||
2971 | |||
2972 | +static int omninet_attach(struct usb_serial *serial) | ||
2973 | +{ | ||
2974 | + /* The second bulk-out endpoint is used for writing. */ | ||
2975 | + if (serial->num_bulk_out < 2) { | ||
2976 | + dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
2977 | + return -ENODEV; | ||
2978 | + } | ||
2979 | + | ||
2980 | + return 0; | ||
2981 | +} | ||
2982 | + | ||
2983 | static int omninet_port_probe(struct usb_serial_port *port) | ||
2984 | { | ||
2985 | struct omninet_data *od; | ||
2986 | diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c | ||
2987 | index a4b88bc038b6..b8bf52bf7a94 100644 | ||
2988 | --- a/drivers/usb/serial/oti6858.c | ||
2989 | +++ b/drivers/usb/serial/oti6858.c | ||
2990 | @@ -134,6 +134,7 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty); | ||
2991 | static int oti6858_tiocmget(struct tty_struct *tty); | ||
2992 | static int oti6858_tiocmset(struct tty_struct *tty, | ||
2993 | unsigned int set, unsigned int clear); | ||
2994 | +static int oti6858_attach(struct usb_serial *serial); | ||
2995 | static int oti6858_port_probe(struct usb_serial_port *port); | ||
2996 | static int oti6858_port_remove(struct usb_serial_port *port); | ||
2997 | |||
2998 | @@ -158,6 +159,7 @@ static struct usb_serial_driver oti6858_device = { | ||
2999 | .write_bulk_callback = oti6858_write_bulk_callback, | ||
3000 | .write_room = oti6858_write_room, | ||
3001 | .chars_in_buffer = oti6858_chars_in_buffer, | ||
3002 | + .attach = oti6858_attach, | ||
3003 | .port_probe = oti6858_port_probe, | ||
3004 | .port_remove = oti6858_port_remove, | ||
3005 | }; | ||
3006 | @@ -324,6 +326,20 @@ static void send_data(struct work_struct *work) | ||
3007 | usb_serial_port_softint(port); | ||
3008 | } | ||
3009 | |||
3010 | +static int oti6858_attach(struct usb_serial *serial) | ||
3011 | +{ | ||
3012 | + unsigned char num_ports = serial->num_ports; | ||
3013 | + | ||
3014 | + if (serial->num_bulk_in < num_ports || | ||
3015 | + serial->num_bulk_out < num_ports || | ||
3016 | + serial->num_interrupt_in < num_ports) { | ||
3017 | + dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
3018 | + return -ENODEV; | ||
3019 | + } | ||
3020 | + | ||
3021 | + return 0; | ||
3022 | +} | ||
3023 | + | ||
3024 | static int oti6858_port_probe(struct usb_serial_port *port) | ||
3025 | { | ||
3026 | struct oti6858_private *priv; | ||
3027 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c | ||
3028 | index ae682e4eeaef..46fca6b75846 100644 | ||
3029 | --- a/drivers/usb/serial/pl2303.c | ||
3030 | +++ b/drivers/usb/serial/pl2303.c | ||
3031 | @@ -220,9 +220,17 @@ static int pl2303_probe(struct usb_serial *serial, | ||
3032 | static int pl2303_startup(struct usb_serial *serial) | ||
3033 | { | ||
3034 | struct pl2303_serial_private *spriv; | ||
3035 | + unsigned char num_ports = serial->num_ports; | ||
3036 | enum pl2303_type type = TYPE_01; | ||
3037 | unsigned char *buf; | ||
3038 | |||
3039 | + if (serial->num_bulk_in < num_ports || | ||
3040 | + serial->num_bulk_out < num_ports || | ||
3041 | + serial->num_interrupt_in < num_ports) { | ||
3042 | + dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
3043 | + return -ENODEV; | ||
3044 | + } | ||
3045 | + | ||
3046 | spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); | ||
3047 | if (!spriv) | ||
3048 | return -ENOMEM; | ||
3049 | diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c | ||
3050 | index b18974cbd995..a3ed07c58754 100644 | ||
3051 | --- a/drivers/usb/serial/quatech2.c | ||
3052 | +++ b/drivers/usb/serial/quatech2.c | ||
3053 | @@ -408,16 +408,12 @@ static void qt2_close(struct usb_serial_port *port) | ||
3054 | { | ||
3055 | struct usb_serial *serial; | ||
3056 | struct qt2_port_private *port_priv; | ||
3057 | - unsigned long flags; | ||
3058 | int i; | ||
3059 | |||
3060 | serial = port->serial; | ||
3061 | port_priv = usb_get_serial_port_data(port); | ||
3062 | |||
3063 | - spin_lock_irqsave(&port_priv->urb_lock, flags); | ||
3064 | usb_kill_urb(port_priv->write_urb); | ||
3065 | - port_priv->urb_in_use = false; | ||
3066 | - spin_unlock_irqrestore(&port_priv->urb_lock, flags); | ||
3067 | |||
3068 | /* flush the port transmit buffer */ | ||
3069 | i = usb_control_msg(serial->dev, | ||
3070 | diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c | ||
3071 | index ef0dbf0703c5..475e6c31b266 100644 | ||
3072 | --- a/drivers/usb/serial/spcp8x5.c | ||
3073 | +++ b/drivers/usb/serial/spcp8x5.c | ||
3074 | @@ -154,6 +154,19 @@ static int spcp8x5_probe(struct usb_serial *serial, | ||
3075 | return 0; | ||
3076 | } | ||
3077 | |||
3078 | +static int spcp8x5_attach(struct usb_serial *serial) | ||
3079 | +{ | ||
3080 | + unsigned char num_ports = serial->num_ports; | ||
3081 | + | ||
3082 | + if (serial->num_bulk_in < num_ports || | ||
3083 | + serial->num_bulk_out < num_ports) { | ||
3084 | + dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
3085 | + return -ENODEV; | ||
3086 | + } | ||
3087 | + | ||
3088 | + return 0; | ||
3089 | +} | ||
3090 | + | ||
3091 | static int spcp8x5_port_probe(struct usb_serial_port *port) | ||
3092 | { | ||
3093 | const struct usb_device_id *id = usb_get_serial_data(port->serial); | ||
3094 | @@ -477,6 +490,7 @@ static struct usb_serial_driver spcp8x5_device = { | ||
3095 | .tiocmget = spcp8x5_tiocmget, | ||
3096 | .tiocmset = spcp8x5_tiocmset, | ||
3097 | .probe = spcp8x5_probe, | ||
3098 | + .attach = spcp8x5_attach, | ||
3099 | .port_probe = spcp8x5_port_probe, | ||
3100 | .port_remove = spcp8x5_port_remove, | ||
3101 | }; | ||
3102 | diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c | ||
3103 | index 2694df2f4559..535fcfafc097 100644 | ||
3104 | --- a/drivers/usb/serial/ti_usb_3410_5052.c | ||
3105 | +++ b/drivers/usb/serial/ti_usb_3410_5052.c | ||
3106 | @@ -339,6 +339,13 @@ static int ti_startup(struct usb_serial *serial) | ||
3107 | goto free_tdev; | ||
3108 | } | ||
3109 | |||
3110 | + if (serial->num_bulk_in < serial->num_ports || | ||
3111 | + serial->num_bulk_out < serial->num_ports) { | ||
3112 | + dev_err(&serial->interface->dev, "missing endpoints\n"); | ||
3113 | + status = -ENODEV; | ||
3114 | + goto free_tdev; | ||
3115 | + } | ||
3116 | + | ||
3117 | return 0; | ||
3118 | |||
3119 | free_tdev: | ||
3120 | diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h | ||
3121 | index 7ffe4209067b..640a2e2ec04d 100644 | ||
3122 | --- a/drivers/usb/storage/unusual_devs.h | ||
3123 | +++ b/drivers/usb/storage/unusual_devs.h | ||
3124 | @@ -2135,6 +2135,13 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001, | ||
3125 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
3126 | US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), | ||
3127 | |||
3128 | +/* Reported-by George Cherian <george.cherian@cavium.com> */ | ||
3129 | +UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x9999, | ||
3130 | + "JMicron", | ||
3131 | + "JMS56x", | ||
3132 | + USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
3133 | + US_FL_NO_REPORT_OPCODES), | ||
3134 | + | ||
3135 | /* | ||
3136 | * Patch by Constantin Baranov <const@tltsu.ru> | ||
3137 | * Report by Andreas Koenecke. | ||
3138 | diff --git a/include/linux/capability.h b/include/linux/capability.h | ||
3139 | index 2654f75a4c46..b20ffe23a09b 100644 | ||
3140 | --- a/include/linux/capability.h | ||
3141 | +++ b/include/linux/capability.h | ||
3142 | @@ -40,8 +40,6 @@ struct inode; | ||
3143 | struct dentry; | ||
3144 | struct user_namespace; | ||
3145 | |||
3146 | -struct user_namespace *current_user_ns(void); | ||
3147 | - | ||
3148 | extern const kernel_cap_t __cap_empty_set; | ||
3149 | extern const kernel_cap_t __cap_init_eff_set; | ||
3150 | |||
3151 | diff --git a/include/linux/cred.h b/include/linux/cred.h | ||
3152 | index 8d70e1361ecd..257db64562e5 100644 | ||
3153 | --- a/include/linux/cred.h | ||
3154 | +++ b/include/linux/cred.h | ||
3155 | @@ -377,7 +377,10 @@ extern struct user_namespace init_user_ns; | ||
3156 | #ifdef CONFIG_USER_NS | ||
3157 | #define current_user_ns() (current_cred_xxx(user_ns)) | ||
3158 | #else | ||
3159 | -#define current_user_ns() (&init_user_ns) | ||
3160 | +static inline struct user_namespace *current_user_ns(void) | ||
3161 | +{ | ||
3162 | + return &init_user_ns; | ||
3163 | +} | ||
3164 | #endif | ||
3165 | |||
3166 | |||
3167 | diff --git a/kernel/cpu.c b/kernel/cpu.c | ||
3168 | index cd6d1258554e..40d20bf5de28 100644 | ||
3169 | --- a/kernel/cpu.c | ||
3170 | +++ b/kernel/cpu.c | ||
3171 | @@ -223,10 +223,6 @@ static int cpu_notify(unsigned long val, void *v) | ||
3172 | return __cpu_notify(val, v, -1, NULL); | ||
3173 | } | ||
3174 | |||
3175 | -static void cpu_notify_nofail(unsigned long val, void *v) | ||
3176 | -{ | ||
3177 | - BUG_ON(cpu_notify(val, v)); | ||
3178 | -} | ||
3179 | EXPORT_SYMBOL(register_cpu_notifier); | ||
3180 | EXPORT_SYMBOL(__register_cpu_notifier); | ||
3181 | |||
3182 | @@ -245,6 +241,11 @@ void __unregister_cpu_notifier(struct notifier_block *nb) | ||
3183 | EXPORT_SYMBOL(__unregister_cpu_notifier); | ||
3184 | |||
3185 | #ifdef CONFIG_HOTPLUG_CPU | ||
3186 | +static void cpu_notify_nofail(unsigned long val, void *v) | ||
3187 | +{ | ||
3188 | + BUG_ON(cpu_notify(val, v)); | ||
3189 | +} | ||
3190 | + | ||
3191 | /** | ||
3192 | * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU | ||
3193 | * @cpu: a CPU id | ||
3194 | diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c | ||
3195 | index f6aae7977824..d2a20e83ebae 100644 | ||
3196 | --- a/kernel/time/tick-broadcast.c | ||
3197 | +++ b/kernel/time/tick-broadcast.c | ||
3198 | @@ -871,6 +871,9 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | ||
3199 | { | ||
3200 | int cpu = smp_processor_id(); | ||
3201 | |||
3202 | + if (!bc) | ||
3203 | + return; | ||
3204 | + | ||
3205 | /* Set it up only once ! */ | ||
3206 | if (bc->event_handler != tick_handle_oneshot_broadcast) { | ||
3207 | int was_periodic = clockevent_state_periodic(bc); | ||
3208 | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c | ||
3209 | index e1225b395415..ea5dfefd765a 100644 | ||
3210 | --- a/net/mac80211/tx.c | ||
3211 | +++ b/net/mac80211/tx.c | ||
3212 | @@ -2699,7 +2699,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, | ||
3213 | int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); | ||
3214 | int hw_headroom = sdata->local->hw.extra_tx_headroom; | ||
3215 | struct ethhdr eth; | ||
3216 | - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
3217 | + struct ieee80211_tx_info *info; | ||
3218 | struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; | ||
3219 | struct ieee80211_tx_data tx; | ||
3220 | ieee80211_tx_result r; | ||
3221 | @@ -2761,6 +2761,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, | ||
3222 | memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); | ||
3223 | memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); | ||
3224 | |||
3225 | + info = IEEE80211_SKB_CB(skb); | ||
3226 | memset(info, 0, sizeof(*info)); | ||
3227 | info->band = fast_tx->band; | ||
3228 | info->control.vif = &sdata->vif; | ||
3229 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
3230 | index 3b2687889cd5..00c50d58f108 100644 | ||
3231 | --- a/sound/pci/hda/patch_realtek.c | ||
3232 | +++ b/sound/pci/hda/patch_realtek.c | ||
3233 | @@ -2230,6 +2230,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | ||
3234 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), | ||
3235 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), | ||
3236 | SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), | ||
3237 | + SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), | ||
3238 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), | ||
3239 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), | ||
3240 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), | ||
3241 | @@ -6892,6 +6893,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | ||
3242 | SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), | ||
3243 | SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), | ||
3244 | SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), | ||
3245 | + SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8), | ||
3246 | SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), | ||
3247 | SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), | ||
3248 | SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), | ||
3249 | diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c | ||
3250 | index e163b0148c4b..fd6e247d9fd8 100644 | ||
3251 | --- a/sound/soc/samsung/i2s.c | ||
3252 | +++ b/sound/soc/samsung/i2s.c | ||
3253 | @@ -1027,12 +1027,13 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) | ||
3254 | static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) | ||
3255 | { | ||
3256 | struct i2s_dai *i2s = snd_soc_dai_get_drvdata(dai); | ||
3257 | + unsigned long flags; | ||
3258 | |||
3259 | if (!is_secondary(i2s)) { | ||
3260 | if (i2s->quirks & QUIRK_NEED_RSTCLR) { | ||
3261 | - spin_lock(i2s->lock); | ||
3262 | + spin_lock_irqsave(i2s->lock, flags); | ||
3263 | writel(0, i2s->addr + I2SCON); | ||
3264 | - spin_unlock(i2s->lock); | ||
3265 | + spin_unlock_irqrestore(i2s->lock, flags); | ||
3266 | } | ||
3267 | } | ||
3268 | |||
3269 | diff --git a/sound/usb/card.c b/sound/usb/card.c | ||
3270 | index 1f09d9591276..a1cbaa5f7fc9 100644 | ||
3271 | --- a/sound/usb/card.c | ||
3272 | +++ b/sound/usb/card.c | ||
3273 | @@ -202,7 +202,6 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int | ||
3274 | if (! snd_usb_parse_audio_interface(chip, interface)) { | ||
3275 | usb_set_interface(dev, interface, 0); /* reset the current interface */ | ||
3276 | usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); | ||
3277 | - return -EINVAL; | ||
3278 | } | ||
3279 | |||
3280 | return 0; | ||
3281 | diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c | ||
3282 | index c07a7eda42a2..be1f511e4f54 100644 | ||
3283 | --- a/sound/usb/endpoint.c | ||
3284 | +++ b/sound/usb/endpoint.c | ||
3285 | @@ -538,6 +538,11 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep) | ||
3286 | alive, ep->ep_num); | ||
3287 | clear_bit(EP_FLAG_STOPPING, &ep->flags); | ||
3288 | |||
3289 | + ep->data_subs = NULL; | ||
3290 | + ep->sync_slave = NULL; | ||
3291 | + ep->retire_data_urb = NULL; | ||
3292 | + ep->prepare_data_urb = NULL; | ||
3293 | + | ||
3294 | return 0; | ||
3295 | } | ||
3296 | |||
3297 | @@ -902,9 +907,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | ||
3298 | /** | ||
3299 | * snd_usb_endpoint_start: start an snd_usb_endpoint | ||
3300 | * | ||
3301 | - * @ep: the endpoint to start | ||
3302 | - * @can_sleep: flag indicating whether the operation is executed in | ||
3303 | - * non-atomic context | ||
3304 | + * @ep: the endpoint to start | ||
3305 | * | ||
3306 | * A call to this function will increment the use count of the endpoint. | ||
3307 | * In case it is not already running, the URBs for this endpoint will be | ||
3308 | @@ -914,7 +917,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | ||
3309 | * | ||
3310 | * Returns an error if the URB submission failed, 0 in all other cases. | ||
3311 | */ | ||
3312 | -int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep) | ||
3313 | +int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) | ||
3314 | { | ||
3315 | int err; | ||
3316 | unsigned int i; | ||
3317 | @@ -928,8 +931,6 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep) | ||
3318 | |||
3319 | /* just to be sure */ | ||
3320 | deactivate_urbs(ep, false); | ||
3321 | - if (can_sleep) | ||
3322 | - wait_clear_urbs(ep); | ||
3323 | |||
3324 | ep->active_mask = 0; | ||
3325 | ep->unlink_mask = 0; | ||
3326 | @@ -1010,10 +1011,6 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep) | ||
3327 | |||
3328 | if (--ep->use_count == 0) { | ||
3329 | deactivate_urbs(ep, false); | ||
3330 | - ep->data_subs = NULL; | ||
3331 | - ep->sync_slave = NULL; | ||
3332 | - ep->retire_data_urb = NULL; | ||
3333 | - ep->prepare_data_urb = NULL; | ||
3334 | set_bit(EP_FLAG_STOPPING, &ep->flags); | ||
3335 | } | ||
3336 | } | ||
3337 | diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h | ||
3338 | index 6428392d8f62..584f295d7c77 100644 | ||
3339 | --- a/sound/usb/endpoint.h | ||
3340 | +++ b/sound/usb/endpoint.h | ||
3341 | @@ -18,7 +18,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, | ||
3342 | struct audioformat *fmt, | ||
3343 | struct snd_usb_endpoint *sync_ep); | ||
3344 | |||
3345 | -int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep); | ||
3346 | +int snd_usb_endpoint_start(struct snd_usb_endpoint *ep); | ||
3347 | void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep); | ||
3348 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); | ||
3349 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); | ||
3350 | diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c | ||
3351 | index 44d178ee9177..48afae053c56 100644 | ||
3352 | --- a/sound/usb/pcm.c | ||
3353 | +++ b/sound/usb/pcm.c | ||
3354 | @@ -218,7 +218,7 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, | ||
3355 | } | ||
3356 | } | ||
3357 | |||
3358 | -static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) | ||
3359 | +static int start_endpoints(struct snd_usb_substream *subs) | ||
3360 | { | ||
3361 | int err; | ||
3362 | |||
3363 | @@ -231,7 +231,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) | ||
3364 | dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep); | ||
3365 | |||
3366 | ep->data_subs = subs; | ||
3367 | - err = snd_usb_endpoint_start(ep, can_sleep); | ||
3368 | + err = snd_usb_endpoint_start(ep); | ||
3369 | if (err < 0) { | ||
3370 | clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags); | ||
3371 | return err; | ||
3372 | @@ -260,7 +260,7 @@ static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep) | ||
3373 | dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep); | ||
3374 | |||
3375 | ep->sync_slave = subs->data_endpoint; | ||
3376 | - err = snd_usb_endpoint_start(ep, can_sleep); | ||
3377 | + err = snd_usb_endpoint_start(ep); | ||
3378 | if (err < 0) { | ||
3379 | clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); | ||
3380 | return err; | ||
3381 | @@ -839,7 +839,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | ||
3382 | /* for playback, submit the URBs now; otherwise, the first hwptr_done | ||
3383 | * updates for all URBs would happen at the same time when starting */ | ||
3384 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) | ||
3385 | - ret = start_endpoints(subs, true); | ||
3386 | + ret = start_endpoints(subs); | ||
3387 | |||
3388 | unlock: | ||
3389 | snd_usb_unlock_shutdown(subs->stream->chip); | ||
3390 | @@ -1655,7 +1655,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream | ||
3391 | |||
3392 | switch (cmd) { | ||
3393 | case SNDRV_PCM_TRIGGER_START: | ||
3394 | - err = start_endpoints(subs, false); | ||
3395 | + err = start_endpoints(subs); | ||
3396 | if (err < 0) | ||
3397 | return err; | ||
3398 |