1 |
commit: 0cd1d154130ca8126d43a19aa18408d0541e2c16 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Nov 25 16:24:36 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 25 16:25:28 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0cd1d154 |
7 |
|
8 |
Linux patch 4.4.203 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1202_linux-4.4.203.patch | 6356 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 6360 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index d34bfc1..e8a6184 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -851,6 +851,10 @@ Patch: 1201_linux-4.4.202.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.4.202 |
23 |
|
24 |
+Patch: 1202_linux-4.4.203.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.4.203 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1202_linux-4.4.203.patch b/1202_linux-4.4.203.patch |
33 |
new file mode 100644 |
34 |
index 0000000..fc3ca6d |
35 |
--- /dev/null |
36 |
+++ b/1202_linux-4.4.203.patch |
37 |
@@ -0,0 +1,6356 @@ |
38 |
+diff --git a/Documentation/misc-devices/mei/mei-amt-version.c b/Documentation/misc-devices/mei/mei-amt-version.c |
39 |
+index 57d0d871dcf7..33e67bd1dc34 100644 |
40 |
+--- a/Documentation/misc-devices/mei/mei-amt-version.c |
41 |
++++ b/Documentation/misc-devices/mei/mei-amt-version.c |
42 |
+@@ -370,7 +370,7 @@ static uint32_t amt_host_if_call(struct amt_host_if *acmd, |
43 |
+ unsigned int expected_sz) |
44 |
+ { |
45 |
+ uint32_t in_buf_sz; |
46 |
+- uint32_t out_buf_sz; |
47 |
++ ssize_t out_buf_sz; |
48 |
+ ssize_t written; |
49 |
+ uint32_t status; |
50 |
+ struct amt_host_if_resp_header *msg_hdr; |
51 |
+diff --git a/Makefile b/Makefile |
52 |
+index e7fecd28672e..3163f289cb52 100644 |
53 |
+--- a/Makefile |
54 |
++++ b/Makefile |
55 |
+@@ -1,6 +1,6 @@ |
56 |
+ VERSION = 4 |
57 |
+ PATCHLEVEL = 4 |
58 |
+-SUBLEVEL = 202 |
59 |
++SUBLEVEL = 203 |
60 |
+ EXTRAVERSION = |
61 |
+ NAME = Blurry Fish Butt |
62 |
+ |
63 |
+diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h |
64 |
+index 17ae0f3efac8..005bf4ff1b4c 100644 |
65 |
+--- a/arch/arm/boot/compressed/libfdt_env.h |
66 |
++++ b/arch/arm/boot/compressed/libfdt_env.h |
67 |
+@@ -5,6 +5,8 @@ |
68 |
+ #include <linux/string.h> |
69 |
+ #include <asm/byteorder.h> |
70 |
+ |
71 |
++#define INT_MAX ((int)(~0U>>1)) |
72 |
++ |
73 |
+ typedef __be16 fdt16_t; |
74 |
+ typedef __be32 fdt32_t; |
75 |
+ typedef __be64 fdt64_t; |
76 |
+diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts |
77 |
+index d9d00ab863a2..2b8614e406f0 100644 |
78 |
+--- a/arch/arm/boot/dts/am335x-evm.dts |
79 |
++++ b/arch/arm/boot/dts/am335x-evm.dts |
80 |
+@@ -697,6 +697,7 @@ |
81 |
+ pinctrl-0 = <&cpsw_default>; |
82 |
+ pinctrl-1 = <&cpsw_sleep>; |
83 |
+ status = "okay"; |
84 |
++ slaves = <1>; |
85 |
+ }; |
86 |
+ |
87 |
+ &davinci_mdio { |
88 |
+@@ -704,15 +705,14 @@ |
89 |
+ pinctrl-0 = <&davinci_mdio_default>; |
90 |
+ pinctrl-1 = <&davinci_mdio_sleep>; |
91 |
+ status = "okay"; |
92 |
+-}; |
93 |
+ |
94 |
+-&cpsw_emac0 { |
95 |
+- phy_id = <&davinci_mdio>, <0>; |
96 |
+- phy-mode = "rgmii-txid"; |
97 |
++ ethphy0: ethernet-phy@0 { |
98 |
++ reg = <0>; |
99 |
++ }; |
100 |
+ }; |
101 |
+ |
102 |
+-&cpsw_emac1 { |
103 |
+- phy_id = <&davinci_mdio>, <1>; |
104 |
++&cpsw_emac0 { |
105 |
++ phy-handle = <ðphy0>; |
106 |
+ phy-mode = "rgmii-txid"; |
107 |
+ }; |
108 |
+ |
109 |
+diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi |
110 |
+index af8b708ac312..53a5a0e311e9 100644 |
111 |
+--- a/arch/arm/boot/dts/at91sam9g45.dtsi |
112 |
++++ b/arch/arm/boot/dts/at91sam9g45.dtsi |
113 |
+@@ -546,7 +546,7 @@ |
114 |
+ }; |
115 |
+ }; |
116 |
+ |
117 |
+- uart1 { |
118 |
++ usart1 { |
119 |
+ pinctrl_usart1: usart1-0 { |
120 |
+ atmel,pins = |
121 |
+ <AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB4 periph A with pullup */ |
122 |
+diff --git a/arch/arm/boot/dts/exynos5250-snow-rev5.dts b/arch/arm/boot/dts/exynos5250-snow-rev5.dts |
123 |
+index f811dc800660..0d46f754070e 100644 |
124 |
+--- a/arch/arm/boot/dts/exynos5250-snow-rev5.dts |
125 |
++++ b/arch/arm/boot/dts/exynos5250-snow-rev5.dts |
126 |
+@@ -23,6 +23,14 @@ |
127 |
+ |
128 |
+ samsung,model = "Snow-I2S-MAX98090"; |
129 |
+ samsung,audio-codec = <&max98090>; |
130 |
++ |
131 |
++ cpu { |
132 |
++ sound-dai = <&i2s0 0>; |
133 |
++ }; |
134 |
++ |
135 |
++ codec { |
136 |
++ sound-dai = <&max98090 0>, <&hdmi>; |
137 |
++ }; |
138 |
+ }; |
139 |
+ }; |
140 |
+ |
141 |
+@@ -34,6 +42,9 @@ |
142 |
+ interrupt-parent = <&gpx0>; |
143 |
+ pinctrl-names = "default"; |
144 |
+ pinctrl-0 = <&max98090_irq>; |
145 |
++ clocks = <&pmu_system_controller 0>; |
146 |
++ clock-names = "mclk"; |
147 |
++ #sound-dai-cells = <1>; |
148 |
+ }; |
149 |
+ }; |
150 |
+ |
151 |
+diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi |
152 |
+index e14d15e5abc8..acd0a9deb116 100644 |
153 |
+--- a/arch/arm/boot/dts/omap3-gta04.dtsi |
154 |
++++ b/arch/arm/boot/dts/omap3-gta04.dtsi |
155 |
+@@ -28,6 +28,7 @@ |
156 |
+ |
157 |
+ aliases { |
158 |
+ display0 = &lcd; |
159 |
++ display1 = &tv0; |
160 |
+ }; |
161 |
+ |
162 |
+ gpio-keys { |
163 |
+@@ -70,7 +71,7 @@ |
164 |
+ #sound-dai-cells = <0>; |
165 |
+ }; |
166 |
+ |
167 |
+- spi_lcd { |
168 |
++ spi_lcd: spi_lcd { |
169 |
+ compatible = "spi-gpio"; |
170 |
+ #address-cells = <0x1>; |
171 |
+ #size-cells = <0x0>; |
172 |
+@@ -459,6 +460,12 @@ |
173 |
+ regulator-max-microvolt = <3150000>; |
174 |
+ }; |
175 |
+ |
176 |
++/* Needed to power the DPI pins */ |
177 |
++ |
178 |
++&vpll2 { |
179 |
++ regulator-always-on; |
180 |
++}; |
181 |
++ |
182 |
+ &dss { |
183 |
+ pinctrl-names = "default"; |
184 |
+ pinctrl-0 = < &dss_dpi_pins >; |
185 |
+@@ -522,22 +529,22 @@ |
186 |
+ |
187 |
+ bootloaders@80000 { |
188 |
+ label = "U-Boot"; |
189 |
+- reg = <0x80000 0x1e0000>; |
190 |
++ reg = <0x80000 0x1c0000>; |
191 |
+ }; |
192 |
+ |
193 |
+- bootloaders_env@260000 { |
194 |
++ bootloaders_env@240000 { |
195 |
+ label = "U-Boot Env"; |
196 |
+- reg = <0x260000 0x20000>; |
197 |
++ reg = <0x240000 0x40000>; |
198 |
+ }; |
199 |
+ |
200 |
+ kernel@280000 { |
201 |
+ label = "Kernel"; |
202 |
+- reg = <0x280000 0x400000>; |
203 |
++ reg = <0x280000 0x600000>; |
204 |
+ }; |
205 |
+ |
206 |
+- filesystem@680000 { |
207 |
++ filesystem@880000 { |
208 |
+ label = "File System"; |
209 |
+- reg = <0x680000 0xf980000>; |
210 |
++ reg = <0x880000 0>; /* 0 = MTDPART_SIZ_FULL */ |
211 |
+ }; |
212 |
+ }; |
213 |
+ }; |
214 |
+diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi |
215 |
+index 210192c38df3..4448505e34d3 100644 |
216 |
+--- a/arch/arm/boot/dts/pxa27x.dtsi |
217 |
++++ b/arch/arm/boot/dts/pxa27x.dtsi |
218 |
+@@ -63,7 +63,7 @@ |
219 |
+ clocks = <&clks CLK_PWM1>; |
220 |
+ }; |
221 |
+ |
222 |
+- pwri2c: i2c@40f000180 { |
223 |
++ pwri2c: i2c@40f00180 { |
224 |
+ compatible = "mrvl,pxa-i2c"; |
225 |
+ reg = <0x40f00180 0x24>; |
226 |
+ interrupts = <6>; |
227 |
+diff --git a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts |
228 |
+index 555e9caf21e1..7b8e1c4215b5 100644 |
229 |
+--- a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts |
230 |
++++ b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts |
231 |
+@@ -88,7 +88,7 @@ |
232 |
+ status = "okay"; |
233 |
+ speed-mode = <0>; |
234 |
+ |
235 |
+- adxl345: adxl345@0 { |
236 |
++ adxl345: adxl345@53 { |
237 |
+ compatible = "adi,adxl345"; |
238 |
+ reg = <0x53>; |
239 |
+ |
240 |
+diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi |
241 |
+index 50f5e9d09203..b2b23ceb6d55 100644 |
242 |
+--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi |
243 |
++++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi |
244 |
+@@ -186,7 +186,7 @@ |
245 |
+ <0xa0410100 0x100>; |
246 |
+ }; |
247 |
+ |
248 |
+- scu@a04100000 { |
249 |
++ scu@a0410000 { |
250 |
+ compatible = "arm,cortex-a9-scu"; |
251 |
+ reg = <0xa0410000 0x100>; |
252 |
+ }; |
253 |
+@@ -894,7 +894,7 @@ |
254 |
+ power-domains = <&pm_domains DOMAIN_VAPE>; |
255 |
+ }; |
256 |
+ |
257 |
+- ssp@80002000 { |
258 |
++ spi@80002000 { |
259 |
+ compatible = "arm,pl022", "arm,primecell"; |
260 |
+ reg = <0x80002000 0x1000>; |
261 |
+ interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; |
262 |
+@@ -908,7 +908,7 @@ |
263 |
+ power-domains = <&pm_domains DOMAIN_VAPE>; |
264 |
+ }; |
265 |
+ |
266 |
+- ssp@80003000 { |
267 |
++ spi@80003000 { |
268 |
+ compatible = "arm,pl022", "arm,primecell"; |
269 |
+ reg = <0x80003000 0x1000>; |
270 |
+ interrupts = <0 52 IRQ_TYPE_LEVEL_HIGH>; |
271 |
+diff --git a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi |
272 |
+index 5c5cea232743..1ec193b0c506 100644 |
273 |
+--- a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi |
274 |
++++ b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi |
275 |
+@@ -607,16 +607,20 @@ |
276 |
+ |
277 |
+ mcde { |
278 |
+ lcd_default_mode: lcd_default { |
279 |
+- default_mux { |
280 |
++ default_mux1 { |
281 |
+ /* Mux in VSI0 and all the data lines */ |
282 |
+ function = "lcd"; |
283 |
+ groups = |
284 |
+ "lcdvsi0_a_1", /* VSI0 for LCD */ |
285 |
+ "lcd_d0_d7_a_1", /* Data lines */ |
286 |
+ "lcd_d8_d11_a_1", /* TV-out */ |
287 |
+- "lcdaclk_b_1", /* Clock line for TV-out */ |
288 |
+ "lcdvsi1_a_1"; /* VSI1 for HDMI */ |
289 |
+ }; |
290 |
++ default_mux2 { |
291 |
++ function = "lcda"; |
292 |
++ groups = |
293 |
++ "lcdaclk_b_1"; /* Clock line for TV-out */ |
294 |
++ }; |
295 |
+ default_cfg1 { |
296 |
+ pins = |
297 |
+ "GPIO68_E1", /* VSI0 */ |
298 |
+diff --git a/arch/arm/boot/dts/ste-hrefprev60.dtsi b/arch/arm/boot/dts/ste-hrefprev60.dtsi |
299 |
+index b0278f4c486c..55a6a1ac0337 100644 |
300 |
+--- a/arch/arm/boot/dts/ste-hrefprev60.dtsi |
301 |
++++ b/arch/arm/boot/dts/ste-hrefprev60.dtsi |
302 |
+@@ -57,7 +57,7 @@ |
303 |
+ }; |
304 |
+ }; |
305 |
+ |
306 |
+- ssp@80002000 { |
307 |
++ spi@80002000 { |
308 |
+ /* |
309 |
+ * On the first generation boards, this SSP/SPI port was connected |
310 |
+ * to the AB8500. |
311 |
+diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts |
312 |
+index e80e42163883..bb1b64d6ab5e 100644 |
313 |
+--- a/arch/arm/boot/dts/ste-snowball.dts |
314 |
++++ b/arch/arm/boot/dts/ste-snowball.dts |
315 |
+@@ -311,7 +311,7 @@ |
316 |
+ pinctrl-1 = <&i2c3_sleep_mode>; |
317 |
+ }; |
318 |
+ |
319 |
+- ssp@80002000 { |
320 |
++ spi@80002000 { |
321 |
+ pinctrl-names = "default"; |
322 |
+ pinctrl-0 = <&ssp0_snowball_mode>; |
323 |
+ }; |
324 |
+diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts |
325 |
+index 82a661677e97..fb6ca7f86417 100644 |
326 |
+--- a/arch/arm/boot/dts/ste-u300.dts |
327 |
++++ b/arch/arm/boot/dts/ste-u300.dts |
328 |
+@@ -451,7 +451,7 @@ |
329 |
+ dma-names = "rx"; |
330 |
+ }; |
331 |
+ |
332 |
+- spi: ssp@c0006000 { |
333 |
++ spi: spi@c0006000 { |
334 |
+ compatible = "arm,pl022", "arm,primecell"; |
335 |
+ reg = <0xc0006000 0x1000>; |
336 |
+ interrupt-parent = <&vica>; |
337 |
+diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi |
338 |
+index bf361277fe10..9a8c20cd0688 100644 |
339 |
+--- a/arch/arm/boot/dts/tegra30-apalis.dtsi |
340 |
++++ b/arch/arm/boot/dts/tegra30-apalis.dtsi |
341 |
+@@ -147,14 +147,14 @@ |
342 |
+ |
343 |
+ /* Apalis MMC1 */ |
344 |
+ sdmmc3_clk_pa6 { |
345 |
+- nvidia,pins = "sdmmc3_clk_pa6", |
346 |
+- "sdmmc3_cmd_pa7"; |
347 |
++ nvidia,pins = "sdmmc3_clk_pa6"; |
348 |
+ nvidia,function = "sdmmc3"; |
349 |
+ nvidia,pull = <TEGRA_PIN_PULL_NONE>; |
350 |
+ nvidia,tristate = <TEGRA_PIN_DISABLE>; |
351 |
+ }; |
352 |
+ sdmmc3_dat0_pb7 { |
353 |
+- nvidia,pins = "sdmmc3_dat0_pb7", |
354 |
++ nvidia,pins = "sdmmc3_cmd_pa7", |
355 |
++ "sdmmc3_dat0_pb7", |
356 |
+ "sdmmc3_dat1_pb6", |
357 |
+ "sdmmc3_dat2_pb5", |
358 |
+ "sdmmc3_dat3_pb4", |
359 |
+diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi |
360 |
+index 313e260529a3..e8f5a55c4b95 100644 |
361 |
+--- a/arch/arm/boot/dts/tegra30.dtsi |
362 |
++++ b/arch/arm/boot/dts/tegra30.dtsi |
363 |
+@@ -823,7 +823,7 @@ |
364 |
+ nvidia,elastic-limit = <16>; |
365 |
+ nvidia,term-range-adj = <6>; |
366 |
+ nvidia,xcvr-setup = <51>; |
367 |
+- nvidia.xcvr-setup-use-fuses; |
368 |
++ nvidia,xcvr-setup-use-fuses; |
369 |
+ nvidia,xcvr-lsfslew = <1>; |
370 |
+ nvidia,xcvr-lsrslew = <1>; |
371 |
+ nvidia,xcvr-hsslew = <32>; |
372 |
+@@ -860,7 +860,7 @@ |
373 |
+ nvidia,elastic-limit = <16>; |
374 |
+ nvidia,term-range-adj = <6>; |
375 |
+ nvidia,xcvr-setup = <51>; |
376 |
+- nvidia.xcvr-setup-use-fuses; |
377 |
++ nvidia,xcvr-setup-use-fuses; |
378 |
+ nvidia,xcvr-lsfslew = <2>; |
379 |
+ nvidia,xcvr-lsrslew = <2>; |
380 |
+ nvidia,xcvr-hsslew = <32>; |
381 |
+@@ -896,7 +896,7 @@ |
382 |
+ nvidia,elastic-limit = <16>; |
383 |
+ nvidia,term-range-adj = <6>; |
384 |
+ nvidia,xcvr-setup = <51>; |
385 |
+- nvidia.xcvr-setup-use-fuses; |
386 |
++ nvidia,xcvr-setup-use-fuses; |
387 |
+ nvidia,xcvr-lsfslew = <2>; |
388 |
+ nvidia,xcvr-lsrslew = <2>; |
389 |
+ nvidia,xcvr-hsslew = <32>; |
390 |
+diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S |
391 |
+index e969b18d9ff9..d31f0300d2c9 100644 |
392 |
+--- a/arch/arm/kernel/entry-common.S |
393 |
++++ b/arch/arm/kernel/entry-common.S |
394 |
+@@ -261,16 +261,15 @@ __sys_trace: |
395 |
+ cmp scno, #-1 @ skip the syscall? |
396 |
+ bne 2b |
397 |
+ add sp, sp, #S_OFF @ restore stack |
398 |
+- b ret_slow_syscall |
399 |
+ |
400 |
+-__sys_trace_return: |
401 |
+- str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 |
402 |
++__sys_trace_return_nosave: |
403 |
++ enable_irq_notrace |
404 |
+ mov r0, sp |
405 |
+ bl syscall_trace_exit |
406 |
+ b ret_slow_syscall |
407 |
+ |
408 |
+-__sys_trace_return_nosave: |
409 |
+- enable_irq_notrace |
410 |
++__sys_trace_return: |
411 |
++ str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 |
412 |
+ mov r0, sp |
413 |
+ bl syscall_trace_exit |
414 |
+ b ret_slow_syscall |
415 |
+diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c |
416 |
+index a19d20f23e71..fff529c5f9b3 100644 |
417 |
+--- a/arch/arm/mach-imx/pm-imx6.c |
418 |
++++ b/arch/arm/mach-imx/pm-imx6.c |
419 |
+@@ -602,6 +602,28 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata |
420 |
+ IMX6Q_GPR1_GINT); |
421 |
+ } |
422 |
+ |
423 |
++static void imx6_pm_stby_poweroff(void) |
424 |
++{ |
425 |
++ imx6_set_lpm(STOP_POWER_OFF); |
426 |
++ imx6q_suspend_finish(0); |
427 |
++ |
428 |
++ mdelay(1000); |
429 |
++ |
430 |
++ pr_emerg("Unable to poweroff system\n"); |
431 |
++} |
432 |
++ |
433 |
++static int imx6_pm_stby_poweroff_probe(void) |
434 |
++{ |
435 |
++ if (pm_power_off) { |
436 |
++ pr_warn("%s: pm_power_off already claimed %p %pf!\n", |
437 |
++ __func__, pm_power_off, pm_power_off); |
438 |
++ return -EBUSY; |
439 |
++ } |
440 |
++ |
441 |
++ pm_power_off = imx6_pm_stby_poweroff; |
442 |
++ return 0; |
443 |
++} |
444 |
++ |
445 |
+ void __init imx6_pm_ccm_init(const char *ccm_compat) |
446 |
+ { |
447 |
+ struct device_node *np; |
448 |
+@@ -618,6 +640,9 @@ void __init imx6_pm_ccm_init(const char *ccm_compat) |
449 |
+ val = readl_relaxed(ccm_base + CLPCR); |
450 |
+ val &= ~BM_CLPCR_LPM; |
451 |
+ writel_relaxed(val, ccm_base + CLPCR); |
452 |
++ |
453 |
++ if (of_property_read_bool(np, "fsl,pmic-stby-poweroff")) |
454 |
++ imx6_pm_stby_poweroff_probe(); |
455 |
+ } |
456 |
+ |
457 |
+ void __init imx6q_pm_init(void) |
458 |
+diff --git a/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi b/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi |
459 |
+index 2874d92881fd..a3030c868be5 100644 |
460 |
+--- a/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi |
461 |
++++ b/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi |
462 |
+@@ -84,7 +84,7 @@ |
463 |
+ clock-names = "uartclk", "apb_pclk"; |
464 |
+ }; |
465 |
+ |
466 |
+- spi0: ssp@e1020000 { |
467 |
++ spi0: spi@e1020000 { |
468 |
+ status = "disabled"; |
469 |
+ compatible = "arm,pl022", "arm,primecell"; |
470 |
+ #gpio-cells = <2>; |
471 |
+@@ -95,7 +95,7 @@ |
472 |
+ clock-names = "apb_pclk"; |
473 |
+ }; |
474 |
+ |
475 |
+- spi1: ssp@e1030000 { |
476 |
++ spi1: spi@e1030000 { |
477 |
+ status = "disabled"; |
478 |
+ compatible = "arm,pl022", "arm,primecell"; |
479 |
+ #gpio-cells = <2>; |
480 |
+diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S |
481 |
+index a9723c71c52b..8d330c30a6f9 100644 |
482 |
+--- a/arch/arm64/lib/clear_user.S |
483 |
++++ b/arch/arm64/lib/clear_user.S |
484 |
+@@ -62,5 +62,7 @@ ENDPROC(__clear_user) |
485 |
+ .section .fixup,"ax" |
486 |
+ .align 2 |
487 |
+ 9: mov x0, x2 // return the original size |
488 |
++ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_HAS_PAN, \ |
489 |
++ CONFIG_ARM64_PAN) |
490 |
+ ret |
491 |
+ .previous |
492 |
+diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S |
493 |
+index 4699cd74f87e..b8c95ef13229 100644 |
494 |
+--- a/arch/arm64/lib/copy_from_user.S |
495 |
++++ b/arch/arm64/lib/copy_from_user.S |
496 |
+@@ -85,5 +85,7 @@ ENDPROC(__copy_from_user) |
497 |
+ strb wzr, [dst], #1 // zero remaining buffer space |
498 |
+ cmp dst, end |
499 |
+ b.lo 9999b |
500 |
++ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_HAS_PAN, \ |
501 |
++ CONFIG_ARM64_PAN) |
502 |
+ ret |
503 |
+ .previous |
504 |
+diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S |
505 |
+index 81c8fc93c100..233703c84bcd 100644 |
506 |
+--- a/arch/arm64/lib/copy_in_user.S |
507 |
++++ b/arch/arm64/lib/copy_in_user.S |
508 |
+@@ -81,5 +81,7 @@ ENDPROC(__copy_in_user) |
509 |
+ .section .fixup,"ax" |
510 |
+ .align 2 |
511 |
+ 9998: sub x0, end, dst // bytes not copied |
512 |
++ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_HAS_PAN, \ |
513 |
++ CONFIG_ARM64_PAN) |
514 |
+ ret |
515 |
+ .previous |
516 |
+diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S |
517 |
+index 7512bbbc07ac..62b179408b23 100644 |
518 |
+--- a/arch/arm64/lib/copy_to_user.S |
519 |
++++ b/arch/arm64/lib/copy_to_user.S |
520 |
+@@ -79,5 +79,7 @@ ENDPROC(__copy_to_user) |
521 |
+ .section .fixup,"ax" |
522 |
+ .align 2 |
523 |
+ 9998: sub x0, end, dst // bytes not copied |
524 |
++ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_HAS_PAN, \ |
525 |
++ CONFIG_ARM64_PAN) |
526 |
+ ret |
527 |
+ .previous |
528 |
+diff --git a/arch/mips/bcm47xx/workarounds.c b/arch/mips/bcm47xx/workarounds.c |
529 |
+index e81ce4623070..06fb94370c7c 100644 |
530 |
+--- a/arch/mips/bcm47xx/workarounds.c |
531 |
++++ b/arch/mips/bcm47xx/workarounds.c |
532 |
+@@ -4,9 +4,8 @@ |
533 |
+ #include <bcm47xx_board.h> |
534 |
+ #include <bcm47xx.h> |
535 |
+ |
536 |
+-static void __init bcm47xx_workarounds_netgear_wnr3500l(void) |
537 |
++static void __init bcm47xx_workarounds_enable_usb_power(int usb_power) |
538 |
+ { |
539 |
+- const int usb_power = 12; |
540 |
+ int err; |
541 |
+ |
542 |
+ err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power"); |
543 |
+@@ -22,7 +21,10 @@ void __init bcm47xx_workarounds(void) |
544 |
+ |
545 |
+ switch (board) { |
546 |
+ case BCM47XX_BOARD_NETGEAR_WNR3500L: |
547 |
+- bcm47xx_workarounds_netgear_wnr3500l(); |
548 |
++ bcm47xx_workarounds_enable_usb_power(12); |
549 |
++ break; |
550 |
++ case BCM47XX_BOARD_NETGEAR_WNDR3400_V3: |
551 |
++ bcm47xx_workarounds_enable_usb_power(21); |
552 |
+ break; |
553 |
+ default: |
554 |
+ /* No workaround(s) needed */ |
555 |
+diff --git a/arch/mips/include/asm/kexec.h b/arch/mips/include/asm/kexec.h |
556 |
+index ee25ebbf2a28..b6a4d4aa548f 100644 |
557 |
+--- a/arch/mips/include/asm/kexec.h |
558 |
++++ b/arch/mips/include/asm/kexec.h |
559 |
+@@ -12,11 +12,11 @@ |
560 |
+ #include <asm/stacktrace.h> |
561 |
+ |
562 |
+ /* Maximum physical address we can use pages from */ |
563 |
+-#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000) |
564 |
++#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) |
565 |
+ /* Maximum address we can reach in physical address mode */ |
566 |
+-#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000) |
567 |
++#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) |
568 |
+ /* Maximum address we can use for the control code buffer */ |
569 |
+-#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000) |
570 |
++#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) |
571 |
+ /* Reserve 3*4096 bytes for board-specific info */ |
572 |
+ #define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096) |
573 |
+ |
574 |
+diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c |
575 |
+index 9d9962ab7d25..7dc97e944d5a 100644 |
576 |
+--- a/arch/mips/txx9/generic/setup.c |
577 |
++++ b/arch/mips/txx9/generic/setup.c |
578 |
+@@ -961,12 +961,11 @@ void __init txx9_sramc_init(struct resource *r) |
579 |
+ goto exit_put; |
580 |
+ err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); |
581 |
+ if (err) { |
582 |
+- device_unregister(&dev->dev); |
583 |
+ iounmap(dev->base); |
584 |
+- kfree(dev); |
585 |
++ device_unregister(&dev->dev); |
586 |
+ } |
587 |
+ return; |
588 |
+ exit_put: |
589 |
++ iounmap(dev->base); |
590 |
+ put_device(&dev->dev); |
591 |
+- return; |
592 |
+ } |
593 |
+diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h |
594 |
+index 7e3789ea396b..0b3db6322c79 100644 |
595 |
+--- a/arch/powerpc/boot/libfdt_env.h |
596 |
++++ b/arch/powerpc/boot/libfdt_env.h |
597 |
+@@ -4,6 +4,8 @@ |
598 |
+ #include <types.h> |
599 |
+ #include <string.h> |
600 |
+ |
601 |
++#define INT_MAX ((int)(~0U>>1)) |
602 |
++ |
603 |
+ #include "of.h" |
604 |
+ |
605 |
+ typedef u32 uint32_t; |
606 |
+diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c |
607 |
+index a8e3490b54e3..4c9b5970af37 100644 |
608 |
+--- a/arch/powerpc/kernel/iommu.c |
609 |
++++ b/arch/powerpc/kernel/iommu.c |
610 |
+@@ -764,9 +764,9 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl, |
611 |
+ |
612 |
+ vaddr = page_address(page) + offset; |
613 |
+ uaddr = (unsigned long)vaddr; |
614 |
+- npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl)); |
615 |
+ |
616 |
+ if (tbl) { |
617 |
++ npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl)); |
618 |
+ align = 0; |
619 |
+ if (tbl->it_page_shift < PAGE_SHIFT && size >= PAGE_SIZE && |
620 |
+ ((unsigned long)vaddr & ~PAGE_MASK) == 0) |
621 |
+diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c |
622 |
+index 0c42e872d548..4fcaa7d3d544 100644 |
623 |
+--- a/arch/powerpc/kernel/rtas.c |
624 |
++++ b/arch/powerpc/kernel/rtas.c |
625 |
+@@ -967,6 +967,7 @@ int rtas_ibm_suspend_me(u64 handle) |
626 |
+ goto out; |
627 |
+ } |
628 |
+ |
629 |
++ cpu_hotplug_disable(); |
630 |
+ stop_topology_update(); |
631 |
+ |
632 |
+ /* Call function on all CPUs. One of us will make the |
633 |
+@@ -981,6 +982,7 @@ int rtas_ibm_suspend_me(u64 handle) |
634 |
+ printk(KERN_ERR "Error doing global join\n"); |
635 |
+ |
636 |
+ start_topology_update(); |
637 |
++ cpu_hotplug_enable(); |
638 |
+ |
639 |
+ /* Take down CPUs not online prior to suspend */ |
640 |
+ cpuret = rtas_offline_cpus_mask(offline_mask); |
641 |
+diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S |
642 |
+index 59cf5f452879..9d112e1b31b8 100644 |
643 |
+--- a/arch/powerpc/kernel/vdso32/datapage.S |
644 |
++++ b/arch/powerpc/kernel/vdso32/datapage.S |
645 |
+@@ -37,6 +37,7 @@ data_page_branch: |
646 |
+ mtlr r0 |
647 |
+ addi r3, r3, __kernel_datapage_offset-data_page_branch |
648 |
+ lwz r0,0(r3) |
649 |
++ .cfi_restore lr |
650 |
+ add r3,r0,r3 |
651 |
+ blr |
652 |
+ .cfi_endproc |
653 |
+diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S |
654 |
+index 6b2b69616e77..7b341b86216c 100644 |
655 |
+--- a/arch/powerpc/kernel/vdso32/gettimeofday.S |
656 |
++++ b/arch/powerpc/kernel/vdso32/gettimeofday.S |
657 |
+@@ -139,6 +139,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) |
658 |
+ */ |
659 |
+ 99: |
660 |
+ li r0,__NR_clock_gettime |
661 |
++ .cfi_restore lr |
662 |
+ sc |
663 |
+ blr |
664 |
+ .cfi_endproc |
665 |
+diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S |
666 |
+index 7612eeb31da1..6832e41c372b 100644 |
667 |
+--- a/arch/powerpc/kernel/vdso64/datapage.S |
668 |
++++ b/arch/powerpc/kernel/vdso64/datapage.S |
669 |
+@@ -37,6 +37,7 @@ data_page_branch: |
670 |
+ mtlr r0 |
671 |
+ addi r3, r3, __kernel_datapage_offset-data_page_branch |
672 |
+ lwz r0,0(r3) |
673 |
++ .cfi_restore lr |
674 |
+ add r3,r0,r3 |
675 |
+ blr |
676 |
+ .cfi_endproc |
677 |
+diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S |
678 |
+index 382021324883..09b2a49f6dd5 100644 |
679 |
+--- a/arch/powerpc/kernel/vdso64/gettimeofday.S |
680 |
++++ b/arch/powerpc/kernel/vdso64/gettimeofday.S |
681 |
+@@ -124,6 +124,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) |
682 |
+ */ |
683 |
+ 99: |
684 |
+ li r0,__NR_clock_gettime |
685 |
++ .cfi_restore lr |
686 |
+ sc |
687 |
+ blr |
688 |
+ .cfi_endproc |
689 |
+diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c |
690 |
+index 4aab1c9c83e1..41ac54bfdfdd 100644 |
691 |
+--- a/arch/powerpc/kvm/book3s.c |
692 |
++++ b/arch/powerpc/kvm/book3s.c |
693 |
+@@ -70,8 +70,11 @@ void kvmppc_unfixup_split_real(struct kvm_vcpu *vcpu) |
694 |
+ { |
695 |
+ if (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) { |
696 |
+ ulong pc = kvmppc_get_pc(vcpu); |
697 |
++ ulong lr = kvmppc_get_lr(vcpu); |
698 |
+ if ((pc & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS) |
699 |
+ kvmppc_set_pc(vcpu, pc & ~SPLIT_HACK_MASK); |
700 |
++ if ((lr & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS) |
701 |
++ kvmppc_set_lr(vcpu, lr & ~SPLIT_HACK_MASK); |
702 |
+ vcpu->arch.hflags &= ~BOOK3S_HFLAG_SPLIT_HACK; |
703 |
+ } |
704 |
+ } |
705 |
+diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c |
706 |
+index 309027208f7c..27f00a7c1085 100644 |
707 |
+--- a/arch/powerpc/mm/slb.c |
708 |
++++ b/arch/powerpc/mm/slb.c |
709 |
+@@ -322,7 +322,7 @@ void slb_initialize(void) |
710 |
+ #endif |
711 |
+ } |
712 |
+ |
713 |
+- get_paca()->stab_rr = SLB_NUM_BOLTED; |
714 |
++ get_paca()->stab_rr = SLB_NUM_BOLTED - 1; |
715 |
+ |
716 |
+ lflags = SLB_VSID_KERNEL | linear_llp; |
717 |
+ vflags = SLB_VSID_KERNEL | vmalloc_llp; |
718 |
+diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c |
719 |
+index 39049e4884fb..7a4d172c9376 100644 |
720 |
+--- a/arch/powerpc/platforms/pseries/dtl.c |
721 |
++++ b/arch/powerpc/platforms/pseries/dtl.c |
722 |
+@@ -150,7 +150,7 @@ static int dtl_start(struct dtl *dtl) |
723 |
+ |
724 |
+ /* Register our dtl buffer with the hypervisor. The HV expects the |
725 |
+ * buffer size to be passed in the second word of the buffer */ |
726 |
+- ((u32 *)dtl->buf)[1] = DISPATCH_LOG_BYTES; |
727 |
++ ((u32 *)dtl->buf)[1] = cpu_to_be32(DISPATCH_LOG_BYTES); |
728 |
+ |
729 |
+ hwcpu = get_hard_smp_processor_id(dtl->cpu); |
730 |
+ addr = __pa(dtl->buf); |
731 |
+@@ -185,7 +185,7 @@ static void dtl_stop(struct dtl *dtl) |
732 |
+ |
733 |
+ static u64 dtl_current_index(struct dtl *dtl) |
734 |
+ { |
735 |
+- return lppaca_of(dtl->cpu).dtl_idx; |
736 |
++ return be64_to_cpu(lppaca_of(dtl->cpu).dtl_idx); |
737 |
+ } |
738 |
+ #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ |
739 |
+ |
740 |
+diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig |
741 |
+index 53b429811aef..1bee1c6a9891 100644 |
742 |
+--- a/arch/x86/Kconfig |
743 |
++++ b/arch/x86/Kconfig |
744 |
+@@ -2526,8 +2526,7 @@ config OLPC |
745 |
+ |
746 |
+ config OLPC_XO1_PM |
747 |
+ bool "OLPC XO-1 Power Management" |
748 |
+- depends on OLPC && MFD_CS5535 && PM_SLEEP |
749 |
+- select MFD_CORE |
750 |
++ depends on OLPC && MFD_CS5535=y && PM_SLEEP |
751 |
+ ---help--- |
752 |
+ Add support for poweroff and suspend of the OLPC XO-1 laptop. |
753 |
+ |
754 |
+diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h |
755 |
+index 3e8674288198..249fa6b27557 100644 |
756 |
+--- a/arch/x86/include/asm/atomic.h |
757 |
++++ b/arch/x86/include/asm/atomic.h |
758 |
+@@ -49,7 +49,7 @@ static __always_inline void atomic_add(int i, atomic_t *v) |
759 |
+ { |
760 |
+ asm volatile(LOCK_PREFIX "addl %1,%0" |
761 |
+ : "+m" (v->counter) |
762 |
+- : "ir" (i)); |
763 |
++ : "ir" (i) : "memory"); |
764 |
+ } |
765 |
+ |
766 |
+ /** |
767 |
+@@ -63,7 +63,7 @@ static __always_inline void atomic_sub(int i, atomic_t *v) |
768 |
+ { |
769 |
+ asm volatile(LOCK_PREFIX "subl %1,%0" |
770 |
+ : "+m" (v->counter) |
771 |
+- : "ir" (i)); |
772 |
++ : "ir" (i) : "memory"); |
773 |
+ } |
774 |
+ |
775 |
+ /** |
776 |
+@@ -89,7 +89,7 @@ static __always_inline int atomic_sub_and_test(int i, atomic_t *v) |
777 |
+ static __always_inline void atomic_inc(atomic_t *v) |
778 |
+ { |
779 |
+ asm volatile(LOCK_PREFIX "incl %0" |
780 |
+- : "+m" (v->counter)); |
781 |
++ : "+m" (v->counter) :: "memory"); |
782 |
+ } |
783 |
+ |
784 |
+ /** |
785 |
+@@ -101,7 +101,7 @@ static __always_inline void atomic_inc(atomic_t *v) |
786 |
+ static __always_inline void atomic_dec(atomic_t *v) |
787 |
+ { |
788 |
+ asm volatile(LOCK_PREFIX "decl %0" |
789 |
+- : "+m" (v->counter)); |
790 |
++ : "+m" (v->counter) :: "memory"); |
791 |
+ } |
792 |
+ |
793 |
+ /** |
794 |
+diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h |
795 |
+index 037351022f54..377fa50cc271 100644 |
796 |
+--- a/arch/x86/include/asm/atomic64_64.h |
797 |
++++ b/arch/x86/include/asm/atomic64_64.h |
798 |
+@@ -44,7 +44,7 @@ static __always_inline void atomic64_add(long i, atomic64_t *v) |
799 |
+ { |
800 |
+ asm volatile(LOCK_PREFIX "addq %1,%0" |
801 |
+ : "=m" (v->counter) |
802 |
+- : "er" (i), "m" (v->counter)); |
803 |
++ : "er" (i), "m" (v->counter) : "memory"); |
804 |
+ } |
805 |
+ |
806 |
+ /** |
807 |
+@@ -58,7 +58,7 @@ static inline void atomic64_sub(long i, atomic64_t *v) |
808 |
+ { |
809 |
+ asm volatile(LOCK_PREFIX "subq %1,%0" |
810 |
+ : "=m" (v->counter) |
811 |
+- : "er" (i), "m" (v->counter)); |
812 |
++ : "er" (i), "m" (v->counter) : "memory"); |
813 |
+ } |
814 |
+ |
815 |
+ /** |
816 |
+@@ -85,7 +85,7 @@ static __always_inline void atomic64_inc(atomic64_t *v) |
817 |
+ { |
818 |
+ asm volatile(LOCK_PREFIX "incq %0" |
819 |
+ : "=m" (v->counter) |
820 |
+- : "m" (v->counter)); |
821 |
++ : "m" (v->counter) : "memory"); |
822 |
+ } |
823 |
+ |
824 |
+ /** |
825 |
+@@ -98,7 +98,7 @@ static __always_inline void atomic64_dec(atomic64_t *v) |
826 |
+ { |
827 |
+ asm volatile(LOCK_PREFIX "decq %0" |
828 |
+ : "=m" (v->counter) |
829 |
+- : "m" (v->counter)); |
830 |
++ : "m" (v->counter) : "memory"); |
831 |
+ } |
832 |
+ |
833 |
+ /** |
834 |
+diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h |
835 |
+index 7f5dcb64cedb..b2a5bef74282 100644 |
836 |
+--- a/arch/x86/include/asm/barrier.h |
837 |
++++ b/arch/x86/include/asm/barrier.h |
838 |
+@@ -116,7 +116,7 @@ do { \ |
839 |
+ #endif |
840 |
+ |
841 |
+ /* Atomic operations are already serializing on x86 */ |
842 |
+-#define smp_mb__before_atomic() barrier() |
843 |
+-#define smp_mb__after_atomic() barrier() |
844 |
++#define smp_mb__before_atomic() do { } while (0) |
845 |
++#define smp_mb__after_atomic() do { } while (0) |
846 |
+ |
847 |
+ #endif /* _ASM_X86_BARRIER_H */ |
848 |
+diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h |
849 |
+index e7814b74caf8..5a51fcbbe563 100644 |
850 |
+--- a/arch/x86/include/asm/insn.h |
851 |
++++ b/arch/x86/include/asm/insn.h |
852 |
+@@ -198,4 +198,22 @@ static inline int insn_offset_immediate(struct insn *insn) |
853 |
+ return insn_offset_displacement(insn) + insn->displacement.nbytes; |
854 |
+ } |
855 |
+ |
856 |
++#define POP_SS_OPCODE 0x1f |
857 |
++#define MOV_SREG_OPCODE 0x8e |
858 |
++ |
859 |
++/* |
860 |
++ * Intel SDM Vol.3A 6.8.3 states; |
861 |
++ * "Any single-step trap that would be delivered following the MOV to SS |
862 |
++ * instruction or POP to SS instruction (because EFLAGS.TF is 1) is |
863 |
++ * suppressed." |
864 |
++ * This function returns true if @insn is MOV SS or POP SS. On these |
865 |
++ * instructions, single stepping is suppressed. |
866 |
++ */ |
867 |
++static inline int insn_masking_exception(struct insn *insn) |
868 |
++{ |
869 |
++ return insn->opcode.bytes[0] == POP_SS_OPCODE || |
870 |
++ (insn->opcode.bytes[0] == MOV_SREG_OPCODE && |
871 |
++ X86_MODRM_REG(insn->modrm.bytes[0]) == 2); |
872 |
++} |
873 |
++ |
874 |
+ #endif /* _ASM_X86_INSN_H */ |
875 |
+diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h |
876 |
+index d2434c1cad05..414f9b52e58e 100644 |
877 |
+--- a/arch/x86/include/asm/kexec.h |
878 |
++++ b/arch/x86/include/asm/kexec.h |
879 |
+@@ -66,7 +66,7 @@ struct kimage; |
880 |
+ |
881 |
+ /* Memory to backup during crash kdump */ |
882 |
+ #define KEXEC_BACKUP_SRC_START (0UL) |
883 |
+-#define KEXEC_BACKUP_SRC_END (640 * 1024UL) /* 640K */ |
884 |
++#define KEXEC_BACKUP_SRC_END (640 * 1024UL - 1) /* 640K */ |
885 |
+ |
886 |
+ /* |
887 |
+ * CPU does not save ss and sp on stack if execution is already |
888 |
+diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c |
889 |
+index 6e4e4191abb5..151625a83d9e 100644 |
890 |
+--- a/arch/x86/kernel/cpu/cyrix.c |
891 |
++++ b/arch/x86/kernel/cpu/cyrix.c |
892 |
+@@ -433,7 +433,7 @@ static void cyrix_identify(struct cpuinfo_x86 *c) |
893 |
+ /* enable MAPEN */ |
894 |
+ setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); |
895 |
+ /* enable cpuid */ |
896 |
+- setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80); |
897 |
++ setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x80); |
898 |
+ /* disable MAPEN */ |
899 |
+ setCx86(CX86_CCR3, ccr3); |
900 |
+ local_irq_restore(flags); |
901 |
+diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c |
902 |
+index a9fc2292d9ce..7c48aa03fe77 100644 |
903 |
+--- a/arch/x86/kernel/kprobes/core.c |
904 |
++++ b/arch/x86/kernel/kprobes/core.c |
905 |
+@@ -372,6 +372,10 @@ int __copy_instruction(u8 *dest, u8 *src) |
906 |
+ return 0; |
907 |
+ memcpy(dest, insn.kaddr, length); |
908 |
+ |
909 |
++ /* We should not singlestep on the exception masking instructions */ |
910 |
++ if (insn_masking_exception(&insn)) |
911 |
++ return 0; |
912 |
++ |
913 |
+ #ifdef CONFIG_X86_64 |
914 |
+ if (insn_rip_relative(&insn)) { |
915 |
+ s64 newdisp; |
916 |
+diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c |
917 |
+index 178d63cac321..8c38784cf992 100644 |
918 |
+--- a/arch/x86/kernel/uprobes.c |
919 |
++++ b/arch/x86/kernel/uprobes.c |
920 |
+@@ -296,6 +296,10 @@ static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool |
921 |
+ if (is_prefix_bad(insn)) |
922 |
+ return -ENOTSUPP; |
923 |
+ |
924 |
++ /* We should not singlestep on the exception masking instructions */ |
925 |
++ if (insn_masking_exception(insn)) |
926 |
++ return -ENOTSUPP; |
927 |
++ |
928 |
+ if (x86_64) |
929 |
+ good_insns = good_insns_64; |
930 |
+ else |
931 |
+@@ -983,7 +987,7 @@ arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs |
932 |
+ pr_err("uprobe: return address clobbered: pid=%d, %%sp=%#lx, " |
933 |
+ "%%ip=%#lx\n", current->pid, regs->sp, regs->ip); |
934 |
+ |
935 |
+- force_sig_info(SIGSEGV, SEND_SIG_FORCED, current); |
936 |
++ force_sig(SIGSEGV, current); |
937 |
+ } |
938 |
+ |
939 |
+ return -1; |
940 |
+diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c |
941 |
+index a000ecb995e6..e59f50576f2a 100644 |
942 |
+--- a/drivers/acpi/osl.c |
943 |
++++ b/drivers/acpi/osl.c |
944 |
+@@ -1186,6 +1186,7 @@ void acpi_os_wait_events_complete(void) |
945 |
+ flush_workqueue(kacpid_wq); |
946 |
+ flush_workqueue(kacpi_notify_wq); |
947 |
+ } |
948 |
++EXPORT_SYMBOL(acpi_os_wait_events_complete); |
949 |
+ |
950 |
+ struct acpi_hp_work { |
951 |
+ struct work_struct work; |
952 |
+diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c |
953 |
+index 3b0b4bd67b71..4031ec8024ce 100644 |
954 |
+--- a/drivers/acpi/pci_root.c |
955 |
++++ b/drivers/acpi/pci_root.c |
956 |
+@@ -454,8 +454,9 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm) |
957 |
+ decode_osc_support(root, "OS supports", support); |
958 |
+ status = acpi_pci_osc_support(root, support); |
959 |
+ if (ACPI_FAILURE(status)) { |
960 |
+- dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n", |
961 |
+- acpi_format_exception(status)); |
962 |
++ dev_info(&device->dev, "_OSC failed (%s)%s\n", |
963 |
++ acpi_format_exception(status), |
964 |
++ pcie_aspm_support_enabled() ? "; disabling ASPM" : ""); |
965 |
+ *no_aspm = 1; |
966 |
+ return; |
967 |
+ } |
968 |
+diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c |
969 |
+index 7a3431018e0a..5008ead4609a 100644 |
970 |
+--- a/drivers/acpi/sbshc.c |
971 |
++++ b/drivers/acpi/sbshc.c |
972 |
+@@ -196,6 +196,7 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc) |
973 |
+ hc->callback = NULL; |
974 |
+ hc->context = NULL; |
975 |
+ mutex_unlock(&hc->lock); |
976 |
++ acpi_os_wait_events_complete(); |
977 |
+ return 0; |
978 |
+ } |
979 |
+ |
980 |
+@@ -292,6 +293,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device) |
981 |
+ |
982 |
+ hc = acpi_driver_data(device); |
983 |
+ acpi_ec_remove_query_handler(hc->ec, hc->query_bit); |
984 |
++ acpi_os_wait_events_complete(); |
985 |
+ kfree(hc); |
986 |
+ device->driver_data = NULL; |
987 |
+ return 0; |
988 |
+diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
989 |
+index 4a267347a6d9..a44aeda57109 100644 |
990 |
+--- a/drivers/ata/libata-scsi.c |
991 |
++++ b/drivers/ata/libata-scsi.c |
992 |
+@@ -1654,6 +1654,21 @@ nothing_to_do: |
993 |
+ return 1; |
994 |
+ } |
995 |
+ |
996 |
++static bool ata_check_nblocks(struct scsi_cmnd *scmd, u32 n_blocks) |
997 |
++{ |
998 |
++ struct request *rq = scmd->request; |
999 |
++ u32 req_blocks; |
1000 |
++ |
1001 |
++ if (!blk_rq_is_passthrough(rq)) |
1002 |
++ return true; |
1003 |
++ |
1004 |
++ req_blocks = blk_rq_bytes(rq) / scmd->device->sector_size; |
1005 |
++ if (n_blocks > req_blocks) |
1006 |
++ return false; |
1007 |
++ |
1008 |
++ return true; |
1009 |
++} |
1010 |
++ |
1011 |
+ /** |
1012 |
+ * ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one |
1013 |
+ * @qc: Storage for translated ATA taskfile |
1014 |
+@@ -1693,6 +1708,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) |
1015 |
+ scsi_10_lba_len(cdb, &block, &n_block); |
1016 |
+ if (cdb[1] & (1 << 3)) |
1017 |
+ tf_flags |= ATA_TFLAG_FUA; |
1018 |
++ if (!ata_check_nblocks(scmd, n_block)) |
1019 |
++ goto invalid_fld; |
1020 |
+ break; |
1021 |
+ case READ_6: |
1022 |
+ case WRITE_6: |
1023 |
+@@ -1705,6 +1722,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) |
1024 |
+ */ |
1025 |
+ if (!n_block) |
1026 |
+ n_block = 256; |
1027 |
++ if (!ata_check_nblocks(scmd, n_block)) |
1028 |
++ goto invalid_fld; |
1029 |
+ break; |
1030 |
+ case READ_16: |
1031 |
+ case WRITE_16: |
1032 |
+@@ -1713,6 +1732,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) |
1033 |
+ scsi_16_lba_len(cdb, &block, &n_block); |
1034 |
+ if (cdb[1] & (1 << 3)) |
1035 |
+ tf_flags |= ATA_TFLAG_FUA; |
1036 |
++ if (!ata_check_nblocks(scmd, n_block)) |
1037 |
++ goto invalid_fld; |
1038 |
+ break; |
1039 |
+ default: |
1040 |
+ DPRINTK("no-byte command\n"); |
1041 |
+diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c |
1042 |
+index bd6b089c67a3..634c814cbeda 100644 |
1043 |
+--- a/drivers/ata/pata_ep93xx.c |
1044 |
++++ b/drivers/ata/pata_ep93xx.c |
1045 |
+@@ -659,7 +659,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) |
1046 |
+ * start of new transfer. |
1047 |
+ */ |
1048 |
+ drv_data->dma_rx_data.port = EP93XX_DMA_IDE; |
1049 |
+- drv_data->dma_rx_data.direction = DMA_FROM_DEVICE; |
1050 |
++ drv_data->dma_rx_data.direction = DMA_DEV_TO_MEM; |
1051 |
+ drv_data->dma_rx_data.name = "ep93xx-pata-rx"; |
1052 |
+ drv_data->dma_rx_channel = dma_request_channel(mask, |
1053 |
+ ep93xx_pata_dma_filter, &drv_data->dma_rx_data); |
1054 |
+@@ -667,7 +667,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) |
1055 |
+ return; |
1056 |
+ |
1057 |
+ drv_data->dma_tx_data.port = EP93XX_DMA_IDE; |
1058 |
+- drv_data->dma_tx_data.direction = DMA_TO_DEVICE; |
1059 |
++ drv_data->dma_tx_data.direction = DMA_MEM_TO_DEV; |
1060 |
+ drv_data->dma_tx_data.name = "ep93xx-pata-tx"; |
1061 |
+ drv_data->dma_tx_channel = dma_request_channel(mask, |
1062 |
+ ep93xx_pata_dma_filter, &drv_data->dma_tx_data); |
1063 |
+@@ -678,7 +678,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) |
1064 |
+ |
1065 |
+ /* Configure receive channel direction and source address */ |
1066 |
+ memset(&conf, 0, sizeof(conf)); |
1067 |
+- conf.direction = DMA_FROM_DEVICE; |
1068 |
++ conf.direction = DMA_DEV_TO_MEM; |
1069 |
+ conf.src_addr = drv_data->udma_in_phys; |
1070 |
+ conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
1071 |
+ if (dmaengine_slave_config(drv_data->dma_rx_channel, &conf)) { |
1072 |
+@@ -689,7 +689,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) |
1073 |
+ |
1074 |
+ /* Configure transmit channel direction and destination address */ |
1075 |
+ memset(&conf, 0, sizeof(conf)); |
1076 |
+- conf.direction = DMA_TO_DEVICE; |
1077 |
++ conf.direction = DMA_MEM_TO_DEV; |
1078 |
+ conf.dst_addr = drv_data->udma_out_phys; |
1079 |
+ conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
1080 |
+ if (dmaengine_slave_config(drv_data->dma_tx_channel, &conf)) { |
1081 |
+diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c |
1082 |
+index d5db2332eb6f..63809e7bbc02 100644 |
1083 |
+--- a/drivers/bluetooth/hci_ldisc.c |
1084 |
++++ b/drivers/bluetooth/hci_ldisc.c |
1085 |
+@@ -227,7 +227,7 @@ static int hci_uart_flush(struct hci_dev *hdev) |
1086 |
+ tty_ldisc_flush(tty); |
1087 |
+ tty_driver_flush_buffer(tty); |
1088 |
+ |
1089 |
+- if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) |
1090 |
++ if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) |
1091 |
+ hu->proto->flush(hu); |
1092 |
+ |
1093 |
+ return 0; |
1094 |
+@@ -506,7 +506,7 @@ static void hci_uart_tty_close(struct tty_struct *tty) |
1095 |
+ |
1096 |
+ cancel_work_sync(&hu->write_work); |
1097 |
+ |
1098 |
+- if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { |
1099 |
++ if (test_and_clear_bit(HCI_UART_PROTO_READY, &hu->flags)) { |
1100 |
+ if (hdev) { |
1101 |
+ if (test_bit(HCI_UART_REGISTERED, &hu->flags)) |
1102 |
+ hci_unregister_dev(hdev); |
1103 |
+@@ -514,6 +514,7 @@ static void hci_uart_tty_close(struct tty_struct *tty) |
1104 |
+ } |
1105 |
+ hu->proto->close(hu); |
1106 |
+ } |
1107 |
++ clear_bit(HCI_UART_PROTO_SET, &hu->flags); |
1108 |
+ |
1109 |
+ kfree(hu); |
1110 |
+ } |
1111 |
+@@ -540,7 +541,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty) |
1112 |
+ if (tty != hu->tty) |
1113 |
+ return; |
1114 |
+ |
1115 |
+- if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) |
1116 |
++ if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) |
1117 |
+ hci_uart_tx_wakeup(hu); |
1118 |
+ } |
1119 |
+ |
1120 |
+@@ -564,7 +565,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, |
1121 |
+ if (!hu || tty != hu->tty) |
1122 |
+ return; |
1123 |
+ |
1124 |
+- if (!test_bit(HCI_UART_PROTO_SET, &hu->flags)) |
1125 |
++ if (!test_bit(HCI_UART_PROTO_READY, &hu->flags)) |
1126 |
+ return; |
1127 |
+ |
1128 |
+ /* It does not need a lock here as it is already protected by a mutex in |
1129 |
+@@ -659,6 +660,7 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id) |
1130 |
+ return err; |
1131 |
+ } |
1132 |
+ |
1133 |
++ set_bit(HCI_UART_PROTO_READY, &hu->flags); |
1134 |
+ return 0; |
1135 |
+ } |
1136 |
+ |
1137 |
+diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h |
1138 |
+index ce00c02eb63f..82d6a3886868 100644 |
1139 |
+--- a/drivers/bluetooth/hci_uart.h |
1140 |
++++ b/drivers/bluetooth/hci_uart.h |
1141 |
+@@ -94,6 +94,7 @@ struct hci_uart { |
1142 |
+ /* HCI_UART proto flag bits */ |
1143 |
+ #define HCI_UART_PROTO_SET 0 |
1144 |
+ #define HCI_UART_REGISTERED 1 |
1145 |
++#define HCI_UART_PROTO_READY 2 |
1146 |
+ |
1147 |
+ /* TX states */ |
1148 |
+ #define HCI_UART_SENDING 1 |
1149 |
+diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c |
1150 |
+index fe8cfe24c518..4b82cf9da0ba 100644 |
1151 |
+--- a/drivers/crypto/mxs-dcp.c |
1152 |
++++ b/drivers/crypto/mxs-dcp.c |
1153 |
+@@ -28,9 +28,24 @@ |
1154 |
+ |
1155 |
+ #define DCP_MAX_CHANS 4 |
1156 |
+ #define DCP_BUF_SZ PAGE_SIZE |
1157 |
++#define DCP_SHA_PAY_SZ 64 |
1158 |
+ |
1159 |
+ #define DCP_ALIGNMENT 64 |
1160 |
+ |
1161 |
++/* |
1162 |
++ * Null hashes to align with hw behavior on imx6sl and ull |
1163 |
++ * these are flipped for consistency with hw output |
1164 |
++ */ |
1165 |
++const uint8_t sha1_null_hash[] = |
1166 |
++ "\x09\x07\xd8\xaf\x90\x18\x60\x95\xef\xbf" |
1167 |
++ "\x55\x32\x0d\x4b\x6b\x5e\xee\xa3\x39\xda"; |
1168 |
++ |
1169 |
++const uint8_t sha256_null_hash[] = |
1170 |
++ "\x55\xb8\x52\x78\x1b\x99\x95\xa4" |
1171 |
++ "\x4c\x93\x9b\x64\xe4\x41\xae\x27" |
1172 |
++ "\x24\xb9\x6f\x99\xc8\xf4\xfb\x9a" |
1173 |
++ "\x14\x1c\xfc\x98\x42\xc4\xb0\xe3"; |
1174 |
++ |
1175 |
+ /* DCP DMA descriptor. */ |
1176 |
+ struct dcp_dma_desc { |
1177 |
+ uint32_t next_cmd_addr; |
1178 |
+@@ -48,6 +63,7 @@ struct dcp_coherent_block { |
1179 |
+ uint8_t aes_in_buf[DCP_BUF_SZ]; |
1180 |
+ uint8_t aes_out_buf[DCP_BUF_SZ]; |
1181 |
+ uint8_t sha_in_buf[DCP_BUF_SZ]; |
1182 |
++ uint8_t sha_out_buf[DCP_SHA_PAY_SZ]; |
1183 |
+ |
1184 |
+ uint8_t aes_key[2 * AES_KEYSIZE_128]; |
1185 |
+ |
1186 |
+@@ -209,6 +225,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, |
1187 |
+ dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf, |
1188 |
+ DCP_BUF_SZ, DMA_FROM_DEVICE); |
1189 |
+ |
1190 |
++ if (actx->fill % AES_BLOCK_SIZE) { |
1191 |
++ dev_err(sdcp->dev, "Invalid block size!\n"); |
1192 |
++ ret = -EINVAL; |
1193 |
++ goto aes_done_run; |
1194 |
++ } |
1195 |
++ |
1196 |
+ /* Fill in the DMA descriptor. */ |
1197 |
+ desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE | |
1198 |
+ MXS_DCP_CONTROL0_INTERRUPT | |
1199 |
+@@ -238,6 +260,7 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, |
1200 |
+ |
1201 |
+ ret = mxs_dcp_start_dma(actx); |
1202 |
+ |
1203 |
++aes_done_run: |
1204 |
+ dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128, |
1205 |
+ DMA_TO_DEVICE); |
1206 |
+ dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE); |
1207 |
+@@ -264,13 +287,15 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
1208 |
+ |
1209 |
+ uint8_t *out_tmp, *src_buf, *dst_buf = NULL; |
1210 |
+ uint32_t dst_off = 0; |
1211 |
++ uint32_t last_out_len = 0; |
1212 |
+ |
1213 |
+ uint8_t *key = sdcp->coh->aes_key; |
1214 |
+ |
1215 |
+ int ret = 0; |
1216 |
+ int split = 0; |
1217 |
+- unsigned int i, len, clen, rem = 0; |
1218 |
++ unsigned int i, len, clen, rem = 0, tlen = 0; |
1219 |
+ int init = 0; |
1220 |
++ bool limit_hit = false; |
1221 |
+ |
1222 |
+ actx->fill = 0; |
1223 |
+ |
1224 |
+@@ -289,6 +314,11 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
1225 |
+ for_each_sg(req->src, src, nents, i) { |
1226 |
+ src_buf = sg_virt(src); |
1227 |
+ len = sg_dma_len(src); |
1228 |
++ tlen += len; |
1229 |
++ limit_hit = tlen > req->nbytes; |
1230 |
++ |
1231 |
++ if (limit_hit) |
1232 |
++ len = req->nbytes - (tlen - len); |
1233 |
+ |
1234 |
+ do { |
1235 |
+ if (actx->fill + len > out_off) |
1236 |
+@@ -305,13 +335,15 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
1237 |
+ * If we filled the buffer or this is the last SG, |
1238 |
+ * submit the buffer. |
1239 |
+ */ |
1240 |
+- if (actx->fill == out_off || sg_is_last(src)) { |
1241 |
++ if (actx->fill == out_off || sg_is_last(src) || |
1242 |
++ limit_hit) { |
1243 |
+ ret = mxs_dcp_run_aes(actx, req, init); |
1244 |
+ if (ret) |
1245 |
+ return ret; |
1246 |
+ init = 0; |
1247 |
+ |
1248 |
+ out_tmp = out_buf; |
1249 |
++ last_out_len = actx->fill; |
1250 |
+ while (dst && actx->fill) { |
1251 |
+ if (!split) { |
1252 |
+ dst_buf = sg_virt(dst); |
1253 |
+@@ -334,6 +366,19 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
1254 |
+ } |
1255 |
+ } |
1256 |
+ } while (len); |
1257 |
++ |
1258 |
++ if (limit_hit) |
1259 |
++ break; |
1260 |
++ } |
1261 |
++ |
1262 |
++ /* Copy the IV for CBC for chaining */ |
1263 |
++ if (!rctx->ecb) { |
1264 |
++ if (rctx->enc) |
1265 |
++ memcpy(req->info, out_buf+(last_out_len-AES_BLOCK_SIZE), |
1266 |
++ AES_BLOCK_SIZE); |
1267 |
++ else |
1268 |
++ memcpy(req->info, in_buf+(last_out_len-AES_BLOCK_SIZE), |
1269 |
++ AES_BLOCK_SIZE); |
1270 |
+ } |
1271 |
+ |
1272 |
+ return ret; |
1273 |
+@@ -518,8 +563,6 @@ static int mxs_dcp_run_sha(struct ahash_request *req) |
1274 |
+ struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); |
1275 |
+ struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm); |
1276 |
+ struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req); |
1277 |
+- struct hash_alg_common *halg = crypto_hash_alg_common(tfm); |
1278 |
+- |
1279 |
+ struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; |
1280 |
+ |
1281 |
+ dma_addr_t digest_phys = 0; |
1282 |
+@@ -541,10 +584,23 @@ static int mxs_dcp_run_sha(struct ahash_request *req) |
1283 |
+ desc->payload = 0; |
1284 |
+ desc->status = 0; |
1285 |
+ |
1286 |
++ /* |
1287 |
++ * Align driver with hw behavior when generating null hashes |
1288 |
++ */ |
1289 |
++ if (rctx->init && rctx->fini && desc->size == 0) { |
1290 |
++ struct hash_alg_common *halg = crypto_hash_alg_common(tfm); |
1291 |
++ const uint8_t *sha_buf = |
1292 |
++ (actx->alg == MXS_DCP_CONTROL1_HASH_SELECT_SHA1) ? |
1293 |
++ sha1_null_hash : sha256_null_hash; |
1294 |
++ memcpy(sdcp->coh->sha_out_buf, sha_buf, halg->digestsize); |
1295 |
++ ret = 0; |
1296 |
++ goto done_run; |
1297 |
++ } |
1298 |
++ |
1299 |
+ /* Set HASH_TERM bit for last transfer block. */ |
1300 |
+ if (rctx->fini) { |
1301 |
+- digest_phys = dma_map_single(sdcp->dev, req->result, |
1302 |
+- halg->digestsize, DMA_FROM_DEVICE); |
1303 |
++ digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf, |
1304 |
++ DCP_SHA_PAY_SZ, DMA_FROM_DEVICE); |
1305 |
+ desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM; |
1306 |
+ desc->payload = digest_phys; |
1307 |
+ } |
1308 |
+@@ -552,9 +608,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req) |
1309 |
+ ret = mxs_dcp_start_dma(actx); |
1310 |
+ |
1311 |
+ if (rctx->fini) |
1312 |
+- dma_unmap_single(sdcp->dev, digest_phys, halg->digestsize, |
1313 |
++ dma_unmap_single(sdcp->dev, digest_phys, DCP_SHA_PAY_SZ, |
1314 |
+ DMA_FROM_DEVICE); |
1315 |
+ |
1316 |
++done_run: |
1317 |
+ dma_unmap_single(sdcp->dev, buf_phys, DCP_BUF_SZ, DMA_TO_DEVICE); |
1318 |
+ |
1319 |
+ return ret; |
1320 |
+@@ -572,6 +629,7 @@ static int dcp_sha_req_to_buf(struct crypto_async_request *arq) |
1321 |
+ const int nents = sg_nents(req->src); |
1322 |
+ |
1323 |
+ uint8_t *in_buf = sdcp->coh->sha_in_buf; |
1324 |
++ uint8_t *out_buf = sdcp->coh->sha_out_buf; |
1325 |
+ |
1326 |
+ uint8_t *src_buf; |
1327 |
+ |
1328 |
+@@ -626,11 +684,9 @@ static int dcp_sha_req_to_buf(struct crypto_async_request *arq) |
1329 |
+ |
1330 |
+ actx->fill = 0; |
1331 |
+ |
1332 |
+- /* For some reason, the result is flipped. */ |
1333 |
+- for (i = 0; i < halg->digestsize / 2; i++) { |
1334 |
+- swap(req->result[i], |
1335 |
+- req->result[halg->digestsize - i - 1]); |
1336 |
+- } |
1337 |
++ /* For some reason the result is flipped */ |
1338 |
++ for (i = 0; i < halg->digestsize; i++) |
1339 |
++ req->result[i] = out_buf[halg->digestsize - i - 1]; |
1340 |
+ } |
1341 |
+ |
1342 |
+ return 0; |
1343 |
+diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c |
1344 |
+index 8344b7c91fe3..1d01e3805f9c 100644 |
1345 |
+--- a/drivers/dma/dma-jz4780.c |
1346 |
++++ b/drivers/dma/dma-jz4780.c |
1347 |
+@@ -576,7 +576,7 @@ static enum dma_status jz4780_dma_tx_status(struct dma_chan *chan, |
1348 |
+ to_jz4780_dma_desc(vdesc), 0); |
1349 |
+ } else if (cookie == jzchan->desc->vdesc.tx.cookie) { |
1350 |
+ txstate->residue = jz4780_dma_desc_residue(jzchan, jzchan->desc, |
1351 |
+- (jzchan->curr_hwdesc + 1) % jzchan->desc->count); |
1352 |
++ jzchan->curr_hwdesc + 1); |
1353 |
+ } else |
1354 |
+ txstate->residue = 0; |
1355 |
+ |
1356 |
+diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c |
1357 |
+index 106fa9b327d9..92b0a7a042ee 100644 |
1358 |
+--- a/drivers/dma/ioat/init.c |
1359 |
++++ b/drivers/dma/ioat/init.c |
1360 |
+@@ -128,7 +128,7 @@ static void |
1361 |
+ ioat_init_channel(struct ioatdma_device *ioat_dma, |
1362 |
+ struct ioatdma_chan *ioat_chan, int idx); |
1363 |
+ static void ioat_intr_quirk(struct ioatdma_device *ioat_dma); |
1364 |
+-static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma); |
1365 |
++static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma); |
1366 |
+ static int ioat3_dma_self_test(struct ioatdma_device *ioat_dma); |
1367 |
+ |
1368 |
+ static int ioat_dca_enabled = 1; |
1369 |
+@@ -593,7 +593,7 @@ static void ioat_dma_remove(struct ioatdma_device *ioat_dma) |
1370 |
+ * ioat_enumerate_channels - find and initialize the device's channels |
1371 |
+ * @ioat_dma: the ioat dma device to be enumerated |
1372 |
+ */ |
1373 |
+-static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) |
1374 |
++static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma) |
1375 |
+ { |
1376 |
+ struct ioatdma_chan *ioat_chan; |
1377 |
+ struct device *dev = &ioat_dma->pdev->dev; |
1378 |
+@@ -612,7 +612,7 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) |
1379 |
+ xfercap_log = readb(ioat_dma->reg_base + IOAT_XFERCAP_OFFSET); |
1380 |
+ xfercap_log &= 0x1f; /* bits [4:0] valid */ |
1381 |
+ if (xfercap_log == 0) |
1382 |
+- return 0; |
1383 |
++ return; |
1384 |
+ dev_dbg(dev, "%s: xfercap = %d\n", __func__, 1 << xfercap_log); |
1385 |
+ |
1386 |
+ for (i = 0; i < dma->chancnt; i++) { |
1387 |
+@@ -629,7 +629,6 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) |
1388 |
+ } |
1389 |
+ } |
1390 |
+ dma->chancnt = i; |
1391 |
+- return i; |
1392 |
+ } |
1393 |
+ |
1394 |
+ /** |
1395 |
+diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c |
1396 |
+index 559cd4073698..cf741187c9bb 100644 |
1397 |
+--- a/drivers/dma/timb_dma.c |
1398 |
++++ b/drivers/dma/timb_dma.c |
1399 |
+@@ -552,7 +552,7 @@ static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan, |
1400 |
+ } |
1401 |
+ |
1402 |
+ dma_sync_single_for_device(chan2dmadev(chan), td_desc->txd.phys, |
1403 |
+- td_desc->desc_list_len, DMA_MEM_TO_DEV); |
1404 |
++ td_desc->desc_list_len, DMA_TO_DEVICE); |
1405 |
+ |
1406 |
+ return &td_desc->txd; |
1407 |
+ } |
1408 |
+diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c |
1409 |
+index 7b25fdf64802..f579938552cc 100644 |
1410 |
+--- a/drivers/gpio/gpio-syscon.c |
1411 |
++++ b/drivers/gpio/gpio-syscon.c |
1412 |
+@@ -127,7 +127,7 @@ static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val) |
1413 |
+ BIT(offs % SYSCON_REG_BITS)); |
1414 |
+ } |
1415 |
+ |
1416 |
+- priv->data->set(chip, offset, val); |
1417 |
++ chip->set(chip, offset, val); |
1418 |
+ |
1419 |
+ return 0; |
1420 |
+ } |
1421 |
+diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c |
1422 |
+index 3e23003f78b0..993c61e95d30 100644 |
1423 |
+--- a/drivers/hwmon/pwm-fan.c |
1424 |
++++ b/drivers/hwmon/pwm-fan.c |
1425 |
+@@ -227,8 +227,12 @@ static int pwm_fan_probe(struct platform_device *pdev) |
1426 |
+ |
1427 |
+ ctx->pwm = devm_of_pwm_get(&pdev->dev, pdev->dev.of_node, NULL); |
1428 |
+ if (IS_ERR(ctx->pwm)) { |
1429 |
+- dev_err(&pdev->dev, "Could not get PWM\n"); |
1430 |
+- return PTR_ERR(ctx->pwm); |
1431 |
++ ret = PTR_ERR(ctx->pwm); |
1432 |
++ |
1433 |
++ if (ret != -EPROBE_DEFER) |
1434 |
++ dev_err(&pdev->dev, "Could not get PWM: %d\n", ret); |
1435 |
++ |
1436 |
++ return ret; |
1437 |
+ } |
1438 |
+ |
1439 |
+ platform_set_drvdata(pdev, ctx); |
1440 |
+diff --git a/drivers/iio/dac/mcp4922.c b/drivers/iio/dac/mcp4922.c |
1441 |
+index 3854d201a5d6..68dd0be1ac07 100644 |
1442 |
+--- a/drivers/iio/dac/mcp4922.c |
1443 |
++++ b/drivers/iio/dac/mcp4922.c |
1444 |
+@@ -94,17 +94,22 @@ static int mcp4922_write_raw(struct iio_dev *indio_dev, |
1445 |
+ long mask) |
1446 |
+ { |
1447 |
+ struct mcp4922_state *state = iio_priv(indio_dev); |
1448 |
++ int ret; |
1449 |
+ |
1450 |
+ if (val2 != 0) |
1451 |
+ return -EINVAL; |
1452 |
+ |
1453 |
+ switch (mask) { |
1454 |
+ case IIO_CHAN_INFO_RAW: |
1455 |
+- if (val > GENMASK(chan->scan_type.realbits-1, 0)) |
1456 |
++ if (val < 0 || val > GENMASK(chan->scan_type.realbits - 1, 0)) |
1457 |
+ return -EINVAL; |
1458 |
+ val <<= chan->scan_type.shift; |
1459 |
+- state->value[chan->channel] = val; |
1460 |
+- return mcp4922_spi_write(state, chan->channel, val); |
1461 |
++ |
1462 |
++ ret = mcp4922_spi_write(state, chan->channel, val); |
1463 |
++ if (!ret) |
1464 |
++ state->value[chan->channel] = val; |
1465 |
++ return ret; |
1466 |
++ |
1467 |
+ default: |
1468 |
+ return -EINVAL; |
1469 |
+ } |
1470 |
+diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c |
1471 |
+index ded76c101dde..834b06aacc2b 100644 |
1472 |
+--- a/drivers/infiniband/hw/mthca/mthca_main.c |
1473 |
++++ b/drivers/infiniband/hw/mthca/mthca_main.c |
1474 |
+@@ -989,7 +989,8 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type) |
1475 |
+ goto err_free_dev; |
1476 |
+ } |
1477 |
+ |
1478 |
+- if (mthca_cmd_init(mdev)) { |
1479 |
++ err = mthca_cmd_init(mdev); |
1480 |
++ if (err) { |
1481 |
+ mthca_err(mdev, "Failed to init command interface, aborting.\n"); |
1482 |
+ goto err_free_dev; |
1483 |
+ } |
1484 |
+diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c |
1485 |
+index fcc6c3368182..ea3f0f5eb534 100644 |
1486 |
+--- a/drivers/input/ff-memless.c |
1487 |
++++ b/drivers/input/ff-memless.c |
1488 |
+@@ -501,6 +501,15 @@ static void ml_ff_destroy(struct ff_device *ff) |
1489 |
+ { |
1490 |
+ struct ml_device *ml = ff->private; |
1491 |
+ |
1492 |
++ /* |
1493 |
++ * Even though we stop all playing effects when tearing down |
1494 |
++ * an input device (via input_device_flush() that calls into |
1495 |
++ * input_ff_flush() that stops and erases all effects), we |
1496 |
++ * do not actually stop the timer, and therefore we should |
1497 |
++ * do it here. |
1498 |
++ */ |
1499 |
++ del_timer_sync(&ml->timer); |
1500 |
++ |
1501 |
+ kfree(ml->private); |
1502 |
+ } |
1503 |
+ |
1504 |
+diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c |
1505 |
+index e943678ce54c..f1c574d6be17 100644 |
1506 |
+--- a/drivers/input/touchscreen/st1232.c |
1507 |
++++ b/drivers/input/touchscreen/st1232.c |
1508 |
+@@ -203,6 +203,7 @@ static int st1232_ts_probe(struct i2c_client *client, |
1509 |
+ input_dev->id.bustype = BUS_I2C; |
1510 |
+ input_dev->dev.parent = &client->dev; |
1511 |
+ |
1512 |
++ __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
1513 |
+ __set_bit(EV_SYN, input_dev->evbit); |
1514 |
+ __set_bit(EV_KEY, input_dev->evbit); |
1515 |
+ __set_bit(EV_ABS, input_dev->evbit); |
1516 |
+diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
1517 |
+index e42092146083..df8f1e69077f 100644 |
1518 |
+--- a/drivers/md/bcache/super.c |
1519 |
++++ b/drivers/md/bcache/super.c |
1520 |
+@@ -902,6 +902,7 @@ static void cached_dev_detach_finish(struct work_struct *w) |
1521 |
+ bch_write_bdev_super(dc, &cl); |
1522 |
+ closure_sync(&cl); |
1523 |
+ |
1524 |
++ calc_cached_dev_sectors(dc->disk.c); |
1525 |
+ bcache_device_detach(&dc->disk); |
1526 |
+ list_move(&dc->list, &uncached_devices); |
1527 |
+ |
1528 |
+diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c |
1529 |
+index 9cd995f418e0..1d67407ffbf6 100644 |
1530 |
+--- a/drivers/media/pci/ivtv/ivtv-yuv.c |
1531 |
++++ b/drivers/media/pci/ivtv/ivtv-yuv.c |
1532 |
+@@ -936,7 +936,7 @@ static void ivtv_yuv_init(struct ivtv *itv) |
1533 |
+ } |
1534 |
+ |
1535 |
+ /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ |
1536 |
+- yi->blanking_ptr = kzalloc(720 * 16, GFP_KERNEL|__GFP_NOWARN); |
1537 |
++ yi->blanking_ptr = kzalloc(720 * 16, GFP_ATOMIC|__GFP_NOWARN); |
1538 |
+ if (yi->blanking_ptr) { |
1539 |
+ yi->blanking_dmaptr = pci_map_single(itv->pdev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE); |
1540 |
+ } else { |
1541 |
+diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c |
1542 |
+index ba887e8e1b17..a85c5199ccd3 100644 |
1543 |
+--- a/drivers/media/pci/meye/meye.c |
1544 |
++++ b/drivers/media/pci/meye/meye.c |
1545 |
+@@ -1469,7 +1469,7 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma) |
1546 |
+ unsigned long page, pos; |
1547 |
+ |
1548 |
+ mutex_lock(&meye.lock); |
1549 |
+- if (size > gbuffers * gbufsize) { |
1550 |
++ if (size > gbuffers * gbufsize || offset > gbuffers * gbufsize - size) { |
1551 |
+ mutex_unlock(&meye.lock); |
1552 |
+ return -EINVAL; |
1553 |
+ } |
1554 |
+diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c |
1555 |
+index 99faea2e84c6..78e37cf3470f 100644 |
1556 |
+--- a/drivers/media/platform/davinci/isif.c |
1557 |
++++ b/drivers/media/platform/davinci/isif.c |
1558 |
+@@ -1106,7 +1106,8 @@ fail_nobase_res: |
1559 |
+ |
1560 |
+ while (i >= 0) { |
1561 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, i); |
1562 |
+- release_mem_region(res->start, resource_size(res)); |
1563 |
++ if (res) |
1564 |
++ release_mem_region(res->start, resource_size(res)); |
1565 |
+ i--; |
1566 |
+ } |
1567 |
+ vpfe_unregister_ccdc_device(&isif_hw_dev); |
1568 |
+diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c |
1569 |
+index 6d91422c4e4c..a9cd8c7a7b34 100644 |
1570 |
+--- a/drivers/media/platform/davinci/vpbe_display.c |
1571 |
++++ b/drivers/media/platform/davinci/vpbe_display.c |
1572 |
+@@ -520,7 +520,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev, |
1573 |
+ else if (v_scale == 4) |
1574 |
+ layer_info->v_zoom = ZOOM_X4; |
1575 |
+ if (v_exp) |
1576 |
+- layer_info->h_exp = V_EXP_6_OVER_5; |
1577 |
++ layer_info->v_exp = V_EXP_6_OVER_5; |
1578 |
+ } else { |
1579 |
+ /* no scaling, only cropping. Set display area to crop area */ |
1580 |
+ cfg->ysize = expected_ysize; |
1581 |
+diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c |
1582 |
+index d0d8f08e37c8..de80925ee4cb 100644 |
1583 |
+--- a/drivers/media/usb/cx231xx/cx231xx-video.c |
1584 |
++++ b/drivers/media/usb/cx231xx/cx231xx-video.c |
1585 |
+@@ -1346,7 +1346,7 @@ int cx231xx_g_register(struct file *file, void *priv, |
1586 |
+ ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, |
1587 |
+ (u16)reg->reg, value, 4); |
1588 |
+ reg->val = value[0] | value[1] << 8 | |
1589 |
+- value[2] << 16 | value[3] << 24; |
1590 |
++ value[2] << 16 | (u32)value[3] << 24; |
1591 |
+ reg->size = 4; |
1592 |
+ break; |
1593 |
+ case 1: /* AFE - read byte */ |
1594 |
+diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c |
1595 |
+index d4c719683a8a..d8961f35a9ec 100644 |
1596 |
+--- a/drivers/misc/genwqe/card_utils.c |
1597 |
++++ b/drivers/misc/genwqe/card_utils.c |
1598 |
+@@ -298,7 +298,7 @@ static int genwqe_sgl_size(int num_pages) |
1599 |
+ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, |
1600 |
+ void __user *user_addr, size_t user_size) |
1601 |
+ { |
1602 |
+- int rc; |
1603 |
++ int ret = -ENOMEM; |
1604 |
+ struct pci_dev *pci_dev = cd->pci_dev; |
1605 |
+ |
1606 |
+ sgl->fpage_offs = offset_in_page((unsigned long)user_addr); |
1607 |
+@@ -317,7 +317,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, |
1608 |
+ if (get_order(sgl->sgl_size) > MAX_ORDER) { |
1609 |
+ dev_err(&pci_dev->dev, |
1610 |
+ "[%s] err: too much memory requested!\n", __func__); |
1611 |
+- return -ENOMEM; |
1612 |
++ return ret; |
1613 |
+ } |
1614 |
+ |
1615 |
+ sgl->sgl = __genwqe_alloc_consistent(cd, sgl->sgl_size, |
1616 |
+@@ -325,7 +325,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, |
1617 |
+ if (sgl->sgl == NULL) { |
1618 |
+ dev_err(&pci_dev->dev, |
1619 |
+ "[%s] err: no memory available!\n", __func__); |
1620 |
+- return -ENOMEM; |
1621 |
++ return ret; |
1622 |
+ } |
1623 |
+ |
1624 |
+ /* Only use buffering on incomplete pages */ |
1625 |
+@@ -338,7 +338,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, |
1626 |
+ /* Sync with user memory */ |
1627 |
+ if (copy_from_user(sgl->fpage + sgl->fpage_offs, |
1628 |
+ user_addr, sgl->fpage_size)) { |
1629 |
+- rc = -EFAULT; |
1630 |
++ ret = -EFAULT; |
1631 |
+ goto err_out; |
1632 |
+ } |
1633 |
+ } |
1634 |
+@@ -351,7 +351,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, |
1635 |
+ /* Sync with user memory */ |
1636 |
+ if (copy_from_user(sgl->lpage, user_addr + user_size - |
1637 |
+ sgl->lpage_size, sgl->lpage_size)) { |
1638 |
+- rc = -EFAULT; |
1639 |
++ ret = -EFAULT; |
1640 |
+ goto err_out2; |
1641 |
+ } |
1642 |
+ } |
1643 |
+@@ -373,7 +373,8 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, |
1644 |
+ sgl->sgl = NULL; |
1645 |
+ sgl->sgl_dma_addr = 0; |
1646 |
+ sgl->sgl_size = 0; |
1647 |
+- return -ENOMEM; |
1648 |
++ |
1649 |
++ return ret; |
1650 |
+ } |
1651 |
+ |
1652 |
+ int genwqe_setup_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, |
1653 |
+diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c |
1654 |
+index bb3a76ad80da..fc8cb855c6e6 100644 |
1655 |
+--- a/drivers/misc/kgdbts.c |
1656 |
++++ b/drivers/misc/kgdbts.c |
1657 |
+@@ -979,6 +979,12 @@ static void kgdbts_run_tests(void) |
1658 |
+ int nmi_sleep = 0; |
1659 |
+ int i; |
1660 |
+ |
1661 |
++ verbose = 0; |
1662 |
++ if (strstr(config, "V1")) |
1663 |
++ verbose = 1; |
1664 |
++ if (strstr(config, "V2")) |
1665 |
++ verbose = 2; |
1666 |
++ |
1667 |
+ ptr = strchr(config, 'F'); |
1668 |
+ if (ptr) |
1669 |
+ fork_test = simple_strtol(ptr + 1, NULL, 10); |
1670 |
+@@ -1062,13 +1068,6 @@ static int kgdbts_option_setup(char *opt) |
1671 |
+ return -ENOSPC; |
1672 |
+ } |
1673 |
+ strcpy(config, opt); |
1674 |
+- |
1675 |
+- verbose = 0; |
1676 |
+- if (strstr(config, "V1")) |
1677 |
+- verbose = 1; |
1678 |
+- if (strstr(config, "V2")) |
1679 |
+- verbose = 2; |
1680 |
+- |
1681 |
+ return 0; |
1682 |
+ } |
1683 |
+ |
1684 |
+@@ -1080,9 +1079,6 @@ static int configure_kgdbts(void) |
1685 |
+ |
1686 |
+ if (!strlen(config) || isspace(config[0])) |
1687 |
+ goto noconfig; |
1688 |
+- err = kgdbts_option_setup(config); |
1689 |
+- if (err) |
1690 |
+- goto noconfig; |
1691 |
+ |
1692 |
+ final_ack = 0; |
1693 |
+ run_plant_and_detach_test(1); |
1694 |
+diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c |
1695 |
+index 4e374a05319c..91d695ee60ac 100644 |
1696 |
+--- a/drivers/mmc/host/sdhci-of-at91.c |
1697 |
++++ b/drivers/mmc/host/sdhci-of-at91.c |
1698 |
+@@ -145,7 +145,7 @@ static int sdhci_at91_probe(struct platform_device *pdev) |
1699 |
+ sdhci_get_of_property(pdev); |
1700 |
+ |
1701 |
+ /* HS200 is broken at this moment */ |
1702 |
+- host->quirks2 = SDHCI_QUIRK2_BROKEN_HS200; |
1703 |
++ host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200; |
1704 |
+ |
1705 |
+ ret = sdhci_add_host(host); |
1706 |
+ if (ret) |
1707 |
+diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c |
1708 |
+index e46b4e983666..77e7542fa8e4 100644 |
1709 |
+--- a/drivers/mtd/maps/physmap_of.c |
1710 |
++++ b/drivers/mtd/maps/physmap_of.c |
1711 |
+@@ -28,7 +28,6 @@ |
1712 |
+ struct of_flash_list { |
1713 |
+ struct mtd_info *mtd; |
1714 |
+ struct map_info map; |
1715 |
+- struct resource *res; |
1716 |
+ }; |
1717 |
+ |
1718 |
+ struct of_flash { |
1719 |
+@@ -53,18 +52,10 @@ static int of_flash_remove(struct platform_device *dev) |
1720 |
+ mtd_concat_destroy(info->cmtd); |
1721 |
+ } |
1722 |
+ |
1723 |
+- for (i = 0; i < info->list_size; i++) { |
1724 |
++ for (i = 0; i < info->list_size; i++) |
1725 |
+ if (info->list[i].mtd) |
1726 |
+ map_destroy(info->list[i].mtd); |
1727 |
+ |
1728 |
+- if (info->list[i].map.virt) |
1729 |
+- iounmap(info->list[i].map.virt); |
1730 |
+- |
1731 |
+- if (info->list[i].res) { |
1732 |
+- release_resource(info->list[i].res); |
1733 |
+- kfree(info->list[i].res); |
1734 |
+- } |
1735 |
+- } |
1736 |
+ return 0; |
1737 |
+ } |
1738 |
+ |
1739 |
+@@ -223,10 +214,11 @@ static int of_flash_probe(struct platform_device *dev) |
1740 |
+ |
1741 |
+ err = -EBUSY; |
1742 |
+ res_size = resource_size(&res); |
1743 |
+- info->list[i].res = request_mem_region(res.start, res_size, |
1744 |
+- dev_name(&dev->dev)); |
1745 |
+- if (!info->list[i].res) |
1746 |
++ info->list[i].map.virt = devm_ioremap_resource(&dev->dev, &res); |
1747 |
++ if (IS_ERR(info->list[i].map.virt)) { |
1748 |
++ err = PTR_ERR(info->list[i].map.virt); |
1749 |
+ goto err_out; |
1750 |
++ } |
1751 |
+ |
1752 |
+ err = -ENXIO; |
1753 |
+ width = of_get_property(dp, "bank-width", NULL); |
1754 |
+@@ -242,15 +234,6 @@ static int of_flash_probe(struct platform_device *dev) |
1755 |
+ info->list[i].map.bankwidth = be32_to_cpup(width); |
1756 |
+ info->list[i].map.device_node = dp; |
1757 |
+ |
1758 |
+- err = -ENOMEM; |
1759 |
+- info->list[i].map.virt = ioremap(info->list[i].map.phys, |
1760 |
+- info->list[i].map.size); |
1761 |
+- if (!info->list[i].map.virt) { |
1762 |
+- dev_err(&dev->dev, "Failed to ioremap() flash" |
1763 |
+- " region\n"); |
1764 |
+- goto err_out; |
1765 |
+- } |
1766 |
+- |
1767 |
+ simple_map_init(&info->list[i].map); |
1768 |
+ |
1769 |
+ /* |
1770 |
+diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c |
1771 |
+index 1f2785ee909f..c00a180306e5 100644 |
1772 |
+--- a/drivers/mtd/nand/sh_flctl.c |
1773 |
++++ b/drivers/mtd/nand/sh_flctl.c |
1774 |
+@@ -428,7 +428,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset) |
1775 |
+ |
1776 |
+ /* initiate DMA transfer */ |
1777 |
+ if (flctl->chan_fifo0_rx && rlen >= 32 && |
1778 |
+- flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_DEV_TO_MEM) > 0) |
1779 |
++ flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0) |
1780 |
+ goto convert; /* DMA success */ |
1781 |
+ |
1782 |
+ /* do polling transfer */ |
1783 |
+@@ -487,7 +487,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen, |
1784 |
+ |
1785 |
+ /* initiate DMA transfer */ |
1786 |
+ if (flctl->chan_fifo0_tx && rlen >= 32 && |
1787 |
+- flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_MEM_TO_DEV) > 0) |
1788 |
++ flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0) |
1789 |
+ return; /* DMA success */ |
1790 |
+ |
1791 |
+ /* do polling transfer */ |
1792 |
+diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c |
1793 |
+index 9a3f15cb7ef4..9b9dfa167ffb 100644 |
1794 |
+--- a/drivers/net/can/slcan.c |
1795 |
++++ b/drivers/net/can/slcan.c |
1796 |
+@@ -613,6 +613,7 @@ err_free_chan: |
1797 |
+ sl->tty = NULL; |
1798 |
+ tty->disc_data = NULL; |
1799 |
+ clear_bit(SLF_INUSE, &sl->flags); |
1800 |
++ free_netdev(sl->dev); |
1801 |
+ |
1802 |
+ err_exit: |
1803 |
+ rtnl_unlock(); |
1804 |
+diff --git a/drivers/net/ethernet/amd/am79c961a.c b/drivers/net/ethernet/amd/am79c961a.c |
1805 |
+index 87e727b921dc..1ad401fed469 100644 |
1806 |
+--- a/drivers/net/ethernet/amd/am79c961a.c |
1807 |
++++ b/drivers/net/ethernet/amd/am79c961a.c |
1808 |
+@@ -440,7 +440,7 @@ static void am79c961_timeout(struct net_device *dev) |
1809 |
+ /* |
1810 |
+ * Transmit a packet |
1811 |
+ */ |
1812 |
+-static int |
1813 |
++static netdev_tx_t |
1814 |
+ am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev) |
1815 |
+ { |
1816 |
+ struct dev_priv *priv = netdev_priv(dev); |
1817 |
+diff --git a/drivers/net/ethernet/amd/atarilance.c b/drivers/net/ethernet/amd/atarilance.c |
1818 |
+index b10964e8cb54..a1dc65136d9f 100644 |
1819 |
+--- a/drivers/net/ethernet/amd/atarilance.c |
1820 |
++++ b/drivers/net/ethernet/amd/atarilance.c |
1821 |
+@@ -339,7 +339,8 @@ static unsigned long lance_probe1( struct net_device *dev, struct lance_addr |
1822 |
+ *init_rec ); |
1823 |
+ static int lance_open( struct net_device *dev ); |
1824 |
+ static void lance_init_ring( struct net_device *dev ); |
1825 |
+-static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ); |
1826 |
++static netdev_tx_t lance_start_xmit(struct sk_buff *skb, |
1827 |
++ struct net_device *dev); |
1828 |
+ static irqreturn_t lance_interrupt( int irq, void *dev_id ); |
1829 |
+ static int lance_rx( struct net_device *dev ); |
1830 |
+ static int lance_close( struct net_device *dev ); |
1831 |
+@@ -770,7 +771,8 @@ static void lance_tx_timeout (struct net_device *dev) |
1832 |
+ |
1833 |
+ /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ |
1834 |
+ |
1835 |
+-static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) |
1836 |
++static netdev_tx_t |
1837 |
++lance_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1838 |
+ { |
1839 |
+ struct lance_private *lp = netdev_priv(dev); |
1840 |
+ struct lance_ioreg *IO = lp->iobase; |
1841 |
+diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c |
1842 |
+index b584b78237df..5e994f981fea 100644 |
1843 |
+--- a/drivers/net/ethernet/amd/declance.c |
1844 |
++++ b/drivers/net/ethernet/amd/declance.c |
1845 |
+@@ -893,7 +893,7 @@ static void lance_tx_timeout(struct net_device *dev) |
1846 |
+ netif_wake_queue(dev); |
1847 |
+ } |
1848 |
+ |
1849 |
+-static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1850 |
++static netdev_tx_t lance_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1851 |
+ { |
1852 |
+ struct lance_private *lp = netdev_priv(dev); |
1853 |
+ volatile struct lance_regs *ll = lp->ll; |
1854 |
+diff --git a/drivers/net/ethernet/amd/sun3lance.c b/drivers/net/ethernet/amd/sun3lance.c |
1855 |
+index 3d8c6b2cdea4..09271665712d 100644 |
1856 |
+--- a/drivers/net/ethernet/amd/sun3lance.c |
1857 |
++++ b/drivers/net/ethernet/amd/sun3lance.c |
1858 |
+@@ -235,7 +235,8 @@ struct lance_private { |
1859 |
+ static int lance_probe( struct net_device *dev); |
1860 |
+ static int lance_open( struct net_device *dev ); |
1861 |
+ static void lance_init_ring( struct net_device *dev ); |
1862 |
+-static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ); |
1863 |
++static netdev_tx_t lance_start_xmit(struct sk_buff *skb, |
1864 |
++ struct net_device *dev); |
1865 |
+ static irqreturn_t lance_interrupt( int irq, void *dev_id); |
1866 |
+ static int lance_rx( struct net_device *dev ); |
1867 |
+ static int lance_close( struct net_device *dev ); |
1868 |
+@@ -511,7 +512,8 @@ static void lance_init_ring( struct net_device *dev ) |
1869 |
+ } |
1870 |
+ |
1871 |
+ |
1872 |
+-static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) |
1873 |
++static netdev_tx_t |
1874 |
++lance_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1875 |
+ { |
1876 |
+ struct lance_private *lp = netdev_priv(dev); |
1877 |
+ int entry, len; |
1878 |
+diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c |
1879 |
+index 8914170fccff..babb0a5fb8de 100644 |
1880 |
+--- a/drivers/net/ethernet/amd/sunlance.c |
1881 |
++++ b/drivers/net/ethernet/amd/sunlance.c |
1882 |
+@@ -1106,7 +1106,7 @@ static void lance_tx_timeout(struct net_device *dev) |
1883 |
+ netif_wake_queue(dev); |
1884 |
+ } |
1885 |
+ |
1886 |
+-static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1887 |
++static netdev_tx_t lance_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1888 |
+ { |
1889 |
+ struct lance_private *lp = netdev_priv(dev); |
1890 |
+ int entry, skblen, len; |
1891 |
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c |
1892 |
+index 64034ff081a0..23fc244eb8a4 100644 |
1893 |
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c |
1894 |
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c |
1895 |
+@@ -1390,7 +1390,7 @@ static int xgbe_close(struct net_device *netdev) |
1896 |
+ return 0; |
1897 |
+ } |
1898 |
+ |
1899 |
+-static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) |
1900 |
++static netdev_tx_t xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) |
1901 |
+ { |
1902 |
+ struct xgbe_prv_data *pdata = netdev_priv(netdev); |
1903 |
+ struct xgbe_hw_if *hw_if = &pdata->hw_if; |
1904 |
+@@ -1399,7 +1399,7 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) |
1905 |
+ struct xgbe_ring *ring; |
1906 |
+ struct xgbe_packet_data *packet; |
1907 |
+ struct netdev_queue *txq; |
1908 |
+- int ret; |
1909 |
++ netdev_tx_t ret; |
1910 |
+ |
1911 |
+ DBGPR("-->xgbe_xmit: skb->len = %d\n", skb->len); |
1912 |
+ |
1913 |
+diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c |
1914 |
+index ec5834087e4b..c01ab06863b3 100644 |
1915 |
+--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c |
1916 |
++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c |
1917 |
+@@ -571,12 +571,13 @@ static irqreturn_t bcm_enet_isr_dma(int irq, void *dev_id) |
1918 |
+ /* |
1919 |
+ * tx request callback |
1920 |
+ */ |
1921 |
+-static int bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1922 |
++static netdev_tx_t |
1923 |
++bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1924 |
+ { |
1925 |
+ struct bcm_enet_priv *priv; |
1926 |
+ struct bcm_enet_desc *desc; |
1927 |
+ u32 len_stat; |
1928 |
+- int ret; |
1929 |
++ netdev_tx_t ret; |
1930 |
+ |
1931 |
+ priv = netdev_priv(dev); |
1932 |
+ |
1933 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1934 |
+index d450d8b3708c..82960603da33 100644 |
1935 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1936 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1937 |
+@@ -3532,6 +3532,16 @@ static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp) |
1938 |
+ */ |
1939 |
+ static void bnx2x_config_mf_bw(struct bnx2x *bp) |
1940 |
+ { |
1941 |
++ /* Workaround for MFW bug. |
1942 |
++ * MFW is not supposed to generate BW attention in |
1943 |
++ * single function mode. |
1944 |
++ */ |
1945 |
++ if (!IS_MF(bp)) { |
1946 |
++ DP(BNX2X_MSG_MCP, |
1947 |
++ "Ignoring MF BW config in single function mode\n"); |
1948 |
++ return; |
1949 |
++ } |
1950 |
++ |
1951 |
+ if (bp->link_vars.link_up) { |
1952 |
+ bnx2x_cmng_fns_init(bp, true, CMNG_FNS_MINMAX); |
1953 |
+ bnx2x_link_sync_notify(bp); |
1954 |
+diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c |
1955 |
+index f557a2aaec23..73a7c8a50470 100644 |
1956 |
+--- a/drivers/net/ethernet/broadcom/sb1250-mac.c |
1957 |
++++ b/drivers/net/ethernet/broadcom/sb1250-mac.c |
1958 |
+@@ -300,7 +300,7 @@ static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *, |
1959 |
+ static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff); |
1960 |
+ static uint64_t sbmac_addr2reg(unsigned char *ptr); |
1961 |
+ static irqreturn_t sbmac_intr(int irq, void *dev_instance); |
1962 |
+-static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); |
1963 |
++static netdev_tx_t sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); |
1964 |
+ static void sbmac_setmulti(struct sbmac_softc *sc); |
1965 |
+ static int sbmac_init(struct platform_device *pldev, long long base); |
1966 |
+ static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed); |
1967 |
+@@ -2033,7 +2033,7 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance) |
1968 |
+ * Return value: |
1969 |
+ * nothing |
1970 |
+ ********************************************************************* */ |
1971 |
+-static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) |
1972 |
++static netdev_tx_t sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) |
1973 |
+ { |
1974 |
+ struct sbmac_softc *sc = netdev_priv(dev); |
1975 |
+ unsigned long flags; |
1976 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c |
1977 |
+index 052c660aca80..658609c1bdab 100644 |
1978 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c |
1979 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c |
1980 |
+@@ -266,8 +266,8 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap, |
1981 |
+ enum cxgb4_dcb_state_input input = |
1982 |
+ ((pcmd->u.dcb.control.all_syncd_pkd & |
1983 |
+ FW_PORT_CMD_ALL_SYNCD_F) |
1984 |
+- ? CXGB4_DCB_STATE_FW_ALLSYNCED |
1985 |
+- : CXGB4_DCB_STATE_FW_INCOMPLETE); |
1986 |
++ ? CXGB4_DCB_INPUT_FW_ALLSYNCED |
1987 |
++ : CXGB4_DCB_INPUT_FW_INCOMPLETE); |
1988 |
+ |
1989 |
+ if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) { |
1990 |
+ dcb_running_version = FW_PORT_CMD_DCB_VERSION_G( |
1991 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h |
1992 |
+index ccf24d3dc982..2c418c405c50 100644 |
1993 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h |
1994 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h |
1995 |
+@@ -67,7 +67,7 @@ |
1996 |
+ do { \ |
1997 |
+ if ((__dcb)->dcb_version == FW_PORT_DCB_VER_IEEE) \ |
1998 |
+ cxgb4_dcb_state_fsm((__dev), \ |
1999 |
+- CXGB4_DCB_STATE_FW_ALLSYNCED); \ |
2000 |
++ CXGB4_DCB_INPUT_FW_ALLSYNCED); \ |
2001 |
+ } while (0) |
2002 |
+ |
2003 |
+ /* States we can be in for a port's Data Center Bridging. |
2004 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
2005 |
+index de23f23b41de..832ad1bd1f29 100644 |
2006 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
2007 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
2008 |
+@@ -3482,7 +3482,7 @@ int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op) |
2009 |
+ c.param[0].mnem = |
2010 |
+ cpu_to_be32(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | |
2011 |
+ FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_FWCACHE)); |
2012 |
+- c.param[0].val = (__force __be32)op; |
2013 |
++ c.param[0].val = cpu_to_be32(op); |
2014 |
+ |
2015 |
+ return t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), NULL); |
2016 |
+ } |
2017 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
2018 |
+index 22c43a776c6c..756c4ea17655 100644 |
2019 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
2020 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
2021 |
+@@ -10828,6 +10828,7 @@ static void i40e_remove(struct pci_dev *pdev) |
2022 |
+ mutex_destroy(&hw->aq.asq_mutex); |
2023 |
+ |
2024 |
+ /* Clear all dynamic memory lists of rings, q_vectors, and VSIs */ |
2025 |
++ rtnl_lock(); |
2026 |
+ i40e_clear_interrupt_scheme(pf); |
2027 |
+ for (i = 0; i < pf->num_alloc_vsi; i++) { |
2028 |
+ if (pf->vsi[i]) { |
2029 |
+@@ -10836,6 +10837,7 @@ static void i40e_remove(struct pci_dev *pdev) |
2030 |
+ pf->vsi[i] = NULL; |
2031 |
+ } |
2032 |
+ } |
2033 |
++ rtnl_unlock(); |
2034 |
+ |
2035 |
+ for (i = 0; i < I40E_MAX_VEB; i++) { |
2036 |
+ kfree(pf->veb[i]); |
2037 |
+@@ -10982,7 +10984,13 @@ static void i40e_shutdown(struct pci_dev *pdev) |
2038 |
+ wr32(hw, I40E_PFPM_WUFC, |
2039 |
+ (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); |
2040 |
+ |
2041 |
++ /* Since we're going to destroy queues during the |
2042 |
++ * i40e_clear_interrupt_scheme() we should hold the RTNL lock for this |
2043 |
++ * whole section |
2044 |
++ */ |
2045 |
++ rtnl_lock(); |
2046 |
+ i40e_clear_interrupt_scheme(pf); |
2047 |
++ rtnl_unlock(); |
2048 |
+ |
2049 |
+ if (system_state == SYSTEM_POWER_OFF) { |
2050 |
+ pci_wake_from_d3(pdev, pf->wol_en); |
2051 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c |
2052 |
+index 565ca7c835bc..e22ebe460b13 100644 |
2053 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c |
2054 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c |
2055 |
+@@ -605,7 +605,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf) |
2056 |
+ if (!IS_ERR_OR_NULL(pf->ptp_clock)) |
2057 |
+ return 0; |
2058 |
+ |
2059 |
+- strncpy(pf->ptp_caps.name, i40e_driver_name, sizeof(pf->ptp_caps.name)); |
2060 |
++ strncpy(pf->ptp_caps.name, i40e_driver_name, |
2061 |
++ sizeof(pf->ptp_caps.name) - 1); |
2062 |
+ pf->ptp_caps.owner = THIS_MODULE; |
2063 |
+ pf->ptp_caps.max_adj = 999999999; |
2064 |
+ pf->ptp_caps.n_ext_ts = 0; |
2065 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
2066 |
+index e116d9a99b8e..cdb263875efb 100644 |
2067 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
2068 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
2069 |
+@@ -1677,6 +1677,16 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) |
2070 |
+ ret = I40E_ERR_INVALID_MAC_ADDR; |
2071 |
+ goto error_param; |
2072 |
+ } |
2073 |
++ |
2074 |
++ if (vf->pf_set_mac && |
2075 |
++ ether_addr_equal(al->list[i].addr, |
2076 |
++ vf->default_lan_addr.addr)) { |
2077 |
++ dev_err(&pf->pdev->dev, |
2078 |
++ "MAC addr %pM has been set by PF, cannot delete it for VF %d, reset VF to change MAC addr\n", |
2079 |
++ vf->default_lan_addr.addr, vf->vf_id); |
2080 |
++ ret = I40E_ERR_PARAM; |
2081 |
++ goto error_param; |
2082 |
++ } |
2083 |
+ } |
2084 |
+ vsi = pf->vsi[vf->lan_vsi_idx]; |
2085 |
+ |
2086 |
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
2087 |
+index a5b443171b8b..4521181aa0ed 100644 |
2088 |
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
2089 |
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |
2090 |
+@@ -4532,6 +4532,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) |
2091 |
+ struct ixgbe_hw *hw = &adapter->hw; |
2092 |
+ struct hlist_node *node2; |
2093 |
+ struct ixgbe_fdir_filter *filter; |
2094 |
++ u64 action; |
2095 |
+ |
2096 |
+ spin_lock(&adapter->fdir_perfect_lock); |
2097 |
+ |
2098 |
+@@ -4540,12 +4541,17 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) |
2099 |
+ |
2100 |
+ hlist_for_each_entry_safe(filter, node2, |
2101 |
+ &adapter->fdir_filter_list, fdir_node) { |
2102 |
++ action = filter->action; |
2103 |
++ if (action != IXGBE_FDIR_DROP_QUEUE && action != 0) |
2104 |
++ action = |
2105 |
++ (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1; |
2106 |
++ |
2107 |
+ ixgbe_fdir_write_perfect_filter_82599(hw, |
2108 |
+ &filter->filter, |
2109 |
+ filter->sw_idx, |
2110 |
+- (filter->action == IXGBE_FDIR_DROP_QUEUE) ? |
2111 |
++ (action == IXGBE_FDIR_DROP_QUEUE) ? |
2112 |
+ IXGBE_FDIR_DROP_QUEUE : |
2113 |
+- adapter->rx_ring[filter->action]->reg_idx); |
2114 |
++ adapter->rx_ring[action]->reg_idx); |
2115 |
+ } |
2116 |
+ |
2117 |
+ spin_unlock(&adapter->fdir_perfect_lock); |
2118 |
+diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c |
2119 |
+index a8522d8af95d..2126286b72e9 100644 |
2120 |
+--- a/drivers/net/ethernet/micrel/ks8695net.c |
2121 |
++++ b/drivers/net/ethernet/micrel/ks8695net.c |
2122 |
+@@ -1156,7 +1156,7 @@ ks8695_timeout(struct net_device *ndev) |
2123 |
+ * sk_buff and adds it to the TX ring. It then kicks the TX DMA |
2124 |
+ * engine to ensure transmission begins. |
2125 |
+ */ |
2126 |
+-static int |
2127 |
++static netdev_tx_t |
2128 |
+ ks8695_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
2129 |
+ { |
2130 |
+ struct ks8695_priv *ksp = netdev_priv(ndev); |
2131 |
+diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c |
2132 |
+index 2fc5cd56c0a8..8dc1f0277117 100644 |
2133 |
+--- a/drivers/net/ethernet/micrel/ks8851_mll.c |
2134 |
++++ b/drivers/net/ethernet/micrel/ks8851_mll.c |
2135 |
+@@ -1020,9 +1020,9 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) |
2136 |
+ * spin_lock_irqsave is required because tx and rx should be mutual exclusive. |
2137 |
+ * So while tx is in-progress, prevent IRQ interrupt from happenning. |
2138 |
+ */ |
2139 |
+-static int ks_start_xmit(struct sk_buff *skb, struct net_device *netdev) |
2140 |
++static netdev_tx_t ks_start_xmit(struct sk_buff *skb, struct net_device *netdev) |
2141 |
+ { |
2142 |
+- int retv = NETDEV_TX_OK; |
2143 |
++ netdev_tx_t retv = NETDEV_TX_OK; |
2144 |
+ struct ks_net *ks = netdev_priv(netdev); |
2145 |
+ |
2146 |
+ disable_irq(netdev->irq); |
2147 |
+diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c |
2148 |
+index bd64eb982e52..37fb6dfc1087 100644 |
2149 |
+--- a/drivers/net/ethernet/smsc/smc911x.c |
2150 |
++++ b/drivers/net/ethernet/smsc/smc911x.c |
2151 |
+@@ -511,7 +511,8 @@ static void smc911x_hardware_send_pkt(struct net_device *dev) |
2152 |
+ * now, or set the card to generates an interrupt when ready |
2153 |
+ * for the packet. |
2154 |
+ */ |
2155 |
+-static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
2156 |
++static netdev_tx_t |
2157 |
++smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
2158 |
+ { |
2159 |
+ struct smc911x_local *lp = netdev_priv(dev); |
2160 |
+ unsigned int free; |
2161 |
+diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c |
2162 |
+index 23a038810083..7405f537beca 100644 |
2163 |
+--- a/drivers/net/ethernet/smsc/smc91x.c |
2164 |
++++ b/drivers/net/ethernet/smsc/smc91x.c |
2165 |
+@@ -637,7 +637,8 @@ done: if (!THROTTLE_TX_PKTS) |
2166 |
+ * now, or set the card to generates an interrupt when ready |
2167 |
+ * for the packet. |
2168 |
+ */ |
2169 |
+-static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
2170 |
++static netdev_tx_t |
2171 |
++smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
2172 |
+ { |
2173 |
+ struct smc_local *lp = netdev_priv(dev); |
2174 |
+ void __iomem *ioaddr = lp->base; |
2175 |
+diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c |
2176 |
+index 219a99b7a631..b62bf77a64f4 100644 |
2177 |
+--- a/drivers/net/ethernet/smsc/smsc911x.c |
2178 |
++++ b/drivers/net/ethernet/smsc/smsc911x.c |
2179 |
+@@ -1677,7 +1677,8 @@ static int smsc911x_stop(struct net_device *dev) |
2180 |
+ } |
2181 |
+ |
2182 |
+ /* Entry point for transmitting a packet */ |
2183 |
+-static int smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
2184 |
++static netdev_tx_t |
2185 |
++smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
2186 |
+ { |
2187 |
+ struct smsc911x_data *pdata = netdev_priv(dev); |
2188 |
+ unsigned int freespace; |
2189 |
+diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c |
2190 |
+index 79f0ec4e51ac..964df98b54ea 100644 |
2191 |
+--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c |
2192 |
++++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c |
2193 |
+@@ -845,9 +845,9 @@ static int gelic_card_kick_txdma(struct gelic_card *card, |
2194 |
+ * @skb: packet to send out |
2195 |
+ * @netdev: interface device structure |
2196 |
+ * |
2197 |
+- * returns 0 on success, <0 on failure |
2198 |
++ * returns NETDEV_TX_OK on success, NETDEV_TX_BUSY on failure |
2199 |
+ */ |
2200 |
+-int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev) |
2201 |
++netdev_tx_t gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev) |
2202 |
+ { |
2203 |
+ struct gelic_card *card = netdev_card(netdev); |
2204 |
+ struct gelic_descr *descr; |
2205 |
+diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.h b/drivers/net/ethernet/toshiba/ps3_gelic_net.h |
2206 |
+index 8505196be9f5..d123644bd720 100644 |
2207 |
+--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.h |
2208 |
++++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.h |
2209 |
+@@ -370,7 +370,7 @@ void gelic_card_up(struct gelic_card *card); |
2210 |
+ void gelic_card_down(struct gelic_card *card); |
2211 |
+ int gelic_net_open(struct net_device *netdev); |
2212 |
+ int gelic_net_stop(struct net_device *netdev); |
2213 |
+-int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev); |
2214 |
++netdev_tx_t gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev); |
2215 |
+ void gelic_net_set_multi(struct net_device *netdev); |
2216 |
+ void gelic_net_tx_timeout(struct net_device *netdev); |
2217 |
+ int gelic_net_change_mtu(struct net_device *netdev, int new_mtu); |
2218 |
+diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c |
2219 |
+index 3c54a2cae5df..8e53211aedd8 100644 |
2220 |
+--- a/drivers/net/ethernet/toshiba/spider_net.c |
2221 |
++++ b/drivers/net/ethernet/toshiba/spider_net.c |
2222 |
+@@ -881,9 +881,9 @@ out: |
2223 |
+ * @skb: packet to send out |
2224 |
+ * @netdev: interface device structure |
2225 |
+ * |
2226 |
+- * returns 0 on success, !0 on failure |
2227 |
++ * returns NETDEV_TX_OK on success, NETDEV_TX_BUSY on failure |
2228 |
+ */ |
2229 |
+-static int |
2230 |
++static netdev_tx_t |
2231 |
+ spider_net_xmit(struct sk_buff *skb, struct net_device *netdev) |
2232 |
+ { |
2233 |
+ int cnt; |
2234 |
+diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c |
2235 |
+index 868fb6306df0..3e33c165a427 100644 |
2236 |
+--- a/drivers/net/ethernet/toshiba/tc35815.c |
2237 |
++++ b/drivers/net/ethernet/toshiba/tc35815.c |
2238 |
+@@ -475,7 +475,8 @@ static void free_rxbuf_skb(struct pci_dev *hwdev, struct sk_buff *skb, dma_addr_ |
2239 |
+ /* Index to functions, as function prototypes. */ |
2240 |
+ |
2241 |
+ static int tc35815_open(struct net_device *dev); |
2242 |
+-static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev); |
2243 |
++static netdev_tx_t tc35815_send_packet(struct sk_buff *skb, |
2244 |
++ struct net_device *dev); |
2245 |
+ static irqreturn_t tc35815_interrupt(int irq, void *dev_id); |
2246 |
+ static int tc35815_rx(struct net_device *dev, int limit); |
2247 |
+ static int tc35815_poll(struct napi_struct *napi, int budget); |
2248 |
+@@ -1279,7 +1280,8 @@ tc35815_open(struct net_device *dev) |
2249 |
+ * invariant will hold if you make sure that the netif_*_queue() |
2250 |
+ * calls are done at the proper times. |
2251 |
+ */ |
2252 |
+-static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev) |
2253 |
++static netdev_tx_t |
2254 |
++tc35815_send_packet(struct sk_buff *skb, struct net_device *dev) |
2255 |
+ { |
2256 |
+ struct tc35815_local *lp = netdev_priv(dev); |
2257 |
+ struct TxFD *txfd; |
2258 |
+diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c |
2259 |
+index 5a1068df7038..ed6a88cf3281 100644 |
2260 |
+--- a/drivers/net/ethernet/xilinx/ll_temac_main.c |
2261 |
++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c |
2262 |
+@@ -673,7 +673,8 @@ static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag) |
2263 |
+ return 0; |
2264 |
+ } |
2265 |
+ |
2266 |
+-static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
2267 |
++static netdev_tx_t |
2268 |
++temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
2269 |
+ { |
2270 |
+ struct temac_local *lp = netdev_priv(ndev); |
2271 |
+ struct cdmac_bd *cur_p; |
2272 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
2273 |
+index f1e969128a4e..7f1a57bb2ab1 100644 |
2274 |
+--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
2275 |
++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c |
2276 |
+@@ -656,7 +656,8 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp, |
2277 |
+ * start the transmission. Additionally if checksum offloading is supported, |
2278 |
+ * it populates AXI Stream Control fields with appropriate values. |
2279 |
+ */ |
2280 |
+-static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
2281 |
++static netdev_tx_t |
2282 |
++axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
2283 |
+ { |
2284 |
+ u32 ii; |
2285 |
+ u32 num_frag; |
2286 |
+diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
2287 |
+index 4cb8b85cbf2c..909a008f9927 100644 |
2288 |
+--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
2289 |
++++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c |
2290 |
+@@ -1008,9 +1008,10 @@ static int xemaclite_close(struct net_device *dev) |
2291 |
+ * deferred and the Tx queue is stopped so that the deferred socket buffer can |
2292 |
+ * be transmitted when the Emaclite device is free to transmit data. |
2293 |
+ * |
2294 |
+- * Return: 0, always. |
2295 |
++ * Return: NETDEV_TX_OK, always. |
2296 |
+ */ |
2297 |
+-static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) |
2298 |
++static netdev_tx_t |
2299 |
++xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) |
2300 |
+ { |
2301 |
+ struct net_local *lp = netdev_priv(dev); |
2302 |
+ struct sk_buff *new_skb; |
2303 |
+@@ -1031,7 +1032,7 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) |
2304 |
+ /* Take the time stamp now, since we can't do this in an ISR. */ |
2305 |
+ skb_tx_timestamp(new_skb); |
2306 |
+ spin_unlock_irqrestore(&lp->reset_lock, flags); |
2307 |
+- return 0; |
2308 |
++ return NETDEV_TX_OK; |
2309 |
+ } |
2310 |
+ spin_unlock_irqrestore(&lp->reset_lock, flags); |
2311 |
+ |
2312 |
+@@ -1040,7 +1041,7 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) |
2313 |
+ dev->stats.tx_bytes += len; |
2314 |
+ dev_consume_skb_any(new_skb); |
2315 |
+ |
2316 |
+- return 0; |
2317 |
++ return NETDEV_TX_OK; |
2318 |
+ } |
2319 |
+ |
2320 |
+ /** |
2321 |
+diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c |
2322 |
+index a17d86a57734..d34bdd2f7ac7 100644 |
2323 |
+--- a/drivers/net/slip/slip.c |
2324 |
++++ b/drivers/net/slip/slip.c |
2325 |
+@@ -860,6 +860,7 @@ err_free_chan: |
2326 |
+ sl->tty = NULL; |
2327 |
+ tty->disc_data = NULL; |
2328 |
+ clear_bit(SLF_INUSE, &sl->flags); |
2329 |
++ free_netdev(sl->dev); |
2330 |
+ |
2331 |
+ err_exit: |
2332 |
+ rtnl_unlock(); |
2333 |
+diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c |
2334 |
+index 5f18fcb8dcc7..6b1d03b73eeb 100644 |
2335 |
+--- a/drivers/net/usb/ax88172a.c |
2336 |
++++ b/drivers/net/usb/ax88172a.c |
2337 |
+@@ -243,7 +243,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf) |
2338 |
+ |
2339 |
+ /* Get the MAC address */ |
2340 |
+ ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf); |
2341 |
+- if (ret < 0) { |
2342 |
++ if (ret < ETH_ALEN) { |
2343 |
+ netdev_err(dev->net, "Failed to read MAC address: %d\n", ret); |
2344 |
+ goto free; |
2345 |
+ } |
2346 |
+diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c |
2347 |
+index 71ef895b4dca..bab13ccfb085 100644 |
2348 |
+--- a/drivers/net/usb/cdc_ncm.c |
2349 |
++++ b/drivers/net/usb/cdc_ncm.c |
2350 |
+@@ -534,7 +534,7 @@ static void cdc_ncm_set_dgram_size(struct usbnet *dev, int new_size) |
2351 |
+ err = usbnet_read_cmd(dev, USB_CDC_GET_MAX_DATAGRAM_SIZE, |
2352 |
+ USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, |
2353 |
+ 0, iface_no, &max_datagram_size, sizeof(max_datagram_size)); |
2354 |
+- if (err < sizeof(max_datagram_size)) { |
2355 |
++ if (err != sizeof(max_datagram_size)) { |
2356 |
+ dev_dbg(&dev->intf->dev, "GET_MAX_DATAGRAM_SIZE failed\n"); |
2357 |
+ goto out; |
2358 |
+ } |
2359 |
+diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c |
2360 |
+index 45a6a7cae4bf..fc922f812280 100644 |
2361 |
+--- a/drivers/net/usb/lan78xx.c |
2362 |
++++ b/drivers/net/usb/lan78xx.c |
2363 |
+@@ -2246,6 +2246,11 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf) |
2364 |
+ int i; |
2365 |
+ |
2366 |
+ ret = lan78xx_get_endpoints(dev, intf); |
2367 |
++ if (ret) { |
2368 |
++ netdev_warn(dev->net, "lan78xx_get_endpoints failed: %d\n", |
2369 |
++ ret); |
2370 |
++ return ret; |
2371 |
++ } |
2372 |
+ |
2373 |
+ dev->data[0] = (unsigned long)kzalloc(sizeof(*pdata), GFP_KERNEL); |
2374 |
+ |
2375 |
+diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h |
2376 |
+index 257836a0cfbc..a7fab3b0a443 100644 |
2377 |
+--- a/drivers/net/wireless/ath/ath10k/core.h |
2378 |
++++ b/drivers/net/wireless/ath/ath10k/core.h |
2379 |
+@@ -755,6 +755,7 @@ struct ath10k { |
2380 |
+ |
2381 |
+ struct completion install_key_done; |
2382 |
+ |
2383 |
++ int last_wmi_vdev_start_status; |
2384 |
+ struct completion vdev_setup_done; |
2385 |
+ |
2386 |
+ struct workqueue_struct *workqueue; |
2387 |
+diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
2388 |
+index 5a0138c1c045..7fbf2abcfc43 100644 |
2389 |
+--- a/drivers/net/wireless/ath/ath10k/mac.c |
2390 |
++++ b/drivers/net/wireless/ath/ath10k/mac.c |
2391 |
+@@ -850,7 +850,7 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar) |
2392 |
+ if (time_left == 0) |
2393 |
+ return -ETIMEDOUT; |
2394 |
+ |
2395 |
+- return 0; |
2396 |
++ return ar->last_wmi_vdev_start_status; |
2397 |
+ } |
2398 |
+ |
2399 |
+ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) |
2400 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c |
2401 |
+index b867875aa6e6..4d8cdbfc9d42 100644 |
2402 |
+--- a/drivers/net/wireless/ath/ath10k/wmi.c |
2403 |
++++ b/drivers/net/wireless/ath/ath10k/wmi.c |
2404 |
+@@ -2294,7 +2294,8 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) |
2405 |
+ status->freq, status->band, status->signal, |
2406 |
+ status->rate_idx); |
2407 |
+ |
2408 |
+- ieee80211_rx(ar->hw, skb); |
2409 |
++ ieee80211_rx_ni(ar->hw, skb); |
2410 |
++ |
2411 |
+ return 0; |
2412 |
+ } |
2413 |
+ |
2414 |
+@@ -2944,18 +2945,31 @@ void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) |
2415 |
+ { |
2416 |
+ struct wmi_vdev_start_ev_arg arg = {}; |
2417 |
+ int ret; |
2418 |
++ u32 status; |
2419 |
+ |
2420 |
+ ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n"); |
2421 |
+ |
2422 |
++ ar->last_wmi_vdev_start_status = 0; |
2423 |
++ |
2424 |
+ ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg); |
2425 |
+ if (ret) { |
2426 |
+ ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret); |
2427 |
+- return; |
2428 |
++ ar->last_wmi_vdev_start_status = ret; |
2429 |
++ goto out; |
2430 |
+ } |
2431 |
+ |
2432 |
+- if (WARN_ON(__le32_to_cpu(arg.status))) |
2433 |
+- return; |
2434 |
++ status = __le32_to_cpu(arg.status); |
2435 |
++ if (WARN_ON_ONCE(status)) { |
2436 |
++ ath10k_warn(ar, "vdev-start-response reports status error: %d (%s)\n", |
2437 |
++ status, (status == WMI_VDEV_START_CHAN_INVALID) ? |
2438 |
++ "chan-invalid" : "unknown"); |
2439 |
++ /* Setup is done one way or another though, so we should still |
2440 |
++ * do the completion, so don't return here. |
2441 |
++ */ |
2442 |
++ ar->last_wmi_vdev_start_status = -EINVAL; |
2443 |
++ } |
2444 |
+ |
2445 |
++out: |
2446 |
+ complete(&ar->vdev_setup_done); |
2447 |
+ } |
2448 |
+ |
2449 |
+diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h |
2450 |
+index a8b2553e8988..66148a82ad25 100644 |
2451 |
+--- a/drivers/net/wireless/ath/ath10k/wmi.h |
2452 |
++++ b/drivers/net/wireless/ath/ath10k/wmi.h |
2453 |
+@@ -5969,11 +5969,17 @@ struct wmi_ch_info_ev_arg { |
2454 |
+ __le32 rx_frame_count; |
2455 |
+ }; |
2456 |
+ |
2457 |
++/* From 10.4 firmware, not sure all have the same values. */ |
2458 |
++enum wmi_vdev_start_status { |
2459 |
++ WMI_VDEV_START_OK = 0, |
2460 |
++ WMI_VDEV_START_CHAN_INVALID, |
2461 |
++}; |
2462 |
++ |
2463 |
+ struct wmi_vdev_start_ev_arg { |
2464 |
+ __le32 vdev_id; |
2465 |
+ __le32 req_id; |
2466 |
+ __le32 resp_type; /* %WMI_VDEV_RESP_ */ |
2467 |
+- __le32 status; |
2468 |
++ __le32 status; /* See wmi_vdev_start_status enum above */ |
2469 |
+ }; |
2470 |
+ |
2471 |
+ struct wmi_peer_kick_ev_arg { |
2472 |
+diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c |
2473 |
+index 03945731eb65..ec805fe6dddb 100644 |
2474 |
+--- a/drivers/net/wireless/ath/ath9k/common-spectral.c |
2475 |
++++ b/drivers/net/wireless/ath/ath9k/common-spectral.c |
2476 |
+@@ -411,7 +411,7 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs, |
2477 |
+ |
2478 |
+ ath_dbg(common, SPECTRAL_SCAN, |
2479 |
+ "Calculated new upper max 0x%X at %i\n", |
2480 |
+- tmp_mag, i); |
2481 |
++ tmp_mag, fft_sample_40.upper_max_index); |
2482 |
+ } else |
2483 |
+ for (i = dc_pos; i < SPECTRAL_HT20_40_NUM_BINS; i++) { |
2484 |
+ if (fft_sample_40.data[i] == (upper_mag >> max_exp)) |
2485 |
+diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c |
2486 |
+index e6c8b0d5afe0..7dae935701a7 100644 |
2487 |
+--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c |
2488 |
++++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c |
2489 |
+@@ -1469,10 +1469,12 @@ int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp, |
2490 |
+ return 0; |
2491 |
+ |
2492 |
+ if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) { |
2493 |
+- if (e->status == BRCMF_E_STATUS_SUCCESS) |
2494 |
++ if (e->status == BRCMF_E_STATUS_SUCCESS) { |
2495 |
+ set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, |
2496 |
+ &p2p->status); |
2497 |
+- else { |
2498 |
++ if (!p2p->wait_for_offchan_complete) |
2499 |
++ complete(&p2p->send_af_done); |
2500 |
++ } else { |
2501 |
+ set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); |
2502 |
+ /* If there is no ack, we don't need to wait for |
2503 |
+ * WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE event |
2504 |
+@@ -1523,6 +1525,17 @@ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p, |
2505 |
+ p2p->af_sent_channel = le32_to_cpu(af_params->channel); |
2506 |
+ p2p->af_tx_sent_jiffies = jiffies; |
2507 |
+ |
2508 |
++ if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status) && |
2509 |
++ p2p->af_sent_channel == |
2510 |
++ ieee80211_frequency_to_channel(p2p->remain_on_channel.center_freq)) |
2511 |
++ p2p->wait_for_offchan_complete = false; |
2512 |
++ else |
2513 |
++ p2p->wait_for_offchan_complete = true; |
2514 |
++ |
2515 |
++ brcmf_dbg(TRACE, "Waiting for %s tx completion event\n", |
2516 |
++ (p2p->wait_for_offchan_complete) ? |
2517 |
++ "off-channel" : "on-channel"); |
2518 |
++ |
2519 |
+ timeout = wait_for_completion_timeout(&p2p->send_af_done, |
2520 |
+ msecs_to_jiffies(P2P_AF_MAX_WAIT_TIME)); |
2521 |
+ |
2522 |
+diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h |
2523 |
+index 5d49059021a9..59e902adfc08 100644 |
2524 |
+--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h |
2525 |
++++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h |
2526 |
+@@ -125,6 +125,7 @@ struct afx_hdl { |
2527 |
+ * @gon_req_action: about to send go negotiation requets frame. |
2528 |
+ * @block_gon_req_tx: drop tx go negotiation requets frame. |
2529 |
+ * @p2pdev_dynamically: is p2p device if created by module param or supplicant. |
2530 |
++ * @wait_for_offchan_complete: wait for off-channel tx completion event. |
2531 |
+ */ |
2532 |
+ struct brcmf_p2p_info { |
2533 |
+ struct brcmf_cfg80211_info *cfg; |
2534 |
+@@ -146,6 +147,7 @@ struct brcmf_p2p_info { |
2535 |
+ bool gon_req_action; |
2536 |
+ bool block_gon_req_tx; |
2537 |
+ bool p2pdev_dynamically; |
2538 |
++ bool wait_for_offchan_complete; |
2539 |
+ }; |
2540 |
+ |
2541 |
+ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced); |
2542 |
+diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c |
2543 |
+index c2d5b495c179..c089540116fa 100644 |
2544 |
+--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c |
2545 |
++++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c |
2546 |
+@@ -146,7 +146,7 @@ static int rtl8187_register_led(struct ieee80211_hw *dev, |
2547 |
+ led->dev = dev; |
2548 |
+ led->ledpin = ledpin; |
2549 |
+ led->is_radio = is_radio; |
2550 |
+- strncpy(led->name, name, sizeof(led->name)); |
2551 |
++ strlcpy(led->name, name, sizeof(led->name)); |
2552 |
+ |
2553 |
+ led->led_dev.name = led->name; |
2554 |
+ led->led_dev.default_trigger = default_trigger; |
2555 |
+diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c |
2556 |
+index 931cc33e46f0..5d6d1bb4f110 100644 |
2557 |
+--- a/drivers/nvmem/core.c |
2558 |
++++ b/drivers/nvmem/core.c |
2559 |
+@@ -457,7 +457,7 @@ static struct nvmem_device *nvmem_find(const char *name) |
2560 |
+ d = bus_find_device(&nvmem_bus_type, NULL, (void *)name, nvmem_match); |
2561 |
+ |
2562 |
+ if (!d) |
2563 |
+- return NULL; |
2564 |
++ return ERR_PTR(-ENOENT); |
2565 |
+ |
2566 |
+ return to_nvmem_device(d); |
2567 |
+ } |
2568 |
+diff --git a/drivers/of/base.c b/drivers/of/base.c |
2569 |
+index c6e019208d17..27783223ca5c 100644 |
2570 |
+--- a/drivers/of/base.c |
2571 |
++++ b/drivers/of/base.c |
2572 |
+@@ -2125,7 +2125,7 @@ struct device_node *of_find_next_cache_node(const struct device_node *np) |
2573 |
+ /* OF on pmac has nodes instead of properties named "l2-cache" |
2574 |
+ * beneath CPU nodes. |
2575 |
+ */ |
2576 |
+- if (!strcmp(np->type, "cpu")) |
2577 |
++ if (IS_ENABLED(CONFIG_PPC_PMAC) && !strcmp(np->type, "cpu")) |
2578 |
+ for_each_child_of_node(np, child) |
2579 |
+ if (!strcmp(child->type, "cache")) |
2580 |
+ return child; |
2581 |
+diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c |
2582 |
+index 9aa82a4e9e25..b4420a0bf7d6 100644 |
2583 |
+--- a/drivers/pinctrl/pinctrl-at91-pio4.c |
2584 |
++++ b/drivers/pinctrl/pinctrl-at91-pio4.c |
2585 |
+@@ -477,7 +477,6 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev, |
2586 |
+ unsigned num_pins, num_configs, reserve; |
2587 |
+ unsigned long *configs; |
2588 |
+ struct property *pins; |
2589 |
+- bool has_config; |
2590 |
+ u32 pinfunc; |
2591 |
+ int ret, i; |
2592 |
+ |
2593 |
+@@ -493,9 +492,6 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev, |
2594 |
+ return ret; |
2595 |
+ } |
2596 |
+ |
2597 |
+- if (num_configs) |
2598 |
+- has_config = true; |
2599 |
+- |
2600 |
+ num_pins = pins->length / sizeof(u32); |
2601 |
+ if (!num_pins) { |
2602 |
+ dev_err(pctldev->dev, "no pins found in node %s\n", |
2603 |
+@@ -508,7 +504,7 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev, |
2604 |
+ * map for each pin. |
2605 |
+ */ |
2606 |
+ reserve = 1; |
2607 |
+- if (has_config && num_pins >= 1) |
2608 |
++ if (num_configs) |
2609 |
+ reserve++; |
2610 |
+ reserve *= num_pins; |
2611 |
+ ret = pinctrl_utils_reserve_map(pctldev, map, reserved_maps, num_maps, |
2612 |
+@@ -531,7 +527,7 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev, |
2613 |
+ pinctrl_utils_add_map_mux(pctldev, map, reserved_maps, num_maps, |
2614 |
+ group, func); |
2615 |
+ |
2616 |
+- if (has_config) { |
2617 |
++ if (num_configs) { |
2618 |
+ ret = pinctrl_utils_add_map_configs(pctldev, map, |
2619 |
+ reserved_maps, num_maps, group, |
2620 |
+ configs, num_configs, |
2621 |
+diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c |
2622 |
+index 0d2fc0cff35e..52bbd34f7d0d 100644 |
2623 |
+--- a/drivers/pinctrl/pinctrl-at91.c |
2624 |
++++ b/drivers/pinctrl/pinctrl-at91.c |
2625 |
+@@ -1556,16 +1556,6 @@ void at91_pinctrl_gpio_resume(void) |
2626 |
+ #define gpio_irq_set_wake NULL |
2627 |
+ #endif /* CONFIG_PM */ |
2628 |
+ |
2629 |
+-static struct irq_chip gpio_irqchip = { |
2630 |
+- .name = "GPIO", |
2631 |
+- .irq_ack = gpio_irq_ack, |
2632 |
+- .irq_disable = gpio_irq_mask, |
2633 |
+- .irq_mask = gpio_irq_mask, |
2634 |
+- .irq_unmask = gpio_irq_unmask, |
2635 |
+- /* .irq_set_type is set dynamically */ |
2636 |
+- .irq_set_wake = gpio_irq_set_wake, |
2637 |
+-}; |
2638 |
+- |
2639 |
+ static void gpio_irq_handler(struct irq_desc *desc) |
2640 |
+ { |
2641 |
+ struct irq_chip *chip = irq_desc_get_chip(desc); |
2642 |
+@@ -1608,12 +1598,22 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, |
2643 |
+ struct gpio_chip *gpiochip_prev = NULL; |
2644 |
+ struct at91_gpio_chip *prev = NULL; |
2645 |
+ struct irq_data *d = irq_get_irq_data(at91_gpio->pioc_virq); |
2646 |
++ struct irq_chip *gpio_irqchip; |
2647 |
+ int ret, i; |
2648 |
+ |
2649 |
++ gpio_irqchip = devm_kzalloc(&pdev->dev, sizeof(*gpio_irqchip), GFP_KERNEL); |
2650 |
++ if (!gpio_irqchip) |
2651 |
++ return -ENOMEM; |
2652 |
++ |
2653 |
+ at91_gpio->pioc_hwirq = irqd_to_hwirq(d); |
2654 |
+ |
2655 |
+- /* Setup proper .irq_set_type function */ |
2656 |
+- gpio_irqchip.irq_set_type = at91_gpio->ops->irq_type; |
2657 |
++ gpio_irqchip->name = "GPIO"; |
2658 |
++ gpio_irqchip->irq_ack = gpio_irq_ack; |
2659 |
++ gpio_irqchip->irq_disable = gpio_irq_mask; |
2660 |
++ gpio_irqchip->irq_mask = gpio_irq_mask; |
2661 |
++ gpio_irqchip->irq_unmask = gpio_irq_unmask; |
2662 |
++ gpio_irqchip->irq_set_wake = gpio_irq_set_wake, |
2663 |
++ gpio_irqchip->irq_set_type = at91_gpio->ops->irq_type; |
2664 |
+ |
2665 |
+ /* Disable irqs of this PIO controller */ |
2666 |
+ writel_relaxed(~0, at91_gpio->regbase + PIO_IDR); |
2667 |
+@@ -1624,7 +1624,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, |
2668 |
+ * interrupt. |
2669 |
+ */ |
2670 |
+ ret = gpiochip_irqchip_add(&at91_gpio->chip, |
2671 |
+- &gpio_irqchip, |
2672 |
++ gpio_irqchip, |
2673 |
+ 0, |
2674 |
+ handle_edge_irq, |
2675 |
+ IRQ_TYPE_EDGE_BOTH); |
2676 |
+@@ -1642,7 +1642,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, |
2677 |
+ if (!gpiochip_prev) { |
2678 |
+ /* Then register the chain on the parent IRQ */ |
2679 |
+ gpiochip_set_chained_irqchip(&at91_gpio->chip, |
2680 |
+- &gpio_irqchip, |
2681 |
++ gpio_irqchip, |
2682 |
+ at91_gpio->pioc_virq, |
2683 |
+ gpio_irq_handler); |
2684 |
+ return 0; |
2685 |
+diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c |
2686 |
+index 3830dade5d69..d91111200dde 100644 |
2687 |
+--- a/drivers/power/ab8500_fg.c |
2688 |
++++ b/drivers/power/ab8500_fg.c |
2689 |
+@@ -2447,17 +2447,14 @@ static ssize_t charge_full_store(struct ab8500_fg *di, const char *buf, |
2690 |
+ size_t count) |
2691 |
+ { |
2692 |
+ unsigned long charge_full; |
2693 |
+- ssize_t ret; |
2694 |
++ int ret; |
2695 |
+ |
2696 |
+ ret = kstrtoul(buf, 10, &charge_full); |
2697 |
++ if (ret) |
2698 |
++ return ret; |
2699 |
+ |
2700 |
+- dev_dbg(di->dev, "Ret %zd charge_full %lu", ret, charge_full); |
2701 |
+- |
2702 |
+- if (!ret) { |
2703 |
+- di->bat_cap.max_mah = (int) charge_full; |
2704 |
+- ret = count; |
2705 |
+- } |
2706 |
+- return ret; |
2707 |
++ di->bat_cap.max_mah = (int) charge_full; |
2708 |
++ return count; |
2709 |
+ } |
2710 |
+ |
2711 |
+ static ssize_t charge_now_show(struct ab8500_fg *di, char *buf) |
2712 |
+@@ -2469,20 +2466,16 @@ static ssize_t charge_now_store(struct ab8500_fg *di, const char *buf, |
2713 |
+ size_t count) |
2714 |
+ { |
2715 |
+ unsigned long charge_now; |
2716 |
+- ssize_t ret; |
2717 |
++ int ret; |
2718 |
+ |
2719 |
+ ret = kstrtoul(buf, 10, &charge_now); |
2720 |
++ if (ret) |
2721 |
++ return ret; |
2722 |
+ |
2723 |
+- dev_dbg(di->dev, "Ret %zd charge_now %lu was %d", |
2724 |
+- ret, charge_now, di->bat_cap.prev_mah); |
2725 |
+- |
2726 |
+- if (!ret) { |
2727 |
+- di->bat_cap.user_mah = (int) charge_now; |
2728 |
+- di->flags.user_cap = true; |
2729 |
+- ret = count; |
2730 |
+- queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); |
2731 |
+- } |
2732 |
+- return ret; |
2733 |
++ di->bat_cap.user_mah = (int) charge_now; |
2734 |
++ di->flags.user_cap = true; |
2735 |
++ queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); |
2736 |
++ return count; |
2737 |
+ } |
2738 |
+ |
2739 |
+ static struct ab8500_fg_sysfs_entry charge_full_attr = |
2740 |
+diff --git a/drivers/power/max8998_charger.c b/drivers/power/max8998_charger.c |
2741 |
+index b64cf0f14142..66438029bdd0 100644 |
2742 |
+--- a/drivers/power/max8998_charger.c |
2743 |
++++ b/drivers/power/max8998_charger.c |
2744 |
+@@ -85,7 +85,7 @@ static const struct power_supply_desc max8998_battery_desc = { |
2745 |
+ static int max8998_battery_probe(struct platform_device *pdev) |
2746 |
+ { |
2747 |
+ struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
2748 |
+- struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev); |
2749 |
++ struct max8998_platform_data *pdata = iodev->pdata; |
2750 |
+ struct power_supply_config psy_cfg = {}; |
2751 |
+ struct max8998_battery_data *max8998; |
2752 |
+ struct i2c_client *i2c; |
2753 |
+diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c |
2754 |
+index bcd4dc304f27..5b1f147b11cb 100644 |
2755 |
+--- a/drivers/power/twl4030_charger.c |
2756 |
++++ b/drivers/power/twl4030_charger.c |
2757 |
+@@ -449,7 +449,8 @@ static void twl4030_current_worker(struct work_struct *data) |
2758 |
+ |
2759 |
+ if (v < USB_MIN_VOLT) { |
2760 |
+ /* Back up and stop adjusting. */ |
2761 |
+- bci->usb_cur -= USB_CUR_STEP; |
2762 |
++ if (bci->usb_cur >= USB_CUR_STEP) |
2763 |
++ bci->usb_cur -= USB_CUR_STEP; |
2764 |
+ bci->usb_cur_target = bci->usb_cur; |
2765 |
+ } else if (bci->usb_cur >= bci->usb_cur_target || |
2766 |
+ bci->usb_cur + USB_CUR_STEP > USB_MAX_CURRENT) { |
2767 |
+@@ -468,6 +469,7 @@ static void twl4030_current_worker(struct work_struct *data) |
2768 |
+ static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable) |
2769 |
+ { |
2770 |
+ int ret; |
2771 |
++ u32 reg; |
2772 |
+ |
2773 |
+ if (bci->usb_mode == CHARGE_OFF) |
2774 |
+ enable = false; |
2775 |
+@@ -481,14 +483,38 @@ static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable) |
2776 |
+ bci->usb_enabled = 1; |
2777 |
+ } |
2778 |
+ |
2779 |
+- if (bci->usb_mode == CHARGE_AUTO) |
2780 |
++ if (bci->usb_mode == CHARGE_AUTO) { |
2781 |
++ /* Enable interrupts now. */ |
2782 |
++ reg = ~(u32)(TWL4030_ICHGLOW | TWL4030_ICHGEOC | |
2783 |
++ TWL4030_TBATOR2 | TWL4030_TBATOR1 | |
2784 |
++ TWL4030_BATSTS); |
2785 |
++ ret = twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, reg, |
2786 |
++ TWL4030_INTERRUPTS_BCIIMR1A); |
2787 |
++ if (ret < 0) { |
2788 |
++ dev_err(bci->dev, |
2789 |
++ "failed to unmask interrupts: %d\n", |
2790 |
++ ret); |
2791 |
++ return ret; |
2792 |
++ } |
2793 |
+ /* forcing the field BCIAUTOUSB (BOOT_BCI[1]) to 1 */ |
2794 |
+ ret = twl4030_clear_set_boot_bci(0, TWL4030_BCIAUTOUSB); |
2795 |
++ } |
2796 |
+ |
2797 |
+ /* forcing USBFASTMCHG(BCIMFSTS4[2]) to 1 */ |
2798 |
+ ret = twl4030_clear_set(TWL_MODULE_MAIN_CHARGE, 0, |
2799 |
+ TWL4030_USBFASTMCHG, TWL4030_BCIMFSTS4); |
2800 |
+ if (bci->usb_mode == CHARGE_LINEAR) { |
2801 |
++ /* Enable interrupts now. */ |
2802 |
++ reg = ~(u32)(TWL4030_ICHGLOW | TWL4030_TBATOR2 | |
2803 |
++ TWL4030_TBATOR1 | TWL4030_BATSTS); |
2804 |
++ ret = twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, reg, |
2805 |
++ TWL4030_INTERRUPTS_BCIIMR1A); |
2806 |
++ if (ret < 0) { |
2807 |
++ dev_err(bci->dev, |
2808 |
++ "failed to unmask interrupts: %d\n", |
2809 |
++ ret); |
2810 |
++ return ret; |
2811 |
++ } |
2812 |
+ twl4030_clear_set_boot_bci(TWL4030_BCIAUTOAC|TWL4030_CVENAC, 0); |
2813 |
+ /* Watch dog key: WOVF acknowledge */ |
2814 |
+ ret = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0x33, |
2815 |
+diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c |
2816 |
+index 22045e7d78ac..97211f7f0cf0 100644 |
2817 |
+--- a/drivers/s390/net/qeth_l2_main.c |
2818 |
++++ b/drivers/s390/net/qeth_l2_main.c |
2819 |
+@@ -996,7 +996,10 @@ static int __qeth_l2_open(struct net_device *dev) |
2820 |
+ |
2821 |
+ if (qdio_stop_irq(card->data.ccwdev, 0) >= 0) { |
2822 |
+ napi_enable(&card->napi); |
2823 |
++ local_bh_disable(); |
2824 |
+ napi_schedule(&card->napi); |
2825 |
++ /* kick-start the NAPI softirq: */ |
2826 |
++ local_bh_enable(); |
2827 |
+ } else |
2828 |
+ rc = -EIO; |
2829 |
+ return rc; |
2830 |
+diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c |
2831 |
+index 2cc9bc1ef1e3..0d71d2e6419a 100644 |
2832 |
+--- a/drivers/s390/net/qeth_l3_main.c |
2833 |
++++ b/drivers/s390/net/qeth_l3_main.c |
2834 |
+@@ -3031,7 +3031,10 @@ static int __qeth_l3_open(struct net_device *dev) |
2835 |
+ |
2836 |
+ if (qdio_stop_irq(card->data.ccwdev, 0) >= 0) { |
2837 |
+ napi_enable(&card->napi); |
2838 |
++ local_bh_disable(); |
2839 |
+ napi_schedule(&card->napi); |
2840 |
++ /* kick-start the NAPI softirq: */ |
2841 |
++ local_bh_enable(); |
2842 |
+ } else |
2843 |
+ rc = -EIO; |
2844 |
+ return rc; |
2845 |
+diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c |
2846 |
+index 400eee9d7783..d44f18f773c0 100644 |
2847 |
+--- a/drivers/scsi/libsas/sas_expander.c |
2848 |
++++ b/drivers/scsi/libsas/sas_expander.c |
2849 |
+@@ -2049,14 +2049,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) |
2850 |
+ return res; |
2851 |
+ } |
2852 |
+ |
2853 |
+- /* delete the old link */ |
2854 |
+- if (SAS_ADDR(phy->attached_sas_addr) && |
2855 |
+- SAS_ADDR(sas_addr) != SAS_ADDR(phy->attached_sas_addr)) { |
2856 |
+- SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n", |
2857 |
+- SAS_ADDR(dev->sas_addr), phy_id, |
2858 |
+- SAS_ADDR(phy->attached_sas_addr)); |
2859 |
+- sas_unregister_devs_sas_addr(dev, phy_id, last); |
2860 |
+- } |
2861 |
++ /* we always have to delete the old device when we went here */ |
2862 |
++ SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n", |
2863 |
++ SAS_ADDR(dev->sas_addr), phy_id, |
2864 |
++ SAS_ADDR(phy->attached_sas_addr)); |
2865 |
++ sas_unregister_devs_sas_addr(dev, phy_id, last); |
2866 |
+ |
2867 |
+ return sas_discover_new(dev, phy_id); |
2868 |
+ } |
2869 |
+diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c |
2870 |
+index 04e67a190652..b3490b4a046a 100644 |
2871 |
+--- a/drivers/scsi/pm8001/pm8001_hwi.c |
2872 |
++++ b/drivers/scsi/pm8001/pm8001_hwi.c |
2873 |
+@@ -1479,6 +1479,12 @@ u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha, |
2874 |
+ } else { |
2875 |
+ u32 producer_index; |
2876 |
+ void *pi_virt = circularQ->pi_virt; |
2877 |
++ /* spurious interrupt during setup if |
2878 |
++ * kexec-ing and driver doing a doorbell access |
2879 |
++ * with the pre-kexec oq interrupt setup |
2880 |
++ */ |
2881 |
++ if (!pi_virt) |
2882 |
++ break; |
2883 |
+ /* Update the producer index from SPC */ |
2884 |
+ producer_index = pm8001_read_32(pi_virt); |
2885 |
+ circularQ->producer_index = cpu_to_le32(producer_index); |
2886 |
+diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c |
2887 |
+index 949198c01ced..3862d8b1defe 100644 |
2888 |
+--- a/drivers/scsi/pm8001/pm8001_sas.c |
2889 |
++++ b/drivers/scsi/pm8001/pm8001_sas.c |
2890 |
+@@ -371,6 +371,13 @@ static int pm8001_task_exec(struct sas_task *task, |
2891 |
+ return 0; |
2892 |
+ } |
2893 |
+ pm8001_ha = pm8001_find_ha_by_dev(task->dev); |
2894 |
++ if (pm8001_ha->controller_fatal_error) { |
2895 |
++ struct task_status_struct *ts = &t->task_status; |
2896 |
++ |
2897 |
++ ts->resp = SAS_TASK_UNDELIVERED; |
2898 |
++ t->task_done(t); |
2899 |
++ return 0; |
2900 |
++ } |
2901 |
+ PM8001_IO_DBG(pm8001_ha, pm8001_printk("pm8001_task_exec device \n ")); |
2902 |
+ spin_lock_irqsave(&pm8001_ha->lock, flags); |
2903 |
+ do { |
2904 |
+@@ -463,7 +470,7 @@ err_out: |
2905 |
+ dev_printk(KERN_ERR, pm8001_ha->dev, "pm8001 exec failed[%d]!\n", rc); |
2906 |
+ if (!sas_protocol_ata(t->task_proto)) |
2907 |
+ if (n_elem) |
2908 |
+- dma_unmap_sg(pm8001_ha->dev, t->scatter, n_elem, |
2909 |
++ dma_unmap_sg(pm8001_ha->dev, t->scatter, t->num_scatter, |
2910 |
+ t->data_dir); |
2911 |
+ out_done: |
2912 |
+ spin_unlock_irqrestore(&pm8001_ha->lock, flags); |
2913 |
+diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h |
2914 |
+index 6628cc38316c..d8768ac41ebb 100644 |
2915 |
+--- a/drivers/scsi/pm8001/pm8001_sas.h |
2916 |
++++ b/drivers/scsi/pm8001/pm8001_sas.h |
2917 |
+@@ -531,6 +531,7 @@ struct pm8001_hba_info { |
2918 |
+ u32 logging_level; |
2919 |
+ u32 fw_status; |
2920 |
+ u32 smp_exp_mode; |
2921 |
++ bool controller_fatal_error; |
2922 |
+ const struct firmware *fw_image; |
2923 |
+ struct isr_param irq_vector[PM8001_MAX_MSIX_VEC]; |
2924 |
+ }; |
2925 |
+diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
2926 |
+index eb4fee61df72..9edd61c063a1 100644 |
2927 |
+--- a/drivers/scsi/pm8001/pm80xx_hwi.c |
2928 |
++++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
2929 |
+@@ -572,6 +572,9 @@ static void update_main_config_table(struct pm8001_hba_info *pm8001_ha) |
2930 |
+ pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_size); |
2931 |
+ pm8001_mw32(address, MAIN_PCS_EVENT_LOG_OPTION, |
2932 |
+ pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity); |
2933 |
++ /* Update Fatal error interrupt vector */ |
2934 |
++ pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |= |
2935 |
++ ((pm8001_ha->number_of_intr - 1) << 8); |
2936 |
+ pm8001_mw32(address, MAIN_FATAL_ERROR_INTERRUPT, |
2937 |
+ pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt); |
2938 |
+ pm8001_mw32(address, MAIN_EVENT_CRC_CHECK, |
2939 |
+@@ -1099,6 +1102,9 @@ static int pm80xx_chip_init(struct pm8001_hba_info *pm8001_ha) |
2940 |
+ return -EBUSY; |
2941 |
+ } |
2942 |
+ |
2943 |
++ /* Initialize the controller fatal error flag */ |
2944 |
++ pm8001_ha->controller_fatal_error = false; |
2945 |
++ |
2946 |
+ /* Initialize pci space address eg: mpi offset */ |
2947 |
+ init_pci_device_addresses(pm8001_ha); |
2948 |
+ init_default_table_values(pm8001_ha); |
2949 |
+@@ -1207,13 +1213,17 @@ pm80xx_chip_soft_rst(struct pm8001_hba_info *pm8001_ha) |
2950 |
+ u32 bootloader_state; |
2951 |
+ u32 ibutton0, ibutton1; |
2952 |
+ |
2953 |
+- /* Check if MPI is in ready state to reset */ |
2954 |
+- if (mpi_uninit_check(pm8001_ha) != 0) { |
2955 |
+- PM8001_FAIL_DBG(pm8001_ha, |
2956 |
+- pm8001_printk("MPI state is not ready\n")); |
2957 |
+- return -1; |
2958 |
++ /* Process MPI table uninitialization only if FW is ready */ |
2959 |
++ if (!pm8001_ha->controller_fatal_error) { |
2960 |
++ /* Check if MPI is in ready state to reset */ |
2961 |
++ if (mpi_uninit_check(pm8001_ha) != 0) { |
2962 |
++ regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); |
2963 |
++ PM8001_FAIL_DBG(pm8001_ha, pm8001_printk( |
2964 |
++ "MPI state is not ready scratch1 :0x%x\n", |
2965 |
++ regval)); |
2966 |
++ return -1; |
2967 |
++ } |
2968 |
+ } |
2969 |
+- |
2970 |
+ /* checked for reset register normal state; 0x0 */ |
2971 |
+ regval = pm8001_cr32(pm8001_ha, 0, SPC_REG_SOFT_RESET); |
2972 |
+ PM8001_INIT_DBG(pm8001_ha, |
2973 |
+@@ -3717,6 +3727,46 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb) |
2974 |
+ } |
2975 |
+ } |
2976 |
+ |
2977 |
++static void print_scratchpad_registers(struct pm8001_hba_info *pm8001_ha) |
2978 |
++{ |
2979 |
++ PM8001_FAIL_DBG(pm8001_ha, |
2980 |
++ pm8001_printk("MSGU_SCRATCH_PAD_0: 0x%x\n", |
2981 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_0))); |
2982 |
++ PM8001_FAIL_DBG(pm8001_ha, |
2983 |
++ pm8001_printk("MSGU_SCRATCH_PAD_1:0x%x\n", |
2984 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1))); |
2985 |
++ PM8001_FAIL_DBG(pm8001_ha, |
2986 |
++ pm8001_printk("MSGU_SCRATCH_PAD_2: 0x%x\n", |
2987 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_2))); |
2988 |
++ PM8001_FAIL_DBG(pm8001_ha, |
2989 |
++ pm8001_printk("MSGU_SCRATCH_PAD_3: 0x%x\n", |
2990 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_3))); |
2991 |
++ PM8001_FAIL_DBG(pm8001_ha, |
2992 |
++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_0: 0x%x\n", |
2993 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_0))); |
2994 |
++ PM8001_FAIL_DBG(pm8001_ha, |
2995 |
++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_1: 0x%x\n", |
2996 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_1))); |
2997 |
++ PM8001_FAIL_DBG(pm8001_ha, |
2998 |
++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_2: 0x%x\n", |
2999 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_2))); |
3000 |
++ PM8001_FAIL_DBG(pm8001_ha, |
3001 |
++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_3: 0x%x\n", |
3002 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_3))); |
3003 |
++ PM8001_FAIL_DBG(pm8001_ha, |
3004 |
++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_4: 0x%x\n", |
3005 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_4))); |
3006 |
++ PM8001_FAIL_DBG(pm8001_ha, |
3007 |
++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_5: 0x%x\n", |
3008 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_5))); |
3009 |
++ PM8001_FAIL_DBG(pm8001_ha, |
3010 |
++ pm8001_printk("MSGU_RSVD_SCRATCH_PAD_0: 0x%x\n", |
3011 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_6))); |
3012 |
++ PM8001_FAIL_DBG(pm8001_ha, |
3013 |
++ pm8001_printk("MSGU_RSVD_SCRATCH_PAD_1: 0x%x\n", |
3014 |
++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_7))); |
3015 |
++} |
3016 |
++ |
3017 |
+ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) |
3018 |
+ { |
3019 |
+ struct outbound_queue_table *circularQ; |
3020 |
+@@ -3724,10 +3774,28 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) |
3021 |
+ u8 uninitialized_var(bc); |
3022 |
+ u32 ret = MPI_IO_STATUS_FAIL; |
3023 |
+ unsigned long flags; |
3024 |
++ u32 regval; |
3025 |
+ |
3026 |
++ if (vec == (pm8001_ha->number_of_intr - 1)) { |
3027 |
++ regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); |
3028 |
++ if ((regval & SCRATCH_PAD_MIPSALL_READY) != |
3029 |
++ SCRATCH_PAD_MIPSALL_READY) { |
3030 |
++ pm8001_ha->controller_fatal_error = true; |
3031 |
++ PM8001_FAIL_DBG(pm8001_ha, pm8001_printk( |
3032 |
++ "Firmware Fatal error! Regval:0x%x\n", regval)); |
3033 |
++ print_scratchpad_registers(pm8001_ha); |
3034 |
++ return ret; |
3035 |
++ } |
3036 |
++ } |
3037 |
+ spin_lock_irqsave(&pm8001_ha->lock, flags); |
3038 |
+ circularQ = &pm8001_ha->outbnd_q_tbl[vec]; |
3039 |
+ do { |
3040 |
++ /* spurious interrupt during setup if kexec-ing and |
3041 |
++ * driver doing a doorbell access w/ the pre-kexec oq |
3042 |
++ * interrupt setup. |
3043 |
++ */ |
3044 |
++ if (!circularQ->pi_virt) |
3045 |
++ break; |
3046 |
+ ret = pm8001_mpi_msg_consume(pm8001_ha, circularQ, &pMsg1, &bc); |
3047 |
+ if (MPI_IO_STATUS_SUCCESS == ret) { |
3048 |
+ /* process the outbound message */ |
3049 |
+diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h |
3050 |
+index 7a443bad6163..411b414a9a0e 100644 |
3051 |
+--- a/drivers/scsi/pm8001/pm80xx_hwi.h |
3052 |
++++ b/drivers/scsi/pm8001/pm80xx_hwi.h |
3053 |
+@@ -1288,6 +1288,9 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t; |
3054 |
+ #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0 |
3055 |
+ #define SCRATCH_PAD_IOP0_READY 0xC00 |
3056 |
+ #define SCRATCH_PAD_IOP1_READY 0x3000 |
3057 |
++#define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \ |
3058 |
++ SCRATCH_PAD_IOP0_READY | \ |
3059 |
++ SCRATCH_PAD_RAAE_READY) |
3060 |
+ |
3061 |
+ /* boot loader state */ |
3062 |
+ #define SCRATCH_PAD1_BOOTSTATE_MASK 0x70 /* Bit 4-6 */ |
3063 |
+diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c |
3064 |
+index c6425e3df5a0..f1c771437752 100644 |
3065 |
+--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c |
3066 |
++++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c |
3067 |
+@@ -4371,6 +4371,13 @@ static void sym_nego_rejected(struct sym_hcb *np, struct sym_tcb *tp, struct sym |
3068 |
+ OUTB(np, HS_PRT, HS_BUSY); |
3069 |
+ } |
3070 |
+ |
3071 |
++#define sym_printk(lvl, tp, cp, fmt, v...) do { \ |
3072 |
++ if (cp) \ |
3073 |
++ scmd_printk(lvl, cp->cmd, fmt, ##v); \ |
3074 |
++ else \ |
3075 |
++ starget_printk(lvl, tp->starget, fmt, ##v); \ |
3076 |
++} while (0) |
3077 |
++ |
3078 |
+ /* |
3079 |
+ * chip exception handler for programmed interrupts. |
3080 |
+ */ |
3081 |
+@@ -4416,7 +4423,7 @@ static void sym_int_sir(struct sym_hcb *np) |
3082 |
+ * been selected with ATN. We do not want to handle that. |
3083 |
+ */ |
3084 |
+ case SIR_SEL_ATN_NO_MSG_OUT: |
3085 |
+- scmd_printk(KERN_WARNING, cp->cmd, |
3086 |
++ sym_printk(KERN_WARNING, tp, cp, |
3087 |
+ "No MSG OUT phase after selection with ATN\n"); |
3088 |
+ goto out_stuck; |
3089 |
+ /* |
3090 |
+@@ -4424,7 +4431,7 @@ static void sym_int_sir(struct sym_hcb *np) |
3091 |
+ * having reselected the initiator. |
3092 |
+ */ |
3093 |
+ case SIR_RESEL_NO_MSG_IN: |
3094 |
+- scmd_printk(KERN_WARNING, cp->cmd, |
3095 |
++ sym_printk(KERN_WARNING, tp, cp, |
3096 |
+ "No MSG IN phase after reselection\n"); |
3097 |
+ goto out_stuck; |
3098 |
+ /* |
3099 |
+@@ -4432,7 +4439,7 @@ static void sym_int_sir(struct sym_hcb *np) |
3100 |
+ * an IDENTIFY. |
3101 |
+ */ |
3102 |
+ case SIR_RESEL_NO_IDENTIFY: |
3103 |
+- scmd_printk(KERN_WARNING, cp->cmd, |
3104 |
++ sym_printk(KERN_WARNING, tp, cp, |
3105 |
+ "No IDENTIFY after reselection\n"); |
3106 |
+ goto out_stuck; |
3107 |
+ /* |
3108 |
+@@ -4461,7 +4468,7 @@ static void sym_int_sir(struct sym_hcb *np) |
3109 |
+ case SIR_RESEL_ABORTED: |
3110 |
+ np->lastmsg = np->msgout[0]; |
3111 |
+ np->msgout[0] = M_NOOP; |
3112 |
+- scmd_printk(KERN_WARNING, cp->cmd, |
3113 |
++ sym_printk(KERN_WARNING, tp, cp, |
3114 |
+ "message %x sent on bad reselection\n", np->lastmsg); |
3115 |
+ goto out; |
3116 |
+ /* |
3117 |
+diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c |
3118 |
+index 035767c02072..f42ae9efb255 100644 |
3119 |
+--- a/drivers/spi/spi-rockchip.c |
3120 |
++++ b/drivers/spi/spi-rockchip.c |
3121 |
+@@ -444,6 +444,9 @@ static void rockchip_spi_prepare_dma(struct rockchip_spi *rs) |
3122 |
+ struct dma_slave_config rxconf, txconf; |
3123 |
+ struct dma_async_tx_descriptor *rxdesc, *txdesc; |
3124 |
+ |
3125 |
++ memset(&rxconf, 0, sizeof(rxconf)); |
3126 |
++ memset(&txconf, 0, sizeof(txconf)); |
3127 |
++ |
3128 |
+ spin_lock_irqsave(&rs->lock, flags); |
3129 |
+ rs->state &= ~RXBUSY; |
3130 |
+ rs->state &= ~TXBUSY; |
3131 |
+diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c |
3132 |
+index d0e7dfc647cf..c5f1045561ac 100644 |
3133 |
+--- a/drivers/spi/spidev.c |
3134 |
++++ b/drivers/spi/spidev.c |
3135 |
+@@ -713,11 +713,9 @@ static int spidev_probe(struct spi_device *spi) |
3136 |
+ * compatible string, it is a Linux implementation thing |
3137 |
+ * rather than a description of the hardware. |
3138 |
+ */ |
3139 |
+- if (spi->dev.of_node && !of_match_device(spidev_dt_ids, &spi->dev)) { |
3140 |
+- dev_err(&spi->dev, "buggy DT: spidev listed directly in DT\n"); |
3141 |
+- WARN_ON(spi->dev.of_node && |
3142 |
+- !of_match_device(spidev_dt_ids, &spi->dev)); |
3143 |
+- } |
3144 |
++ WARN(spi->dev.of_node && |
3145 |
++ of_device_is_compatible(spi->dev.of_node, "spidev"), |
3146 |
++ "%pOF: buggy DT: spidev listed directly in DT\n", spi->dev.of_node); |
3147 |
+ |
3148 |
+ /* Allocate driver data */ |
3149 |
+ spidev = kzalloc(sizeof(*spidev), GFP_KERNEL); |
3150 |
+diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c |
3151 |
+index daa4a65ef6ff..fe870170db74 100644 |
3152 |
+--- a/drivers/tty/serial/mxs-auart.c |
3153 |
++++ b/drivers/tty/serial/mxs-auart.c |
3154 |
+@@ -1248,8 +1248,9 @@ static int mxs_auart_request_gpio_irq(struct mxs_auart_port *s) |
3155 |
+ |
3156 |
+ /* |
3157 |
+ * If something went wrong, rollback. |
3158 |
++ * Be careful: i may be unsigned. |
3159 |
+ */ |
3160 |
+- while (err && (--i >= 0)) |
3161 |
++ while (err && (i-- > 0)) |
3162 |
+ if (irq[i] >= 0) |
3163 |
+ free_irq(irq[i], s); |
3164 |
+ |
3165 |
+diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c |
3166 |
+index f36a1ac3bfbd..b8650210be0f 100644 |
3167 |
+--- a/drivers/usb/chipidea/otg.c |
3168 |
++++ b/drivers/usb/chipidea/otg.c |
3169 |
+@@ -206,14 +206,17 @@ static void ci_otg_work(struct work_struct *work) |
3170 |
+ } |
3171 |
+ |
3172 |
+ pm_runtime_get_sync(ci->dev); |
3173 |
++ |
3174 |
+ if (ci->id_event) { |
3175 |
+ ci->id_event = false; |
3176 |
+ ci_handle_id_switch(ci); |
3177 |
+- } else if (ci->b_sess_valid_event) { |
3178 |
++ } |
3179 |
++ |
3180 |
++ if (ci->b_sess_valid_event) { |
3181 |
+ ci->b_sess_valid_event = false; |
3182 |
+ ci_handle_vbus_change(ci); |
3183 |
+- } else |
3184 |
+- dev_err(ci->dev, "unexpected event occurs at %s\n", __func__); |
3185 |
++ } |
3186 |
++ |
3187 |
+ pm_runtime_put_sync(ci->dev); |
3188 |
+ |
3189 |
+ enable_irq(ci->irq); |
3190 |
+diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c |
3191 |
+index 01656f1c6d65..a49ff1f5c0f9 100644 |
3192 |
+--- a/drivers/usb/gadget/function/uvc_configfs.c |
3193 |
++++ b/drivers/usb/gadget/function/uvc_configfs.c |
3194 |
+@@ -564,6 +564,7 @@ static int uvcg_control_class_allow_link(struct config_item *src, |
3195 |
+ unlock: |
3196 |
+ mutex_unlock(&opts->lock); |
3197 |
+ out: |
3198 |
++ config_item_put(header); |
3199 |
+ mutex_unlock(su_mutex); |
3200 |
+ return ret; |
3201 |
+ } |
3202 |
+@@ -605,6 +606,7 @@ static int uvcg_control_class_drop_link(struct config_item *src, |
3203 |
+ unlock: |
3204 |
+ mutex_unlock(&opts->lock); |
3205 |
+ out: |
3206 |
++ config_item_put(header); |
3207 |
+ mutex_unlock(su_mutex); |
3208 |
+ return ret; |
3209 |
+ } |
3210 |
+@@ -805,6 +807,7 @@ static int uvcg_streaming_header_allow_link(struct config_item *src, |
3211 |
+ format_ptr->fmt = target_fmt; |
3212 |
+ list_add_tail(&format_ptr->entry, &src_hdr->formats); |
3213 |
+ ++src_hdr->num_fmt; |
3214 |
++ ++target_fmt->linked; |
3215 |
+ |
3216 |
+ out: |
3217 |
+ mutex_unlock(&opts->lock); |
3218 |
+@@ -843,6 +846,8 @@ static int uvcg_streaming_header_drop_link(struct config_item *src, |
3219 |
+ break; |
3220 |
+ } |
3221 |
+ |
3222 |
++ --target_fmt->linked; |
3223 |
++ |
3224 |
+ out: |
3225 |
+ mutex_unlock(&opts->lock); |
3226 |
+ mutex_unlock(su_mutex); |
3227 |
+@@ -2087,6 +2092,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src, |
3228 |
+ unlock: |
3229 |
+ mutex_unlock(&opts->lock); |
3230 |
+ out: |
3231 |
++ config_item_put(header); |
3232 |
+ mutex_unlock(su_mutex); |
3233 |
+ return ret; |
3234 |
+ } |
3235 |
+@@ -2131,6 +2137,7 @@ static int uvcg_streaming_class_drop_link(struct config_item *src, |
3236 |
+ unlock: |
3237 |
+ mutex_unlock(&opts->lock); |
3238 |
+ out: |
3239 |
++ config_item_put(header); |
3240 |
+ mutex_unlock(su_mutex); |
3241 |
+ return ret; |
3242 |
+ } |
3243 |
+diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c |
3244 |
+index 0f01c04d7cbd..d6bab12b0b47 100644 |
3245 |
+--- a/drivers/usb/gadget/function/uvc_video.c |
3246 |
++++ b/drivers/usb/gadget/function/uvc_video.c |
3247 |
+@@ -129,6 +129,21 @@ uvc_video_encode_isoc(struct usb_request *req, struct uvc_video *video, |
3248 |
+ * Request handling |
3249 |
+ */ |
3250 |
+ |
3251 |
++static int uvcg_video_ep_queue(struct uvc_video *video, struct usb_request *req) |
3252 |
++{ |
3253 |
++ int ret; |
3254 |
++ |
3255 |
++ ret = usb_ep_queue(video->ep, req, GFP_ATOMIC); |
3256 |
++ if (ret < 0) { |
3257 |
++ printk(KERN_INFO "Failed to queue request (%d).\n", ret); |
3258 |
++ /* Isochronous endpoints can't be halted. */ |
3259 |
++ if (usb_endpoint_xfer_bulk(video->ep->desc)) |
3260 |
++ usb_ep_set_halt(video->ep); |
3261 |
++ } |
3262 |
++ |
3263 |
++ return ret; |
3264 |
++} |
3265 |
++ |
3266 |
+ /* |
3267 |
+ * I somehow feel that synchronisation won't be easy to achieve here. We have |
3268 |
+ * three events that control USB requests submission: |
3269 |
+@@ -193,14 +208,13 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req) |
3270 |
+ |
3271 |
+ video->encode(req, video, buf); |
3272 |
+ |
3273 |
+- if ((ret = usb_ep_queue(ep, req, GFP_ATOMIC)) < 0) { |
3274 |
+- printk(KERN_INFO "Failed to queue request (%d).\n", ret); |
3275 |
+- usb_ep_set_halt(ep); |
3276 |
+- spin_unlock_irqrestore(&video->queue.irqlock, flags); |
3277 |
++ ret = uvcg_video_ep_queue(video, req); |
3278 |
++ spin_unlock_irqrestore(&video->queue.irqlock, flags); |
3279 |
++ |
3280 |
++ if (ret < 0) { |
3281 |
+ uvcg_queue_cancel(queue, 0); |
3282 |
+ goto requeue; |
3283 |
+ } |
3284 |
+- spin_unlock_irqrestore(&video->queue.irqlock, flags); |
3285 |
+ |
3286 |
+ return; |
3287 |
+ |
3288 |
+@@ -320,15 +334,13 @@ int uvcg_video_pump(struct uvc_video *video) |
3289 |
+ video->encode(req, video, buf); |
3290 |
+ |
3291 |
+ /* Queue the USB request */ |
3292 |
+- ret = usb_ep_queue(video->ep, req, GFP_ATOMIC); |
3293 |
++ ret = uvcg_video_ep_queue(video, req); |
3294 |
++ spin_unlock_irqrestore(&queue->irqlock, flags); |
3295 |
++ |
3296 |
+ if (ret < 0) { |
3297 |
+- printk(KERN_INFO "Failed to queue request (%d)\n", ret); |
3298 |
+- usb_ep_set_halt(video->ep); |
3299 |
+- spin_unlock_irqrestore(&queue->irqlock, flags); |
3300 |
+ uvcg_queue_cancel(queue, 0); |
3301 |
+ break; |
3302 |
+ } |
3303 |
+- spin_unlock_irqrestore(&queue->irqlock, flags); |
3304 |
+ } |
3305 |
+ |
3306 |
+ spin_lock_irqsave(&video->req_lock, flags); |
3307 |
+diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c |
3308 |
+index 95df2b3bb6a1..76e991557116 100644 |
3309 |
+--- a/drivers/usb/gadget/udc/fotg210-udc.c |
3310 |
++++ b/drivers/usb/gadget/udc/fotg210-udc.c |
3311 |
+@@ -744,7 +744,7 @@ static void fotg210_get_status(struct fotg210_udc *fotg210, |
3312 |
+ fotg210->ep0_req->length = 2; |
3313 |
+ |
3314 |
+ spin_unlock(&fotg210->lock); |
3315 |
+- fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_KERNEL); |
3316 |
++ fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_ATOMIC); |
3317 |
+ spin_lock(&fotg210->lock); |
3318 |
+ } |
3319 |
+ |
3320 |
+diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c |
3321 |
+index 244acb1299a9..e92cd1eceefa 100644 |
3322 |
+--- a/drivers/usb/serial/cypress_m8.c |
3323 |
++++ b/drivers/usb/serial/cypress_m8.c |
3324 |
+@@ -773,7 +773,7 @@ send: |
3325 |
+ |
3326 |
+ usb_fill_int_urb(port->interrupt_out_urb, port->serial->dev, |
3327 |
+ usb_sndintpipe(port->serial->dev, port->interrupt_out_endpointAddress), |
3328 |
+- port->interrupt_out_buffer, port->interrupt_out_size, |
3329 |
++ port->interrupt_out_buffer, actual_size, |
3330 |
+ cypress_write_int_callback, port, priv->write_urb_interval); |
3331 |
+ result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); |
3332 |
+ if (result) { |
3333 |
+diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c |
3334 |
+index c55c632a3b24..ad5929fbceb1 100644 |
3335 |
+--- a/drivers/vfio/pci/vfio_pci_config.c |
3336 |
++++ b/drivers/vfio/pci/vfio_pci_config.c |
3337 |
+@@ -1130,8 +1130,10 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos) |
3338 |
+ return -ENOMEM; |
3339 |
+ |
3340 |
+ ret = init_pci_cap_msi_perm(vdev->msi_perm, len, flags); |
3341 |
+- if (ret) |
3342 |
++ if (ret) { |
3343 |
++ kfree(vdev->msi_perm); |
3344 |
+ return ret; |
3345 |
++ } |
3346 |
+ |
3347 |
+ return len; |
3348 |
+ } |
3349 |
+diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c |
3350 |
+index cd50df5807ea..086611c7bc03 100644 |
3351 |
+--- a/drivers/video/backlight/lm3639_bl.c |
3352 |
++++ b/drivers/video/backlight/lm3639_bl.c |
3353 |
+@@ -400,10 +400,8 @@ static int lm3639_remove(struct i2c_client *client) |
3354 |
+ |
3355 |
+ regmap_write(pchip->regmap, REG_ENABLE, 0x00); |
3356 |
+ |
3357 |
+- if (&pchip->cdev_torch) |
3358 |
+- led_classdev_unregister(&pchip->cdev_torch); |
3359 |
+- if (&pchip->cdev_flash) |
3360 |
+- led_classdev_unregister(&pchip->cdev_flash); |
3361 |
++ led_classdev_unregister(&pchip->cdev_torch); |
3362 |
++ led_classdev_unregister(&pchip->cdev_flash); |
3363 |
+ if (pchip->bled) |
3364 |
+ device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode); |
3365 |
+ return 0; |
3366 |
+diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig |
3367 |
+index 3543e3e4cfb5..6873be034448 100644 |
3368 |
+--- a/drivers/video/fbdev/Kconfig |
3369 |
++++ b/drivers/video/fbdev/Kconfig |
3370 |
+@@ -1991,16 +1991,6 @@ config FB_SH_MOBILE_LCDC |
3371 |
+ ---help--- |
3372 |
+ Frame buffer driver for the on-chip SH-Mobile LCD controller. |
3373 |
+ |
3374 |
+-config FB_SH_MOBILE_HDMI |
3375 |
+- tristate "SuperH Mobile HDMI controller support" |
3376 |
+- depends on FB_SH_MOBILE_LCDC |
3377 |
+- select FB_MODE_HELPERS |
3378 |
+- select SOUND |
3379 |
+- select SND |
3380 |
+- select SND_SOC |
3381 |
+- ---help--- |
3382 |
+- Driver for the on-chip SH-Mobile HDMI controller. |
3383 |
+- |
3384 |
+ config FB_TMIO |
3385 |
+ tristate "Toshiba Mobile IO FrameBuffer support" |
3386 |
+ depends on FB && (MFD_TMIO || COMPILE_TEST) |
3387 |
+diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile |
3388 |
+index 50ed1b4fc2bf..65fb15075c8f 100644 |
3389 |
+--- a/drivers/video/fbdev/Makefile |
3390 |
++++ b/drivers/video/fbdev/Makefile |
3391 |
+@@ -118,7 +118,6 @@ obj-$(CONFIG_FB_UDL) += udlfb.o |
3392 |
+ obj-$(CONFIG_FB_SMSCUFX) += smscufx.o |
3393 |
+ obj-$(CONFIG_FB_XILINX) += xilinxfb.o |
3394 |
+ obj-$(CONFIG_SH_MIPI_DSI) += sh_mipi_dsi.o |
3395 |
+-obj-$(CONFIG_FB_SH_MOBILE_HDMI) += sh_mobile_hdmi.o |
3396 |
+ obj-$(CONFIG_FB_SH_MOBILE_MERAM) += sh_mobile_meram.o |
3397 |
+ obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o |
3398 |
+ obj-$(CONFIG_FB_OMAP) += omap/ |
3399 |
+diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c |
3400 |
+index 47c3191ec313..0a5b3f844654 100644 |
3401 |
+--- a/drivers/video/fbdev/core/fbmon.c |
3402 |
++++ b/drivers/video/fbdev/core/fbmon.c |
3403 |
+@@ -997,97 +997,6 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) |
3404 |
+ DPRINTK("========================================\n"); |
3405 |
+ } |
3406 |
+ |
3407 |
+-/** |
3408 |
+- * fb_edid_add_monspecs() - add monitor video modes from E-EDID data |
3409 |
+- * @edid: 128 byte array with an E-EDID block |
3410 |
+- * @spacs: monitor specs to be extended |
3411 |
+- */ |
3412 |
+-void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) |
3413 |
+-{ |
3414 |
+- unsigned char *block; |
3415 |
+- struct fb_videomode *m; |
3416 |
+- int num = 0, i; |
3417 |
+- u8 svd[64], edt[(128 - 4) / DETAILED_TIMING_DESCRIPTION_SIZE]; |
3418 |
+- u8 pos = 4, svd_n = 0; |
3419 |
+- |
3420 |
+- if (!edid) |
3421 |
+- return; |
3422 |
+- |
3423 |
+- if (!edid_checksum(edid)) |
3424 |
+- return; |
3425 |
+- |
3426 |
+- if (edid[0] != 0x2 || |
3427 |
+- edid[2] < 4 || edid[2] > 128 - DETAILED_TIMING_DESCRIPTION_SIZE) |
3428 |
+- return; |
3429 |
+- |
3430 |
+- DPRINTK(" Short Video Descriptors\n"); |
3431 |
+- |
3432 |
+- while (pos < edid[2]) { |
3433 |
+- u8 len = edid[pos] & 0x1f, type = (edid[pos] >> 5) & 7; |
3434 |
+- pr_debug("Data block %u of %u bytes\n", type, len); |
3435 |
+- if (type == 2) { |
3436 |
+- for (i = pos; i < pos + len; i++) { |
3437 |
+- u8 idx = edid[pos + i] & 0x7f; |
3438 |
+- svd[svd_n++] = idx; |
3439 |
+- pr_debug("N%sative mode #%d\n", |
3440 |
+- edid[pos + i] & 0x80 ? "" : "on-n", idx); |
3441 |
+- } |
3442 |
+- } else if (type == 3 && len >= 3) { |
3443 |
+- /* Check Vendor Specific Data Block. For HDMI, |
3444 |
+- it is always 00-0C-03 for HDMI Licensing, LLC. */ |
3445 |
+- if (edid[pos + 1] == 3 && edid[pos + 2] == 0xc && |
3446 |
+- edid[pos + 3] == 0) |
3447 |
+- specs->misc |= FB_MISC_HDMI; |
3448 |
+- } |
3449 |
+- pos += len + 1; |
3450 |
+- } |
3451 |
+- |
3452 |
+- block = edid + edid[2]; |
3453 |
+- |
3454 |
+- DPRINTK(" Extended Detailed Timings\n"); |
3455 |
+- |
3456 |
+- for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE; |
3457 |
+- i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) |
3458 |
+- if (PIXEL_CLOCK) |
3459 |
+- edt[num++] = block - edid; |
3460 |
+- |
3461 |
+- /* Yikes, EDID data is totally useless */ |
3462 |
+- if (!(num + svd_n)) |
3463 |
+- return; |
3464 |
+- |
3465 |
+- m = kzalloc((specs->modedb_len + num + svd_n) * |
3466 |
+- sizeof(struct fb_videomode), GFP_KERNEL); |
3467 |
+- |
3468 |
+- if (!m) |
3469 |
+- return; |
3470 |
+- |
3471 |
+- memcpy(m, specs->modedb, specs->modedb_len * sizeof(struct fb_videomode)); |
3472 |
+- |
3473 |
+- for (i = specs->modedb_len; i < specs->modedb_len + num; i++) { |
3474 |
+- get_detailed_timing(edid + edt[i - specs->modedb_len], &m[i]); |
3475 |
+- if (i == specs->modedb_len) |
3476 |
+- m[i].flag |= FB_MODE_IS_FIRST; |
3477 |
+- pr_debug("Adding %ux%u@%u\n", m[i].xres, m[i].yres, m[i].refresh); |
3478 |
+- } |
3479 |
+- |
3480 |
+- for (i = specs->modedb_len + num; i < specs->modedb_len + num + svd_n; i++) { |
3481 |
+- int idx = svd[i - specs->modedb_len - num]; |
3482 |
+- if (!idx || idx >= ARRAY_SIZE(cea_modes)) { |
3483 |
+- pr_warning("Reserved SVD code %d\n", idx); |
3484 |
+- } else if (!cea_modes[idx].xres) { |
3485 |
+- pr_warning("Unimplemented SVD code %d\n", idx); |
3486 |
+- } else { |
3487 |
+- memcpy(&m[i], cea_modes + idx, sizeof(m[i])); |
3488 |
+- pr_debug("Adding SVD #%d: %ux%u@%u\n", idx, |
3489 |
+- m[i].xres, m[i].yres, m[i].refresh); |
3490 |
+- } |
3491 |
+- } |
3492 |
+- |
3493 |
+- kfree(specs->modedb); |
3494 |
+- specs->modedb = m; |
3495 |
+- specs->modedb_len = specs->modedb_len + num + svd_n; |
3496 |
+-} |
3497 |
+- |
3498 |
+ /* |
3499 |
+ * VESA Generalized Timing Formula (GTF) |
3500 |
+ */ |
3501 |
+@@ -1498,9 +1407,6 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) |
3502 |
+ { |
3503 |
+ specs = NULL; |
3504 |
+ } |
3505 |
+-void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) |
3506 |
+-{ |
3507 |
+-} |
3508 |
+ void fb_destroy_modedb(struct fb_videomode *modedb) |
3509 |
+ { |
3510 |
+ } |
3511 |
+@@ -1608,7 +1514,6 @@ EXPORT_SYMBOL(fb_firmware_edid); |
3512 |
+ |
3513 |
+ EXPORT_SYMBOL(fb_parse_edid); |
3514 |
+ EXPORT_SYMBOL(fb_edid_to_monspecs); |
3515 |
+-EXPORT_SYMBOL(fb_edid_add_monspecs); |
3516 |
+ EXPORT_SYMBOL(fb_get_mode); |
3517 |
+ EXPORT_SYMBOL(fb_validate_mode); |
3518 |
+ EXPORT_SYMBOL(fb_destroy_modedb); |
3519 |
+diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c |
3520 |
+index 455a15f70172..a9d76e1b4378 100644 |
3521 |
+--- a/drivers/video/fbdev/core/modedb.c |
3522 |
++++ b/drivers/video/fbdev/core/modedb.c |
3523 |
+@@ -289,63 +289,6 @@ static const struct fb_videomode modedb[] = { |
3524 |
+ }; |
3525 |
+ |
3526 |
+ #ifdef CONFIG_FB_MODE_HELPERS |
3527 |
+-const struct fb_videomode cea_modes[65] = { |
3528 |
+- /* #1: 640x480p@59.94/60Hz */ |
3529 |
+- [1] = { |
3530 |
+- NULL, 60, 640, 480, 39722, 48, 16, 33, 10, 96, 2, 0, |
3531 |
+- FB_VMODE_NONINTERLACED, 0, |
3532 |
+- }, |
3533 |
+- /* #3: 720x480p@59.94/60Hz */ |
3534 |
+- [3] = { |
3535 |
+- NULL, 60, 720, 480, 37037, 60, 16, 30, 9, 62, 6, 0, |
3536 |
+- FB_VMODE_NONINTERLACED, 0, |
3537 |
+- }, |
3538 |
+- /* #5: 1920x1080i@59.94/60Hz */ |
3539 |
+- [5] = { |
3540 |
+- NULL, 60, 1920, 1080, 13763, 148, 88, 15, 2, 44, 5, |
3541 |
+- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
3542 |
+- FB_VMODE_INTERLACED, 0, |
3543 |
+- }, |
3544 |
+- /* #7: 720(1440)x480iH@59.94/60Hz */ |
3545 |
+- [7] = { |
3546 |
+- NULL, 60, 1440, 480, 18554/*37108*/, 114, 38, 15, 4, 124, 3, 0, |
3547 |
+- FB_VMODE_INTERLACED, 0, |
3548 |
+- }, |
3549 |
+- /* #9: 720(1440)x240pH@59.94/60Hz */ |
3550 |
+- [9] = { |
3551 |
+- NULL, 60, 1440, 240, 18554, 114, 38, 16, 4, 124, 3, 0, |
3552 |
+- FB_VMODE_NONINTERLACED, 0, |
3553 |
+- }, |
3554 |
+- /* #18: 720x576pH@50Hz */ |
3555 |
+- [18] = { |
3556 |
+- NULL, 50, 720, 576, 37037, 68, 12, 39, 5, 64, 5, 0, |
3557 |
+- FB_VMODE_NONINTERLACED, 0, |
3558 |
+- }, |
3559 |
+- /* #19: 1280x720p@50Hz */ |
3560 |
+- [19] = { |
3561 |
+- NULL, 50, 1280, 720, 13468, 220, 440, 20, 5, 40, 5, |
3562 |
+- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
3563 |
+- FB_VMODE_NONINTERLACED, 0, |
3564 |
+- }, |
3565 |
+- /* #20: 1920x1080i@50Hz */ |
3566 |
+- [20] = { |
3567 |
+- NULL, 50, 1920, 1080, 13480, 148, 528, 15, 5, 528, 5, |
3568 |
+- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
3569 |
+- FB_VMODE_INTERLACED, 0, |
3570 |
+- }, |
3571 |
+- /* #32: 1920x1080p@23.98/24Hz */ |
3572 |
+- [32] = { |
3573 |
+- NULL, 24, 1920, 1080, 13468, 148, 638, 36, 4, 44, 5, |
3574 |
+- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, |
3575 |
+- FB_VMODE_NONINTERLACED, 0, |
3576 |
+- }, |
3577 |
+- /* #35: (2880)x480p4x@59.94/60Hz */ |
3578 |
+- [35] = { |
3579 |
+- NULL, 60, 2880, 480, 9250, 240, 64, 30, 9, 248, 6, 0, |
3580 |
+- FB_VMODE_NONINTERLACED, 0, |
3581 |
+- }, |
3582 |
+-}; |
3583 |
+- |
3584 |
+ const struct fb_videomode vesa_modes[] = { |
3585 |
+ /* 0 640x350-85 VESA */ |
3586 |
+ { NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3, |
3587 |
+diff --git a/drivers/video/fbdev/sbuslib.c b/drivers/video/fbdev/sbuslib.c |
3588 |
+index 31c301d6be62..52e161dbd204 100644 |
3589 |
+--- a/drivers/video/fbdev/sbuslib.c |
3590 |
++++ b/drivers/video/fbdev/sbuslib.c |
3591 |
+@@ -105,11 +105,11 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, |
3592 |
+ struct fbtype __user *f = (struct fbtype __user *) arg; |
3593 |
+ |
3594 |
+ if (put_user(type, &f->fb_type) || |
3595 |
+- __put_user(info->var.yres, &f->fb_height) || |
3596 |
+- __put_user(info->var.xres, &f->fb_width) || |
3597 |
+- __put_user(fb_depth, &f->fb_depth) || |
3598 |
+- __put_user(0, &f->fb_cmsize) || |
3599 |
+- __put_user(fb_size, &f->fb_cmsize)) |
3600 |
++ put_user(info->var.yres, &f->fb_height) || |
3601 |
++ put_user(info->var.xres, &f->fb_width) || |
3602 |
++ put_user(fb_depth, &f->fb_depth) || |
3603 |
++ put_user(0, &f->fb_cmsize) || |
3604 |
++ put_user(fb_size, &f->fb_cmsize)) |
3605 |
+ return -EFAULT; |
3606 |
+ return 0; |
3607 |
+ } |
3608 |
+@@ -124,10 +124,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, |
3609 |
+ unsigned int index, count, i; |
3610 |
+ |
3611 |
+ if (get_user(index, &c->index) || |
3612 |
+- __get_user(count, &c->count) || |
3613 |
+- __get_user(ured, &c->red) || |
3614 |
+- __get_user(ugreen, &c->green) || |
3615 |
+- __get_user(ublue, &c->blue)) |
3616 |
++ get_user(count, &c->count) || |
3617 |
++ get_user(ured, &c->red) || |
3618 |
++ get_user(ugreen, &c->green) || |
3619 |
++ get_user(ublue, &c->blue)) |
3620 |
+ return -EFAULT; |
3621 |
+ |
3622 |
+ cmap.len = 1; |
3623 |
+@@ -164,13 +164,13 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, |
3624 |
+ u8 red, green, blue; |
3625 |
+ |
3626 |
+ if (get_user(index, &c->index) || |
3627 |
+- __get_user(count, &c->count) || |
3628 |
+- __get_user(ured, &c->red) || |
3629 |
+- __get_user(ugreen, &c->green) || |
3630 |
+- __get_user(ublue, &c->blue)) |
3631 |
++ get_user(count, &c->count) || |
3632 |
++ get_user(ured, &c->red) || |
3633 |
++ get_user(ugreen, &c->green) || |
3634 |
++ get_user(ublue, &c->blue)) |
3635 |
+ return -EFAULT; |
3636 |
+ |
3637 |
+- if (index + count > cmap->len) |
3638 |
++ if (index > cmap->len || count > cmap->len - index) |
3639 |
+ return -EINVAL; |
3640 |
+ |
3641 |
+ for (i = 0; i < count; i++) { |
3642 |
+diff --git a/drivers/video/fbdev/sh_mobile_hdmi.c b/drivers/video/fbdev/sh_mobile_hdmi.c |
3643 |
+deleted file mode 100644 |
3644 |
+index 7c72a3f02056..000000000000 |
3645 |
+--- a/drivers/video/fbdev/sh_mobile_hdmi.c |
3646 |
++++ /dev/null |
3647 |
+@@ -1,1489 +0,0 @@ |
3648 |
+-/* |
3649 |
+- * SH-Mobile High-Definition Multimedia Interface (HDMI) driver |
3650 |
+- * for SLISHDMI13T and SLIPHDMIT IP cores |
3651 |
+- * |
3652 |
+- * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@×××.de> |
3653 |
+- * |
3654 |
+- * This program is free software; you can redistribute it and/or modify |
3655 |
+- * it under the terms of the GNU General Public License version 2 as |
3656 |
+- * published by the Free Software Foundation. |
3657 |
+- */ |
3658 |
+- |
3659 |
+-#include <linux/clk.h> |
3660 |
+-#include <linux/console.h> |
3661 |
+-#include <linux/delay.h> |
3662 |
+-#include <linux/err.h> |
3663 |
+-#include <linux/init.h> |
3664 |
+-#include <linux/interrupt.h> |
3665 |
+-#include <linux/io.h> |
3666 |
+-#include <linux/module.h> |
3667 |
+-#include <linux/platform_device.h> |
3668 |
+-#include <linux/pm_runtime.h> |
3669 |
+-#include <linux/slab.h> |
3670 |
+-#include <linux/types.h> |
3671 |
+-#include <linux/workqueue.h> |
3672 |
+-#include <sound/soc.h> |
3673 |
+-#include <sound/soc-dapm.h> |
3674 |
+-#include <sound/initval.h> |
3675 |
+- |
3676 |
+-#include <video/sh_mobile_hdmi.h> |
3677 |
+-#include <video/sh_mobile_lcdc.h> |
3678 |
+- |
3679 |
+-#include "sh_mobile_lcdcfb.h" |
3680 |
+- |
3681 |
+-/* HDMI Core Control Register (HTOP0) */ |
3682 |
+-#define HDMI_SYSTEM_CTRL 0x00 /* System control */ |
3683 |
+-#define HDMI_L_R_DATA_SWAP_CTRL_RPKT 0x01 /* L/R data swap control, |
3684 |
+- bits 19..16 of 20-bit N for Audio Clock Regeneration packet */ |
3685 |
+-#define HDMI_20_BIT_N_FOR_AUDIO_RPKT_15_8 0x02 /* bits 15..8 of 20-bit N for Audio Clock Regeneration packet */ |
3686 |
+-#define HDMI_20_BIT_N_FOR_AUDIO_RPKT_7_0 0x03 /* bits 7..0 of 20-bit N for Audio Clock Regeneration packet */ |
3687 |
+-#define HDMI_SPDIF_AUDIO_SAMP_FREQ_CTS 0x04 /* SPDIF audio sampling frequency, |
3688 |
+- bits 19..16 of Internal CTS */ |
3689 |
+-#define HDMI_INTERNAL_CTS_15_8 0x05 /* bits 15..8 of Internal CTS */ |
3690 |
+-#define HDMI_INTERNAL_CTS_7_0 0x06 /* bits 7..0 of Internal CTS */ |
3691 |
+-#define HDMI_EXTERNAL_CTS_19_16 0x07 /* External CTS */ |
3692 |
+-#define HDMI_EXTERNAL_CTS_15_8 0x08 /* External CTS */ |
3693 |
+-#define HDMI_EXTERNAL_CTS_7_0 0x09 /* External CTS */ |
3694 |
+-#define HDMI_AUDIO_SETTING_1 0x0A /* Audio setting.1 */ |
3695 |
+-#define HDMI_AUDIO_SETTING_2 0x0B /* Audio setting.2 */ |
3696 |
+-#define HDMI_I2S_AUDIO_SET 0x0C /* I2S audio setting */ |
3697 |
+-#define HDMI_DSD_AUDIO_SET 0x0D /* DSD audio setting */ |
3698 |
+-#define HDMI_DEBUG_MONITOR_1 0x0E /* Debug monitor.1 */ |
3699 |
+-#define HDMI_DEBUG_MONITOR_2 0x0F /* Debug monitor.2 */ |
3700 |
+-#define HDMI_I2S_INPUT_PIN_SWAP 0x10 /* I2S input pin swap */ |
3701 |
+-#define HDMI_AUDIO_STATUS_BITS_SETTING_1 0x11 /* Audio status bits setting.1 */ |
3702 |
+-#define HDMI_AUDIO_STATUS_BITS_SETTING_2 0x12 /* Audio status bits setting.2 */ |
3703 |
+-#define HDMI_CATEGORY_CODE 0x13 /* Category code */ |
3704 |
+-#define HDMI_SOURCE_NUM_AUDIO_WORD_LEN 0x14 /* Source number/Audio word length */ |
3705 |
+-#define HDMI_AUDIO_VIDEO_SETTING_1 0x15 /* Audio/Video setting.1 */ |
3706 |
+-#define HDMI_VIDEO_SETTING_1 0x16 /* Video setting.1 */ |
3707 |
+-#define HDMI_DEEP_COLOR_MODES 0x17 /* Deep Color Modes */ |
3708 |
+- |
3709 |
+-/* 12 16- and 10-bit Color space conversion parameters: 0x18..0x2f */ |
3710 |
+-#define HDMI_COLOR_SPACE_CONVERSION_PARAMETERS 0x18 |
3711 |
+- |
3712 |
+-#define HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS 0x30 /* External video parameter settings */ |
3713 |
+-#define HDMI_EXTERNAL_H_TOTAL_7_0 0x31 /* External horizontal total (LSB) */ |
3714 |
+-#define HDMI_EXTERNAL_H_TOTAL_11_8 0x32 /* External horizontal total (MSB) */ |
3715 |
+-#define HDMI_EXTERNAL_H_BLANK_7_0 0x33 /* External horizontal blank (LSB) */ |
3716 |
+-#define HDMI_EXTERNAL_H_BLANK_9_8 0x34 /* External horizontal blank (MSB) */ |
3717 |
+-#define HDMI_EXTERNAL_H_DELAY_7_0 0x35 /* External horizontal delay (LSB) */ |
3718 |
+-#define HDMI_EXTERNAL_H_DELAY_9_8 0x36 /* External horizontal delay (MSB) */ |
3719 |
+-#define HDMI_EXTERNAL_H_DURATION_7_0 0x37 /* External horizontal duration (LSB) */ |
3720 |
+-#define HDMI_EXTERNAL_H_DURATION_9_8 0x38 /* External horizontal duration (MSB) */ |
3721 |
+-#define HDMI_EXTERNAL_V_TOTAL_7_0 0x39 /* External vertical total (LSB) */ |
3722 |
+-#define HDMI_EXTERNAL_V_TOTAL_9_8 0x3A /* External vertical total (MSB) */ |
3723 |
+-#define HDMI_AUDIO_VIDEO_SETTING_2 0x3B /* Audio/Video setting.2 */ |
3724 |
+-#define HDMI_EXTERNAL_V_BLANK 0x3D /* External vertical blank */ |
3725 |
+-#define HDMI_EXTERNAL_V_DELAY 0x3E /* External vertical delay */ |
3726 |
+-#define HDMI_EXTERNAL_V_DURATION 0x3F /* External vertical duration */ |
3727 |
+-#define HDMI_CTRL_PKT_MANUAL_SEND_CONTROL 0x40 /* Control packet manual send control */ |
3728 |
+-#define HDMI_CTRL_PKT_AUTO_SEND 0x41 /* Control packet auto send with VSYNC control */ |
3729 |
+-#define HDMI_AUTO_CHECKSUM_OPTION 0x42 /* Auto checksum option */ |
3730 |
+-#define HDMI_VIDEO_SETTING_2 0x45 /* Video setting.2 */ |
3731 |
+-#define HDMI_OUTPUT_OPTION 0x46 /* Output option */ |
3732 |
+-#define HDMI_SLIPHDMIT_PARAM_OPTION 0x51 /* SLIPHDMIT parameter option */ |
3733 |
+-#define HDMI_HSYNC_PMENT_AT_EMB_7_0 0x52 /* HSYNC placement at embedded sync (LSB) */ |
3734 |
+-#define HDMI_HSYNC_PMENT_AT_EMB_15_8 0x53 /* HSYNC placement at embedded sync (MSB) */ |
3735 |
+-#define HDMI_VSYNC_PMENT_AT_EMB_7_0 0x54 /* VSYNC placement at embedded sync (LSB) */ |
3736 |
+-#define HDMI_VSYNC_PMENT_AT_EMB_14_8 0x55 /* VSYNC placement at embedded sync (MSB) */ |
3737 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_1 0x56 /* SLIPHDMIT parameter settings.1 */ |
3738 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_2 0x57 /* SLIPHDMIT parameter settings.2 */ |
3739 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_3 0x58 /* SLIPHDMIT parameter settings.3 */ |
3740 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_5 0x59 /* SLIPHDMIT parameter settings.5 */ |
3741 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_6 0x5A /* SLIPHDMIT parameter settings.6 */ |
3742 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_7 0x5B /* SLIPHDMIT parameter settings.7 */ |
3743 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_8 0x5C /* SLIPHDMIT parameter settings.8 */ |
3744 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_9 0x5D /* SLIPHDMIT parameter settings.9 */ |
3745 |
+-#define HDMI_SLIPHDMIT_PARAM_SETTINGS_10 0x5E /* SLIPHDMIT parameter settings.10 */ |
3746 |
+-#define HDMI_CTRL_PKT_BUF_INDEX 0x5F /* Control packet buffer index */ |
3747 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_HB0 0x60 /* Control packet data buffer access window - HB0 */ |
3748 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_HB1 0x61 /* Control packet data buffer access window - HB1 */ |
3749 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_HB2 0x62 /* Control packet data buffer access window - HB2 */ |
3750 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB0 0x63 /* Control packet data buffer access window - PB0 */ |
3751 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB1 0x64 /* Control packet data buffer access window - PB1 */ |
3752 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB2 0x65 /* Control packet data buffer access window - PB2 */ |
3753 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB3 0x66 /* Control packet data buffer access window - PB3 */ |
3754 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB4 0x67 /* Control packet data buffer access window - PB4 */ |
3755 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB5 0x68 /* Control packet data buffer access window - PB5 */ |
3756 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB6 0x69 /* Control packet data buffer access window - PB6 */ |
3757 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB7 0x6A /* Control packet data buffer access window - PB7 */ |
3758 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB8 0x6B /* Control packet data buffer access window - PB8 */ |
3759 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB9 0x6C /* Control packet data buffer access window - PB9 */ |
3760 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB10 0x6D /* Control packet data buffer access window - PB10 */ |
3761 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB11 0x6E /* Control packet data buffer access window - PB11 */ |
3762 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB12 0x6F /* Control packet data buffer access window - PB12 */ |
3763 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB13 0x70 /* Control packet data buffer access window - PB13 */ |
3764 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB14 0x71 /* Control packet data buffer access window - PB14 */ |
3765 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB15 0x72 /* Control packet data buffer access window - PB15 */ |
3766 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB16 0x73 /* Control packet data buffer access window - PB16 */ |
3767 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB17 0x74 /* Control packet data buffer access window - PB17 */ |
3768 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB18 0x75 /* Control packet data buffer access window - PB18 */ |
3769 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB19 0x76 /* Control packet data buffer access window - PB19 */ |
3770 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB20 0x77 /* Control packet data buffer access window - PB20 */ |
3771 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB21 0x78 /* Control packet data buffer access window - PB21 */ |
3772 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB22 0x79 /* Control packet data buffer access window - PB22 */ |
3773 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB23 0x7A /* Control packet data buffer access window - PB23 */ |
3774 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB24 0x7B /* Control packet data buffer access window - PB24 */ |
3775 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB25 0x7C /* Control packet data buffer access window - PB25 */ |
3776 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB26 0x7D /* Control packet data buffer access window - PB26 */ |
3777 |
+-#define HDMI_CTRL_PKT_BUF_ACCESS_PB27 0x7E /* Control packet data buffer access window - PB27 */ |
3778 |
+-#define HDMI_EDID_KSV_FIFO_ACCESS_WINDOW 0x80 /* EDID/KSV FIFO access window */ |
3779 |
+-#define HDMI_DDC_BUS_ACCESS_FREQ_CTRL_7_0 0x81 /* DDC bus access frequency control (LSB) */ |
3780 |
+-#define HDMI_DDC_BUS_ACCESS_FREQ_CTRL_15_8 0x82 /* DDC bus access frequency control (MSB) */ |
3781 |
+-#define HDMI_INTERRUPT_MASK_1 0x92 /* Interrupt mask.1 */ |
3782 |
+-#define HDMI_INTERRUPT_MASK_2 0x93 /* Interrupt mask.2 */ |
3783 |
+-#define HDMI_INTERRUPT_STATUS_1 0x94 /* Interrupt status.1 */ |
3784 |
+-#define HDMI_INTERRUPT_STATUS_2 0x95 /* Interrupt status.2 */ |
3785 |
+-#define HDMI_INTERRUPT_MASK_3 0x96 /* Interrupt mask.3 */ |
3786 |
+-#define HDMI_INTERRUPT_MASK_4 0x97 /* Interrupt mask.4 */ |
3787 |
+-#define HDMI_INTERRUPT_STATUS_3 0x98 /* Interrupt status.3 */ |
3788 |
+-#define HDMI_INTERRUPT_STATUS_4 0x99 /* Interrupt status.4 */ |
3789 |
+-#define HDMI_SOFTWARE_HDCP_CONTROL_1 0x9A /* Software HDCP control.1 */ |
3790 |
+-#define HDMI_FRAME_COUNTER 0x9C /* Frame counter */ |
3791 |
+-#define HDMI_FRAME_COUNTER_FOR_RI_CHECK 0x9D /* Frame counter for Ri check */ |
3792 |
+-#define HDMI_HDCP_CONTROL 0xAF /* HDCP control */ |
3793 |
+-#define HDMI_RI_FRAME_COUNT_REGISTER 0xB2 /* Ri frame count register */ |
3794 |
+-#define HDMI_DDC_BUS_CONTROL 0xB7 /* DDC bus control */ |
3795 |
+-#define HDMI_HDCP_STATUS 0xB8 /* HDCP status */ |
3796 |
+-#define HDMI_SHA0 0xB9 /* sha0 */ |
3797 |
+-#define HDMI_SHA1 0xBA /* sha1 */ |
3798 |
+-#define HDMI_SHA2 0xBB /* sha2 */ |
3799 |
+-#define HDMI_SHA3 0xBC /* sha3 */ |
3800 |
+-#define HDMI_SHA4 0xBD /* sha4 */ |
3801 |
+-#define HDMI_BCAPS_READ 0xBE /* BCAPS read / debug */ |
3802 |
+-#define HDMI_AKSV_BKSV_7_0_MONITOR 0xBF /* AKSV/BKSV[7:0] monitor */ |
3803 |
+-#define HDMI_AKSV_BKSV_15_8_MONITOR 0xC0 /* AKSV/BKSV[15:8] monitor */ |
3804 |
+-#define HDMI_AKSV_BKSV_23_16_MONITOR 0xC1 /* AKSV/BKSV[23:16] monitor */ |
3805 |
+-#define HDMI_AKSV_BKSV_31_24_MONITOR 0xC2 /* AKSV/BKSV[31:24] monitor */ |
3806 |
+-#define HDMI_AKSV_BKSV_39_32_MONITOR 0xC3 /* AKSV/BKSV[39:32] monitor */ |
3807 |
+-#define HDMI_EDID_SEGMENT_POINTER 0xC4 /* EDID segment pointer */ |
3808 |
+-#define HDMI_EDID_WORD_ADDRESS 0xC5 /* EDID word address */ |
3809 |
+-#define HDMI_EDID_DATA_FIFO_ADDRESS 0xC6 /* EDID data FIFO address */ |
3810 |
+-#define HDMI_NUM_OF_HDMI_DEVICES 0xC7 /* Number of HDMI devices */ |
3811 |
+-#define HDMI_HDCP_ERROR_CODE 0xC8 /* HDCP error code */ |
3812 |
+-#define HDMI_100MS_TIMER_SET 0xC9 /* 100ms timer setting */ |
3813 |
+-#define HDMI_5SEC_TIMER_SET 0xCA /* 5sec timer setting */ |
3814 |
+-#define HDMI_RI_READ_COUNT 0xCB /* Ri read count */ |
3815 |
+-#define HDMI_AN_SEED 0xCC /* An seed */ |
3816 |
+-#define HDMI_MAX_NUM_OF_RCIVRS_ALLOWED 0xCD /* Maximum number of receivers allowed */ |
3817 |
+-#define HDMI_HDCP_MEMORY_ACCESS_CONTROL_1 0xCE /* HDCP memory access control.1 */ |
3818 |
+-#define HDMI_HDCP_MEMORY_ACCESS_CONTROL_2 0xCF /* HDCP memory access control.2 */ |
3819 |
+-#define HDMI_HDCP_CONTROL_2 0xD0 /* HDCP Control 2 */ |
3820 |
+-#define HDMI_HDCP_KEY_MEMORY_CONTROL 0xD2 /* HDCP Key Memory Control */ |
3821 |
+-#define HDMI_COLOR_SPACE_CONV_CONFIG_1 0xD3 /* Color space conversion configuration.1 */ |
3822 |
+-#define HDMI_VIDEO_SETTING_3 0xD4 /* Video setting.3 */ |
3823 |
+-#define HDMI_RI_7_0 0xD5 /* Ri[7:0] */ |
3824 |
+-#define HDMI_RI_15_8 0xD6 /* Ri[15:8] */ |
3825 |
+-#define HDMI_PJ 0xD7 /* Pj */ |
3826 |
+-#define HDMI_SHA_RD 0xD8 /* sha_rd */ |
3827 |
+-#define HDMI_RI_7_0_SAVED 0xD9 /* Ri[7:0] saved */ |
3828 |
+-#define HDMI_RI_15_8_SAVED 0xDA /* Ri[15:8] saved */ |
3829 |
+-#define HDMI_PJ_SAVED 0xDB /* Pj saved */ |
3830 |
+-#define HDMI_NUM_OF_DEVICES 0xDC /* Number of devices */ |
3831 |
+-#define HDMI_HOT_PLUG_MSENS_STATUS 0xDF /* Hot plug/MSENS status */ |
3832 |
+-#define HDMI_BCAPS_WRITE 0xE0 /* bcaps */ |
3833 |
+-#define HDMI_BSTAT_7_0 0xE1 /* bstat[7:0] */ |
3834 |
+-#define HDMI_BSTAT_15_8 0xE2 /* bstat[15:8] */ |
3835 |
+-#define HDMI_BKSV_7_0 0xE3 /* bksv[7:0] */ |
3836 |
+-#define HDMI_BKSV_15_8 0xE4 /* bksv[15:8] */ |
3837 |
+-#define HDMI_BKSV_23_16 0xE5 /* bksv[23:16] */ |
3838 |
+-#define HDMI_BKSV_31_24 0xE6 /* bksv[31:24] */ |
3839 |
+-#define HDMI_BKSV_39_32 0xE7 /* bksv[39:32] */ |
3840 |
+-#define HDMI_AN_7_0 0xE8 /* An[7:0] */ |
3841 |
+-#define HDMI_AN_15_8 0xE9 /* An [15:8] */ |
3842 |
+-#define HDMI_AN_23_16 0xEA /* An [23:16] */ |
3843 |
+-#define HDMI_AN_31_24 0xEB /* An [31:24] */ |
3844 |
+-#define HDMI_AN_39_32 0xEC /* An [39:32] */ |
3845 |
+-#define HDMI_AN_47_40 0xED /* An [47:40] */ |
3846 |
+-#define HDMI_AN_55_48 0xEE /* An [55:48] */ |
3847 |
+-#define HDMI_AN_63_56 0xEF /* An [63:56] */ |
3848 |
+-#define HDMI_PRODUCT_ID 0xF0 /* Product ID */ |
3849 |
+-#define HDMI_REVISION_ID 0xF1 /* Revision ID */ |
3850 |
+-#define HDMI_TEST_MODE 0xFE /* Test mode */ |
3851 |
+- |
3852 |
+-/* HDMI Control Register (HTOP1) */ |
3853 |
+-#define HDMI_HTOP1_TEST_MODE 0x0000 /* Test mode */ |
3854 |
+-#define HDMI_HTOP1_VIDEO_INPUT 0x0008 /* VideoInput */ |
3855 |
+-#define HDMI_HTOP1_CORE_RSTN 0x000C /* CoreResetn */ |
3856 |
+-#define HDMI_HTOP1_PLLBW 0x0018 /* PLLBW */ |
3857 |
+-#define HDMI_HTOP1_CLK_TO_PHY 0x001C /* Clk to Phy */ |
3858 |
+-#define HDMI_HTOP1_VIDEO_INPUT2 0x0020 /* VideoInput2 */ |
3859 |
+-#define HDMI_HTOP1_TISEMP0_1 0x0024 /* tisemp0-1 */ |
3860 |
+-#define HDMI_HTOP1_TISEMP2_C 0x0028 /* tisemp2-c */ |
3861 |
+-#define HDMI_HTOP1_TISIDRV 0x002C /* tisidrv */ |
3862 |
+-#define HDMI_HTOP1_TISEN 0x0034 /* tisen */ |
3863 |
+-#define HDMI_HTOP1_TISDREN 0x0038 /* tisdren */ |
3864 |
+-#define HDMI_HTOP1_CISRANGE 0x003C /* cisrange */ |
3865 |
+-#define HDMI_HTOP1_ENABLE_SELECTOR 0x0040 /* Enable Selector */ |
3866 |
+-#define HDMI_HTOP1_MACRO_RESET 0x0044 /* Macro reset */ |
3867 |
+-#define HDMI_HTOP1_PLL_CALIBRATION 0x0048 /* PLL calibration */ |
3868 |
+-#define HDMI_HTOP1_RE_CALIBRATION 0x004C /* Re-calibration */ |
3869 |
+-#define HDMI_HTOP1_CURRENT 0x0050 /* Current */ |
3870 |
+-#define HDMI_HTOP1_PLL_LOCK_DETECT 0x0054 /* PLL lock detect */ |
3871 |
+-#define HDMI_HTOP1_PHY_TEST_MODE 0x0058 /* PHY Test Mode */ |
3872 |
+-#define HDMI_HTOP1_CLK_SET 0x0080 /* Clock Set */ |
3873 |
+-#define HDMI_HTOP1_DDC_FAIL_SAFE 0x0084 /* DDC fail safe */ |
3874 |
+-#define HDMI_HTOP1_PRBS 0x0088 /* PRBS */ |
3875 |
+-#define HDMI_HTOP1_EDID_AINC_CONTROL 0x008C /* EDID ainc Control */ |
3876 |
+-#define HDMI_HTOP1_HTOP_DCL_MODE 0x00FC /* Deep Coloer Mode */ |
3877 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_COEF0 0x0100 /* Deep Color:FRC COEF0 */ |
3878 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_COEF1 0x0104 /* Deep Color:FRC COEF1 */ |
3879 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_COEF2 0x0108 /* Deep Color:FRC COEF2 */ |
3880 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_COEF3 0x010C /* Deep Color:FRC COEF3 */ |
3881 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_COEF0_C 0x0110 /* Deep Color:FRC COEF0C */ |
3882 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_COEF1_C 0x0114 /* Deep Color:FRC COEF1C */ |
3883 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_COEF2_C 0x0118 /* Deep Color:FRC COEF2C */ |
3884 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_COEF3_C 0x011C /* Deep Color:FRC COEF3C */ |
3885 |
+-#define HDMI_HTOP1_HTOP_DCL_FRC_MODE 0x0120 /* Deep Color:FRC Mode */ |
3886 |
+-#define HDMI_HTOP1_HTOP_DCL_RECT_START1 0x0124 /* Deep Color:Rect Start1 */ |
3887 |
+-#define HDMI_HTOP1_HTOP_DCL_RECT_SIZE1 0x0128 /* Deep Color:Rect Size1 */ |
3888 |
+-#define HDMI_HTOP1_HTOP_DCL_RECT_START2 0x012C /* Deep Color:Rect Start2 */ |
3889 |
+-#define HDMI_HTOP1_HTOP_DCL_RECT_SIZE2 0x0130 /* Deep Color:Rect Size2 */ |
3890 |
+-#define HDMI_HTOP1_HTOP_DCL_RECT_START3 0x0134 /* Deep Color:Rect Start3 */ |
3891 |
+-#define HDMI_HTOP1_HTOP_DCL_RECT_SIZE3 0x0138 /* Deep Color:Rect Size3 */ |
3892 |
+-#define HDMI_HTOP1_HTOP_DCL_RECT_START4 0x013C /* Deep Color:Rect Start4 */ |
3893 |
+-#define HDMI_HTOP1_HTOP_DCL_RECT_SIZE4 0x0140 /* Deep Color:Rect Size4 */ |
3894 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_Y1_1 0x0144 /* Deep Color:Fil Para Y1_1 */ |
3895 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_Y1_2 0x0148 /* Deep Color:Fil Para Y1_2 */ |
3896 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_CB1_1 0x014C /* Deep Color:Fil Para CB1_1 */ |
3897 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_CB1_2 0x0150 /* Deep Color:Fil Para CB1_2 */ |
3898 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_CR1_1 0x0154 /* Deep Color:Fil Para CR1_1 */ |
3899 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_CR1_2 0x0158 /* Deep Color:Fil Para CR1_2 */ |
3900 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_Y2_1 0x015C /* Deep Color:Fil Para Y2_1 */ |
3901 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_Y2_2 0x0160 /* Deep Color:Fil Para Y2_2 */ |
3902 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_CB2_1 0x0164 /* Deep Color:Fil Para CB2_1 */ |
3903 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_CB2_2 0x0168 /* Deep Color:Fil Para CB2_2 */ |
3904 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_CR2_1 0x016C /* Deep Color:Fil Para CR2_1 */ |
3905 |
+-#define HDMI_HTOP1_HTOP_DCL_FIL_PARA_CR2_2 0x0170 /* Deep Color:Fil Para CR2_2 */ |
3906 |
+-#define HDMI_HTOP1_HTOP_DCL_COR_PARA_Y1 0x0174 /* Deep Color:Cor Para Y1 */ |
3907 |
+-#define HDMI_HTOP1_HTOP_DCL_COR_PARA_CB1 0x0178 /* Deep Color:Cor Para CB1 */ |
3908 |
+-#define HDMI_HTOP1_HTOP_DCL_COR_PARA_CR1 0x017C /* Deep Color:Cor Para CR1 */ |
3909 |
+-#define HDMI_HTOP1_HTOP_DCL_COR_PARA_Y2 0x0180 /* Deep Color:Cor Para Y2 */ |
3910 |
+-#define HDMI_HTOP1_HTOP_DCL_COR_PARA_CB2 0x0184 /* Deep Color:Cor Para CB2 */ |
3911 |
+-#define HDMI_HTOP1_HTOP_DCL_COR_PARA_CR2 0x0188 /* Deep Color:Cor Para CR2 */ |
3912 |
+-#define HDMI_HTOP1_EDID_DATA_READ 0x0200 /* EDID Data Read 128Byte:0x03FC */ |
3913 |
+- |
3914 |
+-enum hotplug_state { |
3915 |
+- HDMI_HOTPLUG_DISCONNECTED, |
3916 |
+- HDMI_HOTPLUG_CONNECTED, |
3917 |
+- HDMI_HOTPLUG_EDID_DONE, |
3918 |
+-}; |
3919 |
+- |
3920 |
+-struct sh_hdmi { |
3921 |
+- struct sh_mobile_lcdc_entity entity; |
3922 |
+- |
3923 |
+- void __iomem *base; |
3924 |
+- void __iomem *htop1; |
3925 |
+- enum hotplug_state hp_state; /* hot-plug status */ |
3926 |
+- u8 preprogrammed_vic; /* use a pre-programmed VIC or |
3927 |
+- the external mode */ |
3928 |
+- u8 edid_block_addr; |
3929 |
+- u8 edid_segment_nr; |
3930 |
+- u8 edid_blocks; |
3931 |
+- int irq; |
3932 |
+- struct clk *hdmi_clk; |
3933 |
+- struct device *dev; |
3934 |
+- struct delayed_work edid_work; |
3935 |
+- struct fb_videomode mode; |
3936 |
+- struct fb_monspecs monspec; |
3937 |
+- |
3938 |
+- /* register access functions */ |
3939 |
+- void (*write)(struct sh_hdmi *hdmi, u8 data, u8 reg); |
3940 |
+- u8 (*read)(struct sh_hdmi *hdmi, u8 reg); |
3941 |
+-}; |
3942 |
+- |
3943 |
+-#define entity_to_sh_hdmi(e) container_of(e, struct sh_hdmi, entity) |
3944 |
+- |
3945 |
+-static void __hdmi_write8(struct sh_hdmi *hdmi, u8 data, u8 reg) |
3946 |
+-{ |
3947 |
+- iowrite8(data, hdmi->base + reg); |
3948 |
+-} |
3949 |
+- |
3950 |
+-static u8 __hdmi_read8(struct sh_hdmi *hdmi, u8 reg) |
3951 |
+-{ |
3952 |
+- return ioread8(hdmi->base + reg); |
3953 |
+-} |
3954 |
+- |
3955 |
+-static void __hdmi_write32(struct sh_hdmi *hdmi, u8 data, u8 reg) |
3956 |
+-{ |
3957 |
+- iowrite32((u32)data, hdmi->base + (reg * 4)); |
3958 |
+- udelay(100); |
3959 |
+-} |
3960 |
+- |
3961 |
+-static u8 __hdmi_read32(struct sh_hdmi *hdmi, u8 reg) |
3962 |
+-{ |
3963 |
+- return (u8)ioread32(hdmi->base + (reg * 4)); |
3964 |
+-} |
3965 |
+- |
3966 |
+-static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg) |
3967 |
+-{ |
3968 |
+- hdmi->write(hdmi, data, reg); |
3969 |
+-} |
3970 |
+- |
3971 |
+-static u8 hdmi_read(struct sh_hdmi *hdmi, u8 reg) |
3972 |
+-{ |
3973 |
+- return hdmi->read(hdmi, reg); |
3974 |
+-} |
3975 |
+- |
3976 |
+-static void hdmi_bit_set(struct sh_hdmi *hdmi, u8 mask, u8 data, u8 reg) |
3977 |
+-{ |
3978 |
+- u8 val = hdmi_read(hdmi, reg); |
3979 |
+- |
3980 |
+- val &= ~mask; |
3981 |
+- val |= (data & mask); |
3982 |
+- |
3983 |
+- hdmi_write(hdmi, val, reg); |
3984 |
+-} |
3985 |
+- |
3986 |
+-static void hdmi_htop1_write(struct sh_hdmi *hdmi, u32 data, u32 reg) |
3987 |
+-{ |
3988 |
+- iowrite32(data, hdmi->htop1 + reg); |
3989 |
+- udelay(100); |
3990 |
+-} |
3991 |
+- |
3992 |
+-static u32 hdmi_htop1_read(struct sh_hdmi *hdmi, u32 reg) |
3993 |
+-{ |
3994 |
+- return ioread32(hdmi->htop1 + reg); |
3995 |
+-} |
3996 |
+- |
3997 |
+-/* |
3998 |
+- * HDMI sound |
3999 |
+- */ |
4000 |
+-static unsigned int sh_hdmi_snd_read(struct snd_soc_codec *codec, |
4001 |
+- unsigned int reg) |
4002 |
+-{ |
4003 |
+- struct sh_hdmi *hdmi = snd_soc_codec_get_drvdata(codec); |
4004 |
+- |
4005 |
+- return hdmi_read(hdmi, reg); |
4006 |
+-} |
4007 |
+- |
4008 |
+-static int sh_hdmi_snd_write(struct snd_soc_codec *codec, |
4009 |
+- unsigned int reg, |
4010 |
+- unsigned int value) |
4011 |
+-{ |
4012 |
+- struct sh_hdmi *hdmi = snd_soc_codec_get_drvdata(codec); |
4013 |
+- |
4014 |
+- hdmi_write(hdmi, value, reg); |
4015 |
+- return 0; |
4016 |
+-} |
4017 |
+- |
4018 |
+-static struct snd_soc_dai_driver sh_hdmi_dai = { |
4019 |
+- .name = "sh_mobile_hdmi-hifi", |
4020 |
+- .playback = { |
4021 |
+- .stream_name = "Playback", |
4022 |
+- .channels_min = 2, |
4023 |
+- .channels_max = 8, |
4024 |
+- .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | |
4025 |
+- SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | |
4026 |
+- SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | |
4027 |
+- SNDRV_PCM_RATE_192000, |
4028 |
+- .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, |
4029 |
+- }, |
4030 |
+-}; |
4031 |
+- |
4032 |
+-static int sh_hdmi_snd_probe(struct snd_soc_codec *codec) |
4033 |
+-{ |
4034 |
+- dev_info(codec->dev, "SH Mobile HDMI Audio Codec"); |
4035 |
+- |
4036 |
+- return 0; |
4037 |
+-} |
4038 |
+- |
4039 |
+-static struct snd_soc_codec_driver soc_codec_dev_sh_hdmi = { |
4040 |
+- .probe = sh_hdmi_snd_probe, |
4041 |
+- .read = sh_hdmi_snd_read, |
4042 |
+- .write = sh_hdmi_snd_write, |
4043 |
+-}; |
4044 |
+- |
4045 |
+-/* |
4046 |
+- * HDMI video |
4047 |
+- */ |
4048 |
+- |
4049 |
+-/* External video parameter settings */ |
4050 |
+-static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi) |
4051 |
+-{ |
4052 |
+- struct fb_videomode *mode = &hdmi->mode; |
4053 |
+- u16 htotal, hblank, hdelay, vtotal, vblank, vdelay, voffset; |
4054 |
+- u8 sync = 0; |
4055 |
+- |
4056 |
+- htotal = mode->xres + mode->right_margin + mode->left_margin |
4057 |
+- + mode->hsync_len; |
4058 |
+- hdelay = mode->hsync_len + mode->left_margin; |
4059 |
+- hblank = mode->right_margin + hdelay; |
4060 |
+- |
4061 |
+- /* |
4062 |
+- * Vertical timing looks a bit different in Figure 18, |
4063 |
+- * but let's try the same first by setting offset = 0 |
4064 |
+- */ |
4065 |
+- vtotal = mode->yres + mode->upper_margin + mode->lower_margin |
4066 |
+- + mode->vsync_len; |
4067 |
+- vdelay = mode->vsync_len + mode->upper_margin; |
4068 |
+- vblank = mode->lower_margin + vdelay; |
4069 |
+- voffset = min(mode->upper_margin / 2, 6U); |
4070 |
+- |
4071 |
+- /* |
4072 |
+- * [3]: VSYNC polarity: Positive |
4073 |
+- * [2]: HSYNC polarity: Positive |
4074 |
+- * [1]: Interlace/Progressive: Progressive |
4075 |
+- * [0]: External video settings enable: used. |
4076 |
+- */ |
4077 |
+- if (mode->sync & FB_SYNC_HOR_HIGH_ACT) |
4078 |
+- sync |= 4; |
4079 |
+- if (mode->sync & FB_SYNC_VERT_HIGH_ACT) |
4080 |
+- sync |= 8; |
4081 |
+- |
4082 |
+- dev_dbg(hdmi->dev, "H: %u, %u, %u, %u; V: %u, %u, %u, %u; sync 0x%x\n", |
4083 |
+- htotal, hblank, hdelay, mode->hsync_len, |
4084 |
+- vtotal, vblank, vdelay, mode->vsync_len, sync); |
4085 |
+- |
4086 |
+- hdmi_write(hdmi, sync | (voffset << 4), HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS); |
4087 |
+- |
4088 |
+- hdmi_write(hdmi, htotal, HDMI_EXTERNAL_H_TOTAL_7_0); |
4089 |
+- hdmi_write(hdmi, htotal >> 8, HDMI_EXTERNAL_H_TOTAL_11_8); |
4090 |
+- |
4091 |
+- hdmi_write(hdmi, hblank, HDMI_EXTERNAL_H_BLANK_7_0); |
4092 |
+- hdmi_write(hdmi, hblank >> 8, HDMI_EXTERNAL_H_BLANK_9_8); |
4093 |
+- |
4094 |
+- hdmi_write(hdmi, hdelay, HDMI_EXTERNAL_H_DELAY_7_0); |
4095 |
+- hdmi_write(hdmi, hdelay >> 8, HDMI_EXTERNAL_H_DELAY_9_8); |
4096 |
+- |
4097 |
+- hdmi_write(hdmi, mode->hsync_len, HDMI_EXTERNAL_H_DURATION_7_0); |
4098 |
+- hdmi_write(hdmi, mode->hsync_len >> 8, HDMI_EXTERNAL_H_DURATION_9_8); |
4099 |
+- |
4100 |
+- hdmi_write(hdmi, vtotal, HDMI_EXTERNAL_V_TOTAL_7_0); |
4101 |
+- hdmi_write(hdmi, vtotal >> 8, HDMI_EXTERNAL_V_TOTAL_9_8); |
4102 |
+- |
4103 |
+- hdmi_write(hdmi, vblank, HDMI_EXTERNAL_V_BLANK); |
4104 |
+- |
4105 |
+- hdmi_write(hdmi, vdelay, HDMI_EXTERNAL_V_DELAY); |
4106 |
+- |
4107 |
+- hdmi_write(hdmi, mode->vsync_len, HDMI_EXTERNAL_V_DURATION); |
4108 |
+- |
4109 |
+- /* Set bit 0 of HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS here for external mode */ |
4110 |
+- if (!hdmi->preprogrammed_vic) |
4111 |
+- hdmi_write(hdmi, sync | 1 | (voffset << 4), |
4112 |
+- HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS); |
4113 |
+-} |
4114 |
+- |
4115 |
+-/** |
4116 |
+- * sh_hdmi_video_config() |
4117 |
+- */ |
4118 |
+-static void sh_hdmi_video_config(struct sh_hdmi *hdmi) |
4119 |
+-{ |
4120 |
+- /* |
4121 |
+- * [7:4]: Audio sampling frequency: 48kHz |
4122 |
+- * [3:1]: Input video format: RGB and YCbCr 4:4:4 (Y on Green) |
4123 |
+- * [0]: Internal/External DE select: internal |
4124 |
+- */ |
4125 |
+- hdmi_write(hdmi, 0x20, HDMI_AUDIO_VIDEO_SETTING_1); |
4126 |
+- |
4127 |
+- /* |
4128 |
+- * [7:6]: Video output format: RGB 4:4:4 |
4129 |
+- * [5:4]: Input video data width: 8 bit |
4130 |
+- * [3:1]: EAV/SAV location: channel 1 |
4131 |
+- * [0]: Video input color space: RGB |
4132 |
+- */ |
4133 |
+- hdmi_write(hdmi, 0x34, HDMI_VIDEO_SETTING_1); |
4134 |
+- |
4135 |
+- /* |
4136 |
+- * [7:6]: Together with bit [6] of HDMI_AUDIO_VIDEO_SETTING_2, which is |
4137 |
+- * left at 0 by default, this configures 24bpp and sets the Color Depth |
4138 |
+- * (CD) field in the General Control Packet |
4139 |
+- */ |
4140 |
+- hdmi_write(hdmi, 0x20, HDMI_DEEP_COLOR_MODES); |
4141 |
+-} |
4142 |
+- |
4143 |
+-/** |
4144 |
+- * sh_hdmi_audio_config() |
4145 |
+- */ |
4146 |
+-static void sh_hdmi_audio_config(struct sh_hdmi *hdmi) |
4147 |
+-{ |
4148 |
+- u8 data; |
4149 |
+- struct sh_mobile_hdmi_info *pdata = dev_get_platdata(hdmi->dev); |
4150 |
+- |
4151 |
+- /* |
4152 |
+- * [7:4] L/R data swap control |
4153 |
+- * [3:0] appropriate N[19:16] |
4154 |
+- */ |
4155 |
+- hdmi_write(hdmi, 0x00, HDMI_L_R_DATA_SWAP_CTRL_RPKT); |
4156 |
+- /* appropriate N[15:8] */ |
4157 |
+- hdmi_write(hdmi, 0x18, HDMI_20_BIT_N_FOR_AUDIO_RPKT_15_8); |
4158 |
+- /* appropriate N[7:0] */ |
4159 |
+- hdmi_write(hdmi, 0x00, HDMI_20_BIT_N_FOR_AUDIO_RPKT_7_0); |
4160 |
+- |
4161 |
+- /* [7:4] 48 kHz SPDIF not used */ |
4162 |
+- hdmi_write(hdmi, 0x20, HDMI_SPDIF_AUDIO_SAMP_FREQ_CTS); |
4163 |
+- |
4164 |
+- /* |
4165 |
+- * [6:5] set required down sampling rate if required |
4166 |
+- * [4:3] set required audio source |
4167 |
+- */ |
4168 |
+- switch (pdata->flags & HDMI_SND_SRC_MASK) { |
4169 |
+- default: |
4170 |
+- /* fall through */ |
4171 |
+- case HDMI_SND_SRC_I2S: |
4172 |
+- data = 0x0 << 3; |
4173 |
+- break; |
4174 |
+- case HDMI_SND_SRC_SPDIF: |
4175 |
+- data = 0x1 << 3; |
4176 |
+- break; |
4177 |
+- case HDMI_SND_SRC_DSD: |
4178 |
+- data = 0x2 << 3; |
4179 |
+- break; |
4180 |
+- case HDMI_SND_SRC_HBR: |
4181 |
+- data = 0x3 << 3; |
4182 |
+- break; |
4183 |
+- } |
4184 |
+- hdmi_write(hdmi, data, HDMI_AUDIO_SETTING_1); |
4185 |
+- |
4186 |
+- /* [3:0] set sending channel number for channel status */ |
4187 |
+- hdmi_write(hdmi, 0x40, HDMI_AUDIO_SETTING_2); |
4188 |
+- |
4189 |
+- /* |
4190 |
+- * [5:2] set valid I2S source input pin |
4191 |
+- * [1:0] set input I2S source mode |
4192 |
+- */ |
4193 |
+- hdmi_write(hdmi, 0x04, HDMI_I2S_AUDIO_SET); |
4194 |
+- |
4195 |
+- /* [7:4] set valid DSD source input pin */ |
4196 |
+- hdmi_write(hdmi, 0x00, HDMI_DSD_AUDIO_SET); |
4197 |
+- |
4198 |
+- /* [7:0] set appropriate I2S input pin swap settings if required */ |
4199 |
+- hdmi_write(hdmi, 0x00, HDMI_I2S_INPUT_PIN_SWAP); |
4200 |
+- |
4201 |
+- /* |
4202 |
+- * [7] set validity bit for channel status |
4203 |
+- * [3:0] set original sample frequency for channel status |
4204 |
+- */ |
4205 |
+- hdmi_write(hdmi, 0x00, HDMI_AUDIO_STATUS_BITS_SETTING_1); |
4206 |
+- |
4207 |
+- /* |
4208 |
+- * [7] set value for channel status |
4209 |
+- * [6] set value for channel status |
4210 |
+- * [5] set copyright bit for channel status |
4211 |
+- * [4:2] set additional information for channel status |
4212 |
+- * [1:0] set clock accuracy for channel status |
4213 |
+- */ |
4214 |
+- hdmi_write(hdmi, 0x00, HDMI_AUDIO_STATUS_BITS_SETTING_2); |
4215 |
+- |
4216 |
+- /* [7:0] set category code for channel status */ |
4217 |
+- hdmi_write(hdmi, 0x00, HDMI_CATEGORY_CODE); |
4218 |
+- |
4219 |
+- /* |
4220 |
+- * [7:4] set source number for channel status |
4221 |
+- * [3:0] set word length for channel status |
4222 |
+- */ |
4223 |
+- hdmi_write(hdmi, 0x00, HDMI_SOURCE_NUM_AUDIO_WORD_LEN); |
4224 |
+- |
4225 |
+- /* [7:4] set sample frequency for channel status */ |
4226 |
+- hdmi_write(hdmi, 0x20, HDMI_AUDIO_VIDEO_SETTING_1); |
4227 |
+-} |
4228 |
+- |
4229 |
+-/** |
4230 |
+- * sh_hdmi_phy_config() - configure the HDMI PHY for the used video mode |
4231 |
+- */ |
4232 |
+-static void sh_hdmi_phy_config(struct sh_hdmi *hdmi) |
4233 |
+-{ |
4234 |
+- if (hdmi->mode.pixclock < 10000) { |
4235 |
+- /* for 1080p8bit 148MHz */ |
4236 |
+- hdmi_write(hdmi, 0x1d, HDMI_SLIPHDMIT_PARAM_SETTINGS_1); |
4237 |
+- hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2); |
4238 |
+- hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_3); |
4239 |
+- hdmi_write(hdmi, 0x4c, HDMI_SLIPHDMIT_PARAM_SETTINGS_5); |
4240 |
+- hdmi_write(hdmi, 0x1e, HDMI_SLIPHDMIT_PARAM_SETTINGS_6); |
4241 |
+- hdmi_write(hdmi, 0x48, HDMI_SLIPHDMIT_PARAM_SETTINGS_7); |
4242 |
+- hdmi_write(hdmi, 0x0e, HDMI_SLIPHDMIT_PARAM_SETTINGS_8); |
4243 |
+- hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9); |
4244 |
+- hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10); |
4245 |
+- } else if (hdmi->mode.pixclock < 30000) { |
4246 |
+- /* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */ |
4247 |
+- /* |
4248 |
+- * [1:0] Speed_A |
4249 |
+- * [3:2] Speed_B |
4250 |
+- * [4] PLLA_Bypass |
4251 |
+- * [6] DRV_TEST_EN |
4252 |
+- * [7] DRV_TEST_IN |
4253 |
+- */ |
4254 |
+- hdmi_write(hdmi, 0x0f, HDMI_SLIPHDMIT_PARAM_SETTINGS_1); |
4255 |
+- /* PLLB_CONFIG[17], PLLA_CONFIG[17] - not in PHY datasheet */ |
4256 |
+- hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2); |
4257 |
+- /* |
4258 |
+- * [2:0] BGR_I_OFFSET |
4259 |
+- * [6:4] BGR_V_OFFSET |
4260 |
+- */ |
4261 |
+- hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_3); |
4262 |
+- /* PLLA_CONFIG[7:0]: VCO gain, VCO offset, LPF resistance[0] */ |
4263 |
+- hdmi_write(hdmi, 0x44, HDMI_SLIPHDMIT_PARAM_SETTINGS_5); |
4264 |
+- /* |
4265 |
+- * PLLA_CONFIG[15:8]: regulator voltage[0], CP current, |
4266 |
+- * LPF capacitance, LPF resistance[1] |
4267 |
+- */ |
4268 |
+- hdmi_write(hdmi, 0x32, HDMI_SLIPHDMIT_PARAM_SETTINGS_6); |
4269 |
+- /* PLLB_CONFIG[7:0]: LPF resistance[0], VCO offset, VCO gain */ |
4270 |
+- hdmi_write(hdmi, 0x4A, HDMI_SLIPHDMIT_PARAM_SETTINGS_7); |
4271 |
+- /* |
4272 |
+- * PLLB_CONFIG[15:8]: regulator voltage[0], CP current, |
4273 |
+- * LPF capacitance, LPF resistance[1] |
4274 |
+- */ |
4275 |
+- hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_8); |
4276 |
+- /* DRV_CONFIG, PE_CONFIG */ |
4277 |
+- hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9); |
4278 |
+- /* |
4279 |
+- * [2:0] AMON_SEL (4 == LPF voltage) |
4280 |
+- * [4] PLLA_CONFIG[16] |
4281 |
+- * [5] PLLB_CONFIG[16] |
4282 |
+- */ |
4283 |
+- hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10); |
4284 |
+- } else { |
4285 |
+- /* for 480p8bit 27MHz */ |
4286 |
+- hdmi_write(hdmi, 0x19, HDMI_SLIPHDMIT_PARAM_SETTINGS_1); |
4287 |
+- hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2); |
4288 |
+- hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_3); |
4289 |
+- hdmi_write(hdmi, 0x44, HDMI_SLIPHDMIT_PARAM_SETTINGS_5); |
4290 |
+- hdmi_write(hdmi, 0x32, HDMI_SLIPHDMIT_PARAM_SETTINGS_6); |
4291 |
+- hdmi_write(hdmi, 0x48, HDMI_SLIPHDMIT_PARAM_SETTINGS_7); |
4292 |
+- hdmi_write(hdmi, 0x0F, HDMI_SLIPHDMIT_PARAM_SETTINGS_8); |
4293 |
+- hdmi_write(hdmi, 0x20, HDMI_SLIPHDMIT_PARAM_SETTINGS_9); |
4294 |
+- hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10); |
4295 |
+- } |
4296 |
+-} |
4297 |
+- |
4298 |
+-/** |
4299 |
+- * sh_hdmi_avi_infoframe_setup() - Auxiliary Video Information InfoFrame CONTROL PACKET |
4300 |
+- */ |
4301 |
+-static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi) |
4302 |
+-{ |
4303 |
+- u8 vic; |
4304 |
+- |
4305 |
+- /* AVI InfoFrame */ |
4306 |
+- hdmi_write(hdmi, 0x06, HDMI_CTRL_PKT_BUF_INDEX); |
4307 |
+- |
4308 |
+- /* Packet Type = 0x82 */ |
4309 |
+- hdmi_write(hdmi, 0x82, HDMI_CTRL_PKT_BUF_ACCESS_HB0); |
4310 |
+- |
4311 |
+- /* Version = 0x02 */ |
4312 |
+- hdmi_write(hdmi, 0x02, HDMI_CTRL_PKT_BUF_ACCESS_HB1); |
4313 |
+- |
4314 |
+- /* Length = 13 (0x0D) */ |
4315 |
+- hdmi_write(hdmi, 0x0D, HDMI_CTRL_PKT_BUF_ACCESS_HB2); |
4316 |
+- |
4317 |
+- /* N. A. Checksum */ |
4318 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB0); |
4319 |
+- |
4320 |
+- /* |
4321 |
+- * Y = RGB |
4322 |
+- * A0 = No Data |
4323 |
+- * B = Bar Data not valid |
4324 |
+- * S = No Data |
4325 |
+- */ |
4326 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB1); |
4327 |
+- |
4328 |
+- /* |
4329 |
+- * [7:6] C = Colorimetry: no data |
4330 |
+- * [5:4] M = 2: 16:9, 1: 4:3 Picture Aspect Ratio |
4331 |
+- * [3:0] R = 8: Active Frame Aspect Ratio: same as picture aspect ratio |
4332 |
+- */ |
4333 |
+- hdmi_write(hdmi, 0x28, HDMI_CTRL_PKT_BUF_ACCESS_PB2); |
4334 |
+- |
4335 |
+- /* |
4336 |
+- * ITC = No Data |
4337 |
+- * EC = xvYCC601 |
4338 |
+- * Q = Default (depends on video format) |
4339 |
+- * SC = No Known non_uniform Scaling |
4340 |
+- */ |
4341 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB3); |
4342 |
+- |
4343 |
+- /* |
4344 |
+- * VIC should be ignored if external config is used, so, we could just use 0, |
4345 |
+- * but play safe and use a valid value in any case just in case |
4346 |
+- */ |
4347 |
+- if (hdmi->preprogrammed_vic) |
4348 |
+- vic = hdmi->preprogrammed_vic; |
4349 |
+- else |
4350 |
+- vic = 4; |
4351 |
+- hdmi_write(hdmi, vic, HDMI_CTRL_PKT_BUF_ACCESS_PB4); |
4352 |
+- |
4353 |
+- /* PR = No Repetition */ |
4354 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB5); |
4355 |
+- |
4356 |
+- /* Line Number of End of Top Bar (lower 8 bits) */ |
4357 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB6); |
4358 |
+- |
4359 |
+- /* Line Number of End of Top Bar (upper 8 bits) */ |
4360 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB7); |
4361 |
+- |
4362 |
+- /* Line Number of Start of Bottom Bar (lower 8 bits) */ |
4363 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB8); |
4364 |
+- |
4365 |
+- /* Line Number of Start of Bottom Bar (upper 8 bits) */ |
4366 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB9); |
4367 |
+- |
4368 |
+- /* Pixel Number of End of Left Bar (lower 8 bits) */ |
4369 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB10); |
4370 |
+- |
4371 |
+- /* Pixel Number of End of Left Bar (upper 8 bits) */ |
4372 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB11); |
4373 |
+- |
4374 |
+- /* Pixel Number of Start of Right Bar (lower 8 bits) */ |
4375 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB12); |
4376 |
+- |
4377 |
+- /* Pixel Number of Start of Right Bar (upper 8 bits) */ |
4378 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB13); |
4379 |
+-} |
4380 |
+- |
4381 |
+-/** |
4382 |
+- * sh_hdmi_audio_infoframe_setup() - Audio InfoFrame of CONTROL PACKET |
4383 |
+- */ |
4384 |
+-static void sh_hdmi_audio_infoframe_setup(struct sh_hdmi *hdmi) |
4385 |
+-{ |
4386 |
+- /* Audio InfoFrame */ |
4387 |
+- hdmi_write(hdmi, 0x08, HDMI_CTRL_PKT_BUF_INDEX); |
4388 |
+- |
4389 |
+- /* Packet Type = 0x84 */ |
4390 |
+- hdmi_write(hdmi, 0x84, HDMI_CTRL_PKT_BUF_ACCESS_HB0); |
4391 |
+- |
4392 |
+- /* Version Number = 0x01 */ |
4393 |
+- hdmi_write(hdmi, 0x01, HDMI_CTRL_PKT_BUF_ACCESS_HB1); |
4394 |
+- |
4395 |
+- /* 0 Length = 10 (0x0A) */ |
4396 |
+- hdmi_write(hdmi, 0x0A, HDMI_CTRL_PKT_BUF_ACCESS_HB2); |
4397 |
+- |
4398 |
+- /* n. a. Checksum */ |
4399 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB0); |
4400 |
+- |
4401 |
+- /* Audio Channel Count = Refer to Stream Header */ |
4402 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB1); |
4403 |
+- |
4404 |
+- /* Refer to Stream Header */ |
4405 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB2); |
4406 |
+- |
4407 |
+- /* Format depends on coding type (i.e. CT0...CT3) */ |
4408 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB3); |
4409 |
+- |
4410 |
+- /* Speaker Channel Allocation = Front Right + Front Left */ |
4411 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB4); |
4412 |
+- |
4413 |
+- /* Level Shift Value = 0 dB, Down - mix is permitted or no information */ |
4414 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB5); |
4415 |
+- |
4416 |
+- /* Reserved (0) */ |
4417 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB6); |
4418 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB7); |
4419 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB8); |
4420 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB9); |
4421 |
+- hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB10); |
4422 |
+-} |
4423 |
+- |
4424 |
+-/** |
4425 |
+- * sh_hdmi_configure() - Initialise HDMI for output |
4426 |
+- */ |
4427 |
+-static void sh_hdmi_configure(struct sh_hdmi *hdmi) |
4428 |
+-{ |
4429 |
+- /* Configure video format */ |
4430 |
+- sh_hdmi_video_config(hdmi); |
4431 |
+- |
4432 |
+- /* Configure audio format */ |
4433 |
+- sh_hdmi_audio_config(hdmi); |
4434 |
+- |
4435 |
+- /* Configure PHY */ |
4436 |
+- sh_hdmi_phy_config(hdmi); |
4437 |
+- |
4438 |
+- /* Auxiliary Video Information (AVI) InfoFrame */ |
4439 |
+- sh_hdmi_avi_infoframe_setup(hdmi); |
4440 |
+- |
4441 |
+- /* Audio InfoFrame */ |
4442 |
+- sh_hdmi_audio_infoframe_setup(hdmi); |
4443 |
+- |
4444 |
+- /* |
4445 |
+- * Control packet auto send with VSYNC control: auto send |
4446 |
+- * General control, Gamut metadata, ISRC, and ACP packets |
4447 |
+- */ |
4448 |
+- hdmi_write(hdmi, 0x8E, HDMI_CTRL_PKT_AUTO_SEND); |
4449 |
+- |
4450 |
+- /* FIXME */ |
4451 |
+- msleep(10); |
4452 |
+- |
4453 |
+- /* PS mode b->d, reset PLLA and PLLB */ |
4454 |
+- hdmi_bit_set(hdmi, 0xFC, 0x4C, HDMI_SYSTEM_CTRL); |
4455 |
+- |
4456 |
+- udelay(10); |
4457 |
+- |
4458 |
+- hdmi_bit_set(hdmi, 0xFC, 0x40, HDMI_SYSTEM_CTRL); |
4459 |
+-} |
4460 |
+- |
4461 |
+-static unsigned long sh_hdmi_rate_error(struct sh_hdmi *hdmi, |
4462 |
+- const struct fb_videomode *mode, |
4463 |
+- unsigned long *hdmi_rate, unsigned long *parent_rate) |
4464 |
+-{ |
4465 |
+- unsigned long target = PICOS2KHZ(mode->pixclock) * 1000, rate_error; |
4466 |
+- struct sh_mobile_hdmi_info *pdata = dev_get_platdata(hdmi->dev); |
4467 |
+- |
4468 |
+- *hdmi_rate = clk_round_rate(hdmi->hdmi_clk, target); |
4469 |
+- if ((long)*hdmi_rate < 0) |
4470 |
+- *hdmi_rate = clk_get_rate(hdmi->hdmi_clk); |
4471 |
+- |
4472 |
+- rate_error = (long)*hdmi_rate > 0 ? abs(*hdmi_rate - target) : ULONG_MAX; |
4473 |
+- if (rate_error && pdata->clk_optimize_parent) |
4474 |
+- rate_error = pdata->clk_optimize_parent(target, hdmi_rate, parent_rate); |
4475 |
+- else if (clk_get_parent(hdmi->hdmi_clk)) |
4476 |
+- *parent_rate = clk_get_rate(clk_get_parent(hdmi->hdmi_clk)); |
4477 |
+- |
4478 |
+- dev_dbg(hdmi->dev, "%u-%u-%u-%u x %u-%u-%u-%u\n", |
4479 |
+- mode->left_margin, mode->xres, |
4480 |
+- mode->right_margin, mode->hsync_len, |
4481 |
+- mode->upper_margin, mode->yres, |
4482 |
+- mode->lower_margin, mode->vsync_len); |
4483 |
+- |
4484 |
+- dev_dbg(hdmi->dev, "\t@%lu(+/-%lu)Hz, e=%lu / 1000, r=%uHz, p=%luHz\n", target, |
4485 |
+- rate_error, rate_error ? 10000 / (10 * target / rate_error) : 0, |
4486 |
+- mode->refresh, *parent_rate); |
4487 |
+- |
4488 |
+- return rate_error; |
4489 |
+-} |
4490 |
+- |
4491 |
+-static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate, |
4492 |
+- unsigned long *parent_rate) |
4493 |
+-{ |
4494 |
+- struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc; |
4495 |
+- const struct fb_videomode *mode, *found = NULL; |
4496 |
+- unsigned int f_width = 0, f_height = 0, f_refresh = 0; |
4497 |
+- unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */ |
4498 |
+- bool scanning = false, preferred_bad = false; |
4499 |
+- bool use_edid_mode = false; |
4500 |
+- u8 edid[128]; |
4501 |
+- char *forced; |
4502 |
+- int i; |
4503 |
+- |
4504 |
+- /* Read EDID */ |
4505 |
+- dev_dbg(hdmi->dev, "Read back EDID code:"); |
4506 |
+- for (i = 0; i < 128; i++) { |
4507 |
+- edid[i] = (hdmi->htop1) ? |
4508 |
+- (u8)hdmi_htop1_read(hdmi, HDMI_HTOP1_EDID_DATA_READ + (i * 4)) : |
4509 |
+- hdmi_read(hdmi, HDMI_EDID_KSV_FIFO_ACCESS_WINDOW); |
4510 |
+-#ifdef DEBUG |
4511 |
+- if ((i % 16) == 0) { |
4512 |
+- printk(KERN_CONT "\n"); |
4513 |
+- printk(KERN_DEBUG "%02X | %02X", i, edid[i]); |
4514 |
+- } else { |
4515 |
+- printk(KERN_CONT " %02X", edid[i]); |
4516 |
+- } |
4517 |
+-#endif |
4518 |
+- } |
4519 |
+-#ifdef DEBUG |
4520 |
+- printk(KERN_CONT "\n"); |
4521 |
+-#endif |
4522 |
+- |
4523 |
+- if (!hdmi->edid_blocks) { |
4524 |
+- fb_edid_to_monspecs(edid, &hdmi->monspec); |
4525 |
+- hdmi->edid_blocks = edid[126] + 1; |
4526 |
+- |
4527 |
+- dev_dbg(hdmi->dev, "%d main modes, %d extension blocks\n", |
4528 |
+- hdmi->monspec.modedb_len, hdmi->edid_blocks - 1); |
4529 |
+- } else { |
4530 |
+- dev_dbg(hdmi->dev, "Extension %u detected, DTD start %u\n", |
4531 |
+- edid[0], edid[2]); |
4532 |
+- fb_edid_add_monspecs(edid, &hdmi->monspec); |
4533 |
+- } |
4534 |
+- |
4535 |
+- if (hdmi->edid_blocks > hdmi->edid_segment_nr * 2 + |
4536 |
+- (hdmi->edid_block_addr >> 7) + 1) { |
4537 |
+- /* More blocks to read */ |
4538 |
+- if (hdmi->edid_block_addr) { |
4539 |
+- hdmi->edid_block_addr = 0; |
4540 |
+- hdmi->edid_segment_nr++; |
4541 |
+- } else { |
4542 |
+- hdmi->edid_block_addr = 0x80; |
4543 |
+- } |
4544 |
+- /* Set EDID word address */ |
4545 |
+- hdmi_write(hdmi, hdmi->edid_block_addr, HDMI_EDID_WORD_ADDRESS); |
4546 |
+- /* Enable EDID interrupt */ |
4547 |
+- hdmi_write(hdmi, 0xC6, HDMI_INTERRUPT_MASK_1); |
4548 |
+- /* Set EDID segment pointer - starts reading EDID */ |
4549 |
+- hdmi_write(hdmi, hdmi->edid_segment_nr, HDMI_EDID_SEGMENT_POINTER); |
4550 |
+- return -EAGAIN; |
4551 |
+- } |
4552 |
+- |
4553 |
+- /* All E-EDID blocks ready */ |
4554 |
+- dev_dbg(hdmi->dev, "%d main and extended modes\n", hdmi->monspec.modedb_len); |
4555 |
+- |
4556 |
+- fb_get_options("sh_mobile_lcdc", &forced); |
4557 |
+- if (forced && *forced) { |
4558 |
+- /* Only primitive parsing so far */ |
4559 |
+- i = sscanf(forced, "%ux%u@%u", |
4560 |
+- &f_width, &f_height, &f_refresh); |
4561 |
+- if (i < 2) { |
4562 |
+- f_width = 0; |
4563 |
+- f_height = 0; |
4564 |
+- } else { |
4565 |
+- /* The user wants us to use the EDID data */ |
4566 |
+- scanning = true; |
4567 |
+- } |
4568 |
+- dev_dbg(hdmi->dev, "Forced mode %ux%u@%uHz\n", |
4569 |
+- f_width, f_height, f_refresh); |
4570 |
+- } |
4571 |
+- |
4572 |
+- /* Walk monitor modes to find the best or the exact match */ |
4573 |
+- for (i = 0, mode = hdmi->monspec.modedb; |
4574 |
+- i < hdmi->monspec.modedb_len && scanning; |
4575 |
+- i++, mode++) { |
4576 |
+- unsigned long rate_error; |
4577 |
+- |
4578 |
+- if (!f_width && !f_height) { |
4579 |
+- /* |
4580 |
+- * A parameter string "video=sh_mobile_lcdc:0x0" means |
4581 |
+- * use the preferred EDID mode. If it is rejected by |
4582 |
+- * .fb_check_var(), keep looking, until an acceptable |
4583 |
+- * one is found. |
4584 |
+- */ |
4585 |
+- if ((mode->flag & FB_MODE_IS_FIRST) || preferred_bad) |
4586 |
+- scanning = false; |
4587 |
+- else |
4588 |
+- continue; |
4589 |
+- } else if (f_width != mode->xres || f_height != mode->yres) { |
4590 |
+- /* No interest in unmatching modes */ |
4591 |
+- continue; |
4592 |
+- } |
4593 |
+- |
4594 |
+- rate_error = sh_hdmi_rate_error(hdmi, mode, hdmi_rate, parent_rate); |
4595 |
+- |
4596 |
+- if (scanning) { |
4597 |
+- if (f_refresh == mode->refresh || (!f_refresh && !rate_error)) |
4598 |
+- /* |
4599 |
+- * Exact match if either the refresh rate |
4600 |
+- * matches or it hasn't been specified and we've |
4601 |
+- * found a mode, for which we can configure the |
4602 |
+- * clock precisely |
4603 |
+- */ |
4604 |
+- scanning = false; |
4605 |
+- else if (found && found_rate_error <= rate_error) |
4606 |
+- /* |
4607 |
+- * We otherwise search for the closest matching |
4608 |
+- * clock rate - either if no refresh rate has |
4609 |
+- * been specified or we cannot find an exactly |
4610 |
+- * matching one |
4611 |
+- */ |
4612 |
+- continue; |
4613 |
+- } |
4614 |
+- |
4615 |
+- /* Check if supported: sufficient fb memory, supported clock-rate */ |
4616 |
+- if (ch && ch->notify && |
4617 |
+- ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_MODE, mode, |
4618 |
+- NULL)) { |
4619 |
+- scanning = true; |
4620 |
+- preferred_bad = true; |
4621 |
+- continue; |
4622 |
+- } |
4623 |
+- |
4624 |
+- found = mode; |
4625 |
+- found_rate_error = rate_error; |
4626 |
+- use_edid_mode = true; |
4627 |
+- } |
4628 |
+- |
4629 |
+- /* |
4630 |
+- * TODO 1: if no default mode is present, postpone running the config |
4631 |
+- * until after the LCDC channel is initialized. |
4632 |
+- * TODO 2: consider registering the HDMI platform device from the LCDC |
4633 |
+- * driver. |
4634 |
+- */ |
4635 |
+- if (!found && hdmi->entity.def_mode.xres != 0) { |
4636 |
+- found = &hdmi->entity.def_mode; |
4637 |
+- found_rate_error = sh_hdmi_rate_error(hdmi, found, hdmi_rate, |
4638 |
+- parent_rate); |
4639 |
+- } |
4640 |
+- |
4641 |
+- /* No cookie today */ |
4642 |
+- if (!found) |
4643 |
+- return -ENXIO; |
4644 |
+- |
4645 |
+- if (found->xres == 640 && found->yres == 480 && found->refresh == 60) |
4646 |
+- hdmi->preprogrammed_vic = 1; |
4647 |
+- else if (found->xres == 720 && found->yres == 480 && found->refresh == 60) |
4648 |
+- hdmi->preprogrammed_vic = 2; |
4649 |
+- else if (found->xres == 720 && found->yres == 576 && found->refresh == 50) |
4650 |
+- hdmi->preprogrammed_vic = 17; |
4651 |
+- else if (found->xres == 1280 && found->yres == 720 && found->refresh == 60) |
4652 |
+- hdmi->preprogrammed_vic = 4; |
4653 |
+- else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 24) |
4654 |
+- hdmi->preprogrammed_vic = 32; |
4655 |
+- else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 50) |
4656 |
+- hdmi->preprogrammed_vic = 31; |
4657 |
+- else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 60) |
4658 |
+- hdmi->preprogrammed_vic = 16; |
4659 |
+- else |
4660 |
+- hdmi->preprogrammed_vic = 0; |
4661 |
+- |
4662 |
+- dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), " |
4663 |
+- "clock error %luHz\n", use_edid_mode ? "EDID" : "default", |
4664 |
+- hdmi->preprogrammed_vic ? "VIC" : "external", found->xres, |
4665 |
+- found->yres, found->refresh, PICOS2KHZ(found->pixclock) * 1000, |
4666 |
+- found_rate_error); |
4667 |
+- |
4668 |
+- hdmi->mode = *found; |
4669 |
+- sh_hdmi_external_video_param(hdmi); |
4670 |
+- |
4671 |
+- return 0; |
4672 |
+-} |
4673 |
+- |
4674 |
+-static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id) |
4675 |
+-{ |
4676 |
+- struct sh_hdmi *hdmi = dev_id; |
4677 |
+- u8 status1, status2, mask1, mask2; |
4678 |
+- |
4679 |
+- /* mode_b and PLLA and PLLB reset */ |
4680 |
+- hdmi_bit_set(hdmi, 0xFC, 0x2C, HDMI_SYSTEM_CTRL); |
4681 |
+- |
4682 |
+- /* How long shall reset be held? */ |
4683 |
+- udelay(10); |
4684 |
+- |
4685 |
+- /* mode_b and PLLA and PLLB reset release */ |
4686 |
+- hdmi_bit_set(hdmi, 0xFC, 0x20, HDMI_SYSTEM_CTRL); |
4687 |
+- |
4688 |
+- status1 = hdmi_read(hdmi, HDMI_INTERRUPT_STATUS_1); |
4689 |
+- status2 = hdmi_read(hdmi, HDMI_INTERRUPT_STATUS_2); |
4690 |
+- |
4691 |
+- mask1 = hdmi_read(hdmi, HDMI_INTERRUPT_MASK_1); |
4692 |
+- mask2 = hdmi_read(hdmi, HDMI_INTERRUPT_MASK_2); |
4693 |
+- |
4694 |
+- /* Correct would be to ack only set bits, but the datasheet requires 0xff */ |
4695 |
+- hdmi_write(hdmi, 0xFF, HDMI_INTERRUPT_STATUS_1); |
4696 |
+- hdmi_write(hdmi, 0xFF, HDMI_INTERRUPT_STATUS_2); |
4697 |
+- |
4698 |
+- if (printk_ratelimit()) |
4699 |
+- dev_dbg(hdmi->dev, "IRQ #%d: Status #1: 0x%x & 0x%x, #2: 0x%x & 0x%x\n", |
4700 |
+- irq, status1, mask1, status2, mask2); |
4701 |
+- |
4702 |
+- if (!((status1 & mask1) | (status2 & mask2))) { |
4703 |
+- return IRQ_NONE; |
4704 |
+- } else if (status1 & 0xc0) { |
4705 |
+- u8 msens; |
4706 |
+- |
4707 |
+- /* Datasheet specifies 10ms... */ |
4708 |
+- udelay(500); |
4709 |
+- |
4710 |
+- msens = hdmi_read(hdmi, HDMI_HOT_PLUG_MSENS_STATUS); |
4711 |
+- dev_dbg(hdmi->dev, "MSENS 0x%x\n", msens); |
4712 |
+- /* Check, if hot plug & MSENS pin status are both high */ |
4713 |
+- if ((msens & 0xC0) == 0xC0) { |
4714 |
+- /* Display plug in */ |
4715 |
+- hdmi->edid_segment_nr = 0; |
4716 |
+- hdmi->edid_block_addr = 0; |
4717 |
+- hdmi->edid_blocks = 0; |
4718 |
+- hdmi->hp_state = HDMI_HOTPLUG_CONNECTED; |
4719 |
+- |
4720 |
+- /* Set EDID word address */ |
4721 |
+- hdmi_write(hdmi, 0x00, HDMI_EDID_WORD_ADDRESS); |
4722 |
+- /* Enable EDID interrupt */ |
4723 |
+- hdmi_write(hdmi, 0xC6, HDMI_INTERRUPT_MASK_1); |
4724 |
+- /* Set EDID segment pointer - starts reading EDID */ |
4725 |
+- hdmi_write(hdmi, 0x00, HDMI_EDID_SEGMENT_POINTER); |
4726 |
+- } else if (!(status1 & 0x80)) { |
4727 |
+- /* Display unplug, beware multiple interrupts */ |
4728 |
+- if (hdmi->hp_state != HDMI_HOTPLUG_DISCONNECTED) { |
4729 |
+- hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED; |
4730 |
+- schedule_delayed_work(&hdmi->edid_work, 0); |
4731 |
+- } |
4732 |
+- /* display_off will switch back to mode_a */ |
4733 |
+- } |
4734 |
+- } else if (status1 & 2) { |
4735 |
+- /* EDID error interrupt: retry */ |
4736 |
+- /* Set EDID word address */ |
4737 |
+- hdmi_write(hdmi, hdmi->edid_block_addr, HDMI_EDID_WORD_ADDRESS); |
4738 |
+- /* Set EDID segment pointer */ |
4739 |
+- hdmi_write(hdmi, hdmi->edid_segment_nr, HDMI_EDID_SEGMENT_POINTER); |
4740 |
+- } else if (status1 & 4) { |
4741 |
+- /* Disable EDID interrupt */ |
4742 |
+- hdmi_write(hdmi, 0xC0, HDMI_INTERRUPT_MASK_1); |
4743 |
+- schedule_delayed_work(&hdmi->edid_work, msecs_to_jiffies(10)); |
4744 |
+- } |
4745 |
+- |
4746 |
+- return IRQ_HANDLED; |
4747 |
+-} |
4748 |
+- |
4749 |
+-static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity) |
4750 |
+-{ |
4751 |
+- struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity); |
4752 |
+- |
4753 |
+- dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, |
4754 |
+- hdmi->hp_state); |
4755 |
+- |
4756 |
+- /* |
4757 |
+- * hp_state can be set to |
4758 |
+- * HDMI_HOTPLUG_DISCONNECTED: on monitor unplug |
4759 |
+- * HDMI_HOTPLUG_CONNECTED: on monitor plug-in |
4760 |
+- * HDMI_HOTPLUG_EDID_DONE: on EDID read completion |
4761 |
+- */ |
4762 |
+- if (hdmi->hp_state == HDMI_HOTPLUG_EDID_DONE) { |
4763 |
+- /* PS mode d->e. All functions are active */ |
4764 |
+- hdmi_bit_set(hdmi, 0xFC, 0x80, HDMI_SYSTEM_CTRL); |
4765 |
+- dev_dbg(hdmi->dev, "HDMI running\n"); |
4766 |
+- } |
4767 |
+- |
4768 |
+- return hdmi->hp_state == HDMI_HOTPLUG_DISCONNECTED |
4769 |
+- ? SH_MOBILE_LCDC_DISPLAY_DISCONNECTED |
4770 |
+- : SH_MOBILE_LCDC_DISPLAY_CONNECTED; |
4771 |
+-} |
4772 |
+- |
4773 |
+-static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity) |
4774 |
+-{ |
4775 |
+- struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity); |
4776 |
+- |
4777 |
+- dev_dbg(hdmi->dev, "%s(%p)\n", __func__, hdmi); |
4778 |
+- /* PS mode e->a */ |
4779 |
+- hdmi_bit_set(hdmi, 0xFC, 0x10, HDMI_SYSTEM_CTRL); |
4780 |
+-} |
4781 |
+- |
4782 |
+-static const struct sh_mobile_lcdc_entity_ops sh_hdmi_ops = { |
4783 |
+- .display_on = sh_hdmi_display_on, |
4784 |
+- .display_off = sh_hdmi_display_off, |
4785 |
+-}; |
4786 |
+- |
4787 |
+-/** |
4788 |
+- * sh_hdmi_clk_configure() - set HDMI clock frequency and enable the clock |
4789 |
+- * @hdmi: driver context |
4790 |
+- * @hdmi_rate: HDMI clock frequency in Hz |
4791 |
+- * @parent_rate: if != 0 - set parent clock rate for optimal precision |
4792 |
+- * return: configured positive rate if successful |
4793 |
+- * 0 if couldn't set the rate, but managed to enable the |
4794 |
+- * clock, negative error, if couldn't enable the clock |
4795 |
+- */ |
4796 |
+-static long sh_hdmi_clk_configure(struct sh_hdmi *hdmi, unsigned long hdmi_rate, |
4797 |
+- unsigned long parent_rate) |
4798 |
+-{ |
4799 |
+- int ret; |
4800 |
+- |
4801 |
+- if (parent_rate && clk_get_parent(hdmi->hdmi_clk)) { |
4802 |
+- ret = clk_set_rate(clk_get_parent(hdmi->hdmi_clk), parent_rate); |
4803 |
+- if (ret < 0) { |
4804 |
+- dev_warn(hdmi->dev, "Cannot set parent rate %ld: %d\n", parent_rate, ret); |
4805 |
+- hdmi_rate = clk_round_rate(hdmi->hdmi_clk, hdmi_rate); |
4806 |
+- } else { |
4807 |
+- dev_dbg(hdmi->dev, "HDMI set parent frequency %lu\n", parent_rate); |
4808 |
+- } |
4809 |
+- } |
4810 |
+- |
4811 |
+- ret = clk_set_rate(hdmi->hdmi_clk, hdmi_rate); |
4812 |
+- if (ret < 0) { |
4813 |
+- dev_warn(hdmi->dev, "Cannot set rate %ld: %d\n", hdmi_rate, ret); |
4814 |
+- hdmi_rate = 0; |
4815 |
+- } else { |
4816 |
+- dev_dbg(hdmi->dev, "HDMI set frequency %lu\n", hdmi_rate); |
4817 |
+- } |
4818 |
+- |
4819 |
+- return hdmi_rate; |
4820 |
+-} |
4821 |
+- |
4822 |
+-/* Hotplug interrupt occurred, read EDID */ |
4823 |
+-static void sh_hdmi_edid_work_fn(struct work_struct *work) |
4824 |
+-{ |
4825 |
+- struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work); |
4826 |
+- struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc; |
4827 |
+- int ret; |
4828 |
+- |
4829 |
+- dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__, hdmi, |
4830 |
+- hdmi->hp_state); |
4831 |
+- |
4832 |
+- if (hdmi->hp_state == HDMI_HOTPLUG_CONNECTED) { |
4833 |
+- unsigned long parent_rate = 0, hdmi_rate; |
4834 |
+- |
4835 |
+- ret = sh_hdmi_read_edid(hdmi, &hdmi_rate, &parent_rate); |
4836 |
+- if (ret < 0) |
4837 |
+- goto out; |
4838 |
+- |
4839 |
+- hdmi->hp_state = HDMI_HOTPLUG_EDID_DONE; |
4840 |
+- |
4841 |
+- /* Reconfigure the clock */ |
4842 |
+- ret = sh_hdmi_clk_configure(hdmi, hdmi_rate, parent_rate); |
4843 |
+- if (ret < 0) |
4844 |
+- goto out; |
4845 |
+- |
4846 |
+- msleep(10); |
4847 |
+- sh_hdmi_configure(hdmi); |
4848 |
+- /* Switched to another (d) power-save mode */ |
4849 |
+- msleep(10); |
4850 |
+- |
4851 |
+- if (ch && ch->notify) |
4852 |
+- ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT, |
4853 |
+- &hdmi->mode, &hdmi->monspec); |
4854 |
+- } else { |
4855 |
+- hdmi->monspec.modedb_len = 0; |
4856 |
+- fb_destroy_modedb(hdmi->monspec.modedb); |
4857 |
+- hdmi->monspec.modedb = NULL; |
4858 |
+- |
4859 |
+- if (ch && ch->notify) |
4860 |
+- ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT, |
4861 |
+- NULL, NULL); |
4862 |
+- |
4863 |
+- ret = 0; |
4864 |
+- } |
4865 |
+- |
4866 |
+-out: |
4867 |
+- if (ret < 0 && ret != -EAGAIN) |
4868 |
+- hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED; |
4869 |
+- |
4870 |
+- dev_dbg(hdmi->dev, "%s(%p): end\n", __func__, hdmi); |
4871 |
+-} |
4872 |
+- |
4873 |
+-static void sh_hdmi_htop1_init(struct sh_hdmi *hdmi) |
4874 |
+-{ |
4875 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_HTOP_DCL_MODE); |
4876 |
+- hdmi_htop1_write(hdmi, 0x0000000b, 0x0010); |
4877 |
+- hdmi_htop1_write(hdmi, 0x00006710, HDMI_HTOP1_HTOP_DCL_FRC_MODE); |
4878 |
+- hdmi_htop1_write(hdmi, 0x01020406, HDMI_HTOP1_HTOP_DCL_FIL_PARA_Y1_1); |
4879 |
+- hdmi_htop1_write(hdmi, 0x07080806, HDMI_HTOP1_HTOP_DCL_FIL_PARA_Y1_2); |
4880 |
+- hdmi_htop1_write(hdmi, 0x01020406, HDMI_HTOP1_HTOP_DCL_FIL_PARA_CB1_1); |
4881 |
+- hdmi_htop1_write(hdmi, 0x07080806, HDMI_HTOP1_HTOP_DCL_FIL_PARA_CB1_2); |
4882 |
+- hdmi_htop1_write(hdmi, 0x01020406, HDMI_HTOP1_HTOP_DCL_FIL_PARA_CR1_1); |
4883 |
+- hdmi_htop1_write(hdmi, 0x07080806, HDMI_HTOP1_HTOP_DCL_FIL_PARA_CR1_2); |
4884 |
+- hdmi_htop1_write(hdmi, 0x01020406, HDMI_HTOP1_HTOP_DCL_FIL_PARA_Y2_1); |
4885 |
+- hdmi_htop1_write(hdmi, 0x07080806, HDMI_HTOP1_HTOP_DCL_FIL_PARA_Y2_2); |
4886 |
+- hdmi_htop1_write(hdmi, 0x01020406, HDMI_HTOP1_HTOP_DCL_FIL_PARA_CB2_1); |
4887 |
+- hdmi_htop1_write(hdmi, 0x07080806, HDMI_HTOP1_HTOP_DCL_FIL_PARA_CB2_2); |
4888 |
+- hdmi_htop1_write(hdmi, 0x01020406, HDMI_HTOP1_HTOP_DCL_FIL_PARA_CR2_1); |
4889 |
+- hdmi_htop1_write(hdmi, 0x07080806, HDMI_HTOP1_HTOP_DCL_FIL_PARA_CR2_2); |
4890 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_HTOP_DCL_COR_PARA_Y1); |
4891 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_HTOP_DCL_COR_PARA_CB1); |
4892 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_HTOP_DCL_COR_PARA_CR1); |
4893 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_HTOP_DCL_COR_PARA_Y2); |
4894 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_HTOP_DCL_COR_PARA_CB2); |
4895 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_HTOP_DCL_COR_PARA_CR2); |
4896 |
+- hdmi_htop1_write(hdmi, 0x00000008, HDMI_HTOP1_CURRENT); |
4897 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_TISEMP0_1); |
4898 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_TISEMP2_C); |
4899 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_PHY_TEST_MODE); |
4900 |
+- hdmi_htop1_write(hdmi, 0x00000081, HDMI_HTOP1_TISIDRV); |
4901 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_PLLBW); |
4902 |
+- hdmi_htop1_write(hdmi, 0x0000000f, HDMI_HTOP1_TISEN); |
4903 |
+- hdmi_htop1_write(hdmi, 0x0000000f, HDMI_HTOP1_TISDREN); |
4904 |
+- hdmi_htop1_write(hdmi, 0x00000003, HDMI_HTOP1_ENABLE_SELECTOR); |
4905 |
+- hdmi_htop1_write(hdmi, 0x00000001, HDMI_HTOP1_MACRO_RESET); |
4906 |
+- hdmi_htop1_write(hdmi, 0x00000016, HDMI_HTOP1_CISRANGE); |
4907 |
+- msleep(100); |
4908 |
+- hdmi_htop1_write(hdmi, 0x00000001, HDMI_HTOP1_ENABLE_SELECTOR); |
4909 |
+- msleep(100); |
4910 |
+- hdmi_htop1_write(hdmi, 0x00000003, HDMI_HTOP1_ENABLE_SELECTOR); |
4911 |
+- hdmi_htop1_write(hdmi, 0x00000001, HDMI_HTOP1_MACRO_RESET); |
4912 |
+- hdmi_htop1_write(hdmi, 0x0000000f, HDMI_HTOP1_TISEN); |
4913 |
+- hdmi_htop1_write(hdmi, 0x0000000f, HDMI_HTOP1_TISDREN); |
4914 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_VIDEO_INPUT); |
4915 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_CLK_TO_PHY); |
4916 |
+- hdmi_htop1_write(hdmi, 0x00000000, HDMI_HTOP1_VIDEO_INPUT2); |
4917 |
+- hdmi_htop1_write(hdmi, 0x0000000a, HDMI_HTOP1_CLK_SET); |
4918 |
+-} |
4919 |
+- |
4920 |
+-static int __init sh_hdmi_probe(struct platform_device *pdev) |
4921 |
+-{ |
4922 |
+- struct sh_mobile_hdmi_info *pdata = dev_get_platdata(&pdev->dev); |
4923 |
+- struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
4924 |
+- struct resource *htop1_res; |
4925 |
+- int irq = platform_get_irq(pdev, 0), ret; |
4926 |
+- struct sh_hdmi *hdmi; |
4927 |
+- long rate; |
4928 |
+- |
4929 |
+- if (!res || !pdata || irq < 0) |
4930 |
+- return -ENODEV; |
4931 |
+- |
4932 |
+- htop1_res = NULL; |
4933 |
+- if (pdata->flags & HDMI_HAS_HTOP1) { |
4934 |
+- htop1_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
4935 |
+- if (!htop1_res) { |
4936 |
+- dev_err(&pdev->dev, "htop1 needs register base\n"); |
4937 |
+- return -EINVAL; |
4938 |
+- } |
4939 |
+- } |
4940 |
+- |
4941 |
+- hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); |
4942 |
+- if (!hdmi) { |
4943 |
+- dev_err(&pdev->dev, "Cannot allocate device data\n"); |
4944 |
+- return -ENOMEM; |
4945 |
+- } |
4946 |
+- |
4947 |
+- hdmi->dev = &pdev->dev; |
4948 |
+- hdmi->entity.owner = THIS_MODULE; |
4949 |
+- hdmi->entity.ops = &sh_hdmi_ops; |
4950 |
+- hdmi->irq = irq; |
4951 |
+- |
4952 |
+- hdmi->hdmi_clk = clk_get(&pdev->dev, "ick"); |
4953 |
+- if (IS_ERR(hdmi->hdmi_clk)) { |
4954 |
+- ret = PTR_ERR(hdmi->hdmi_clk); |
4955 |
+- dev_err(&pdev->dev, "Unable to get clock: %d\n", ret); |
4956 |
+- return ret; |
4957 |
+- } |
4958 |
+- |
4959 |
+- /* select register access functions */ |
4960 |
+- if (pdata->flags & HDMI_32BIT_REG) { |
4961 |
+- hdmi->write = __hdmi_write32; |
4962 |
+- hdmi->read = __hdmi_read32; |
4963 |
+- } else { |
4964 |
+- hdmi->write = __hdmi_write8; |
4965 |
+- hdmi->read = __hdmi_read8; |
4966 |
+- } |
4967 |
+- |
4968 |
+- /* An arbitrary relaxed pixclock just to get things started: from standard 480p */ |
4969 |
+- rate = clk_round_rate(hdmi->hdmi_clk, PICOS2KHZ(37037)); |
4970 |
+- if (rate > 0) |
4971 |
+- rate = sh_hdmi_clk_configure(hdmi, rate, 0); |
4972 |
+- |
4973 |
+- if (rate < 0) { |
4974 |
+- ret = rate; |
4975 |
+- goto erate; |
4976 |
+- } |
4977 |
+- |
4978 |
+- ret = clk_prepare_enable(hdmi->hdmi_clk); |
4979 |
+- if (ret < 0) { |
4980 |
+- dev_err(hdmi->dev, "Cannot enable clock: %d\n", ret); |
4981 |
+- goto erate; |
4982 |
+- } |
4983 |
+- |
4984 |
+- dev_dbg(&pdev->dev, "Enabled HDMI clock at %luHz\n", rate); |
4985 |
+- |
4986 |
+- if (!request_mem_region(res->start, resource_size(res), dev_name(&pdev->dev))) { |
4987 |
+- dev_err(&pdev->dev, "HDMI register region already claimed\n"); |
4988 |
+- ret = -EBUSY; |
4989 |
+- goto ereqreg; |
4990 |
+- } |
4991 |
+- |
4992 |
+- hdmi->base = ioremap(res->start, resource_size(res)); |
4993 |
+- if (!hdmi->base) { |
4994 |
+- dev_err(&pdev->dev, "HDMI register region already claimed\n"); |
4995 |
+- ret = -ENOMEM; |
4996 |
+- goto emap; |
4997 |
+- } |
4998 |
+- |
4999 |
+- platform_set_drvdata(pdev, &hdmi->entity); |
5000 |
+- |
5001 |
+- INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn); |
5002 |
+- |
5003 |
+- pm_runtime_enable(&pdev->dev); |
5004 |
+- pm_runtime_get_sync(&pdev->dev); |
5005 |
+- |
5006 |
+- /* init interrupt polarity */ |
5007 |
+- if (pdata->flags & HDMI_OUTPUT_PUSH_PULL) |
5008 |
+- hdmi_bit_set(hdmi, 0x02, 0x02, HDMI_SYSTEM_CTRL); |
5009 |
+- |
5010 |
+- if (pdata->flags & HDMI_OUTPUT_POLARITY_HI) |
5011 |
+- hdmi_bit_set(hdmi, 0x01, 0x01, HDMI_SYSTEM_CTRL); |
5012 |
+- |
5013 |
+- /* enable htop1 register if needed */ |
5014 |
+- if (htop1_res) { |
5015 |
+- hdmi->htop1 = ioremap(htop1_res->start, resource_size(htop1_res)); |
5016 |
+- if (!hdmi->htop1) { |
5017 |
+- dev_err(&pdev->dev, "control register region already claimed\n"); |
5018 |
+- ret = -ENOMEM; |
5019 |
+- goto emap_htop1; |
5020 |
+- } |
5021 |
+- sh_hdmi_htop1_init(hdmi); |
5022 |
+- } |
5023 |
+- |
5024 |
+- /* Product and revision IDs are 0 in sh-mobile version */ |
5025 |
+- dev_info(&pdev->dev, "Detected HDMI controller 0x%x:0x%x\n", |
5026 |
+- hdmi_read(hdmi, HDMI_PRODUCT_ID), hdmi_read(hdmi, HDMI_REVISION_ID)); |
5027 |
+- |
5028 |
+- ret = request_irq(irq, sh_hdmi_hotplug, 0, |
5029 |
+- dev_name(&pdev->dev), hdmi); |
5030 |
+- if (ret < 0) { |
5031 |
+- dev_err(&pdev->dev, "Unable to request irq: %d\n", ret); |
5032 |
+- goto ereqirq; |
5033 |
+- } |
5034 |
+- |
5035 |
+- ret = snd_soc_register_codec(&pdev->dev, |
5036 |
+- &soc_codec_dev_sh_hdmi, &sh_hdmi_dai, 1); |
5037 |
+- if (ret < 0) { |
5038 |
+- dev_err(&pdev->dev, "codec registration failed\n"); |
5039 |
+- goto ecodec; |
5040 |
+- } |
5041 |
+- |
5042 |
+- return 0; |
5043 |
+- |
5044 |
+-ecodec: |
5045 |
+- free_irq(irq, hdmi); |
5046 |
+-ereqirq: |
5047 |
+- if (hdmi->htop1) |
5048 |
+- iounmap(hdmi->htop1); |
5049 |
+-emap_htop1: |
5050 |
+- pm_runtime_put(&pdev->dev); |
5051 |
+- pm_runtime_disable(&pdev->dev); |
5052 |
+- iounmap(hdmi->base); |
5053 |
+-emap: |
5054 |
+- release_mem_region(res->start, resource_size(res)); |
5055 |
+-ereqreg: |
5056 |
+- clk_disable_unprepare(hdmi->hdmi_clk); |
5057 |
+-erate: |
5058 |
+- clk_put(hdmi->hdmi_clk); |
5059 |
+- |
5060 |
+- return ret; |
5061 |
+-} |
5062 |
+- |
5063 |
+-static int __exit sh_hdmi_remove(struct platform_device *pdev) |
5064 |
+-{ |
5065 |
+- struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev)); |
5066 |
+- struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
5067 |
+- |
5068 |
+- snd_soc_unregister_codec(&pdev->dev); |
5069 |
+- |
5070 |
+- /* No new work will be scheduled, wait for running ISR */ |
5071 |
+- free_irq(hdmi->irq, hdmi); |
5072 |
+- /* Wait for already scheduled work */ |
5073 |
+- cancel_delayed_work_sync(&hdmi->edid_work); |
5074 |
+- pm_runtime_put(&pdev->dev); |
5075 |
+- pm_runtime_disable(&pdev->dev); |
5076 |
+- clk_disable_unprepare(hdmi->hdmi_clk); |
5077 |
+- clk_put(hdmi->hdmi_clk); |
5078 |
+- if (hdmi->htop1) |
5079 |
+- iounmap(hdmi->htop1); |
5080 |
+- iounmap(hdmi->base); |
5081 |
+- release_mem_region(res->start, resource_size(res)); |
5082 |
+- |
5083 |
+- return 0; |
5084 |
+-} |
5085 |
+- |
5086 |
+-static int sh_hdmi_suspend(struct device *dev) |
5087 |
+-{ |
5088 |
+- struct platform_device *pdev = to_platform_device(dev); |
5089 |
+- struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev)); |
5090 |
+- |
5091 |
+- disable_irq(hdmi->irq); |
5092 |
+- /* Wait for already scheduled work */ |
5093 |
+- cancel_delayed_work_sync(&hdmi->edid_work); |
5094 |
+- return 0; |
5095 |
+-} |
5096 |
+- |
5097 |
+-static int sh_hdmi_resume(struct device *dev) |
5098 |
+-{ |
5099 |
+- struct platform_device *pdev = to_platform_device(dev); |
5100 |
+- struct sh_mobile_hdmi_info *pdata = dev_get_platdata(dev); |
5101 |
+- struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev)); |
5102 |
+- |
5103 |
+- /* Re-init interrupt polarity */ |
5104 |
+- if (pdata->flags & HDMI_OUTPUT_PUSH_PULL) |
5105 |
+- hdmi_bit_set(hdmi, 0x02, 0x02, HDMI_SYSTEM_CTRL); |
5106 |
+- |
5107 |
+- if (pdata->flags & HDMI_OUTPUT_POLARITY_HI) |
5108 |
+- hdmi_bit_set(hdmi, 0x01, 0x01, HDMI_SYSTEM_CTRL); |
5109 |
+- |
5110 |
+- /* Re-init htop1 */ |
5111 |
+- if (hdmi->htop1) |
5112 |
+- sh_hdmi_htop1_init(hdmi); |
5113 |
+- |
5114 |
+- /* Now it's safe to enable interrupts again */ |
5115 |
+- enable_irq(hdmi->irq); |
5116 |
+- return 0; |
5117 |
+-} |
5118 |
+- |
5119 |
+-static const struct dev_pm_ops sh_hdmi_pm_ops = { |
5120 |
+- .suspend = sh_hdmi_suspend, |
5121 |
+- .resume = sh_hdmi_resume, |
5122 |
+-}; |
5123 |
+- |
5124 |
+-static struct platform_driver sh_hdmi_driver = { |
5125 |
+- .remove = __exit_p(sh_hdmi_remove), |
5126 |
+- .driver = { |
5127 |
+- .name = "sh-mobile-hdmi", |
5128 |
+- .pm = &sh_hdmi_pm_ops, |
5129 |
+- }, |
5130 |
+-}; |
5131 |
+- |
5132 |
+-module_platform_driver_probe(sh_hdmi_driver, sh_hdmi_probe); |
5133 |
+- |
5134 |
+-MODULE_AUTHOR("Guennadi Liakhovetski <g.liakhovetski@×××.de>"); |
5135 |
+-MODULE_DESCRIPTION("SuperH / ARM-shmobile HDMI driver"); |
5136 |
+-MODULE_LICENSE("GPL v2"); |
5137 |
+diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c |
5138 |
+index 844d0c4da84f..34897aeb4a66 100644 |
5139 |
+--- a/fs/ecryptfs/inode.c |
5140 |
++++ b/fs/ecryptfs/inode.c |
5141 |
+@@ -330,9 +330,9 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry, |
5142 |
+ struct dentry *lower_dentry, |
5143 |
+ struct inode *dir_inode) |
5144 |
+ { |
5145 |
+- struct inode *inode, *lower_inode = d_inode(lower_dentry); |
5146 |
++ struct path *path = ecryptfs_dentry_to_lower_path(dentry->d_parent); |
5147 |
++ struct inode *inode, *lower_inode; |
5148 |
+ struct ecryptfs_dentry_info *dentry_info; |
5149 |
+- struct vfsmount *lower_mnt; |
5150 |
+ int rc = 0; |
5151 |
+ |
5152 |
+ dentry_info = kmem_cache_alloc(ecryptfs_dentry_info_cache, GFP_KERNEL); |
5153 |
+@@ -344,15 +344,22 @@ static int ecryptfs_lookup_interpose(struct dentry *dentry, |
5154 |
+ return -ENOMEM; |
5155 |
+ } |
5156 |
+ |
5157 |
+- lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent)); |
5158 |
+- fsstack_copy_attr_atime(dir_inode, d_inode(lower_dentry->d_parent)); |
5159 |
++ fsstack_copy_attr_atime(dir_inode, d_inode(path->dentry)); |
5160 |
+ BUG_ON(!d_count(lower_dentry)); |
5161 |
+ |
5162 |
+ ecryptfs_set_dentry_private(dentry, dentry_info); |
5163 |
+- dentry_info->lower_path.mnt = lower_mnt; |
5164 |
++ dentry_info->lower_path.mnt = mntget(path->mnt); |
5165 |
+ dentry_info->lower_path.dentry = lower_dentry; |
5166 |
+ |
5167 |
+- if (d_really_is_negative(lower_dentry)) { |
5168 |
++ /* |
5169 |
++ * negative dentry can go positive under us here - its parent is not |
5170 |
++ * locked. That's OK and that could happen just as we return from |
5171 |
++ * ecryptfs_lookup() anyway. Just need to be careful and fetch |
5172 |
++ * ->d_inode only once - it's not stable here. |
5173 |
++ */ |
5174 |
++ lower_inode = READ_ONCE(lower_dentry->d_inode); |
5175 |
++ |
5176 |
++ if (!lower_inode) { |
5177 |
+ /* We want to add because we couldn't find in lower */ |
5178 |
+ d_add(dentry, NULL); |
5179 |
+ return 0; |
5180 |
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
5181 |
+index 928b9e046d8a..de32dfaaa492 100644 |
5182 |
+--- a/fs/f2fs/gc.c |
5183 |
++++ b/fs/f2fs/gc.c |
5184 |
+@@ -880,7 +880,7 @@ stop: |
5185 |
+ |
5186 |
+ put_gc_inode(&gc_list); |
5187 |
+ |
5188 |
+- if (sync) |
5189 |
++ if (sync && !ret) |
5190 |
+ ret = sec_freed ? 0 : -EAGAIN; |
5191 |
+ return ret; |
5192 |
+ } |
5193 |
+diff --git a/fs/fuse/control.c b/fs/fuse/control.c |
5194 |
+index 89a4b231e79c..bb56c6a58fa7 100644 |
5195 |
+--- a/fs/fuse/control.c |
5196 |
++++ b/fs/fuse/control.c |
5197 |
+@@ -107,7 +107,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file, |
5198 |
+ if (!fc) |
5199 |
+ return 0; |
5200 |
+ |
5201 |
+- val = fc->max_background; |
5202 |
++ val = READ_ONCE(fc->max_background); |
5203 |
+ fuse_conn_put(fc); |
5204 |
+ |
5205 |
+ return fuse_conn_limit_read(file, buf, len, ppos, val); |
5206 |
+@@ -144,7 +144,7 @@ static ssize_t fuse_conn_congestion_threshold_read(struct file *file, |
5207 |
+ if (!fc) |
5208 |
+ return 0; |
5209 |
+ |
5210 |
+- val = fc->congestion_threshold; |
5211 |
++ val = READ_ONCE(fc->congestion_threshold); |
5212 |
+ fuse_conn_put(fc); |
5213 |
+ |
5214 |
+ return fuse_conn_limit_read(file, buf, len, ppos, val); |
5215 |
+diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c |
5216 |
+index 9c159e6ad116..e632006a52df 100644 |
5217 |
+--- a/fs/gfs2/rgrp.c |
5218 |
++++ b/fs/gfs2/rgrp.c |
5219 |
+@@ -1228,7 +1228,7 @@ static int update_rgrp_lvb(struct gfs2_rgrpd *rgd) |
5220 |
+ rl_flags = be32_to_cpu(rgd->rd_rgl->rl_flags); |
5221 |
+ rl_flags &= ~GFS2_RDF_MASK; |
5222 |
+ rgd->rd_flags &= GFS2_RDF_MASK; |
5223 |
+- rgd->rd_flags |= (rl_flags | GFS2_RDF_UPTODATE | GFS2_RDF_CHECK); |
5224 |
++ rgd->rd_flags |= (rl_flags | GFS2_RDF_CHECK); |
5225 |
+ if (rgd->rd_rgl->rl_unlinked == 0) |
5226 |
+ rgd->rd_flags &= ~GFS2_RDF_CHECK; |
5227 |
+ rgd->rd_free = be32_to_cpu(rgd->rd_rgl->rl_free); |
5228 |
+diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c |
5229 |
+index 894fb01a91da..a4eb38c1f554 100644 |
5230 |
+--- a/fs/gfs2/super.c |
5231 |
++++ b/fs/gfs2/super.c |
5232 |
+@@ -835,10 +835,10 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp) |
5233 |
+ if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) |
5234 |
+ return error; |
5235 |
+ |
5236 |
++ flush_workqueue(gfs2_delete_workqueue); |
5237 |
+ kthread_stop(sdp->sd_quotad_process); |
5238 |
+ kthread_stop(sdp->sd_logd_process); |
5239 |
+ |
5240 |
+- flush_workqueue(gfs2_delete_workqueue); |
5241 |
+ gfs2_quota_sync(sdp->sd_vfs, 0); |
5242 |
+ gfs2_statfs_sync(sdp->sd_vfs, 0); |
5243 |
+ |
5244 |
+diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c |
5245 |
+index b3b293e2c099..0a379a86ff76 100644 |
5246 |
+--- a/fs/kernfs/symlink.c |
5247 |
++++ b/fs/kernfs/symlink.c |
5248 |
+@@ -63,6 +63,9 @@ static int kernfs_get_target_path(struct kernfs_node *parent, |
5249 |
+ if (base == kn) |
5250 |
+ break; |
5251 |
+ |
5252 |
++ if ((s - path) + 3 >= PATH_MAX) |
5253 |
++ return -ENAMETOOLONG; |
5254 |
++ |
5255 |
+ strcpy(s, "../"); |
5256 |
+ s += 3; |
5257 |
+ base = base->parent; |
5258 |
+@@ -79,7 +82,7 @@ static int kernfs_get_target_path(struct kernfs_node *parent, |
5259 |
+ if (len < 2) |
5260 |
+ return -EINVAL; |
5261 |
+ len--; |
5262 |
+- if ((s - path) + len > PATH_MAX) |
5263 |
++ if ((s - path) + len >= PATH_MAX) |
5264 |
+ return -ENAMETOOLONG; |
5265 |
+ |
5266 |
+ /* reverse fillup of target string from target to base */ |
5267 |
+diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c |
5268 |
+index 5dac3382405c..b50315ad0391 100644 |
5269 |
+--- a/fs/nfs/delegation.c |
5270 |
++++ b/fs/nfs/delegation.c |
5271 |
+@@ -101,7 +101,7 @@ int nfs4_check_delegation(struct inode *inode, fmode_t flags) |
5272 |
+ return nfs4_do_check_delegation(inode, flags, false); |
5273 |
+ } |
5274 |
+ |
5275 |
+-static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid) |
5276 |
++static int nfs_delegation_claim_locks(struct nfs4_state *state, const nfs4_stateid *stateid) |
5277 |
+ { |
5278 |
+ struct inode *inode = state->inode; |
5279 |
+ struct file_lock *fl; |
5280 |
+@@ -116,7 +116,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_ |
5281 |
+ spin_lock(&flctx->flc_lock); |
5282 |
+ restart: |
5283 |
+ list_for_each_entry(fl, list, fl_list) { |
5284 |
+- if (nfs_file_open_context(fl->fl_file) != ctx) |
5285 |
++ if (nfs_file_open_context(fl->fl_file)->state != state) |
5286 |
+ continue; |
5287 |
+ spin_unlock(&flctx->flc_lock); |
5288 |
+ status = nfs4_lock_delegation_recall(fl, state, stateid); |
5289 |
+@@ -163,7 +163,7 @@ again: |
5290 |
+ seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); |
5291 |
+ err = nfs4_open_delegation_recall(ctx, state, stateid, type); |
5292 |
+ if (!err) |
5293 |
+- err = nfs_delegation_claim_locks(ctx, state, stateid); |
5294 |
++ err = nfs_delegation_claim_locks(state, stateid); |
5295 |
+ if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) |
5296 |
+ err = -EAGAIN; |
5297 |
+ mutex_unlock(&sp->so_delegreturn_mutex); |
5298 |
+diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c |
5299 |
+index 4e61388ec03d..08143139b65a 100644 |
5300 |
+--- a/fs/proc/vmcore.c |
5301 |
++++ b/fs/proc/vmcore.c |
5302 |
+@@ -164,6 +164,16 @@ int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma, |
5303 |
+ return remap_pfn_range(vma, from, pfn, size, prot); |
5304 |
+ } |
5305 |
+ |
5306 |
++/* |
5307 |
++ * Architectures which support memory encryption override this. |
5308 |
++ */ |
5309 |
++ssize_t __weak |
5310 |
++copy_oldmem_page_encrypted(unsigned long pfn, char *buf, size_t csize, |
5311 |
++ unsigned long offset, int userbuf) |
5312 |
++{ |
5313 |
++ return copy_oldmem_page(pfn, buf, csize, offset, userbuf); |
5314 |
++} |
5315 |
++ |
5316 |
+ /* |
5317 |
+ * Copy to either kernel or user space |
5318 |
+ */ |
5319 |
+diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h |
5320 |
+index 1383e1c03ff2..e4b945925e40 100644 |
5321 |
+--- a/include/linux/blkdev.h |
5322 |
++++ b/include/linux/blkdev.h |
5323 |
+@@ -199,6 +199,11 @@ struct request { |
5324 |
+ struct request *next_rq; |
5325 |
+ }; |
5326 |
+ |
5327 |
++static inline bool blk_rq_is_passthrough(struct request *rq) |
5328 |
++{ |
5329 |
++ return rq->cmd_type != REQ_TYPE_FS; |
5330 |
++} |
5331 |
++ |
5332 |
+ static inline unsigned short req_get_ioprio(struct request *req) |
5333 |
+ { |
5334 |
+ return req->ioprio; |
5335 |
+@@ -582,9 +587,10 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) |
5336 |
+ ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ |
5337 |
+ REQ_FAILFAST_DRIVER)) |
5338 |
+ |
5339 |
+-#define blk_account_rq(rq) \ |
5340 |
+- (((rq)->cmd_flags & REQ_STARTED) && \ |
5341 |
+- ((rq)->cmd_type == REQ_TYPE_FS)) |
5342 |
++static inline bool blk_account_rq(struct request *rq) |
5343 |
++{ |
5344 |
++ return (rq->cmd_flags & REQ_STARTED) && !blk_rq_is_passthrough(rq); |
5345 |
++} |
5346 |
+ |
5347 |
+ #define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) |
5348 |
+ #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) |
5349 |
+@@ -645,7 +651,7 @@ static inline void blk_clear_rl_full(struct request_list *rl, bool sync) |
5350 |
+ |
5351 |
+ static inline bool rq_mergeable(struct request *rq) |
5352 |
+ { |
5353 |
+- if (rq->cmd_type != REQ_TYPE_FS) |
5354 |
++ if (blk_rq_is_passthrough(rq)) |
5355 |
+ return false; |
5356 |
+ |
5357 |
+ if (rq->cmd_flags & REQ_NOMERGE_FLAGS) |
5358 |
+@@ -890,7 +896,7 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq) |
5359 |
+ { |
5360 |
+ struct request_queue *q = rq->q; |
5361 |
+ |
5362 |
+- if (unlikely(rq->cmd_type != REQ_TYPE_FS)) |
5363 |
++ if (blk_rq_is_passthrough(rq)) |
5364 |
+ return q->limits.max_hw_sectors; |
5365 |
+ |
5366 |
+ if (!q->limits.chunk_sectors || (rq->cmd_flags & REQ_DISCARD)) |
5367 |
+diff --git a/include/linux/cpufeature.h b/include/linux/cpufeature.h |
5368 |
+index 986c06c88d81..84d3c81b5978 100644 |
5369 |
+--- a/include/linux/cpufeature.h |
5370 |
++++ b/include/linux/cpufeature.h |
5371 |
+@@ -45,7 +45,7 @@ |
5372 |
+ * 'asm/cpufeature.h' of your favorite architecture. |
5373 |
+ */ |
5374 |
+ #define module_cpu_feature_match(x, __initfunc) \ |
5375 |
+-static struct cpu_feature const cpu_feature_match_ ## x[] = \ |
5376 |
++static struct cpu_feature const __maybe_unused cpu_feature_match_ ## x[] = \ |
5377 |
+ { { .feature = cpu_feature(x) }, { } }; \ |
5378 |
+ MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \ |
5379 |
+ \ |
5380 |
+diff --git a/include/linux/edac.h b/include/linux/edac.h |
5381 |
+index 4fe67b853de0..9bb4f3311e13 100644 |
5382 |
+--- a/include/linux/edac.h |
5383 |
++++ b/include/linux/edac.h |
5384 |
+@@ -17,6 +17,7 @@ |
5385 |
+ #include <linux/completion.h> |
5386 |
+ #include <linux/workqueue.h> |
5387 |
+ #include <linux/debugfs.h> |
5388 |
++#include <linux/numa.h> |
5389 |
+ |
5390 |
+ struct device; |
5391 |
+ |
5392 |
+@@ -778,6 +779,6 @@ struct mem_ctl_info { |
5393 |
+ /* |
5394 |
+ * Maximum number of memory controllers in the coherent fabric. |
5395 |
+ */ |
5396 |
+-#define EDAC_MAX_MCS 16 |
5397 |
++#define EDAC_MAX_MCS 2 * MAX_NUMNODES |
5398 |
+ |
5399 |
+ #endif |
5400 |
+diff --git a/include/linux/fb.h b/include/linux/fb.h |
5401 |
+index 3d003805aac3..b48a14e5424e 100644 |
5402 |
+--- a/include/linux/fb.h |
5403 |
++++ b/include/linux/fb.h |
5404 |
+@@ -716,8 +716,6 @@ extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); |
5405 |
+ extern const unsigned char *fb_firmware_edid(struct device *device); |
5406 |
+ extern void fb_edid_to_monspecs(unsigned char *edid, |
5407 |
+ struct fb_monspecs *specs); |
5408 |
+-extern void fb_edid_add_monspecs(unsigned char *edid, |
5409 |
+- struct fb_monspecs *specs); |
5410 |
+ extern void fb_destroy_modedb(struct fb_videomode *modedb); |
5411 |
+ extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); |
5412 |
+ extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter); |
5413 |
+@@ -791,7 +789,6 @@ struct dmt_videomode { |
5414 |
+ |
5415 |
+ extern const char *fb_mode_option; |
5416 |
+ extern const struct fb_videomode vesa_modes[]; |
5417 |
+-extern const struct fb_videomode cea_modes[65]; |
5418 |
+ extern const struct dmt_videomode dmt_modes[]; |
5419 |
+ |
5420 |
+ struct fb_modelist { |
5421 |
+diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h |
5422 |
+index e353f6600b0b..27dbab59f034 100644 |
5423 |
+--- a/include/linux/intel-iommu.h |
5424 |
++++ b/include/linux/intel-iommu.h |
5425 |
+@@ -295,7 +295,8 @@ enum { |
5426 |
+ #define QI_DEV_IOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32) |
5427 |
+ #define QI_DEV_IOTLB_QDEP(qdep) (((qdep) & 0x1f) << 16) |
5428 |
+ #define QI_DEV_IOTLB_ADDR(addr) ((u64)(addr) & VTD_PAGE_MASK) |
5429 |
+-#define QI_DEV_IOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52)) |
5430 |
++#define QI_DEV_IOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \ |
5431 |
++ ((u64)((pfsid >> 4) & 0xfff) << 52)) |
5432 |
+ #define QI_DEV_IOTLB_SIZE 1 |
5433 |
+ #define QI_DEV_IOTLB_MAX_INVS 32 |
5434 |
+ |
5435 |
+@@ -320,7 +321,8 @@ enum { |
5436 |
+ #define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32) |
5437 |
+ #define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16) |
5438 |
+ #define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4) |
5439 |
+-#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52)) |
5440 |
++#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \ |
5441 |
++ ((u64)((pfsid >> 4) & 0xfff) << 52)) |
5442 |
+ #define QI_DEV_EIOTLB_MAX_INVS 32 |
5443 |
+ |
5444 |
+ #define QI_PGRP_IDX(idx) (((u64)(idx)) << 55) |
5445 |
+diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h |
5446 |
+index 2a663c6bb428..8850e243c940 100644 |
5447 |
+--- a/include/linux/libfdt_env.h |
5448 |
++++ b/include/linux/libfdt_env.h |
5449 |
+@@ -1,6 +1,7 @@ |
5450 |
+ #ifndef _LIBFDT_ENV_H |
5451 |
+ #define _LIBFDT_ENV_H |
5452 |
+ |
5453 |
++#include <linux/kernel.h> /* For INT_MAX */ |
5454 |
+ #include <linux/string.h> |
5455 |
+ |
5456 |
+ #include <asm/byteorder.h> |
5457 |
+diff --git a/include/linux/platform_data/dma-ep93xx.h b/include/linux/platform_data/dma-ep93xx.h |
5458 |
+index e82c642fa53c..5913be0793a2 100644 |
5459 |
+--- a/include/linux/platform_data/dma-ep93xx.h |
5460 |
++++ b/include/linux/platform_data/dma-ep93xx.h |
5461 |
+@@ -84,7 +84,7 @@ static inline enum dma_transfer_direction |
5462 |
+ ep93xx_dma_chan_direction(struct dma_chan *chan) |
5463 |
+ { |
5464 |
+ if (!ep93xx_dma_chan_is_m2p(chan)) |
5465 |
+- return DMA_NONE; |
5466 |
++ return DMA_TRANS_NONE; |
5467 |
+ |
5468 |
+ /* even channels are for TX, odd for RX */ |
5469 |
+ return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; |
5470 |
+diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h |
5471 |
+index d703f0ef37d8..7d347e8cf944 100644 |
5472 |
+--- a/include/linux/sunrpc/sched.h |
5473 |
++++ b/include/linux/sunrpc/sched.h |
5474 |
+@@ -181,7 +181,6 @@ struct rpc_timer { |
5475 |
+ struct rpc_wait_queue { |
5476 |
+ spinlock_t lock; |
5477 |
+ struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */ |
5478 |
+- pid_t owner; /* process id of last task serviced */ |
5479 |
+ unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */ |
5480 |
+ unsigned char priority; /* current priority */ |
5481 |
+ unsigned char nr; /* # tasks remaining for cookie */ |
5482 |
+@@ -197,7 +196,6 @@ struct rpc_wait_queue { |
5483 |
+ * from a single cookie. The aim is to improve |
5484 |
+ * performance of NFS operations such as read/write. |
5485 |
+ */ |
5486 |
+-#define RPC_BATCH_COUNT 16 |
5487 |
+ #define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0) |
5488 |
+ |
5489 |
+ /* |
5490 |
+diff --git a/include/net/llc.h b/include/net/llc.h |
5491 |
+index 82d989995d18..95e5ced4c133 100644 |
5492 |
+--- a/include/net/llc.h |
5493 |
++++ b/include/net/llc.h |
5494 |
+@@ -66,6 +66,7 @@ struct llc_sap { |
5495 |
+ int sk_count; |
5496 |
+ struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES]; |
5497 |
+ struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES]; |
5498 |
++ struct rcu_head rcu; |
5499 |
+ }; |
5500 |
+ |
5501 |
+ static inline |
5502 |
+diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h |
5503 |
+deleted file mode 100644 |
5504 |
+index 63d20efa254a..000000000000 |
5505 |
+--- a/include/video/sh_mobile_hdmi.h |
5506 |
++++ /dev/null |
5507 |
+@@ -1,49 +0,0 @@ |
5508 |
+-/* |
5509 |
+- * SH-Mobile High-Definition Multimedia Interface (HDMI) |
5510 |
+- * |
5511 |
+- * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@×××.de> |
5512 |
+- * |
5513 |
+- * This program is free software; you can redistribute it and/or modify |
5514 |
+- * it under the terms of the GNU General Public License version 2 as |
5515 |
+- * published by the Free Software Foundation. |
5516 |
+- */ |
5517 |
+- |
5518 |
+-#ifndef SH_MOBILE_HDMI_H |
5519 |
+-#define SH_MOBILE_HDMI_H |
5520 |
+- |
5521 |
+-struct sh_mobile_lcdc_chan_cfg; |
5522 |
+-struct device; |
5523 |
+-struct clk; |
5524 |
+- |
5525 |
+-/* |
5526 |
+- * flags format |
5527 |
+- * |
5528 |
+- * 0x00000CBA |
5529 |
+- * |
5530 |
+- * A: Audio source select |
5531 |
+- * B: Int output option |
5532 |
+- * C: Chip specific option |
5533 |
+- */ |
5534 |
+- |
5535 |
+-/* Audio source select */ |
5536 |
+-#define HDMI_SND_SRC_MASK (0xF << 0) |
5537 |
+-#define HDMI_SND_SRC_I2S (0 << 0) /* default */ |
5538 |
+-#define HDMI_SND_SRC_SPDIF (1 << 0) |
5539 |
+-#define HDMI_SND_SRC_DSD (2 << 0) |
5540 |
+-#define HDMI_SND_SRC_HBR (3 << 0) |
5541 |
+- |
5542 |
+-/* Int output option */ |
5543 |
+-#define HDMI_OUTPUT_PUSH_PULL (1 << 4) /* System control : output mode */ |
5544 |
+-#define HDMI_OUTPUT_POLARITY_HI (1 << 5) /* System control : output polarity */ |
5545 |
+- |
5546 |
+-/* Chip specific option */ |
5547 |
+-#define HDMI_32BIT_REG (1 << 8) |
5548 |
+-#define HDMI_HAS_HTOP1 (1 << 9) |
5549 |
+- |
5550 |
+-struct sh_mobile_hdmi_info { |
5551 |
+- unsigned int flags; |
5552 |
+- long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq, |
5553 |
+- unsigned long *parent_freq); |
5554 |
+-}; |
5555 |
+- |
5556 |
+-#endif |
5557 |
+diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c |
5558 |
+index aad43c88a668..8cad3cd92e23 100644 |
5559 |
+--- a/kernel/events/uprobes.c |
5560 |
++++ b/kernel/events/uprobes.c |
5561 |
+@@ -1836,7 +1836,7 @@ static void handle_trampoline(struct pt_regs *regs) |
5562 |
+ |
5563 |
+ sigill: |
5564 |
+ uprobe_warn(current, "handle uretprobe, sending SIGILL."); |
5565 |
+- force_sig_info(SIGILL, SEND_SIG_FORCED, current); |
5566 |
++ force_sig(SIGILL, current); |
5567 |
+ |
5568 |
+ } |
5569 |
+ |
5570 |
+@@ -1952,7 +1952,7 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs) |
5571 |
+ |
5572 |
+ if (unlikely(err)) { |
5573 |
+ uprobe_warn(current, "execute the probed insn, sending SIGILL."); |
5574 |
+- force_sig_info(SIGILL, SEND_SIG_FORCED, current); |
5575 |
++ force_sig(SIGILL, current); |
5576 |
+ } |
5577 |
+ } |
5578 |
+ |
5579 |
+diff --git a/kernel/kprobes.c b/kernel/kprobes.c |
5580 |
+index fdde50d39a46..f59f49bc2a5d 100644 |
5581 |
+--- a/kernel/kprobes.c |
5582 |
++++ b/kernel/kprobes.c |
5583 |
+@@ -514,8 +514,14 @@ static void do_free_cleaned_kprobes(void) |
5584 |
+ struct optimized_kprobe *op, *tmp; |
5585 |
+ |
5586 |
+ list_for_each_entry_safe(op, tmp, &freeing_list, list) { |
5587 |
+- BUG_ON(!kprobe_unused(&op->kp)); |
5588 |
+ list_del_init(&op->list); |
5589 |
++ if (WARN_ON_ONCE(!kprobe_unused(&op->kp))) { |
5590 |
++ /* |
5591 |
++ * This must not happen, but if there is a kprobe |
5592 |
++ * still in use, keep it on kprobes hash list. |
5593 |
++ */ |
5594 |
++ continue; |
5595 |
++ } |
5596 |
+ free_aggr_kprobe(&op->kp); |
5597 |
+ } |
5598 |
+ } |
5599 |
+diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c |
5600 |
+index 5a1b2a914b4e..699c18c9d763 100644 |
5601 |
+--- a/kernel/printk/printk.c |
5602 |
++++ b/kernel/printk/printk.c |
5603 |
+@@ -279,6 +279,7 @@ static u32 clear_idx; |
5604 |
+ #define LOG_ALIGN __alignof__(struct printk_log) |
5605 |
+ #endif |
5606 |
+ #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) |
5607 |
++#define LOG_BUF_LEN_MAX (u32)(1 << 31) |
5608 |
+ static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); |
5609 |
+ static char *log_buf = __log_buf; |
5610 |
+ static u32 log_buf_len = __LOG_BUF_LEN; |
5611 |
+@@ -870,18 +871,23 @@ void log_buf_kexec_setup(void) |
5612 |
+ static unsigned long __initdata new_log_buf_len; |
5613 |
+ |
5614 |
+ /* we practice scaling the ring buffer by powers of 2 */ |
5615 |
+-static void __init log_buf_len_update(unsigned size) |
5616 |
++static void __init log_buf_len_update(u64 size) |
5617 |
+ { |
5618 |
++ if (size > (u64)LOG_BUF_LEN_MAX) { |
5619 |
++ size = (u64)LOG_BUF_LEN_MAX; |
5620 |
++ pr_err("log_buf over 2G is not supported.\n"); |
5621 |
++ } |
5622 |
++ |
5623 |
+ if (size) |
5624 |
+ size = roundup_pow_of_two(size); |
5625 |
+ if (size > log_buf_len) |
5626 |
+- new_log_buf_len = size; |
5627 |
++ new_log_buf_len = (unsigned long)size; |
5628 |
+ } |
5629 |
+ |
5630 |
+ /* save requested log_buf_len since it's too early to process it */ |
5631 |
+ static int __init log_buf_len_setup(char *str) |
5632 |
+ { |
5633 |
+- unsigned int size; |
5634 |
++ u64 size; |
5635 |
+ |
5636 |
+ if (!str) |
5637 |
+ return -EINVAL; |
5638 |
+@@ -951,7 +957,7 @@ void __init setup_log_buf(int early) |
5639 |
+ } |
5640 |
+ |
5641 |
+ if (unlikely(!new_log_buf)) { |
5642 |
+- pr_err("log_buf_len: %ld bytes not available\n", |
5643 |
++ pr_err("log_buf_len: %lu bytes not available\n", |
5644 |
+ new_log_buf_len); |
5645 |
+ return; |
5646 |
+ } |
5647 |
+@@ -964,8 +970,8 @@ void __init setup_log_buf(int early) |
5648 |
+ memcpy(log_buf, __log_buf, __LOG_BUF_LEN); |
5649 |
+ raw_spin_unlock_irqrestore(&logbuf_lock, flags); |
5650 |
+ |
5651 |
+- pr_info("log_buf_len: %d bytes\n", log_buf_len); |
5652 |
+- pr_info("early log buf free: %d(%d%%)\n", |
5653 |
++ pr_info("log_buf_len: %u bytes\n", log_buf_len); |
5654 |
++ pr_info("early log buf free: %u(%u%%)\n", |
5655 |
+ free, (free * 100) / __LOG_BUF_LEN); |
5656 |
+ } |
5657 |
+ |
5658 |
+diff --git a/kernel/signal.c b/kernel/signal.c |
5659 |
+index 072fd152ab01..3095b2309876 100644 |
5660 |
+--- a/kernel/signal.c |
5661 |
++++ b/kernel/signal.c |
5662 |
+@@ -71,6 +71,10 @@ static int sig_task_ignored(struct task_struct *t, int sig, bool force) |
5663 |
+ |
5664 |
+ handler = sig_handler(t, sig); |
5665 |
+ |
5666 |
++ /* SIGKILL and SIGSTOP may not be sent to the global init */ |
5667 |
++ if (unlikely(is_global_init(t) && sig_kernel_only(sig))) |
5668 |
++ return true; |
5669 |
++ |
5670 |
+ if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && |
5671 |
+ handler == SIG_DFL && !(force && sig_kernel_only(sig))) |
5672 |
+ return 1; |
5673 |
+diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c |
5674 |
+index d8fb10de0f14..b6db19945992 100644 |
5675 |
+--- a/mm/hugetlb_cgroup.c |
5676 |
++++ b/mm/hugetlb_cgroup.c |
5677 |
+@@ -180,7 +180,7 @@ int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, |
5678 |
+ again: |
5679 |
+ rcu_read_lock(); |
5680 |
+ h_cg = hugetlb_cgroup_from_task(current); |
5681 |
+- if (!css_tryget_online(&h_cg->css)) { |
5682 |
++ if (!css_tryget(&h_cg->css)) { |
5683 |
+ rcu_read_unlock(); |
5684 |
+ goto again; |
5685 |
+ } |
5686 |
+diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
5687 |
+index a84eb0f8c5db..c27031b4683a 100644 |
5688 |
+--- a/mm/memcontrol.c |
5689 |
++++ b/mm/memcontrol.c |
5690 |
+@@ -833,7 +833,7 @@ static struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm) |
5691 |
+ if (unlikely(!memcg)) |
5692 |
+ memcg = root_mem_cgroup; |
5693 |
+ } |
5694 |
+- } while (!css_tryget_online(&memcg->css)); |
5695 |
++ } while (!css_tryget(&memcg->css)); |
5696 |
+ rcu_read_unlock(); |
5697 |
+ return memcg; |
5698 |
+ } |
5699 |
+diff --git a/mm/shmem.c b/mm/shmem.c |
5700 |
+index 62668379623b..e40239bf6dfe 100644 |
5701 |
+--- a/mm/shmem.c |
5702 |
++++ b/mm/shmem.c |
5703 |
+@@ -1862,7 +1862,7 @@ static void shmem_tag_pins(struct address_space *mapping) |
5704 |
+ spin_lock_irq(&mapping->tree_lock); |
5705 |
+ restart: |
5706 |
+ radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) { |
5707 |
+- page = radix_tree_deref_slot(slot); |
5708 |
++ page = radix_tree_deref_slot_protected(slot, &mapping->tree_lock); |
5709 |
+ if (!page || radix_tree_exception(page)) { |
5710 |
+ if (radix_tree_deref_retry(page)) |
5711 |
+ goto restart; |
5712 |
+diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c |
5713 |
+index c25f1e4846cd..302c3bacb024 100644 |
5714 |
+--- a/net/bluetooth/l2cap_core.c |
5715 |
++++ b/net/bluetooth/l2cap_core.c |
5716 |
+@@ -6795,6 +6795,16 @@ static int l2cap_le_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb) |
5717 |
+ chan->sdu_len = sdu_len; |
5718 |
+ chan->sdu_last_frag = skb; |
5719 |
+ |
5720 |
++ /* Detect if remote is not able to use the selected MPS */ |
5721 |
++ if (skb->len + L2CAP_SDULEN_SIZE < chan->mps) { |
5722 |
++ u16 mps_len = skb->len + L2CAP_SDULEN_SIZE; |
5723 |
++ |
5724 |
++ /* Adjust the number of credits */ |
5725 |
++ BT_DBG("chan->mps %u -> %u", chan->mps, mps_len); |
5726 |
++ chan->mps = mps_len; |
5727 |
++ l2cap_chan_le_send_credits(chan); |
5728 |
++ } |
5729 |
++ |
5730 |
+ return 0; |
5731 |
+ } |
5732 |
+ |
5733 |
+diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c |
5734 |
+index e896a2c53b12..f1e442a39db8 100644 |
5735 |
+--- a/net/llc/llc_core.c |
5736 |
++++ b/net/llc/llc_core.c |
5737 |
+@@ -127,9 +127,7 @@ void llc_sap_close(struct llc_sap *sap) |
5738 |
+ list_del_rcu(&sap->node); |
5739 |
+ spin_unlock_bh(&llc_sap_list_lock); |
5740 |
+ |
5741 |
+- synchronize_rcu(); |
5742 |
+- |
5743 |
+- kfree(sap); |
5744 |
++ kfree_rcu(sap, rcu); |
5745 |
+ } |
5746 |
+ |
5747 |
+ static struct packet_type llc_packet_type __read_mostly = { |
5748 |
+diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c |
5749 |
+index 239ed6e92b89..ff3b28e7dbce 100644 |
5750 |
+--- a/net/mac80211/rc80211_minstrel_ht.c |
5751 |
++++ b/net/mac80211/rc80211_minstrel_ht.c |
5752 |
+@@ -128,7 +128,7 @@ |
5753 |
+ |
5754 |
+ #define CCK_GROUP \ |
5755 |
+ [MINSTREL_CCK_GROUP] = { \ |
5756 |
+- .streams = 0, \ |
5757 |
++ .streams = 1, \ |
5758 |
+ .flags = 0, \ |
5759 |
+ .duration = { \ |
5760 |
+ CCK_DURATION_LIST(false), \ |
5761 |
+diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c |
5762 |
+index ec76398a792f..12ec61b259b9 100644 |
5763 |
+--- a/net/openvswitch/vport-internal_dev.c |
5764 |
++++ b/net/openvswitch/vport-internal_dev.c |
5765 |
+@@ -44,7 +44,8 @@ static struct internal_dev *internal_dev_priv(struct net_device *netdev) |
5766 |
+ } |
5767 |
+ |
5768 |
+ /* Called with rcu_read_lock_bh. */ |
5769 |
+-static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) |
5770 |
++static netdev_tx_t |
5771 |
++internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) |
5772 |
+ { |
5773 |
+ int len, err; |
5774 |
+ |
5775 |
+@@ -63,7 +64,7 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) |
5776 |
+ } else { |
5777 |
+ netdev->stats.tx_errors++; |
5778 |
+ } |
5779 |
+- return 0; |
5780 |
++ return NETDEV_TX_OK; |
5781 |
+ } |
5782 |
+ |
5783 |
+ static int internal_dev_open(struct net_device *netdev) |
5784 |
+diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
5785 |
+index 1cb35c753dcd..3eed71a2ff2b 100644 |
5786 |
+--- a/net/sunrpc/sched.c |
5787 |
++++ b/net/sunrpc/sched.c |
5788 |
+@@ -98,64 +98,78 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task) |
5789 |
+ list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list); |
5790 |
+ } |
5791 |
+ |
5792 |
+-static void rpc_rotate_queue_owner(struct rpc_wait_queue *queue) |
5793 |
+-{ |
5794 |
+- struct list_head *q = &queue->tasks[queue->priority]; |
5795 |
+- struct rpc_task *task; |
5796 |
+- |
5797 |
+- if (!list_empty(q)) { |
5798 |
+- task = list_first_entry(q, struct rpc_task, u.tk_wait.list); |
5799 |
+- if (task->tk_owner == queue->owner) |
5800 |
+- list_move_tail(&task->u.tk_wait.list, q); |
5801 |
+- } |
5802 |
+-} |
5803 |
+- |
5804 |
+ static void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority) |
5805 |
+ { |
5806 |
+ if (queue->priority != priority) { |
5807 |
+- /* Fairness: rotate the list when changing priority */ |
5808 |
+- rpc_rotate_queue_owner(queue); |
5809 |
+ queue->priority = priority; |
5810 |
++ queue->nr = 1U << priority; |
5811 |
+ } |
5812 |
+ } |
5813 |
+ |
5814 |
+-static void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid) |
5815 |
+-{ |
5816 |
+- queue->owner = pid; |
5817 |
+- queue->nr = RPC_BATCH_COUNT; |
5818 |
+-} |
5819 |
+- |
5820 |
+ static void rpc_reset_waitqueue_priority(struct rpc_wait_queue *queue) |
5821 |
+ { |
5822 |
+ rpc_set_waitqueue_priority(queue, queue->maxpriority); |
5823 |
+- rpc_set_waitqueue_owner(queue, 0); |
5824 |
+ } |
5825 |
+ |
5826 |
+ /* |
5827 |
+- * Add new request to a priority queue. |
5828 |
++ * Add a request to a queue list |
5829 |
+ */ |
5830 |
+-static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue, |
5831 |
+- struct rpc_task *task, |
5832 |
+- unsigned char queue_priority) |
5833 |
++static void |
5834 |
++__rpc_list_enqueue_task(struct list_head *q, struct rpc_task *task) |
5835 |
+ { |
5836 |
+- struct list_head *q; |
5837 |
+ struct rpc_task *t; |
5838 |
+ |
5839 |
+- INIT_LIST_HEAD(&task->u.tk_wait.links); |
5840 |
+- if (unlikely(queue_priority > queue->maxpriority)) |
5841 |
+- queue_priority = queue->maxpriority; |
5842 |
+- if (queue_priority > queue->priority) |
5843 |
+- rpc_set_waitqueue_priority(queue, queue_priority); |
5844 |
+- q = &queue->tasks[queue_priority]; |
5845 |
+ list_for_each_entry(t, q, u.tk_wait.list) { |
5846 |
+ if (t->tk_owner == task->tk_owner) { |
5847 |
+- list_add_tail(&task->u.tk_wait.list, &t->u.tk_wait.links); |
5848 |
++ list_add_tail(&task->u.tk_wait.links, |
5849 |
++ &t->u.tk_wait.links); |
5850 |
++ /* Cache the queue head in task->u.tk_wait.list */ |
5851 |
++ task->u.tk_wait.list.next = q; |
5852 |
++ task->u.tk_wait.list.prev = NULL; |
5853 |
+ return; |
5854 |
+ } |
5855 |
+ } |
5856 |
++ INIT_LIST_HEAD(&task->u.tk_wait.links); |
5857 |
+ list_add_tail(&task->u.tk_wait.list, q); |
5858 |
+ } |
5859 |
+ |
5860 |
++/* |
5861 |
++ * Remove request from a queue list |
5862 |
++ */ |
5863 |
++static void |
5864 |
++__rpc_list_dequeue_task(struct rpc_task *task) |
5865 |
++{ |
5866 |
++ struct list_head *q; |
5867 |
++ struct rpc_task *t; |
5868 |
++ |
5869 |
++ if (task->u.tk_wait.list.prev == NULL) { |
5870 |
++ list_del(&task->u.tk_wait.links); |
5871 |
++ return; |
5872 |
++ } |
5873 |
++ if (!list_empty(&task->u.tk_wait.links)) { |
5874 |
++ t = list_first_entry(&task->u.tk_wait.links, |
5875 |
++ struct rpc_task, |
5876 |
++ u.tk_wait.links); |
5877 |
++ /* Assume __rpc_list_enqueue_task() cached the queue head */ |
5878 |
++ q = t->u.tk_wait.list.next; |
5879 |
++ list_add_tail(&t->u.tk_wait.list, q); |
5880 |
++ list_del(&task->u.tk_wait.links); |
5881 |
++ } |
5882 |
++ list_del(&task->u.tk_wait.list); |
5883 |
++} |
5884 |
++ |
5885 |
++/* |
5886 |
++ * Add new request to a priority queue. |
5887 |
++ */ |
5888 |
++static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue, |
5889 |
++ struct rpc_task *task, |
5890 |
++ unsigned char queue_priority) |
5891 |
++{ |
5892 |
++ if (unlikely(queue_priority > queue->maxpriority)) |
5893 |
++ queue_priority = queue->maxpriority; |
5894 |
++ __rpc_list_enqueue_task(&queue->tasks[queue_priority], task); |
5895 |
++} |
5896 |
++ |
5897 |
+ /* |
5898 |
+ * Add new request to wait queue. |
5899 |
+ * |
5900 |
+@@ -193,13 +207,7 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue, |
5901 |
+ */ |
5902 |
+ static void __rpc_remove_wait_queue_priority(struct rpc_task *task) |
5903 |
+ { |
5904 |
+- struct rpc_task *t; |
5905 |
+- |
5906 |
+- if (!list_empty(&task->u.tk_wait.links)) { |
5907 |
+- t = list_entry(task->u.tk_wait.links.next, struct rpc_task, u.tk_wait.list); |
5908 |
+- list_move(&t->u.tk_wait.list, &task->u.tk_wait.list); |
5909 |
+- list_splice_init(&task->u.tk_wait.links, &t->u.tk_wait.links); |
5910 |
+- } |
5911 |
++ __rpc_list_dequeue_task(task); |
5912 |
+ } |
5913 |
+ |
5914 |
+ /* |
5915 |
+@@ -211,7 +219,8 @@ static void __rpc_remove_wait_queue(struct rpc_wait_queue *queue, struct rpc_tas |
5916 |
+ __rpc_disable_timer(queue, task); |
5917 |
+ if (RPC_IS_PRIORITY(queue)) |
5918 |
+ __rpc_remove_wait_queue_priority(task); |
5919 |
+- list_del(&task->u.tk_wait.list); |
5920 |
++ else |
5921 |
++ list_del(&task->u.tk_wait.list); |
5922 |
+ queue->qlen--; |
5923 |
+ dprintk("RPC: %5u removed from queue %p \"%s\"\n", |
5924 |
+ task->tk_pid, queue, rpc_qname(queue)); |
5925 |
+@@ -467,17 +476,9 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q |
5926 |
+ * Service a batch of tasks from a single owner. |
5927 |
+ */ |
5928 |
+ q = &queue->tasks[queue->priority]; |
5929 |
+- if (!list_empty(q)) { |
5930 |
+- task = list_entry(q->next, struct rpc_task, u.tk_wait.list); |
5931 |
+- if (queue->owner == task->tk_owner) { |
5932 |
+- if (--queue->nr) |
5933 |
+- goto out; |
5934 |
+- list_move_tail(&task->u.tk_wait.list, q); |
5935 |
+- } |
5936 |
+- /* |
5937 |
+- * Check if we need to switch queues. |
5938 |
+- */ |
5939 |
+- goto new_owner; |
5940 |
++ if (!list_empty(q) && --queue->nr) { |
5941 |
++ task = list_first_entry(q, struct rpc_task, u.tk_wait.list); |
5942 |
++ goto out; |
5943 |
+ } |
5944 |
+ |
5945 |
+ /* |
5946 |
+@@ -489,7 +490,7 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q |
5947 |
+ else |
5948 |
+ q = q - 1; |
5949 |
+ if (!list_empty(q)) { |
5950 |
+- task = list_entry(q->next, struct rpc_task, u.tk_wait.list); |
5951 |
++ task = list_first_entry(q, struct rpc_task, u.tk_wait.list); |
5952 |
+ goto new_queue; |
5953 |
+ } |
5954 |
+ } while (q != &queue->tasks[queue->priority]); |
5955 |
+@@ -499,8 +500,6 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q |
5956 |
+ |
5957 |
+ new_queue: |
5958 |
+ rpc_set_waitqueue_priority(queue, (unsigned int)(q - &queue->tasks[0])); |
5959 |
+-new_owner: |
5960 |
+- rpc_set_waitqueue_owner(queue, task->tk_owner); |
5961 |
+ out: |
5962 |
+ return task; |
5963 |
+ } |
5964 |
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
5965 |
+index 4de66dbd5bb6..fd0bf278067e 100644 |
5966 |
+--- a/net/wireless/nl80211.c |
5967 |
++++ b/net/wireless/nl80211.c |
5968 |
+@@ -2879,7 +2879,7 @@ static void get_key_callback(void *c, struct key_params *params) |
5969 |
+ params->cipher))) |
5970 |
+ goto nla_put_failure; |
5971 |
+ |
5972 |
+- if (nla_put_u8(cookie->msg, NL80211_ATTR_KEY_IDX, cookie->idx)) |
5973 |
++ if (nla_put_u8(cookie->msg, NL80211_KEY_IDX, cookie->idx)) |
5974 |
+ goto nla_put_failure; |
5975 |
+ |
5976 |
+ nla_nest_end(cookie->msg, key); |
5977 |
+diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c |
5978 |
+index 9068369f8a1b..0d8dd71f989e 100644 |
5979 |
+--- a/security/apparmor/apparmorfs.c |
5980 |
++++ b/security/apparmor/apparmorfs.c |
5981 |
+@@ -380,6 +380,8 @@ void __aa_fs_profile_migrate_dents(struct aa_profile *old, |
5982 |
+ |
5983 |
+ for (i = 0; i < AAFS_PROF_SIZEOF; i++) { |
5984 |
+ new->dents[i] = old->dents[i]; |
5985 |
++ if (new->dents[i]) |
5986 |
++ new->dents[i]->d_inode->i_mtime = CURRENT_TIME; |
5987 |
+ old->dents[i] = NULL; |
5988 |
+ } |
5989 |
+ } |
5990 |
+diff --git a/security/apparmor/audit.c b/security/apparmor/audit.c |
5991 |
+index 89c78658031f..3a7f1da1425e 100644 |
5992 |
+--- a/security/apparmor/audit.c |
5993 |
++++ b/security/apparmor/audit.c |
5994 |
+@@ -200,7 +200,8 @@ int aa_audit(int type, struct aa_profile *profile, gfp_t gfp, |
5995 |
+ |
5996 |
+ if (sa->aad->type == AUDIT_APPARMOR_KILL) |
5997 |
+ (void)send_sig_info(SIGKILL, NULL, |
5998 |
+- sa->u.tsk ? sa->u.tsk : current); |
5999 |
++ sa->type == LSM_AUDIT_DATA_TASK && sa->u.tsk ? |
6000 |
++ sa->u.tsk : current); |
6001 |
+ |
6002 |
+ if (sa->aad->type == AUDIT_APPARMOR_ALLOWED) |
6003 |
+ return complain_error(sa->aad->error); |
6004 |
+diff --git a/security/apparmor/file.c b/security/apparmor/file.c |
6005 |
+index 913f377a038a..43d6ae71b446 100644 |
6006 |
+--- a/security/apparmor/file.c |
6007 |
++++ b/security/apparmor/file.c |
6008 |
+@@ -110,7 +110,8 @@ int aa_audit_file(struct aa_profile *profile, struct file_perms *perms, |
6009 |
+ int type = AUDIT_APPARMOR_AUTO; |
6010 |
+ struct common_audit_data sa; |
6011 |
+ struct apparmor_audit_data aad = {0,}; |
6012 |
+- sa.type = LSM_AUDIT_DATA_NONE; |
6013 |
++ sa.type = LSM_AUDIT_DATA_TASK; |
6014 |
++ sa.u.tsk = NULL; |
6015 |
+ sa.aad = &aad; |
6016 |
+ aad.op = op, |
6017 |
+ aad.fs.request = request; |
6018 |
+diff --git a/security/apparmor/include/policy.h b/security/apparmor/include/policy.h |
6019 |
+index c28b0f20ab53..52275f040a5f 100644 |
6020 |
+--- a/security/apparmor/include/policy.h |
6021 |
++++ b/security/apparmor/include/policy.h |
6022 |
+@@ -403,6 +403,8 @@ static inline int AUDIT_MODE(struct aa_profile *profile) |
6023 |
+ return profile->audit; |
6024 |
+ } |
6025 |
+ |
6026 |
++bool policy_view_capable(void); |
6027 |
++bool policy_admin_capable(void); |
6028 |
+ bool aa_may_manage_policy(int op); |
6029 |
+ |
6030 |
+ #endif /* __AA_POLICY_H */ |
6031 |
+diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c |
6032 |
+index 6dc4ce47580f..a95b6c98d460 100644 |
6033 |
+--- a/security/apparmor/lsm.c |
6034 |
++++ b/security/apparmor/lsm.c |
6035 |
+@@ -749,51 +749,49 @@ __setup("apparmor=", apparmor_enabled_setup); |
6036 |
+ /* set global flag turning off the ability to load policy */ |
6037 |
+ static int param_set_aalockpolicy(const char *val, const struct kernel_param *kp) |
6038 |
+ { |
6039 |
+- if (!capable(CAP_MAC_ADMIN)) |
6040 |
++ if (!policy_admin_capable()) |
6041 |
+ return -EPERM; |
6042 |
+- if (aa_g_lock_policy) |
6043 |
+- return -EACCES; |
6044 |
+ return param_set_bool(val, kp); |
6045 |
+ } |
6046 |
+ |
6047 |
+ static int param_get_aalockpolicy(char *buffer, const struct kernel_param *kp) |
6048 |
+ { |
6049 |
+- if (!capable(CAP_MAC_ADMIN)) |
6050 |
++ if (!policy_view_capable()) |
6051 |
+ return -EPERM; |
6052 |
+ return param_get_bool(buffer, kp); |
6053 |
+ } |
6054 |
+ |
6055 |
+ static int param_set_aabool(const char *val, const struct kernel_param *kp) |
6056 |
+ { |
6057 |
+- if (!capable(CAP_MAC_ADMIN)) |
6058 |
++ if (!policy_admin_capable()) |
6059 |
+ return -EPERM; |
6060 |
+ return param_set_bool(val, kp); |
6061 |
+ } |
6062 |
+ |
6063 |
+ static int param_get_aabool(char *buffer, const struct kernel_param *kp) |
6064 |
+ { |
6065 |
+- if (!capable(CAP_MAC_ADMIN)) |
6066 |
++ if (!policy_view_capable()) |
6067 |
+ return -EPERM; |
6068 |
+ return param_get_bool(buffer, kp); |
6069 |
+ } |
6070 |
+ |
6071 |
+ static int param_set_aauint(const char *val, const struct kernel_param *kp) |
6072 |
+ { |
6073 |
+- if (!capable(CAP_MAC_ADMIN)) |
6074 |
++ if (!policy_admin_capable()) |
6075 |
+ return -EPERM; |
6076 |
+ return param_set_uint(val, kp); |
6077 |
+ } |
6078 |
+ |
6079 |
+ static int param_get_aauint(char *buffer, const struct kernel_param *kp) |
6080 |
+ { |
6081 |
+- if (!capable(CAP_MAC_ADMIN)) |
6082 |
++ if (!policy_view_capable()) |
6083 |
+ return -EPERM; |
6084 |
+ return param_get_uint(buffer, kp); |
6085 |
+ } |
6086 |
+ |
6087 |
+ static int param_get_audit(char *buffer, struct kernel_param *kp) |
6088 |
+ { |
6089 |
+- if (!capable(CAP_MAC_ADMIN)) |
6090 |
++ if (!policy_view_capable()) |
6091 |
+ return -EPERM; |
6092 |
+ |
6093 |
+ if (!apparmor_enabled) |
6094 |
+@@ -805,7 +803,7 @@ static int param_get_audit(char *buffer, struct kernel_param *kp) |
6095 |
+ static int param_set_audit(const char *val, struct kernel_param *kp) |
6096 |
+ { |
6097 |
+ int i; |
6098 |
+- if (!capable(CAP_MAC_ADMIN)) |
6099 |
++ if (!policy_admin_capable()) |
6100 |
+ return -EPERM; |
6101 |
+ |
6102 |
+ if (!apparmor_enabled) |
6103 |
+@@ -826,7 +824,7 @@ static int param_set_audit(const char *val, struct kernel_param *kp) |
6104 |
+ |
6105 |
+ static int param_get_mode(char *buffer, struct kernel_param *kp) |
6106 |
+ { |
6107 |
+- if (!capable(CAP_MAC_ADMIN)) |
6108 |
++ if (!policy_admin_capable()) |
6109 |
+ return -EPERM; |
6110 |
+ |
6111 |
+ if (!apparmor_enabled) |
6112 |
+@@ -838,7 +836,7 @@ static int param_get_mode(char *buffer, struct kernel_param *kp) |
6113 |
+ static int param_set_mode(const char *val, struct kernel_param *kp) |
6114 |
+ { |
6115 |
+ int i; |
6116 |
+- if (!capable(CAP_MAC_ADMIN)) |
6117 |
++ if (!policy_admin_capable()) |
6118 |
+ return -EPERM; |
6119 |
+ |
6120 |
+ if (!apparmor_enabled) |
6121 |
+diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c |
6122 |
+index 705c2879d3a9..9e2d9f2c9e37 100644 |
6123 |
+--- a/security/apparmor/policy.c |
6124 |
++++ b/security/apparmor/policy.c |
6125 |
+@@ -916,6 +916,22 @@ static int audit_policy(int op, gfp_t gfp, const char *name, const char *info, |
6126 |
+ &sa, NULL); |
6127 |
+ } |
6128 |
+ |
6129 |
++bool policy_view_capable(void) |
6130 |
++{ |
6131 |
++ struct user_namespace *user_ns = current_user_ns(); |
6132 |
++ bool response = false; |
6133 |
++ |
6134 |
++ if (ns_capable(user_ns, CAP_MAC_ADMIN)) |
6135 |
++ response = true; |
6136 |
++ |
6137 |
++ return response; |
6138 |
++} |
6139 |
++ |
6140 |
++bool policy_admin_capable(void) |
6141 |
++{ |
6142 |
++ return policy_view_capable() && !aa_g_lock_policy; |
6143 |
++} |
6144 |
++ |
6145 |
+ /** |
6146 |
+ * aa_may_manage_policy - can the current task manage policy |
6147 |
+ * @op: the policy manipulation operation being done |
6148 |
+@@ -930,7 +946,7 @@ bool aa_may_manage_policy(int op) |
6149 |
+ return 0; |
6150 |
+ } |
6151 |
+ |
6152 |
+- if (!capable(CAP_MAC_ADMIN)) { |
6153 |
++ if (!policy_admin_capable()) { |
6154 |
+ audit_policy(op, GFP_KERNEL, NULL, "not policy admin", -EACCES); |
6155 |
+ return 0; |
6156 |
+ } |
6157 |
+diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c |
6158 |
+index a84a1d3d23e5..c6888d76ca5e 100644 |
6159 |
+--- a/sound/core/oss/pcm_plugin.c |
6160 |
++++ b/sound/core/oss/pcm_plugin.c |
6161 |
+@@ -111,7 +111,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) |
6162 |
+ while (plugin->next) { |
6163 |
+ if (plugin->dst_frames) |
6164 |
+ frames = plugin->dst_frames(plugin, frames); |
6165 |
+- if (snd_BUG_ON(frames <= 0)) |
6166 |
++ if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) |
6167 |
+ return -ENXIO; |
6168 |
+ plugin = plugin->next; |
6169 |
+ err = snd_pcm_plugin_alloc(plugin, frames); |
6170 |
+@@ -123,7 +123,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) |
6171 |
+ while (plugin->prev) { |
6172 |
+ if (plugin->src_frames) |
6173 |
+ frames = plugin->src_frames(plugin, frames); |
6174 |
+- if (snd_BUG_ON(frames <= 0)) |
6175 |
++ if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) |
6176 |
+ return -ENXIO; |
6177 |
+ plugin = plugin->prev; |
6178 |
+ err = snd_pcm_plugin_alloc(plugin, frames); |
6179 |
+diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c |
6180 |
+index 8ce1d0b40dce..ce1f1e4727ab 100644 |
6181 |
+--- a/sound/core/seq/seq_system.c |
6182 |
++++ b/sound/core/seq/seq_system.c |
6183 |
+@@ -123,6 +123,7 @@ int __init snd_seq_system_client_init(void) |
6184 |
+ { |
6185 |
+ struct snd_seq_port_callback pcallbacks; |
6186 |
+ struct snd_seq_port_info *port; |
6187 |
++ int err; |
6188 |
+ |
6189 |
+ port = kzalloc(sizeof(*port), GFP_KERNEL); |
6190 |
+ if (!port) |
6191 |
+@@ -144,7 +145,10 @@ int __init snd_seq_system_client_init(void) |
6192 |
+ port->flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT; |
6193 |
+ port->addr.client = sysclient; |
6194 |
+ port->addr.port = SNDRV_SEQ_PORT_SYSTEM_TIMER; |
6195 |
+- snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); |
6196 |
++ err = snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, |
6197 |
++ port); |
6198 |
++ if (err < 0) |
6199 |
++ goto error_port; |
6200 |
+ |
6201 |
+ /* register announcement port */ |
6202 |
+ strcpy(port->name, "Announce"); |
6203 |
+@@ -154,16 +158,24 @@ int __init snd_seq_system_client_init(void) |
6204 |
+ port->flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT; |
6205 |
+ port->addr.client = sysclient; |
6206 |
+ port->addr.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE; |
6207 |
+- snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); |
6208 |
++ err = snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, |
6209 |
++ port); |
6210 |
++ if (err < 0) |
6211 |
++ goto error_port; |
6212 |
+ announce_port = port->addr.port; |
6213 |
+ |
6214 |
+ kfree(port); |
6215 |
+ return 0; |
6216 |
++ |
6217 |
++ error_port: |
6218 |
++ snd_seq_system_client_done(); |
6219 |
++ kfree(port); |
6220 |
++ return err; |
6221 |
+ } |
6222 |
+ |
6223 |
+ |
6224 |
+ /* unregister our internal client */ |
6225 |
+-void __exit snd_seq_system_client_done(void) |
6226 |
++void snd_seq_system_client_done(void) |
6227 |
+ { |
6228 |
+ int oldsysclient = sysclient; |
6229 |
+ |
6230 |
+diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c |
6231 |
+index 0abab7926dca..d1a6d20ace0d 100644 |
6232 |
+--- a/sound/pci/hda/patch_sigmatel.c |
6233 |
++++ b/sound/pci/hda/patch_sigmatel.c |
6234 |
+@@ -77,6 +77,7 @@ enum { |
6235 |
+ STAC_DELL_M6_BOTH, |
6236 |
+ STAC_DELL_EQ, |
6237 |
+ STAC_ALIENWARE_M17X, |
6238 |
++ STAC_ELO_VUPOINT_15MX, |
6239 |
+ STAC_92HD89XX_HP_FRONT_JACK, |
6240 |
+ STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, |
6241 |
+ STAC_92HD73XX_ASUS_MOBO, |
6242 |
+@@ -1875,6 +1876,18 @@ static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec, |
6243 |
+ codec->no_jack_detect = 1; |
6244 |
+ } |
6245 |
+ |
6246 |
++ |
6247 |
++static void stac92hd73xx_disable_automute(struct hda_codec *codec, |
6248 |
++ const struct hda_fixup *fix, int action) |
6249 |
++{ |
6250 |
++ struct sigmatel_spec *spec = codec->spec; |
6251 |
++ |
6252 |
++ if (action != HDA_FIXUP_ACT_PRE_PROBE) |
6253 |
++ return; |
6254 |
++ |
6255 |
++ spec->gen.suppress_auto_mute = 1; |
6256 |
++} |
6257 |
++ |
6258 |
+ static const struct hda_fixup stac92hd73xx_fixups[] = { |
6259 |
+ [STAC_92HD73XX_REF] = { |
6260 |
+ .type = HDA_FIXUP_FUNC, |
6261 |
+@@ -1900,6 +1913,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { |
6262 |
+ .type = HDA_FIXUP_FUNC, |
6263 |
+ .v.func = stac92hd73xx_fixup_alienware_m17x, |
6264 |
+ }, |
6265 |
++ [STAC_ELO_VUPOINT_15MX] = { |
6266 |
++ .type = HDA_FIXUP_FUNC, |
6267 |
++ .v.func = stac92hd73xx_disable_automute, |
6268 |
++ }, |
6269 |
+ [STAC_92HD73XX_INTEL] = { |
6270 |
+ .type = HDA_FIXUP_PINS, |
6271 |
+ .v.pins = intel_dg45id_pin_configs, |
6272 |
+@@ -1938,6 +1955,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { |
6273 |
+ { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, |
6274 |
+ { .id = STAC_DELL_EQ, .name = "dell-eq" }, |
6275 |
+ { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, |
6276 |
++ { .id = STAC_ELO_VUPOINT_15MX, .name = "elo-vupoint-15mx" }, |
6277 |
+ { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, |
6278 |
+ {} |
6279 |
+ }; |
6280 |
+@@ -1987,6 +2005,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { |
6281 |
+ "Alienware M17x", STAC_ALIENWARE_M17X), |
6282 |
+ SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, |
6283 |
+ "Alienware M17x R3", STAC_DELL_EQ), |
6284 |
++ SND_PCI_QUIRK(0x1059, 0x1011, |
6285 |
++ "ELO VuPoint 15MX", STAC_ELO_VUPOINT_15MX), |
6286 |
+ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927, |
6287 |
+ "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), |
6288 |
+ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, |
6289 |
+diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c |
6290 |
+index 1bc98c867133..2286dfd72ff7 100644 |
6291 |
+--- a/sound/pci/intel8x0m.c |
6292 |
++++ b/sound/pci/intel8x0m.c |
6293 |
+@@ -1171,16 +1171,6 @@ static int snd_intel8x0m_create(struct snd_card *card, |
6294 |
+ } |
6295 |
+ |
6296 |
+ port_inited: |
6297 |
+- if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED, |
6298 |
+- KBUILD_MODNAME, chip)) { |
6299 |
+- dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); |
6300 |
+- snd_intel8x0m_free(chip); |
6301 |
+- return -EBUSY; |
6302 |
+- } |
6303 |
+- chip->irq = pci->irq; |
6304 |
+- pci_set_master(pci); |
6305 |
+- synchronize_irq(chip->irq); |
6306 |
+- |
6307 |
+ /* initialize offsets */ |
6308 |
+ chip->bdbars_count = 2; |
6309 |
+ tbl = intel_regs; |
6310 |
+@@ -1224,11 +1214,21 @@ static int snd_intel8x0m_create(struct snd_card *card, |
6311 |
+ chip->int_sta_reg = ICH_REG_GLOB_STA; |
6312 |
+ chip->int_sta_mask = int_sta_masks; |
6313 |
+ |
6314 |
++ pci_set_master(pci); |
6315 |
++ |
6316 |
+ if ((err = snd_intel8x0m_chip_init(chip, 1)) < 0) { |
6317 |
+ snd_intel8x0m_free(chip); |
6318 |
+ return err; |
6319 |
+ } |
6320 |
+ |
6321 |
++ if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED, |
6322 |
++ KBUILD_MODNAME, chip)) { |
6323 |
++ dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); |
6324 |
++ snd_intel8x0m_free(chip); |
6325 |
++ return -EBUSY; |
6326 |
++ } |
6327 |
++ chip->irq = pci->irq; |
6328 |
++ |
6329 |
+ if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
6330 |
+ snd_intel8x0m_free(chip); |
6331 |
+ return err; |
6332 |
+diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c |
6333 |
+index 4808b70ec12c..a3dd7030f629 100644 |
6334 |
+--- a/sound/soc/codecs/sgtl5000.c |
6335 |
++++ b/sound/soc/codecs/sgtl5000.c |
6336 |
+@@ -1415,7 +1415,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) |
6337 |
+ * Searching for a suitable index solving this formula: |
6338 |
+ * idx = 40 * log10(vag_val / lo_cagcntrl) + 15 |
6339 |
+ */ |
6340 |
+- vol_quot = (vag * 100) / lo_vag; |
6341 |
++ vol_quot = lo_vag ? (vag * 100) / lo_vag : 0; |
6342 |
+ lo_vol = 0; |
6343 |
+ for (i = 0; i < ARRAY_SIZE(vol_quot_table); i++) { |
6344 |
+ if (vol_quot >= vol_quot_table[i]) |
6345 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
6346 |
+index 1c0d44c86c01..78813057167d 100644 |
6347 |
+--- a/sound/soc/soc-pcm.c |
6348 |
++++ b/sound/soc/soc-pcm.c |
6349 |
+@@ -1541,7 +1541,7 @@ static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime, |
6350 |
+ u64 formats) |
6351 |
+ { |
6352 |
+ runtime->hw.rate_min = stream->rate_min; |
6353 |
+- runtime->hw.rate_max = stream->rate_max; |
6354 |
++ runtime->hw.rate_max = min_not_zero(stream->rate_max, UINT_MAX); |
6355 |
+ runtime->hw.channels_min = stream->channels_min; |
6356 |
+ runtime->hw.channels_max = stream->channels_max; |
6357 |
+ if (runtime->hw.formats) |
6358 |
+diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c |
6359 |
+index ae2981460cd8..66648b4bdd28 100644 |
6360 |
+--- a/sound/usb/endpoint.c |
6361 |
++++ b/sound/usb/endpoint.c |
6362 |
+@@ -403,6 +403,9 @@ static void snd_complete_urb(struct urb *urb) |
6363 |
+ } |
6364 |
+ |
6365 |
+ prepare_outbound_urb(ep, ctx); |
6366 |
++ /* can be stopped during prepare callback */ |
6367 |
++ if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags))) |
6368 |
++ goto exit_clear; |
6369 |
+ } else { |
6370 |
+ retire_inbound_urb(ep, ctx); |
6371 |
+ /* can be stopped during retire callback */ |
6372 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
6373 |
+index e24572fd6e30..1b81f18010d2 100644 |
6374 |
+--- a/sound/usb/mixer.c |
6375 |
++++ b/sound/usb/mixer.c |
6376 |
+@@ -1045,7 +1045,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, |
6377 |
+ if (cval->min + cval->res < cval->max) { |
6378 |
+ int last_valid_res = cval->res; |
6379 |
+ int saved, test, check; |
6380 |
+- get_cur_mix_raw(cval, minchn, &saved); |
6381 |
++ if (get_cur_mix_raw(cval, minchn, &saved) < 0) |
6382 |
++ goto no_res_check; |
6383 |
+ for (;;) { |
6384 |
+ test = saved; |
6385 |
+ if (test < cval->max) |
6386 |
+@@ -1065,6 +1066,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, |
6387 |
+ snd_usb_set_cur_mix_value(cval, minchn, 0, saved); |
6388 |
+ } |
6389 |
+ |
6390 |
++no_res_check: |
6391 |
+ cval->initialized = 1; |
6392 |
+ } |
6393 |
+ |