Contents of /trunk/kernel-alx/patches-4.9/0306-4.9.207-all-fixes.patch
Parent Directory | Revision Log
Revision 3581 -
(show annotations)
(download)
Thu Aug 13 10:21:22 2020 UTC (4 years, 1 month ago) by niro
File size: 200238 byte(s)
Thu Aug 13 10:21:22 2020 UTC (4 years, 1 month ago) by niro
File size: 200238 byte(s)
linux-207
1 | diff --git a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt |
2 | index be789685a1c2..18b892d010d8 100644 |
3 | --- a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt |
4 | +++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt |
5 | @@ -27,4 +27,4 @@ and valid to enable charging: |
6 | |
7 | - "abracon,tc-diode": should be "standard" (0.6V) or "schottky" (0.3V) |
8 | - "abracon,tc-resistor": should be <0>, <3>, <6> or <11>. 0 disables the output |
9 | - resistor, the other values are in ohm. |
10 | + resistor, the other values are in kOhm. |
11 | diff --git a/Makefile b/Makefile |
12 | index 55a91bc3d8f9..aa8e52a3b73d 100644 |
13 | --- a/Makefile |
14 | +++ b/Makefile |
15 | @@ -1,6 +1,6 @@ |
16 | VERSION = 4 |
17 | PATCHLEVEL = 9 |
18 | -SUBLEVEL = 206 |
19 | +SUBLEVEL = 207 |
20 | EXTRAVERSION = |
21 | NAME = Roaring Lionus |
22 | |
23 | @@ -1521,9 +1521,6 @@ else # KBUILD_EXTMOD |
24 | |
25 | # We are always building modules |
26 | KBUILD_MODULES := 1 |
27 | -PHONY += crmodverdir |
28 | -crmodverdir: |
29 | - $(cmd_crmodverdir) |
30 | |
31 | PHONY += $(objtree)/Module.symvers |
32 | $(objtree)/Module.symvers: |
33 | @@ -1535,7 +1532,7 @@ $(objtree)/Module.symvers: |
34 | |
35 | module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) |
36 | PHONY += $(module-dirs) modules |
37 | -$(module-dirs): crmodverdir $(objtree)/Module.symvers |
38 | +$(module-dirs): prepare $(objtree)/Module.symvers |
39 | $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) |
40 | |
41 | modules: $(module-dirs) |
42 | @@ -1576,7 +1573,8 @@ help: |
43 | |
44 | # Dummies... |
45 | PHONY += prepare scripts |
46 | -prepare: ; |
47 | +prepare: |
48 | + $(cmd_crmodverdir) |
49 | scripts: ; |
50 | endif # KBUILD_EXTMOD |
51 | |
52 | @@ -1701,17 +1699,14 @@ endif |
53 | |
54 | # Modules |
55 | /: prepare scripts FORCE |
56 | - $(cmd_crmodverdir) |
57 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
58 | $(build)=$(build-dir) |
59 | # Make sure the latest headers are built for Documentation |
60 | Documentation/ samples/: headers_install |
61 | %/: prepare scripts FORCE |
62 | - $(cmd_crmodverdir) |
63 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
64 | $(build)=$(build-dir) |
65 | %.ko: prepare scripts FORCE |
66 | - $(cmd_crmodverdir) |
67 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ |
68 | $(build)=$(build-dir) $(@:.ko=.o) |
69 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
70 | diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug |
71 | index a5625430bef6..bb8f39fe3a22 100644 |
72 | --- a/arch/arm/Kconfig.debug |
73 | +++ b/arch/arm/Kconfig.debug |
74 | @@ -987,14 +987,21 @@ choice |
75 | Say Y here if you want kernel low-level debugging support |
76 | on SOCFPGA(Cyclone 5 and Arria 5) based platforms. |
77 | |
78 | - config DEBUG_SOCFPGA_UART1 |
79 | + config DEBUG_SOCFPGA_ARRIA10_UART1 |
80 | depends on ARCH_SOCFPGA |
81 | - bool "Use SOCFPGA UART1 for low-level debug" |
82 | + bool "Use SOCFPGA Arria10 UART1 for low-level debug" |
83 | select DEBUG_UART_8250 |
84 | help |
85 | Say Y here if you want kernel low-level debugging support |
86 | on SOCFPGA(Arria 10) based platforms. |
87 | |
88 | + config DEBUG_SOCFPGA_CYCLONE5_UART1 |
89 | + depends on ARCH_SOCFPGA |
90 | + bool "Use SOCFPGA Cyclone 5 UART1 for low-level debug" |
91 | + select DEBUG_UART_8250 |
92 | + help |
93 | + Say Y here if you want kernel low-level debugging support |
94 | + on SOCFPGA(Cyclone 5 and Arria 5) based platforms. |
95 | |
96 | config DEBUG_SUN9I_UART0 |
97 | bool "Kernel low-level debugging messages via sun9i UART0" |
98 | @@ -1534,7 +1541,8 @@ config DEBUG_UART_PHYS |
99 | default 0xfe800000 if ARCH_IOP32X |
100 | default 0xff690000 if DEBUG_RK32_UART2 |
101 | default 0xffc02000 if DEBUG_SOCFPGA_UART0 |
102 | - default 0xffc02100 if DEBUG_SOCFPGA_UART1 |
103 | + default 0xffc02100 if DEBUG_SOCFPGA_ARRIA10_UART1 |
104 | + default 0xffc03000 if DEBUG_SOCFPGA_CYCLONE5_UART1 |
105 | default 0xffd82340 if ARCH_IOP13XX |
106 | default 0xffe40000 if DEBUG_RCAR_GEN1_SCIF0 |
107 | default 0xffe42000 if DEBUG_RCAR_GEN1_SCIF2 |
108 | @@ -1624,7 +1632,8 @@ config DEBUG_UART_VIRT |
109 | default 0xfeb30c00 if DEBUG_KEYSTONE_UART0 |
110 | default 0xfeb31000 if DEBUG_KEYSTONE_UART1 |
111 | default 0xfec02000 if DEBUG_SOCFPGA_UART0 |
112 | - default 0xfec02100 if DEBUG_SOCFPGA_UART1 |
113 | + default 0xfec02100 if DEBUG_SOCFPGA_ARRIA10_UART1 |
114 | + default 0xfec03000 if DEBUG_SOCFPGA_CYCLONE5_UART1 |
115 | default 0xfec12000 if (DEBUG_MVEBU_UART0 || DEBUG_MVEBU_UART0_ALTERNATE) && ARCH_MVEBU |
116 | default 0xfec12100 if DEBUG_MVEBU_UART1_ALTERNATE |
117 | default 0xfec10000 if DEBUG_SIRFATLAS7_UART0 |
118 | @@ -1672,9 +1681,9 @@ config DEBUG_UART_8250_WORD |
119 | depends on DEBUG_LL_UART_8250 || DEBUG_UART_8250 |
120 | depends on DEBUG_UART_8250_SHIFT >= 2 |
121 | default y if DEBUG_PICOXCELL_UART || \ |
122 | - DEBUG_SOCFPGA_UART0 || DEBUG_SOCFPGA_UART1 || \ |
123 | - DEBUG_KEYSTONE_UART0 || DEBUG_KEYSTONE_UART1 || \ |
124 | - DEBUG_ALPINE_UART0 || \ |
125 | + DEBUG_SOCFPGA_UART0 || DEBUG_SOCFPGA_ARRIA10_UART1 || \ |
126 | + DEBUG_SOCFPGA_CYCLONE5_UART1 || DEBUG_KEYSTONE_UART0 || \ |
127 | + DEBUG_KEYSTONE_UART1 || DEBUG_ALPINE_UART0 || \ |
128 | DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \ |
129 | DEBUG_DAVINCI_DA8XX_UART2 || \ |
130 | DEBUG_BCM_KONA_UART || DEBUG_RK32_UART2 |
131 | diff --git a/arch/arm/boot/dts/arm-realview-pb1176.dts b/arch/arm/boot/dts/arm-realview-pb1176.dts |
132 | index c1fd5615ddfe..939c108c24a6 100644 |
133 | --- a/arch/arm/boot/dts/arm-realview-pb1176.dts |
134 | +++ b/arch/arm/boot/dts/arm-realview-pb1176.dts |
135 | @@ -45,7 +45,7 @@ |
136 | }; |
137 | |
138 | /* The voltage to the MMC card is hardwired at 3.3V */ |
139 | - vmmc: fixedregulator@0 { |
140 | + vmmc: regulator-vmmc { |
141 | compatible = "regulator-fixed"; |
142 | regulator-name = "vmmc"; |
143 | regulator-min-microvolt = <3300000>; |
144 | @@ -53,7 +53,7 @@ |
145 | regulator-boot-on; |
146 | }; |
147 | |
148 | - veth: fixedregulator@0 { |
149 | + veth: regulator-veth { |
150 | compatible = "regulator-fixed"; |
151 | regulator-name = "veth"; |
152 | regulator-min-microvolt = <3300000>; |
153 | diff --git a/arch/arm/boot/dts/arm-realview-pb11mp.dts b/arch/arm/boot/dts/arm-realview-pb11mp.dts |
154 | index e306f1cceb4e..95037c48182d 100644 |
155 | --- a/arch/arm/boot/dts/arm-realview-pb11mp.dts |
156 | +++ b/arch/arm/boot/dts/arm-realview-pb11mp.dts |
157 | @@ -145,7 +145,7 @@ |
158 | }; |
159 | |
160 | /* The voltage to the MMC card is hardwired at 3.3V */ |
161 | - vmmc: fixedregulator@0 { |
162 | + vmmc: regulator-vmmc { |
163 | compatible = "regulator-fixed"; |
164 | regulator-name = "vmmc"; |
165 | regulator-min-microvolt = <3300000>; |
166 | @@ -153,7 +153,7 @@ |
167 | regulator-boot-on; |
168 | }; |
169 | |
170 | - veth: fixedregulator@0 { |
171 | + veth: regulator-veth { |
172 | compatible = "regulator-fixed"; |
173 | regulator-name = "veth"; |
174 | regulator-min-microvolt = <3300000>; |
175 | diff --git a/arch/arm/boot/dts/arm-realview-pbx.dtsi b/arch/arm/boot/dts/arm-realview-pbx.dtsi |
176 | index 2bf3958b2e6b..068293254fbb 100644 |
177 | --- a/arch/arm/boot/dts/arm-realview-pbx.dtsi |
178 | +++ b/arch/arm/boot/dts/arm-realview-pbx.dtsi |
179 | @@ -43,7 +43,7 @@ |
180 | }; |
181 | |
182 | /* The voltage to the MMC card is hardwired at 3.3V */ |
183 | - vmmc: fixedregulator@0 { |
184 | + vmmc: regulator-vmmc { |
185 | compatible = "regulator-fixed"; |
186 | regulator-name = "vmmc"; |
187 | regulator-min-microvolt = <3300000>; |
188 | @@ -51,7 +51,7 @@ |
189 | regulator-boot-on; |
190 | }; |
191 | |
192 | - veth: fixedregulator@0 { |
193 | + veth: regulator-veth { |
194 | compatible = "regulator-fixed"; |
195 | regulator-name = "veth"; |
196 | regulator-min-microvolt = <3300000>; |
197 | @@ -539,4 +539,3 @@ |
198 | }; |
199 | }; |
200 | }; |
201 | - |
202 | diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi |
203 | index 51dbd8cb91cb..99b3d2331971 100644 |
204 | --- a/arch/arm/boot/dts/exynos3250.dtsi |
205 | +++ b/arch/arm/boot/dts/exynos3250.dtsi |
206 | @@ -345,7 +345,7 @@ |
207 | }; |
208 | |
209 | hsotg: hsotg@12480000 { |
210 | - compatible = "snps,dwc2"; |
211 | + compatible = "samsung,s3c6400-hsotg", "snps,dwc2"; |
212 | reg = <0x12480000 0x20000>; |
213 | interrupts = <0 141 0>; |
214 | clocks = <&cmu CLK_USBOTG>; |
215 | diff --git a/arch/arm/boot/dts/mmp2.dtsi b/arch/arm/boot/dts/mmp2.dtsi |
216 | index 47e5b63339d1..e95deed6a797 100644 |
217 | --- a/arch/arm/boot/dts/mmp2.dtsi |
218 | +++ b/arch/arm/boot/dts/mmp2.dtsi |
219 | @@ -180,7 +180,7 @@ |
220 | clocks = <&soc_clocks MMP2_CLK_GPIO>; |
221 | resets = <&soc_clocks MMP2_CLK_GPIO>; |
222 | interrupt-controller; |
223 | - #interrupt-cells = <1>; |
224 | + #interrupt-cells = <2>; |
225 | ranges; |
226 | |
227 | gcb0: gpio@d4019000 { |
228 | diff --git a/arch/arm/boot/dts/omap3-pandora-common.dtsi b/arch/arm/boot/dts/omap3-pandora-common.dtsi |
229 | index 53e007abdc71..964240a0f4a9 100644 |
230 | --- a/arch/arm/boot/dts/omap3-pandora-common.dtsi |
231 | +++ b/arch/arm/boot/dts/omap3-pandora-common.dtsi |
232 | @@ -221,6 +221,17 @@ |
233 | gpio = <&gpio6 4 GPIO_ACTIVE_HIGH>; /* GPIO_164 */ |
234 | }; |
235 | |
236 | + /* wl1251 wifi+bt module */ |
237 | + wlan_en: fixed-regulator-wg7210_en { |
238 | + compatible = "regulator-fixed"; |
239 | + regulator-name = "vwlan"; |
240 | + regulator-min-microvolt = <1800000>; |
241 | + regulator-max-microvolt = <1800000>; |
242 | + startup-delay-us = <50000>; |
243 | + enable-active-high; |
244 | + gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>; |
245 | + }; |
246 | + |
247 | /* wg7210 (wifi+bt module) 32k clock buffer */ |
248 | wg7210_32k: fixed-regulator-wg7210_32k { |
249 | compatible = "regulator-fixed"; |
250 | @@ -514,9 +525,30 @@ |
251 | /*wp-gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;*/ /* GPIO_127 */ |
252 | }; |
253 | |
254 | -/* mmc3 is probed using pdata-quirks to pass wl1251 card data */ |
255 | &mmc3 { |
256 | - status = "disabled"; |
257 | + vmmc-supply = <&wlan_en>; |
258 | + |
259 | + bus-width = <4>; |
260 | + non-removable; |
261 | + ti,non-removable; |
262 | + cap-power-off-card; |
263 | + |
264 | + pinctrl-names = "default"; |
265 | + pinctrl-0 = <&mmc3_pins>; |
266 | + |
267 | + #address-cells = <1>; |
268 | + #size-cells = <0>; |
269 | + |
270 | + wlan: wifi@1 { |
271 | + compatible = "ti,wl1251"; |
272 | + |
273 | + reg = <1>; |
274 | + |
275 | + interrupt-parent = <&gpio1>; |
276 | + interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* GPIO_21 */ |
277 | + |
278 | + ti,wl1251-has-eeprom; |
279 | + }; |
280 | }; |
281 | |
282 | /* bluetooth*/ |
283 | diff --git a/arch/arm/boot/dts/omap3-tao3530.dtsi b/arch/arm/boot/dts/omap3-tao3530.dtsi |
284 | index dc80886b5329..e3dfba8b3efe 100644 |
285 | --- a/arch/arm/boot/dts/omap3-tao3530.dtsi |
286 | +++ b/arch/arm/boot/dts/omap3-tao3530.dtsi |
287 | @@ -225,7 +225,7 @@ |
288 | pinctrl-0 = <&mmc1_pins>; |
289 | vmmc-supply = <&vmmc1>; |
290 | vmmc_aux-supply = <&vsim>; |
291 | - cd-gpios = <&twl_gpio 0 GPIO_ACTIVE_HIGH>; |
292 | + cd-gpios = <&twl_gpio 0 GPIO_ACTIVE_LOW>; |
293 | bus-width = <8>; |
294 | }; |
295 | |
296 | diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi |
297 | index 0e1320afa156..d629948000db 100644 |
298 | --- a/arch/arm/boot/dts/pxa27x.dtsi |
299 | +++ b/arch/arm/boot/dts/pxa27x.dtsi |
300 | @@ -34,7 +34,7 @@ |
301 | clocks = <&clks CLK_NONE>; |
302 | }; |
303 | |
304 | - pxa27x_ohci: usb@4c000000 { |
305 | + usb0: usb@4c000000 { |
306 | compatible = "marvell,pxa-ohci"; |
307 | reg = <0x4c000000 0x10000>; |
308 | interrupts = <3>; |
309 | diff --git a/arch/arm/boot/dts/pxa2xx.dtsi b/arch/arm/boot/dts/pxa2xx.dtsi |
310 | index 3ff077ca4400..5a6f4ed92dac 100644 |
311 | --- a/arch/arm/boot/dts/pxa2xx.dtsi |
312 | +++ b/arch/arm/boot/dts/pxa2xx.dtsi |
313 | @@ -117,13 +117,6 @@ |
314 | status = "disabled"; |
315 | }; |
316 | |
317 | - usb0: ohci@4c000000 { |
318 | - compatible = "marvell,pxa-ohci"; |
319 | - reg = <0x4c000000 0x10000>; |
320 | - interrupts = <3>; |
321 | - status = "disabled"; |
322 | - }; |
323 | - |
324 | mmc0: mmc@41100000 { |
325 | compatible = "marvell,pxa-mmc"; |
326 | reg = <0x41100000 0x1000>; |
327 | diff --git a/arch/arm/boot/dts/pxa3xx.dtsi b/arch/arm/boot/dts/pxa3xx.dtsi |
328 | index 9d6f3aacedb7..4aee15062690 100644 |
329 | --- a/arch/arm/boot/dts/pxa3xx.dtsi |
330 | +++ b/arch/arm/boot/dts/pxa3xx.dtsi |
331 | @@ -187,7 +187,7 @@ |
332 | status = "disabled"; |
333 | }; |
334 | |
335 | - pxa3xx_ohci: usb@4c000000 { |
336 | + usb0: usb@4c000000 { |
337 | compatible = "marvell,pxa-ohci"; |
338 | reg = <0x4c000000 0x10000>; |
339 | interrupts = <3>; |
340 | diff --git a/arch/arm/boot/dts/rk3288-rock2-som.dtsi b/arch/arm/boot/dts/rk3288-rock2-som.dtsi |
341 | index bb1f01e037ba..c1c576875bc8 100644 |
342 | --- a/arch/arm/boot/dts/rk3288-rock2-som.dtsi |
343 | +++ b/arch/arm/boot/dts/rk3288-rock2-som.dtsi |
344 | @@ -63,7 +63,7 @@ |
345 | |
346 | vcc_flash: flash-regulator { |
347 | compatible = "regulator-fixed"; |
348 | - regulator-name = "vcc_sys"; |
349 | + regulator-name = "vcc_flash"; |
350 | regulator-min-microvolt = <1800000>; |
351 | regulator-max-microvolt = <1800000>; |
352 | startup-delay-us = <150>; |
353 | diff --git a/arch/arm/boot/dts/s3c6410-mini6410.dts b/arch/arm/boot/dts/s3c6410-mini6410.dts |
354 | index f4afda3594f8..de04d8764b0f 100644 |
355 | --- a/arch/arm/boot/dts/s3c6410-mini6410.dts |
356 | +++ b/arch/arm/boot/dts/s3c6410-mini6410.dts |
357 | @@ -167,6 +167,10 @@ |
358 | }; |
359 | }; |
360 | |
361 | +&clocks { |
362 | + clocks = <&fin_pll>; |
363 | +}; |
364 | + |
365 | &sdhci0 { |
366 | pinctrl-names = "default"; |
367 | pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>; |
368 | diff --git a/arch/arm/boot/dts/s3c6410-smdk6410.dts b/arch/arm/boot/dts/s3c6410-smdk6410.dts |
369 | index ecf35ec466f7..7ade1a0686d2 100644 |
370 | --- a/arch/arm/boot/dts/s3c6410-smdk6410.dts |
371 | +++ b/arch/arm/boot/dts/s3c6410-smdk6410.dts |
372 | @@ -71,6 +71,10 @@ |
373 | }; |
374 | }; |
375 | |
376 | +&clocks { |
377 | + clocks = <&fin_pll>; |
378 | +}; |
379 | + |
380 | &sdhci0 { |
381 | pinctrl-names = "default"; |
382 | pinctrl-0 = <&sd0_clk>, <&sd0_cmd>, <&sd0_cd>, <&sd0_bus4>; |
383 | diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi |
384 | index ce1960453a0b..3bfa79717dfa 100644 |
385 | --- a/arch/arm/boot/dts/sun6i-a31.dtsi |
386 | +++ b/arch/arm/boot/dts/sun6i-a31.dtsi |
387 | @@ -174,7 +174,7 @@ |
388 | }; |
389 | |
390 | pmu { |
391 | - compatible = "arm,cortex-a7-pmu", "arm,cortex-a15-pmu"; |
392 | + compatible = "arm,cortex-a7-pmu"; |
393 | interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>, |
394 | <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, |
395 | <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, |
396 | diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi |
397 | index 94cf5a1c7172..db5d30598ad6 100644 |
398 | --- a/arch/arm/boot/dts/sun7i-a20.dtsi |
399 | +++ b/arch/arm/boot/dts/sun7i-a20.dtsi |
400 | @@ -172,7 +172,7 @@ |
401 | }; |
402 | |
403 | pmu { |
404 | - compatible = "arm,cortex-a7-pmu", "arm,cortex-a15-pmu"; |
405 | + compatible = "arm,cortex-a7-pmu"; |
406 | interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>, |
407 | <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>; |
408 | }; |
409 | diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h |
410 | index 0f6c6b873bc5..e05c31af48d1 100644 |
411 | --- a/arch/arm/include/asm/uaccess.h |
412 | +++ b/arch/arm/include/asm/uaccess.h |
413 | @@ -379,6 +379,13 @@ do { \ |
414 | #define __get_user_asm_byte(x, addr, err) \ |
415 | __get_user_asm(x, addr, err, ldrb) |
416 | |
417 | +#if __LINUX_ARM_ARCH__ >= 6 |
418 | + |
419 | +#define __get_user_asm_half(x, addr, err) \ |
420 | + __get_user_asm(x, addr, err, ldrh) |
421 | + |
422 | +#else |
423 | + |
424 | #ifndef __ARMEB__ |
425 | #define __get_user_asm_half(x, __gu_addr, err) \ |
426 | ({ \ |
427 | @@ -397,6 +404,8 @@ do { \ |
428 | }) |
429 | #endif |
430 | |
431 | +#endif /* __LINUX_ARM_ARCH__ >= 6 */ |
432 | + |
433 | #define __get_user_asm_word(x, addr, err) \ |
434 | __get_user_asm(x, addr, err, ldr) |
435 | #endif |
436 | @@ -472,6 +481,13 @@ do { \ |
437 | #define __put_user_asm_byte(x, __pu_addr, err) \ |
438 | __put_user_asm(x, __pu_addr, err, strb) |
439 | |
440 | +#if __LINUX_ARM_ARCH__ >= 6 |
441 | + |
442 | +#define __put_user_asm_half(x, __pu_addr, err) \ |
443 | + __put_user_asm(x, __pu_addr, err, strh) |
444 | + |
445 | +#else |
446 | + |
447 | #ifndef __ARMEB__ |
448 | #define __put_user_asm_half(x, __pu_addr, err) \ |
449 | ({ \ |
450 | @@ -488,6 +504,8 @@ do { \ |
451 | }) |
452 | #endif |
453 | |
454 | +#endif /* __LINUX_ARM_ARCH__ >= 6 */ |
455 | + |
456 | #define __put_user_asm_word(x, __pu_addr, err) \ |
457 | __put_user_asm(x, __pu_addr, err, str) |
458 | |
459 | diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S |
460 | index 746e7801dcdf..b2e4bc3a635e 100644 |
461 | --- a/arch/arm/lib/getuser.S |
462 | +++ b/arch/arm/lib/getuser.S |
463 | @@ -42,6 +42,12 @@ _ASM_NOKPROBE(__get_user_1) |
464 | |
465 | ENTRY(__get_user_2) |
466 | check_uaccess r0, 2, r1, r2, __get_user_bad |
467 | +#if __LINUX_ARM_ARCH__ >= 6 |
468 | + |
469 | +2: TUSER(ldrh) r2, [r0] |
470 | + |
471 | +#else |
472 | + |
473 | #ifdef CONFIG_CPU_USE_DOMAINS |
474 | rb .req ip |
475 | 2: ldrbt r2, [r0], #1 |
476 | @@ -56,6 +62,9 @@ rb .req r0 |
477 | #else |
478 | orr r2, rb, r2, lsl #8 |
479 | #endif |
480 | + |
481 | +#endif /* __LINUX_ARM_ARCH__ >= 6 */ |
482 | + |
483 | mov r0, #0 |
484 | ret lr |
485 | ENDPROC(__get_user_2) |
486 | @@ -145,7 +154,9 @@ _ASM_NOKPROBE(__get_user_bad8) |
487 | .pushsection __ex_table, "a" |
488 | .long 1b, __get_user_bad |
489 | .long 2b, __get_user_bad |
490 | +#if __LINUX_ARM_ARCH__ < 6 |
491 | .long 3b, __get_user_bad |
492 | +#endif |
493 | .long 4b, __get_user_bad |
494 | .long 5b, __get_user_bad8 |
495 | .long 6b, __get_user_bad8 |
496 | diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S |
497 | index 38d660d3705f..515eeaa9975c 100644 |
498 | --- a/arch/arm/lib/putuser.S |
499 | +++ b/arch/arm/lib/putuser.S |
500 | @@ -41,16 +41,13 @@ ENDPROC(__put_user_1) |
501 | |
502 | ENTRY(__put_user_2) |
503 | check_uaccess r0, 2, r1, ip, __put_user_bad |
504 | - mov ip, r2, lsr #8 |
505 | -#ifdef CONFIG_THUMB2_KERNEL |
506 | -#ifndef __ARMEB__ |
507 | -2: TUSER(strb) r2, [r0] |
508 | -3: TUSER(strb) ip, [r0, #1] |
509 | +#if __LINUX_ARM_ARCH__ >= 6 |
510 | + |
511 | +2: TUSER(strh) r2, [r0] |
512 | + |
513 | #else |
514 | -2: TUSER(strb) ip, [r0] |
515 | -3: TUSER(strb) r2, [r0, #1] |
516 | -#endif |
517 | -#else /* !CONFIG_THUMB2_KERNEL */ |
518 | + |
519 | + mov ip, r2, lsr #8 |
520 | #ifndef __ARMEB__ |
521 | 2: TUSER(strb) r2, [r0], #1 |
522 | 3: TUSER(strb) ip, [r0] |
523 | @@ -58,7 +55,8 @@ ENTRY(__put_user_2) |
524 | 2: TUSER(strb) ip, [r0], #1 |
525 | 3: TUSER(strb) r2, [r0] |
526 | #endif |
527 | -#endif /* CONFIG_THUMB2_KERNEL */ |
528 | + |
529 | +#endif /* __LINUX_ARM_ARCH__ >= 6 */ |
530 | mov r0, #0 |
531 | ret lr |
532 | ENDPROC(__put_user_2) |
533 | @@ -91,7 +89,9 @@ ENDPROC(__put_user_bad) |
534 | .pushsection __ex_table, "a" |
535 | .long 1b, __put_user_bad |
536 | .long 2b, __put_user_bad |
537 | +#if __LINUX_ARM_ARCH__ < 6 |
538 | .long 3b, __put_user_bad |
539 | +#endif |
540 | .long 4b, __put_user_bad |
541 | .long 5b, __put_user_bad |
542 | .long 6b, __put_user_bad |
543 | diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c |
544 | index 52de382fc804..7e49dfda3d2f 100644 |
545 | --- a/arch/arm/mach-omap1/id.c |
546 | +++ b/arch/arm/mach-omap1/id.c |
547 | @@ -200,10 +200,10 @@ void __init omap_check_revision(void) |
548 | printk(KERN_INFO "Unknown OMAP cpu type: 0x%02x\n", cpu_type); |
549 | } |
550 | |
551 | - printk(KERN_INFO "OMAP%04x", omap_revision >> 16); |
552 | + pr_info("OMAP%04x", omap_revision >> 16); |
553 | if ((omap_revision >> 8) & 0xff) |
554 | - printk(KERN_INFO "%x", (omap_revision >> 8) & 0xff); |
555 | - printk(KERN_INFO " revision %i handled as %02xxx id: %08x%08x\n", |
556 | + pr_cont("%x", (omap_revision >> 8) & 0xff); |
557 | + pr_cont(" revision %i handled as %02xxx id: %08x%08x\n", |
558 | die_rev, omap_revision & 0xff, system_serial_low, |
559 | system_serial_high); |
560 | } |
561 | diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c |
562 | index cc6d9fa60924..9d942f022f2f 100644 |
563 | --- a/arch/arm/mach-omap2/id.c |
564 | +++ b/arch/arm/mach-omap2/id.c |
565 | @@ -199,8 +199,8 @@ void __init omap2xxx_check_revision(void) |
566 | |
567 | pr_info("%s", soc_name); |
568 | if ((omap_rev() >> 8) & 0x0f) |
569 | - pr_info("%s", soc_rev); |
570 | - pr_info("\n"); |
571 | + pr_cont("%s", soc_rev); |
572 | + pr_cont("\n"); |
573 | } |
574 | |
575 | #define OMAP3_SHOW_FEATURE(feat) \ |
576 | diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c |
577 | index 88676fe9b119..c3b3972c301a 100644 |
578 | --- a/arch/arm/mach-omap2/pdata-quirks.c |
579 | +++ b/arch/arm/mach-omap2/pdata-quirks.c |
580 | @@ -308,108 +308,15 @@ static void __init omap3_logicpd_torpedo_init(void) |
581 | } |
582 | |
583 | /* omap3pandora legacy devices */ |
584 | -#define PANDORA_WIFI_IRQ_GPIO 21 |
585 | -#define PANDORA_WIFI_NRESET_GPIO 23 |
586 | |
587 | static struct platform_device pandora_backlight = { |
588 | .name = "pandora-backlight", |
589 | .id = -1, |
590 | }; |
591 | |
592 | -static struct regulator_consumer_supply pandora_vmmc3_supply[] = { |
593 | - REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"), |
594 | -}; |
595 | - |
596 | -static struct regulator_init_data pandora_vmmc3 = { |
597 | - .constraints = { |
598 | - .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
599 | - }, |
600 | - .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc3_supply), |
601 | - .consumer_supplies = pandora_vmmc3_supply, |
602 | -}; |
603 | - |
604 | -static struct fixed_voltage_config pandora_vwlan = { |
605 | - .supply_name = "vwlan", |
606 | - .microvolts = 1800000, /* 1.8V */ |
607 | - .gpio = PANDORA_WIFI_NRESET_GPIO, |
608 | - .startup_delay = 50000, /* 50ms */ |
609 | - .enable_high = 1, |
610 | - .init_data = &pandora_vmmc3, |
611 | -}; |
612 | - |
613 | -static struct platform_device pandora_vwlan_device = { |
614 | - .name = "reg-fixed-voltage", |
615 | - .id = 1, |
616 | - .dev = { |
617 | - .platform_data = &pandora_vwlan, |
618 | - }, |
619 | -}; |
620 | - |
621 | -static void pandora_wl1251_init_card(struct mmc_card *card) |
622 | -{ |
623 | - /* |
624 | - * We have TI wl1251 attached to MMC3. Pass this information to |
625 | - * SDIO core because it can't be probed by normal methods. |
626 | - */ |
627 | - if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) { |
628 | - card->quirks |= MMC_QUIRK_NONSTD_SDIO; |
629 | - card->cccr.wide_bus = 1; |
630 | - card->cis.vendor = 0x104c; |
631 | - card->cis.device = 0x9066; |
632 | - card->cis.blksize = 512; |
633 | - card->cis.max_dtr = 24000000; |
634 | - card->ocr = 0x80; |
635 | - } |
636 | -} |
637 | - |
638 | -static struct omap2_hsmmc_info pandora_mmc3[] = { |
639 | - { |
640 | - .mmc = 3, |
641 | - .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, |
642 | - .gpio_cd = -EINVAL, |
643 | - .gpio_wp = -EINVAL, |
644 | - .init_card = pandora_wl1251_init_card, |
645 | - }, |
646 | - {} /* Terminator */ |
647 | -}; |
648 | - |
649 | -static void __init pandora_wl1251_init(void) |
650 | -{ |
651 | - struct wl1251_platform_data pandora_wl1251_pdata; |
652 | - int ret; |
653 | - |
654 | - memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); |
655 | - |
656 | - pandora_wl1251_pdata.power_gpio = -1; |
657 | - |
658 | - ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq"); |
659 | - if (ret < 0) |
660 | - goto fail; |
661 | - |
662 | - pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); |
663 | - if (pandora_wl1251_pdata.irq < 0) |
664 | - goto fail_irq; |
665 | - |
666 | - pandora_wl1251_pdata.use_eeprom = true; |
667 | - ret = wl1251_set_platform_data(&pandora_wl1251_pdata); |
668 | - if (ret < 0) |
669 | - goto fail_irq; |
670 | - |
671 | - return; |
672 | - |
673 | -fail_irq: |
674 | - gpio_free(PANDORA_WIFI_IRQ_GPIO); |
675 | -fail: |
676 | - pr_err("wl1251 board initialisation failed\n"); |
677 | -} |
678 | - |
679 | static void __init omap3_pandora_legacy_init(void) |
680 | { |
681 | platform_device_register(&pandora_backlight); |
682 | - platform_device_register(&pandora_vwlan_device); |
683 | - omap_hsmmc_init(pandora_mmc3); |
684 | - omap_hsmmc_late_init(pandora_mmc3); |
685 | - pandora_wl1251_init(); |
686 | } |
687 | #endif /* CONFIG_ARCH_OMAP3 */ |
688 | |
689 | diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S |
690 | index e3070fdab80b..3fe4ae654047 100644 |
691 | --- a/arch/arm/mach-tegra/reset-handler.S |
692 | +++ b/arch/arm/mach-tegra/reset-handler.S |
693 | @@ -56,16 +56,16 @@ ENTRY(tegra_resume) |
694 | cmp r6, #TEGRA20 |
695 | beq 1f @ Yes |
696 | /* Clear the flow controller flags for this CPU. */ |
697 | - cpu_to_csr_reg r1, r0 |
698 | + cpu_to_csr_reg r3, r0 |
699 | mov32 r2, TEGRA_FLOW_CTRL_BASE |
700 | - ldr r1, [r2, r1] |
701 | + ldr r1, [r2, r3] |
702 | /* Clear event & intr flag */ |
703 | orr r1, r1, \ |
704 | #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG |
705 | movw r0, #0x3FFD @ enable, cluster_switch, immed, bitmaps |
706 | @ & ext flags for CPU power mgnt |
707 | bic r1, r1, r0 |
708 | - str r1, [r2] |
709 | + str r1, [r2, r3] |
710 | 1: |
711 | |
712 | mov32 r9, 0xc09 |
713 | diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi |
714 | index e5fc67bf46c2..a88afb6a9c0c 100644 |
715 | --- a/arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi |
716 | +++ b/arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi |
717 | @@ -1583,7 +1583,7 @@ |
718 | regulator-name = "VDD_HDMI_5V0"; |
719 | regulator-min-microvolt = <5000000>; |
720 | regulator-max-microvolt = <5000000>; |
721 | - gpio = <&exp1 12 GPIO_ACTIVE_LOW>; |
722 | + gpio = <&exp1 12 GPIO_ACTIVE_HIGH>; |
723 | enable-active-high; |
724 | vin-supply = <&vdd_5v0_sys>; |
725 | }; |
726 | diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig |
727 | index 92bcde046b6b..f8a529c85279 100644 |
728 | --- a/arch/mips/Kconfig |
729 | +++ b/arch/mips/Kconfig |
730 | @@ -804,6 +804,7 @@ config SIBYTE_LITTLESUR |
731 | select SYS_SUPPORTS_BIG_ENDIAN |
732 | select SYS_SUPPORTS_HIGHMEM |
733 | select SYS_SUPPORTS_LITTLE_ENDIAN |
734 | + select ZONE_DMA32 if 64BIT |
735 | |
736 | config SIBYTE_SENTOSA |
737 | bool "Sibyte BCM91250E-Sentosa" |
738 | diff --git a/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c b/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c |
739 | index 8241fc6aa17d..3839feba68f2 100644 |
740 | --- a/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c |
741 | +++ b/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c |
742 | @@ -266,7 +266,7 @@ int cvmx_cmd_queue_length(cvmx_cmd_queue_id_t queue_id) |
743 | } else { |
744 | union cvmx_pko_mem_debug8 debug8; |
745 | debug8.u64 = cvmx_read_csr(CVMX_PKO_MEM_DEBUG8); |
746 | - return debug8.cn58xx.doorbell; |
747 | + return debug8.cn50xx.doorbell; |
748 | } |
749 | case CVMX_CMD_QUEUE_ZIP: |
750 | case CVMX_CMD_QUEUE_DFA: |
751 | diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c |
752 | index 1ba6bcf98570..2ecc8d1b0539 100644 |
753 | --- a/arch/mips/cavium-octeon/octeon-platform.c |
754 | +++ b/arch/mips/cavium-octeon/octeon-platform.c |
755 | @@ -502,7 +502,7 @@ static void __init octeon_fdt_set_phy(int eth, int phy_addr) |
756 | if (phy_addr >= 256 && alt_phy > 0) { |
757 | const struct fdt_property *phy_prop; |
758 | struct fdt_property *alt_prop; |
759 | - u32 phy_handle_name; |
760 | + fdt32_t phy_handle_name; |
761 | |
762 | /* Use the alt phy node instead.*/ |
763 | phy_prop = fdt_get_property(initial_boot_params, eth, "phy-handle", NULL); |
764 | diff --git a/arch/mips/include/asm/octeon/cvmx-pko.h b/arch/mips/include/asm/octeon/cvmx-pko.h |
765 | index 5f47f76ed510..20eb9c46a75a 100644 |
766 | --- a/arch/mips/include/asm/octeon/cvmx-pko.h |
767 | +++ b/arch/mips/include/asm/octeon/cvmx-pko.h |
768 | @@ -611,7 +611,7 @@ static inline void cvmx_pko_get_port_status(uint64_t port_num, uint64_t clear, |
769 | pko_reg_read_idx.s.index = cvmx_pko_get_base_queue(port_num); |
770 | cvmx_write_csr(CVMX_PKO_REG_READ_IDX, pko_reg_read_idx.u64); |
771 | debug8.u64 = cvmx_read_csr(CVMX_PKO_MEM_DEBUG8); |
772 | - status->doorbell = debug8.cn58xx.doorbell; |
773 | + status->doorbell = debug8.cn50xx.doorbell; |
774 | } |
775 | } |
776 | |
777 | diff --git a/arch/powerpc/include/asm/sfp-machine.h b/arch/powerpc/include/asm/sfp-machine.h |
778 | index d89beaba26ff..8b957aabb826 100644 |
779 | --- a/arch/powerpc/include/asm/sfp-machine.h |
780 | +++ b/arch/powerpc/include/asm/sfp-machine.h |
781 | @@ -213,30 +213,18 @@ |
782 | * respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow |
783 | * (i.e. carry out) is not stored anywhere, and is lost. |
784 | */ |
785 | -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ |
786 | +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ |
787 | do { \ |
788 | if (__builtin_constant_p (bh) && (bh) == 0) \ |
789 | - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ |
790 | - : "=r" ((USItype)(sh)), \ |
791 | - "=&r" ((USItype)(sl)) \ |
792 | - : "%r" ((USItype)(ah)), \ |
793 | - "%r" ((USItype)(al)), \ |
794 | - "rI" ((USItype)(bl))); \ |
795 | - else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \ |
796 | - __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ |
797 | - : "=r" ((USItype)(sh)), \ |
798 | - "=&r" ((USItype)(sl)) \ |
799 | - : "%r" ((USItype)(ah)), \ |
800 | - "%r" ((USItype)(al)), \ |
801 | - "rI" ((USItype)(bl))); \ |
802 | + __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ |
803 | + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ |
804 | + else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ |
805 | + __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ |
806 | + : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ |
807 | else \ |
808 | - __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ |
809 | - : "=r" ((USItype)(sh)), \ |
810 | - "=&r" ((USItype)(sl)) \ |
811 | - : "%r" ((USItype)(ah)), \ |
812 | - "r" ((USItype)(bh)), \ |
813 | - "%r" ((USItype)(al)), \ |
814 | - "rI" ((USItype)(bl))); \ |
815 | + __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ |
816 | + : "=r" (sh), "=&r" (sl) \ |
817 | + : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ |
818 | } while (0) |
819 | |
820 | /* sub_ddmmss is used in op-2.h and udivmodti4.c and should be equivalent to |
821 | @@ -248,44 +236,24 @@ |
822 | * and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, |
823 | * and is lost. |
824 | */ |
825 | -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ |
826 | +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ |
827 | do { \ |
828 | if (__builtin_constant_p (ah) && (ah) == 0) \ |
829 | - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ |
830 | - : "=r" ((USItype)(sh)), \ |
831 | - "=&r" ((USItype)(sl)) \ |
832 | - : "r" ((USItype)(bh)), \ |
833 | - "rI" ((USItype)(al)), \ |
834 | - "r" ((USItype)(bl))); \ |
835 | - else if (__builtin_constant_p (ah) && (ah) ==~(USItype) 0) \ |
836 | - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ |
837 | - : "=r" ((USItype)(sh)), \ |
838 | - "=&r" ((USItype)(sl)) \ |
839 | - : "r" ((USItype)(bh)), \ |
840 | - "rI" ((USItype)(al)), \ |
841 | - "r" ((USItype)(bl))); \ |
842 | + __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ |
843 | + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ |
844 | + else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ |
845 | + __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ |
846 | + : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ |
847 | else if (__builtin_constant_p (bh) && (bh) == 0) \ |
848 | - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ |
849 | - : "=r" ((USItype)(sh)), \ |
850 | - "=&r" ((USItype)(sl)) \ |
851 | - : "r" ((USItype)(ah)), \ |
852 | - "rI" ((USItype)(al)), \ |
853 | - "r" ((USItype)(bl))); \ |
854 | - else if (__builtin_constant_p (bh) && (bh) ==~(USItype) 0) \ |
855 | - __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ |
856 | - : "=r" ((USItype)(sh)), \ |
857 | - "=&r" ((USItype)(sl)) \ |
858 | - : "r" ((USItype)(ah)), \ |
859 | - "rI" ((USItype)(al)), \ |
860 | - "r" ((USItype)(bl))); \ |
861 | + __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ |
862 | + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ |
863 | + else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ |
864 | + __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ |
865 | + : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ |
866 | else \ |
867 | - __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ |
868 | - : "=r" ((USItype)(sh)), \ |
869 | - "=&r" ((USItype)(sl)) \ |
870 | - : "r" ((USItype)(ah)), \ |
871 | - "r" ((USItype)(bh)), \ |
872 | - "rI" ((USItype)(al)), \ |
873 | - "r" ((USItype)(bl))); \ |
874 | + __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ |
875 | + : "=r" (sh), "=&r" (sl) \ |
876 | + : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ |
877 | } while (0) |
878 | |
879 | /* asm fragments for mul and div */ |
880 | @@ -294,13 +262,10 @@ |
881 | * UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype |
882 | * word product in HIGH_PROD and LOW_PROD. |
883 | */ |
884 | -#define umul_ppmm(ph, pl, m0, m1) \ |
885 | +#define umul_ppmm(ph, pl, m0, m1) \ |
886 | do { \ |
887 | USItype __m0 = (m0), __m1 = (m1); \ |
888 | - __asm__ ("mulhwu %0,%1,%2" \ |
889 | - : "=r" ((USItype)(ph)) \ |
890 | - : "%r" (__m0), \ |
891 | - "r" (__m1)); \ |
892 | + __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ |
893 | (pl) = __m0 * __m1; \ |
894 | } while (0) |
895 | |
896 | @@ -312,9 +277,10 @@ |
897 | * significant bit of DENOMINATOR must be 1, then the pre-processor symbol |
898 | * UDIV_NEEDS_NORMALIZATION is defined to 1. |
899 | */ |
900 | -#define udiv_qrnnd(q, r, n1, n0, d) \ |
901 | +#define udiv_qrnnd(q, r, n1, n0, d) \ |
902 | do { \ |
903 | - UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m; \ |
904 | + UWtype __d1, __d0, __q1, __q0; \ |
905 | + UWtype __r1, __r0, __m; \ |
906 | __d1 = __ll_highpart (d); \ |
907 | __d0 = __ll_lowpart (d); \ |
908 | \ |
909 | @@ -325,7 +291,7 @@ |
910 | if (__r1 < __m) \ |
911 | { \ |
912 | __q1--, __r1 += (d); \ |
913 | - if (__r1 >= (d)) /* we didn't get carry when adding to __r1 */ \ |
914 | + if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\ |
915 | if (__r1 < __m) \ |
916 | __q1--, __r1 += (d); \ |
917 | } \ |
918 | diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h |
919 | index 1afe90ade595..674c03350cd1 100644 |
920 | --- a/arch/powerpc/include/asm/vdso_datapage.h |
921 | +++ b/arch/powerpc/include/asm/vdso_datapage.h |
922 | @@ -86,6 +86,7 @@ struct vdso_data { |
923 | __s32 wtom_clock_nsec; |
924 | struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */ |
925 | __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ |
926 | + __u32 hrtimer_res; /* hrtimer resolution */ |
927 | __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ |
928 | __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ |
929 | }; |
930 | @@ -107,6 +108,7 @@ struct vdso_data { |
931 | __s32 wtom_clock_nsec; |
932 | struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */ |
933 | __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ |
934 | + __u32 hrtimer_res; /* hrtimer resolution */ |
935 | __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ |
936 | __u32 dcache_block_size; /* L1 d-cache block size */ |
937 | __u32 icache_block_size; /* L1 i-cache block size */ |
938 | diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c |
939 | index 14fbbd9035ca..dfcf28be12ba 100644 |
940 | --- a/arch/powerpc/kernel/asm-offsets.c |
941 | +++ b/arch/powerpc/kernel/asm-offsets.c |
942 | @@ -383,6 +383,7 @@ int main(void) |
943 | DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); |
944 | DEFINE(STAMP_XTIME, offsetof(struct vdso_data, stamp_xtime)); |
945 | DEFINE(STAMP_SEC_FRAC, offsetof(struct vdso_data, stamp_sec_fraction)); |
946 | + DEFINE(CLOCK_HRTIMER_RES, offsetof(struct vdso_data, hrtimer_res)); |
947 | DEFINE(CFG_ICACHE_BLOCKSZ, offsetof(struct vdso_data, icache_block_size)); |
948 | DEFINE(CFG_DCACHE_BLOCKSZ, offsetof(struct vdso_data, dcache_block_size)); |
949 | DEFINE(CFG_ICACHE_LOGBLOCKSZ, offsetof(struct vdso_data, icache_log_block_size)); |
950 | @@ -411,7 +412,6 @@ int main(void) |
951 | DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); |
952 | DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); |
953 | DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); |
954 | - DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); |
955 | |
956 | #ifdef CONFIG_BUG |
957 | DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry)); |
958 | diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c |
959 | index ab7b661b6da3..3c6258a1656b 100644 |
960 | --- a/arch/powerpc/kernel/time.c |
961 | +++ b/arch/powerpc/kernel/time.c |
962 | @@ -862,6 +862,7 @@ void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm, |
963 | vdso_data->wtom_clock_nsec = wtm->tv_nsec; |
964 | vdso_data->stamp_xtime = *wall_time; |
965 | vdso_data->stamp_sec_fraction = frac_sec; |
966 | + vdso_data->hrtimer_res = hrtimer_resolution; |
967 | smp_wmb(); |
968 | ++(vdso_data->tb_update_count); |
969 | } |
970 | diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S |
971 | index 7b341b86216c..9b24466570c8 100644 |
972 | --- a/arch/powerpc/kernel/vdso32/gettimeofday.S |
973 | +++ b/arch/powerpc/kernel/vdso32/gettimeofday.S |
974 | @@ -160,12 +160,15 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) |
975 | cror cr0*4+eq,cr0*4+eq,cr1*4+eq |
976 | bne cr0,99f |
977 | |
978 | + mflr r12 |
979 | + .cfi_register lr,r12 |
980 | + bl __get_datapage@local /* get data page */ |
981 | + lwz r5, CLOCK_HRTIMER_RES(r3) |
982 | + mtlr r12 |
983 | li r3,0 |
984 | cmpli cr0,r4,0 |
985 | crclr cr0*4+so |
986 | beqlr |
987 | - lis r5,CLOCK_REALTIME_RES@h |
988 | - ori r5,r5,CLOCK_REALTIME_RES@l |
989 | stw r3,TSPC32_TV_SEC(r4) |
990 | stw r5,TSPC32_TV_NSEC(r4) |
991 | blr |
992 | diff --git a/arch/powerpc/kernel/vdso64/cacheflush.S b/arch/powerpc/kernel/vdso64/cacheflush.S |
993 | index 69c5af2b3c96..228a4a2383d6 100644 |
994 | --- a/arch/powerpc/kernel/vdso64/cacheflush.S |
995 | +++ b/arch/powerpc/kernel/vdso64/cacheflush.S |
996 | @@ -39,7 +39,7 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache) |
997 | subf r8,r6,r4 /* compute length */ |
998 | add r8,r8,r5 /* ensure we get enough */ |
999 | lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10) |
1000 | - srw. r8,r8,r9 /* compute line count */ |
1001 | + srd. r8,r8,r9 /* compute line count */ |
1002 | crclr cr0*4+so |
1003 | beqlr /* nothing to do? */ |
1004 | mtctr r8 |
1005 | @@ -56,7 +56,7 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache) |
1006 | subf r8,r6,r4 /* compute length */ |
1007 | add r8,r8,r5 |
1008 | lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10) |
1009 | - srw. r8,r8,r9 /* compute line count */ |
1010 | + srd. r8,r8,r9 /* compute line count */ |
1011 | crclr cr0*4+so |
1012 | beqlr /* nothing to do? */ |
1013 | mtctr r8 |
1014 | diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S |
1015 | index 09b2a49f6dd5..c973378e1f2b 100644 |
1016 | --- a/arch/powerpc/kernel/vdso64/gettimeofday.S |
1017 | +++ b/arch/powerpc/kernel/vdso64/gettimeofday.S |
1018 | @@ -145,12 +145,15 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) |
1019 | cror cr0*4+eq,cr0*4+eq,cr1*4+eq |
1020 | bne cr0,99f |
1021 | |
1022 | + mflr r12 |
1023 | + .cfi_register lr,r12 |
1024 | + bl V_LOCAL_FUNC(__get_datapage) |
1025 | + lwz r5, CLOCK_HRTIMER_RES(r3) |
1026 | + mtlr r12 |
1027 | li r3,0 |
1028 | cmpldi cr0,r4,0 |
1029 | crclr cr0*4+so |
1030 | beqlr |
1031 | - lis r5,CLOCK_REALTIME_RES@h |
1032 | - ori r5,r5,CLOCK_REALTIME_RES@l |
1033 | std r3,TSPC64_TV_SEC(r4) |
1034 | std r5,TSPC64_TV_NSEC(r4) |
1035 | blr |
1036 | diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
1037 | index e348bee411e3..d3b2c5b25c9c 100644 |
1038 | --- a/arch/x86/kernel/cpu/mcheck/mce.c |
1039 | +++ b/arch/x86/kernel/cpu/mcheck/mce.c |
1040 | @@ -1648,36 +1648,6 @@ static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) |
1041 | if (c->x86 == 0x15 && c->x86_model <= 0xf) |
1042 | mce_flags.overflow_recov = 1; |
1043 | |
1044 | - /* |
1045 | - * Turn off MC4_MISC thresholding banks on those models since |
1046 | - * they're not supported there. |
1047 | - */ |
1048 | - if (c->x86 == 0x15 && |
1049 | - (c->x86_model >= 0x10 && c->x86_model <= 0x1f)) { |
1050 | - int i; |
1051 | - u64 hwcr; |
1052 | - bool need_toggle; |
1053 | - u32 msrs[] = { |
1054 | - 0x00000413, /* MC4_MISC0 */ |
1055 | - 0xc0000408, /* MC4_MISC1 */ |
1056 | - }; |
1057 | - |
1058 | - rdmsrl(MSR_K7_HWCR, hwcr); |
1059 | - |
1060 | - /* McStatusWrEn has to be set */ |
1061 | - need_toggle = !(hwcr & BIT(18)); |
1062 | - |
1063 | - if (need_toggle) |
1064 | - wrmsrl(MSR_K7_HWCR, hwcr | BIT(18)); |
1065 | - |
1066 | - /* Clear CntP bit safely */ |
1067 | - for (i = 0; i < ARRAY_SIZE(msrs); i++) |
1068 | - msr_clear_bit(msrs[i], 62); |
1069 | - |
1070 | - /* restore old settings */ |
1071 | - if (need_toggle) |
1072 | - wrmsrl(MSR_K7_HWCR, hwcr); |
1073 | - } |
1074 | } |
1075 | |
1076 | if (c->x86_vendor == X86_VENDOR_INTEL) { |
1077 | diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c |
1078 | index 39526e1e3132..2a473cda3977 100644 |
1079 | --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c |
1080 | +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c |
1081 | @@ -499,6 +499,40 @@ out: |
1082 | return offset; |
1083 | } |
1084 | |
1085 | +/* |
1086 | + * Turn off MC4_MISC thresholding banks on all family 0x15 models since |
1087 | + * they're not supported there. |
1088 | + */ |
1089 | +void disable_err_thresholding(struct cpuinfo_x86 *c) |
1090 | +{ |
1091 | + int i; |
1092 | + u64 hwcr; |
1093 | + bool need_toggle; |
1094 | + u32 msrs[] = { |
1095 | + 0x00000413, /* MC4_MISC0 */ |
1096 | + 0xc0000408, /* MC4_MISC1 */ |
1097 | + }; |
1098 | + |
1099 | + if (c->x86 != 0x15) |
1100 | + return; |
1101 | + |
1102 | + rdmsrl(MSR_K7_HWCR, hwcr); |
1103 | + |
1104 | + /* McStatusWrEn has to be set */ |
1105 | + need_toggle = !(hwcr & BIT(18)); |
1106 | + |
1107 | + if (need_toggle) |
1108 | + wrmsrl(MSR_K7_HWCR, hwcr | BIT(18)); |
1109 | + |
1110 | + /* Clear CntP bit safely */ |
1111 | + for (i = 0; i < ARRAY_SIZE(msrs); i++) |
1112 | + msr_clear_bit(msrs[i], 62); |
1113 | + |
1114 | + /* restore old settings */ |
1115 | + if (need_toggle) |
1116 | + wrmsrl(MSR_K7_HWCR, hwcr); |
1117 | +} |
1118 | + |
1119 | /* cpu init entry point, called from mce.c with preempt off */ |
1120 | void mce_amd_feature_init(struct cpuinfo_x86 *c) |
1121 | { |
1122 | @@ -506,6 +540,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) |
1123 | unsigned int bank, block, cpu = smp_processor_id(); |
1124 | int offset = -1; |
1125 | |
1126 | + disable_err_thresholding(c); |
1127 | + |
1128 | for (bank = 0; bank < mca_cfg.banks; ++bank) { |
1129 | if (mce_flags.smca) |
1130 | get_smca_bank_info(bank); |
1131 | diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c |
1132 | index 18c5b4920e92..242ad06fbe1a 100644 |
1133 | --- a/arch/x86/kvm/cpuid.c |
1134 | +++ b/arch/x86/kvm/cpuid.c |
1135 | @@ -389,7 +389,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, |
1136 | |
1137 | r = -E2BIG; |
1138 | |
1139 | - if (*nent >= maxnent) |
1140 | + if (WARN_ON(*nent >= maxnent)) |
1141 | goto out; |
1142 | |
1143 | do_cpuid_1_ent(entry, function, index); |
1144 | @@ -691,6 +691,9 @@ out: |
1145 | static int do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 func, |
1146 | u32 idx, int *nent, int maxnent, unsigned int type) |
1147 | { |
1148 | + if (*nent >= maxnent) |
1149 | + return -E2BIG; |
1150 | + |
1151 | if (type == KVM_GET_EMULATED_CPUID) |
1152 | return __do_cpuid_ent_emulated(entry, func, idx, nent, maxnent); |
1153 | |
1154 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
1155 | index 06cd710e1d45..c9c533370e88 100644 |
1156 | --- a/arch/x86/kvm/x86.c |
1157 | +++ b/arch/x86/kvm/x86.c |
1158 | @@ -273,13 +273,14 @@ int kvm_set_shared_msr(unsigned slot, u64 value, u64 mask) |
1159 | struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu); |
1160 | int err; |
1161 | |
1162 | - if (((value ^ smsr->values[slot].curr) & mask) == 0) |
1163 | + value = (value & mask) | (smsr->values[slot].host & ~mask); |
1164 | + if (value == smsr->values[slot].curr) |
1165 | return 0; |
1166 | - smsr->values[slot].curr = value; |
1167 | err = wrmsrl_safe(shared_msrs_global.msrs[slot], value); |
1168 | if (err) |
1169 | return 1; |
1170 | |
1171 | + smsr->values[slot].curr = value; |
1172 | if (!smsr->registered) { |
1173 | smsr->urn.on_user_return = kvm_on_user_return; |
1174 | user_return_notifier_register(&smsr->urn); |
1175 | @@ -1074,10 +1075,15 @@ u64 kvm_get_arch_capabilities(void) |
1176 | * If TSX is disabled on the system, guests are also mitigated against |
1177 | * TAA and clear CPU buffer mitigation is not required for guests. |
1178 | */ |
1179 | - if (boot_cpu_has_bug(X86_BUG_TAA) && boot_cpu_has(X86_FEATURE_RTM) && |
1180 | - (data & ARCH_CAP_TSX_CTRL_MSR)) |
1181 | + if (!boot_cpu_has(X86_FEATURE_RTM)) |
1182 | + data &= ~ARCH_CAP_TAA_NO; |
1183 | + else if (!boot_cpu_has_bug(X86_BUG_TAA)) |
1184 | + data |= ARCH_CAP_TAA_NO; |
1185 | + else if (data & ARCH_CAP_TSX_CTRL_MSR) |
1186 | data &= ~ARCH_CAP_MDS_NO; |
1187 | |
1188 | + /* KVM does not emulate MSR_IA32_TSX_CTRL. */ |
1189 | + data &= ~ARCH_CAP_TSX_CTRL_MSR; |
1190 | return data; |
1191 | } |
1192 | |
1193 | diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c |
1194 | index 20fa7c84109d..62950ef7f84e 100644 |
1195 | --- a/arch/x86/pci/fixup.c |
1196 | +++ b/arch/x86/pci/fixup.c |
1197 | @@ -572,6 +572,17 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_invalid_bar); |
1198 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_invalid_bar); |
1199 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_invalid_bar); |
1200 | |
1201 | +/* |
1202 | + * Device [1022:7914] |
1203 | + * When in D0, PME# doesn't get asserted when plugging USB 2.0 device. |
1204 | + */ |
1205 | +static void pci_fixup_amd_fch_xhci_pme(struct pci_dev *dev) |
1206 | +{ |
1207 | + dev_info(&dev->dev, "PME# does not work under D0, disabling it\n"); |
1208 | + dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT); |
1209 | +} |
1210 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x7914, pci_fixup_amd_fch_xhci_pme); |
1211 | + |
1212 | /* |
1213 | * Apple MacBook Pro: Avoid [mem 0x7fa00000-0x7fbfffff] |
1214 | * |
1215 | diff --git a/arch/xtensa/mm/tlb.c b/arch/xtensa/mm/tlb.c |
1216 | index 35c822286bbe..3ce5ccdb054d 100644 |
1217 | --- a/arch/xtensa/mm/tlb.c |
1218 | +++ b/arch/xtensa/mm/tlb.c |
1219 | @@ -218,6 +218,8 @@ static int check_tlb_entry(unsigned w, unsigned e, bool dtlb) |
1220 | unsigned tlbidx = w | (e << PAGE_SHIFT); |
1221 | unsigned r0 = dtlb ? |
1222 | read_dtlb_virtual(tlbidx) : read_itlb_virtual(tlbidx); |
1223 | + unsigned r1 = dtlb ? |
1224 | + read_dtlb_translation(tlbidx) : read_itlb_translation(tlbidx); |
1225 | unsigned vpn = (r0 & PAGE_MASK) | (e << PAGE_SHIFT); |
1226 | unsigned pte = get_pte_for_vaddr(vpn); |
1227 | unsigned mm_asid = (get_rasid_register() >> 8) & ASID_MASK; |
1228 | @@ -233,8 +235,6 @@ static int check_tlb_entry(unsigned w, unsigned e, bool dtlb) |
1229 | } |
1230 | |
1231 | if (tlb_asid == mm_asid) { |
1232 | - unsigned r1 = dtlb ? read_dtlb_translation(tlbidx) : |
1233 | - read_itlb_translation(tlbidx); |
1234 | if ((pte ^ r1) & PAGE_MASK) { |
1235 | pr_err("%cTLB: way: %u, entry: %u, mapping: %08x->%08x, PTE: %08x\n", |
1236 | dtlb ? 'D' : 'I', w, e, r0, r1, pte); |
1237 | diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c |
1238 | index 8c0894e0713b..5b64d9d7d147 100644 |
1239 | --- a/block/blk-mq-sysfs.c |
1240 | +++ b/block/blk-mq-sysfs.c |
1241 | @@ -243,20 +243,25 @@ static ssize_t blk_mq_hw_sysfs_active_show(struct blk_mq_hw_ctx *hctx, char *pag |
1242 | |
1243 | static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page) |
1244 | { |
1245 | + const size_t size = PAGE_SIZE - 1; |
1246 | unsigned int i, first = 1; |
1247 | - ssize_t ret = 0; |
1248 | + int ret = 0, pos = 0; |
1249 | |
1250 | for_each_cpu(i, hctx->cpumask) { |
1251 | if (first) |
1252 | - ret += sprintf(ret + page, "%u", i); |
1253 | + ret = snprintf(pos + page, size - pos, "%u", i); |
1254 | else |
1255 | - ret += sprintf(ret + page, ", %u", i); |
1256 | + ret = snprintf(pos + page, size - pos, ", %u", i); |
1257 | + |
1258 | + if (ret >= size - pos) |
1259 | + break; |
1260 | |
1261 | first = 0; |
1262 | + pos += ret; |
1263 | } |
1264 | |
1265 | - ret += sprintf(ret + page, "\n"); |
1266 | - return ret; |
1267 | + ret = snprintf(pos + page, size + 1 - pos, "\n"); |
1268 | + return pos + ret; |
1269 | } |
1270 | |
1271 | static struct blk_mq_ctx_sysfs_entry blk_mq_sysfs_dispatched = { |
1272 | diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c |
1273 | index 60cf7d163731..810be7a9e3c4 100644 |
1274 | --- a/crypto/crypto_user.c |
1275 | +++ b/crypto/crypto_user.c |
1276 | @@ -269,8 +269,10 @@ static int crypto_report(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, |
1277 | drop_alg: |
1278 | crypto_mod_put(alg); |
1279 | |
1280 | - if (err) |
1281 | + if (err) { |
1282 | + kfree_skb(skb); |
1283 | return err; |
1284 | + } |
1285 | |
1286 | return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).portid); |
1287 | } |
1288 | diff --git a/crypto/ecc.c b/crypto/ecc.c |
1289 | index 414c78a9c214..7cf6c3e4825c 100644 |
1290 | --- a/crypto/ecc.c |
1291 | +++ b/crypto/ecc.c |
1292 | @@ -897,10 +897,11 @@ static void ecc_point_mult(struct ecc_point *result, |
1293 | static inline void ecc_swap_digits(const u64 *in, u64 *out, |
1294 | unsigned int ndigits) |
1295 | { |
1296 | + const __be64 *src = (__force __be64 *)in; |
1297 | int i; |
1298 | |
1299 | for (i = 0; i < ndigits; i++) |
1300 | - out[i] = __swab64(in[ndigits - 1 - i]); |
1301 | + out[i] = be64_to_cpu(src[ndigits - 1 - i]); |
1302 | } |
1303 | |
1304 | int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits, |
1305 | diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
1306 | index 0a3ca20f99af..6b2c9d68d810 100644 |
1307 | --- a/drivers/acpi/bus.c |
1308 | +++ b/drivers/acpi/bus.c |
1309 | @@ -158,7 +158,7 @@ int acpi_bus_get_private_data(acpi_handle handle, void **data) |
1310 | { |
1311 | acpi_status status; |
1312 | |
1313 | - if (!*data) |
1314 | + if (!data) |
1315 | return -EINVAL; |
1316 | |
1317 | status = acpi_get_data(handle, acpi_bus_private_data_handler, data); |
1318 | diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c |
1319 | index 993fd31394c8..c76e4527620c 100644 |
1320 | --- a/drivers/acpi/device_pm.c |
1321 | +++ b/drivers/acpi/device_pm.c |
1322 | @@ -1096,9 +1096,19 @@ static void acpi_dev_pm_detach(struct device *dev, bool power_off) |
1323 | */ |
1324 | int acpi_dev_pm_attach(struct device *dev, bool power_on) |
1325 | { |
1326 | + /* |
1327 | + * Skip devices whose ACPI companions match the device IDs below, |
1328 | + * because they require special power management handling incompatible |
1329 | + * with the generic ACPI PM domain. |
1330 | + */ |
1331 | + static const struct acpi_device_id special_pm_ids[] = { |
1332 | + {"PNP0C0B", }, /* Generic ACPI fan */ |
1333 | + {"INT3404", }, /* Fan */ |
1334 | + {} |
1335 | + }; |
1336 | struct acpi_device *adev = ACPI_COMPANION(dev); |
1337 | |
1338 | - if (!adev) |
1339 | + if (!adev || !acpi_match_device_ids(adev, special_pm_ids)) |
1340 | return -ENODEV; |
1341 | |
1342 | if (dev->pm_domain) |
1343 | diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c |
1344 | index b9fade7a3bcf..c6c7e4287c4d 100644 |
1345 | --- a/drivers/acpi/osl.c |
1346 | +++ b/drivers/acpi/osl.c |
1347 | @@ -375,19 +375,21 @@ void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size) |
1348 | } |
1349 | EXPORT_SYMBOL_GPL(acpi_os_map_memory); |
1350 | |
1351 | -static void acpi_os_drop_map_ref(struct acpi_ioremap *map) |
1352 | +/* Must be called with mutex_lock(&acpi_ioremap_lock) */ |
1353 | +static unsigned long acpi_os_drop_map_ref(struct acpi_ioremap *map) |
1354 | { |
1355 | - if (!--map->refcount) |
1356 | + unsigned long refcount = --map->refcount; |
1357 | + |
1358 | + if (!refcount) |
1359 | list_del_rcu(&map->list); |
1360 | + return refcount; |
1361 | } |
1362 | |
1363 | static void acpi_os_map_cleanup(struct acpi_ioremap *map) |
1364 | { |
1365 | - if (!map->refcount) { |
1366 | - synchronize_rcu_expedited(); |
1367 | - acpi_unmap(map->phys, map->virt); |
1368 | - kfree(map); |
1369 | - } |
1370 | + synchronize_rcu_expedited(); |
1371 | + acpi_unmap(map->phys, map->virt); |
1372 | + kfree(map); |
1373 | } |
1374 | |
1375 | /** |
1376 | @@ -407,6 +409,7 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) |
1377 | void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) |
1378 | { |
1379 | struct acpi_ioremap *map; |
1380 | + unsigned long refcount; |
1381 | |
1382 | if (!acpi_gbl_permanent_mmap) { |
1383 | __acpi_unmap_table(virt, size); |
1384 | @@ -420,10 +423,11 @@ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) |
1385 | WARN(true, PREFIX "%s: bad address %p\n", __func__, virt); |
1386 | return; |
1387 | } |
1388 | - acpi_os_drop_map_ref(map); |
1389 | + refcount = acpi_os_drop_map_ref(map); |
1390 | mutex_unlock(&acpi_ioremap_lock); |
1391 | |
1392 | - acpi_os_map_cleanup(map); |
1393 | + if (!refcount) |
1394 | + acpi_os_map_cleanup(map); |
1395 | } |
1396 | EXPORT_SYMBOL_GPL(acpi_os_unmap_iomem); |
1397 | |
1398 | @@ -464,6 +468,7 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) |
1399 | { |
1400 | u64 addr; |
1401 | struct acpi_ioremap *map; |
1402 | + unsigned long refcount; |
1403 | |
1404 | if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) |
1405 | return; |
1406 | @@ -479,10 +484,11 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) |
1407 | mutex_unlock(&acpi_ioremap_lock); |
1408 | return; |
1409 | } |
1410 | - acpi_os_drop_map_ref(map); |
1411 | + refcount = acpi_os_drop_map_ref(map); |
1412 | mutex_unlock(&acpi_ioremap_lock); |
1413 | |
1414 | - acpi_os_map_cleanup(map); |
1415 | + if (!refcount) |
1416 | + acpi_os_map_cleanup(map); |
1417 | } |
1418 | EXPORT_SYMBOL(acpi_os_unmap_generic_address); |
1419 | |
1420 | diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c |
1421 | index 34997df132e2..6beafaa335c7 100644 |
1422 | --- a/drivers/block/rsxx/core.c |
1423 | +++ b/drivers/block/rsxx/core.c |
1424 | @@ -1025,8 +1025,10 @@ static void rsxx_pci_remove(struct pci_dev *dev) |
1425 | |
1426 | cancel_work_sync(&card->event_work); |
1427 | |
1428 | + destroy_workqueue(card->event_wq); |
1429 | rsxx_destroy_dev(card); |
1430 | rsxx_dma_destroy(card); |
1431 | + destroy_workqueue(card->creg_ctrl.creg_wq); |
1432 | |
1433 | spin_lock_irqsave(&card->irq_lock, flags); |
1434 | rsxx_disable_ier_and_isr(card, CR_INTR_ALL); |
1435 | diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c |
1436 | index 336d02a488cc..3648727dfe83 100644 |
1437 | --- a/drivers/char/ppdev.c |
1438 | +++ b/drivers/char/ppdev.c |
1439 | @@ -624,20 +624,27 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
1440 | if (copy_from_user(time32, argp, sizeof(time32))) |
1441 | return -EFAULT; |
1442 | |
1443 | + if ((time32[0] < 0) || (time32[1] < 0)) |
1444 | + return -EINVAL; |
1445 | + |
1446 | return pp_set_timeout(pp->pdev, time32[0], time32[1]); |
1447 | |
1448 | case PPSETTIME64: |
1449 | if (copy_from_user(time64, argp, sizeof(time64))) |
1450 | return -EFAULT; |
1451 | |
1452 | + if ((time64[0] < 0) || (time64[1] < 0)) |
1453 | + return -EINVAL; |
1454 | + |
1455 | + if (IS_ENABLED(CONFIG_SPARC64) && !in_compat_syscall()) |
1456 | + time64[1] >>= 32; |
1457 | + |
1458 | return pp_set_timeout(pp->pdev, time64[0], time64[1]); |
1459 | |
1460 | case PPGETTIME32: |
1461 | jiffies_to_timespec64(pp->pdev->timeout, &ts); |
1462 | time32[0] = ts.tv_sec; |
1463 | time32[1] = ts.tv_nsec / NSEC_PER_USEC; |
1464 | - if ((time32[0] < 0) || (time32[1] < 0)) |
1465 | - return -EINVAL; |
1466 | |
1467 | if (copy_to_user(argp, time32, sizeof(time32))) |
1468 | return -EFAULT; |
1469 | @@ -648,8 +655,9 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
1470 | jiffies_to_timespec64(pp->pdev->timeout, &ts); |
1471 | time64[0] = ts.tv_sec; |
1472 | time64[1] = ts.tv_nsec / NSEC_PER_USEC; |
1473 | - if ((time64[0] < 0) || (time64[1] < 0)) |
1474 | - return -EINVAL; |
1475 | + |
1476 | + if (IS_ENABLED(CONFIG_SPARC64) && !in_compat_syscall()) |
1477 | + time64[1] <<= 32; |
1478 | |
1479 | if (copy_to_user(argp, time64, sizeof(time64))) |
1480 | return -EFAULT; |
1481 | diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c |
1482 | index 523378d1396e..d62031eedbe6 100644 |
1483 | --- a/drivers/clk/rockchip/clk-rk3188.c |
1484 | +++ b/drivers/clk/rockchip/clk-rk3188.c |
1485 | @@ -361,8 +361,8 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { |
1486 | RK2928_CLKGATE_CON(2), 5, GFLAGS), |
1487 | MUX(SCLK_MAC, "sclk_macref", mux_sclk_macref_p, CLK_SET_RATE_PARENT, |
1488 | RK2928_CLKSEL_CON(21), 4, 1, MFLAGS), |
1489 | - GATE(0, "sclk_mac_lbtest", "sclk_macref", |
1490 | - RK2928_CLKGATE_CON(2), 12, 0, GFLAGS), |
1491 | + GATE(0, "sclk_mac_lbtest", "sclk_macref", 0, |
1492 | + RK2928_CLKGATE_CON(2), 12, GFLAGS), |
1493 | |
1494 | COMPOSITE(0, "hsadc_src", mux_pll_src_gpll_cpll_p, 0, |
1495 | RK2928_CLKSEL_CON(22), 0, 1, MFLAGS, 8, 8, DFLAGS, |
1496 | @@ -390,8 +390,8 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { |
1497 | * Clock-Architecture Diagram 4 |
1498 | */ |
1499 | |
1500 | - GATE(SCLK_SMC, "sclk_smc", "hclk_peri", |
1501 | - RK2928_CLKGATE_CON(2), 4, 0, GFLAGS), |
1502 | + GATE(SCLK_SMC, "sclk_smc", "hclk_peri", 0, |
1503 | + RK2928_CLKGATE_CON(2), 4, GFLAGS), |
1504 | |
1505 | COMPOSITE_NOMUX(SCLK_SPI0, "sclk_spi0", "pclk_peri", 0, |
1506 | RK2928_CLKSEL_CON(25), 0, 7, DFLAGS, |
1507 | diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
1508 | index a26c8a19fe93..9dd6daaa1336 100644 |
1509 | --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
1510 | +++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c |
1511 | @@ -458,7 +458,7 @@ static const char * const csi_sclk_parents[] = { "pll-periph0", "pll-periph1" }; |
1512 | static SUNXI_CCU_M_WITH_MUX_GATE(csi_sclk_clk, "csi-sclk", csi_sclk_parents, |
1513 | 0x134, 16, 4, 24, 3, BIT(31), 0); |
1514 | |
1515 | -static const char * const csi_mclk_parents[] = { "osc24M", "pll-video", "pll-periph0" }; |
1516 | +static const char * const csi_mclk_parents[] = { "osc24M", "pll-video", "pll-periph1" }; |
1517 | static SUNXI_CCU_M_WITH_MUX_GATE(csi_mclk_clk, "csi-mclk", csi_mclk_parents, |
1518 | 0x134, 0, 5, 8, 3, BIT(15), 0); |
1519 | |
1520 | diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c |
1521 | index ab264d393233..3780e1aa6807 100644 |
1522 | --- a/drivers/cpuidle/driver.c |
1523 | +++ b/drivers/cpuidle/driver.c |
1524 | @@ -61,24 +61,23 @@ static inline void __cpuidle_unset_driver(struct cpuidle_driver *drv) |
1525 | * __cpuidle_set_driver - set per CPU driver variables for the given driver. |
1526 | * @drv: a valid pointer to a struct cpuidle_driver |
1527 | * |
1528 | - * For each CPU in the driver's cpumask, unset the registered driver per CPU |
1529 | - * to @drv. |
1530 | - * |
1531 | - * Returns 0 on success, -EBUSY if the CPUs have driver(s) already. |
1532 | + * Returns 0 on success, -EBUSY if any CPU in the cpumask have a driver |
1533 | + * different from drv already. |
1534 | */ |
1535 | static inline int __cpuidle_set_driver(struct cpuidle_driver *drv) |
1536 | { |
1537 | int cpu; |
1538 | |
1539 | for_each_cpu(cpu, drv->cpumask) { |
1540 | + struct cpuidle_driver *old_drv; |
1541 | |
1542 | - if (__cpuidle_get_cpu_driver(cpu)) { |
1543 | - __cpuidle_unset_driver(drv); |
1544 | + old_drv = __cpuidle_get_cpu_driver(cpu); |
1545 | + if (old_drv && old_drv != drv) |
1546 | return -EBUSY; |
1547 | - } |
1548 | + } |
1549 | |
1550 | + for_each_cpu(cpu, drv->cpumask) |
1551 | per_cpu(cpuidle_drivers, cpu) = drv; |
1552 | - } |
1553 | |
1554 | return 0; |
1555 | } |
1556 | diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c |
1557 | index 7d066fa9f2ad..e5e83c6de536 100644 |
1558 | --- a/drivers/crypto/amcc/crypto4xx_core.c |
1559 | +++ b/drivers/crypto/amcc/crypto4xx_core.c |
1560 | @@ -400,12 +400,8 @@ static u32 crypto4xx_build_sdr(struct crypto4xx_device *dev) |
1561 | dma_alloc_coherent(dev->core_dev->device, |
1562 | dev->scatter_buffer_size * PPC4XX_NUM_SD, |
1563 | &dev->scatter_buffer_pa, GFP_ATOMIC); |
1564 | - if (!dev->scatter_buffer_va) { |
1565 | - dma_free_coherent(dev->core_dev->device, |
1566 | - sizeof(struct ce_sd) * PPC4XX_NUM_SD, |
1567 | - dev->sdr, dev->sdr_pa); |
1568 | + if (!dev->scatter_buffer_va) |
1569 | return -ENOMEM; |
1570 | - } |
1571 | |
1572 | sd_array = dev->sdr; |
1573 | |
1574 | diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c |
1575 | index 8d0eeb46d4a2..c4581510c3a1 100644 |
1576 | --- a/drivers/crypto/ccp/ccp-dmaengine.c |
1577 | +++ b/drivers/crypto/ccp/ccp-dmaengine.c |
1578 | @@ -309,6 +309,7 @@ static struct ccp_dma_desc *ccp_alloc_dma_desc(struct ccp_dma_chan *chan, |
1579 | desc->tx_desc.flags = flags; |
1580 | desc->tx_desc.tx_submit = ccp_tx_submit; |
1581 | desc->ccp = chan->ccp; |
1582 | + INIT_LIST_HEAD(&desc->entry); |
1583 | INIT_LIST_HEAD(&desc->pending); |
1584 | INIT_LIST_HEAD(&desc->active); |
1585 | desc->status = DMA_IN_PROGRESS; |
1586 | diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c |
1587 | index db70cee71caa..df62e38de5f5 100644 |
1588 | --- a/drivers/devfreq/devfreq.c |
1589 | +++ b/drivers/devfreq/devfreq.c |
1590 | @@ -135,6 +135,7 @@ int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) |
1591 | int lev, prev_lev, ret = 0; |
1592 | unsigned long cur_time; |
1593 | |
1594 | + lockdep_assert_held(&devfreq->lock); |
1595 | cur_time = jiffies; |
1596 | |
1597 | /* Immediately exit if previous_freq is not initialized yet. */ |
1598 | @@ -1170,12 +1171,17 @@ static ssize_t trans_stat_show(struct device *dev, |
1599 | int i, j; |
1600 | unsigned int max_state = devfreq->profile->max_state; |
1601 | |
1602 | - if (!devfreq->stop_polling && |
1603 | - devfreq_update_status(devfreq, devfreq->previous_freq)) |
1604 | - return 0; |
1605 | if (max_state == 0) |
1606 | return sprintf(buf, "Not Supported.\n"); |
1607 | |
1608 | + mutex_lock(&devfreq->lock); |
1609 | + if (!devfreq->stop_polling && |
1610 | + devfreq_update_status(devfreq, devfreq->previous_freq)) { |
1611 | + mutex_unlock(&devfreq->lock); |
1612 | + return 0; |
1613 | + } |
1614 | + mutex_unlock(&devfreq->lock); |
1615 | + |
1616 | len = sprintf(buf, " From : To\n"); |
1617 | len += sprintf(buf + len, " :"); |
1618 | for (i = 0; i < max_state; i++) |
1619 | diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c |
1620 | index f0c374d6ab40..05d66d4fc31d 100644 |
1621 | --- a/drivers/dma-buf/sync_file.c |
1622 | +++ b/drivers/dma-buf/sync_file.c |
1623 | @@ -204,7 +204,7 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, |
1624 | a_fences = get_fences(a, &a_num_fences); |
1625 | b_fences = get_fences(b, &b_num_fences); |
1626 | if (a_num_fences > INT_MAX - b_num_fences) |
1627 | - return NULL; |
1628 | + goto err; |
1629 | |
1630 | num_fences = a_num_fences + b_num_fences; |
1631 | |
1632 | diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c |
1633 | index 74794c9859f6..6d7d2d54eacf 100644 |
1634 | --- a/drivers/dma/coh901318.c |
1635 | +++ b/drivers/dma/coh901318.c |
1636 | @@ -1797,13 +1797,10 @@ static struct dma_chan *coh901318_xlate(struct of_phandle_args *dma_spec, |
1637 | static int coh901318_config(struct coh901318_chan *cohc, |
1638 | struct coh901318_params *param) |
1639 | { |
1640 | - unsigned long flags; |
1641 | const struct coh901318_params *p; |
1642 | int channel = cohc->id; |
1643 | void __iomem *virtbase = cohc->base->virtbase; |
1644 | |
1645 | - spin_lock_irqsave(&cohc->lock, flags); |
1646 | - |
1647 | if (param) |
1648 | p = param; |
1649 | else |
1650 | @@ -1823,8 +1820,6 @@ static int coh901318_config(struct coh901318_chan *cohc, |
1651 | coh901318_set_conf(cohc, p->config); |
1652 | coh901318_set_ctrl(cohc, p->ctrl_lli_last); |
1653 | |
1654 | - spin_unlock_irqrestore(&cohc->lock, flags); |
1655 | - |
1656 | return 0; |
1657 | } |
1658 | |
1659 | diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c |
1660 | index 4a0612fb9c07..b9b48d45a6dc 100644 |
1661 | --- a/drivers/extcon/extcon-max8997.c |
1662 | +++ b/drivers/extcon/extcon-max8997.c |
1663 | @@ -321,12 +321,10 @@ static int max8997_muic_handle_usb(struct max8997_muic_info *info, |
1664 | { |
1665 | int ret = 0; |
1666 | |
1667 | - if (usb_type == MAX8997_USB_HOST) { |
1668 | - ret = max8997_muic_set_path(info, info->path_usb, attached); |
1669 | - if (ret < 0) { |
1670 | - dev_err(info->dev, "failed to update muic register\n"); |
1671 | - return ret; |
1672 | - } |
1673 | + ret = max8997_muic_set_path(info, info->path_usb, attached); |
1674 | + if (ret < 0) { |
1675 | + dev_err(info->dev, "failed to update muic register\n"); |
1676 | + return ret; |
1677 | } |
1678 | |
1679 | switch (usb_type) { |
1680 | diff --git a/drivers/firmware/qcom_scm-64.c b/drivers/firmware/qcom_scm-64.c |
1681 | index 1e2e5198db53..7c31d27649fe 100644 |
1682 | --- a/drivers/firmware/qcom_scm-64.c |
1683 | +++ b/drivers/firmware/qcom_scm-64.c |
1684 | @@ -158,7 +158,7 @@ static int qcom_scm_call(struct device *dev, u32 svc_id, u32 cmd_id, |
1685 | kfree(args_virt); |
1686 | } |
1687 | |
1688 | - if (res->a0 < 0) |
1689 | + if ((long)res->a0 < 0) |
1690 | return qcom_scm_remap_error(res->a0); |
1691 | |
1692 | return 0; |
1693 | diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c |
1694 | index d91856779beb..70de29f4e2b4 100644 |
1695 | --- a/drivers/gpu/drm/i810/i810_dma.c |
1696 | +++ b/drivers/gpu/drm/i810/i810_dma.c |
1697 | @@ -723,7 +723,7 @@ static void i810_dma_dispatch_vertex(struct drm_device *dev, |
1698 | if (nbox > I810_NR_SAREA_CLIPRECTS) |
1699 | nbox = I810_NR_SAREA_CLIPRECTS; |
1700 | |
1701 | - if (used > 4 * 1024) |
1702 | + if (used < 0 || used > 4 * 1024) |
1703 | used = 0; |
1704 | |
1705 | if (sarea_priv->dirty) |
1706 | @@ -1043,7 +1043,7 @@ static void i810_dma_dispatch_mc(struct drm_device *dev, struct drm_buf *buf, in |
1707 | if (u != I810_BUF_CLIENT) |
1708 | DRM_DEBUG("MC found buffer that isn't mine!\n"); |
1709 | |
1710 | - if (used > 4 * 1024) |
1711 | + if (used < 0 || used > 4 * 1024) |
1712 | used = 0; |
1713 | |
1714 | sarea_priv->dirty = 0x7f; |
1715 | diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c |
1716 | index f5e84f4b58e6..c99a97608798 100644 |
1717 | --- a/drivers/gpu/drm/radeon/r100.c |
1718 | +++ b/drivers/gpu/drm/radeon/r100.c |
1719 | @@ -1824,8 +1824,8 @@ static int r100_packet0_check(struct radeon_cs_parser *p, |
1720 | track->textures[i].use_pitch = 1; |
1721 | } else { |
1722 | track->textures[i].use_pitch = 0; |
1723 | - track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK); |
1724 | - track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK); |
1725 | + track->textures[i].width = 1 << ((idx_value & RADEON_TXFORMAT_WIDTH_MASK) >> RADEON_TXFORMAT_WIDTH_SHIFT); |
1726 | + track->textures[i].height = 1 << ((idx_value & RADEON_TXFORMAT_HEIGHT_MASK) >> RADEON_TXFORMAT_HEIGHT_SHIFT); |
1727 | } |
1728 | if (idx_value & RADEON_TXFORMAT_CUBIC_MAP_ENABLE) |
1729 | track->textures[i].tex_coord_type = 2; |
1730 | diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c |
1731 | index c70e6d5bcd19..8aa3772e935f 100644 |
1732 | --- a/drivers/gpu/drm/radeon/r200.c |
1733 | +++ b/drivers/gpu/drm/radeon/r200.c |
1734 | @@ -476,8 +476,8 @@ int r200_packet0_check(struct radeon_cs_parser *p, |
1735 | track->textures[i].use_pitch = 1; |
1736 | } else { |
1737 | track->textures[i].use_pitch = 0; |
1738 | - track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK); |
1739 | - track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK); |
1740 | + track->textures[i].width = 1 << ((idx_value & RADEON_TXFORMAT_WIDTH_MASK) >> RADEON_TXFORMAT_WIDTH_SHIFT); |
1741 | + track->textures[i].height = 1 << ((idx_value & RADEON_TXFORMAT_HEIGHT_MASK) >> RADEON_TXFORMAT_HEIGHT_SHIFT); |
1742 | } |
1743 | if (idx_value & R200_TXFORMAT_LOOKUP_DISABLE) |
1744 | track->textures[i].lookup_disable = true; |
1745 | diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
1746 | index b9b1e9c8f4c4..00904c6b5b5e 100644 |
1747 | --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
1748 | +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c |
1749 | @@ -667,10 +667,13 @@ static ssize_t cyc_threshold_store(struct device *dev, |
1750 | |
1751 | if (kstrtoul(buf, 16, &val)) |
1752 | return -EINVAL; |
1753 | + |
1754 | + /* mask off max threshold before checking min value */ |
1755 | + val &= ETM_CYC_THRESHOLD_MASK; |
1756 | if (val < drvdata->ccitmin) |
1757 | return -EINVAL; |
1758 | |
1759 | - config->ccctlr = val & ETM_CYC_THRESHOLD_MASK; |
1760 | + config->ccctlr = val; |
1761 | return size; |
1762 | } |
1763 | static DEVICE_ATTR_RW(cyc_threshold); |
1764 | @@ -701,14 +704,16 @@ static ssize_t bb_ctrl_store(struct device *dev, |
1765 | return -EINVAL; |
1766 | if (!drvdata->nr_addr_cmp) |
1767 | return -EINVAL; |
1768 | + |
1769 | /* |
1770 | - * Bit[7:0] selects which address range comparator is used for |
1771 | - * branch broadcast control. |
1772 | + * Bit[8] controls include(1) / exclude(0), bits[0-7] select |
1773 | + * individual range comparators. If include then at least 1 |
1774 | + * range must be selected. |
1775 | */ |
1776 | - if (BMVAL(val, 0, 7) > drvdata->nr_addr_cmp) |
1777 | + if ((val & BIT(8)) && (BMVAL(val, 0, 7) == 0)) |
1778 | return -EINVAL; |
1779 | |
1780 | - config->bb_ctrl = val; |
1781 | + config->bb_ctrl = val & GENMASK(8, 0); |
1782 | return size; |
1783 | } |
1784 | static DEVICE_ATTR_RW(bb_ctrl); |
1785 | @@ -1341,8 +1346,8 @@ static ssize_t seq_event_store(struct device *dev, |
1786 | |
1787 | spin_lock(&drvdata->spinlock); |
1788 | idx = config->seq_idx; |
1789 | - /* RST, bits[7:0] */ |
1790 | - config->seq_ctrl[idx] = val & 0xFF; |
1791 | + /* Seq control has two masks B[15:8] F[7:0] */ |
1792 | + config->seq_ctrl[idx] = val & 0xFFFF; |
1793 | spin_unlock(&drvdata->spinlock); |
1794 | return size; |
1795 | } |
1796 | @@ -1597,7 +1602,7 @@ static ssize_t res_ctrl_store(struct device *dev, |
1797 | if (idx % 2 != 0) |
1798 | /* PAIRINV, bit[21] */ |
1799 | val &= ~BIT(21); |
1800 | - config->res_ctrl[idx] = val; |
1801 | + config->res_ctrl[idx] = val & GENMASK(21, 0); |
1802 | spin_unlock(&drvdata->spinlock); |
1803 | return size; |
1804 | } |
1805 | diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c |
1806 | index c4188308cefa..9c1be9378dfd 100644 |
1807 | --- a/drivers/i2c/busses/i2c-imx.c |
1808 | +++ b/drivers/i2c/busses/i2c-imx.c |
1809 | @@ -1088,7 +1088,8 @@ static int i2c_imx_probe(struct platform_device *pdev) |
1810 | /* Get I2C clock */ |
1811 | i2c_imx->clk = devm_clk_get(&pdev->dev, NULL); |
1812 | if (IS_ERR(i2c_imx->clk)) { |
1813 | - dev_err(&pdev->dev, "can't get I2C clock\n"); |
1814 | + if (PTR_ERR(i2c_imx->clk) != -EPROBE_DEFER) |
1815 | + dev_err(&pdev->dev, "can't get I2C clock\n"); |
1816 | return PTR_ERR(i2c_imx->clk); |
1817 | } |
1818 | |
1819 | diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c |
1820 | index e0c9c70c2a4a..c0e2e78c5c62 100644 |
1821 | --- a/drivers/iio/humidity/hdc100x.c |
1822 | +++ b/drivers/iio/humidity/hdc100x.c |
1823 | @@ -202,7 +202,7 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev, |
1824 | *val2 = 65536; |
1825 | return IIO_VAL_FRACTIONAL; |
1826 | } else { |
1827 | - *val = 100; |
1828 | + *val = 100000; |
1829 | *val2 = 65536; |
1830 | return IIO_VAL_FRACTIONAL; |
1831 | } |
1832 | diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c |
1833 | index 6f975538996c..c950aa10d0ae 100644 |
1834 | --- a/drivers/iio/imu/adis16480.c |
1835 | +++ b/drivers/iio/imu/adis16480.c |
1836 | @@ -724,6 +724,7 @@ static const struct iio_info adis16480_info = { |
1837 | .write_raw = &adis16480_write_raw, |
1838 | .update_scan_mode = adis_update_scan_mode, |
1839 | .driver_module = THIS_MODULE, |
1840 | + .debugfs_reg_access = adis_debugfs_reg_access, |
1841 | }; |
1842 | |
1843 | static int adis16480_stop_device(struct iio_dev *indio_dev) |
1844 | diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.h b/drivers/infiniband/hw/hns/hns_roce_hem.h |
1845 | index 435748858252..8e8917ebb013 100644 |
1846 | --- a/drivers/infiniband/hw/hns/hns_roce_hem.h |
1847 | +++ b/drivers/infiniband/hw/hns/hns_roce_hem.h |
1848 | @@ -52,7 +52,7 @@ enum { |
1849 | |
1850 | #define HNS_ROCE_HEM_CHUNK_LEN \ |
1851 | ((256 - sizeof(struct list_head) - 2 * sizeof(int)) / \ |
1852 | - (sizeof(struct scatterlist))) |
1853 | + (sizeof(struct scatterlist) + sizeof(void *))) |
1854 | |
1855 | enum { |
1856 | HNS_ROCE_HEM_PAGE_SHIFT = 12, |
1857 | diff --git a/drivers/infiniband/hw/mlx4/sysfs.c b/drivers/infiniband/hw/mlx4/sysfs.c |
1858 | index 69fb5ba94d0f..19caacd26f61 100644 |
1859 | --- a/drivers/infiniband/hw/mlx4/sysfs.c |
1860 | +++ b/drivers/infiniband/hw/mlx4/sysfs.c |
1861 | @@ -352,16 +352,12 @@ err: |
1862 | |
1863 | static void get_name(struct mlx4_ib_dev *dev, char *name, int i, int max) |
1864 | { |
1865 | - char base_name[9]; |
1866 | - |
1867 | - /* pci_name format is: bus:dev:func -> xxxx:yy:zz.n */ |
1868 | - strlcpy(name, pci_name(dev->dev->persist->pdev), max); |
1869 | - strncpy(base_name, name, 8); /*till xxxx:yy:*/ |
1870 | - base_name[8] = '\0'; |
1871 | - /* with no ARI only 3 last bits are used so when the fn is higher than 8 |
1872 | + /* pci_name format is: bus:dev:func -> xxxx:yy:zz.n |
1873 | + * with no ARI only 3 last bits are used so when the fn is higher than 8 |
1874 | * need to add it to the dev num, so count in the last number will be |
1875 | * modulo 8 */ |
1876 | - sprintf(name, "%s%.2d.%d", base_name, (i/8), (i%8)); |
1877 | + snprintf(name, max, "%.8s%.2d.%d", pci_name(dev->dev->persist->pdev), |
1878 | + i / 8, i % 8); |
1879 | } |
1880 | |
1881 | struct mlx4_port { |
1882 | diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c |
1883 | index fe4cf5e4acec..8ce0f6eef89e 100644 |
1884 | --- a/drivers/infiniband/hw/qib/qib_sysfs.c |
1885 | +++ b/drivers/infiniband/hw/qib/qib_sysfs.c |
1886 | @@ -301,6 +301,9 @@ static ssize_t qib_portattr_show(struct kobject *kobj, |
1887 | struct qib_pportdata *ppd = |
1888 | container_of(kobj, struct qib_pportdata, pport_kobj); |
1889 | |
1890 | + if (!pattr->show) |
1891 | + return -EIO; |
1892 | + |
1893 | return pattr->show(ppd, buf); |
1894 | } |
1895 | |
1896 | @@ -312,6 +315,9 @@ static ssize_t qib_portattr_store(struct kobject *kobj, |
1897 | struct qib_pportdata *ppd = |
1898 | container_of(kobj, struct qib_pportdata, pport_kobj); |
1899 | |
1900 | + if (!pattr->store) |
1901 | + return -EIO; |
1902 | + |
1903 | return pattr->store(ppd, buf, len); |
1904 | } |
1905 | |
1906 | diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c |
1907 | index 44deca88c579..c1c29d7487bf 100644 |
1908 | --- a/drivers/input/touchscreen/cyttsp4_core.c |
1909 | +++ b/drivers/input/touchscreen/cyttsp4_core.c |
1910 | @@ -1972,11 +1972,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd) |
1911 | |
1912 | /* get sysinfo */ |
1913 | md->si = &cd->sysinfo; |
1914 | - if (!md->si) { |
1915 | - dev_err(dev, "%s: Fail get sysinfo pointer from core p=%p\n", |
1916 | - __func__, md->si); |
1917 | - goto error_get_sysinfo; |
1918 | - } |
1919 | |
1920 | rc = cyttsp4_setup_input_device(cd); |
1921 | if (rc) |
1922 | @@ -1986,8 +1981,6 @@ static int cyttsp4_mt_probe(struct cyttsp4 *cd) |
1923 | |
1924 | error_init_input: |
1925 | input_free_device(md->input); |
1926 | -error_get_sysinfo: |
1927 | - input_set_drvdata(md->input, NULL); |
1928 | error_alloc_failed: |
1929 | dev_err(dev, "%s failed.\n", __func__); |
1930 | return rc; |
1931 | diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c |
1932 | index c599b5a2373b..6a02e7301297 100644 |
1933 | --- a/drivers/input/touchscreen/goodix.c |
1934 | +++ b/drivers/input/touchscreen/goodix.c |
1935 | @@ -89,6 +89,15 @@ static const unsigned long goodix_irq_flags[] = { |
1936 | */ |
1937 | static const struct dmi_system_id rotated_screen[] = { |
1938 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) |
1939 | + { |
1940 | + .ident = "Teclast X89", |
1941 | + .matches = { |
1942 | + /* tPAD is too generic, also match on bios date */ |
1943 | + DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"), |
1944 | + DMI_MATCH(DMI_BOARD_NAME, "tPAD"), |
1945 | + DMI_MATCH(DMI_BIOS_DATE, "12/19/2014"), |
1946 | + }, |
1947 | + }, |
1948 | { |
1949 | .ident = "WinBook TW100", |
1950 | .matches = { |
1951 | diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c |
1952 | index 5f306e2eece5..aee4880f972f 100644 |
1953 | --- a/drivers/isdn/gigaset/usb-gigaset.c |
1954 | +++ b/drivers/isdn/gigaset/usb-gigaset.c |
1955 | @@ -574,8 +574,7 @@ static int gigaset_initcshw(struct cardstate *cs) |
1956 | { |
1957 | struct usb_cardstate *ucs; |
1958 | |
1959 | - cs->hw.usb = ucs = |
1960 | - kmalloc(sizeof(struct usb_cardstate), GFP_KERNEL); |
1961 | + cs->hw.usb = ucs = kzalloc(sizeof(struct usb_cardstate), GFP_KERNEL); |
1962 | if (!ucs) { |
1963 | pr_err("out of memory\n"); |
1964 | return -ENOMEM; |
1965 | @@ -587,9 +586,6 @@ static int gigaset_initcshw(struct cardstate *cs) |
1966 | ucs->bchars[3] = 0; |
1967 | ucs->bchars[4] = 0x11; |
1968 | ucs->bchars[5] = 0x13; |
1969 | - ucs->bulk_out_buffer = NULL; |
1970 | - ucs->bulk_out_urb = NULL; |
1971 | - ucs->read_urb = NULL; |
1972 | tasklet_init(&cs->write_tasklet, |
1973 | gigaset_modem_fill, (unsigned long) cs); |
1974 | |
1975 | @@ -688,6 +684,11 @@ static int gigaset_probe(struct usb_interface *interface, |
1976 | return -ENODEV; |
1977 | } |
1978 | |
1979 | + if (hostif->desc.bNumEndpoints < 2) { |
1980 | + dev_err(&interface->dev, "missing endpoints\n"); |
1981 | + return -ENODEV; |
1982 | + } |
1983 | + |
1984 | dev_info(&udev->dev, "%s: Device matched ... !\n", __func__); |
1985 | |
1986 | /* allocate memory for our device state and initialize it */ |
1987 | @@ -707,6 +708,12 @@ static int gigaset_probe(struct usb_interface *interface, |
1988 | |
1989 | endpoint = &hostif->endpoint[0].desc; |
1990 | |
1991 | + if (!usb_endpoint_is_bulk_out(endpoint)) { |
1992 | + dev_err(&interface->dev, "missing bulk-out endpoint\n"); |
1993 | + retval = -ENODEV; |
1994 | + goto error; |
1995 | + } |
1996 | + |
1997 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); |
1998 | ucs->bulk_out_size = buffer_size; |
1999 | ucs->bulk_out_epnum = usb_endpoint_num(endpoint); |
2000 | @@ -726,6 +733,12 @@ static int gigaset_probe(struct usb_interface *interface, |
2001 | |
2002 | endpoint = &hostif->endpoint[1].desc; |
2003 | |
2004 | + if (!usb_endpoint_is_int_in(endpoint)) { |
2005 | + dev_err(&interface->dev, "missing int-in endpoint\n"); |
2006 | + retval = -ENODEV; |
2007 | + goto error; |
2008 | + } |
2009 | + |
2010 | ucs->busy = 0; |
2011 | |
2012 | ucs->read_urb = usb_alloc_urb(0, GFP_KERNEL); |
2013 | diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c |
2014 | index 21ea537bd55e..eff04fa23dfa 100644 |
2015 | --- a/drivers/md/persistent-data/dm-btree-remove.c |
2016 | +++ b/drivers/md/persistent-data/dm-btree-remove.c |
2017 | @@ -203,7 +203,13 @@ static void __rebalance2(struct dm_btree_info *info, struct btree_node *parent, |
2018 | struct btree_node *right = r->n; |
2019 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
2020 | uint32_t nr_right = le32_to_cpu(right->header.nr_entries); |
2021 | - unsigned threshold = 2 * merge_threshold(left) + 1; |
2022 | + /* |
2023 | + * Ensure the number of entries in each child will be greater |
2024 | + * than or equal to (max_entries / 3 + 1), so no matter which |
2025 | + * child is used for removal, the number will still be not |
2026 | + * less than (max_entries / 3). |
2027 | + */ |
2028 | + unsigned int threshold = 2 * (merge_threshold(left) + 1); |
2029 | |
2030 | if (nr_left + nr_right < threshold) { |
2031 | /* |
2032 | diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
2033 | index 45f82b5ddd77..d88c9ba401b5 100644 |
2034 | --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
2035 | +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c |
2036 | @@ -651,8 +651,7 @@ static int bdisp_release(struct file *file) |
2037 | |
2038 | dev_dbg(bdisp->dev, "%s\n", __func__); |
2039 | |
2040 | - if (mutex_lock_interruptible(&bdisp->lock)) |
2041 | - return -ERESTARTSYS; |
2042 | + mutex_lock(&bdisp->lock); |
2043 | |
2044 | v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); |
2045 | |
2046 | diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c |
2047 | index a93f681aa9d6..6426b07510a7 100644 |
2048 | --- a/drivers/media/radio/radio-wl1273.c |
2049 | +++ b/drivers/media/radio/radio-wl1273.c |
2050 | @@ -1149,8 +1149,7 @@ static int wl1273_fm_fops_release(struct file *file) |
2051 | if (radio->rds_users > 0) { |
2052 | radio->rds_users--; |
2053 | if (radio->rds_users == 0) { |
2054 | - if (mutex_lock_interruptible(&core->lock)) |
2055 | - return -EINTR; |
2056 | + mutex_lock(&core->lock); |
2057 | |
2058 | radio->irq_flags &= ~WL1273_RDS_EVENT; |
2059 | |
2060 | diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c |
2061 | index 7297fd261df9..f9844f87467b 100644 |
2062 | --- a/drivers/media/usb/stkwebcam/stk-webcam.c |
2063 | +++ b/drivers/media/usb/stkwebcam/stk-webcam.c |
2064 | @@ -166,7 +166,11 @@ int stk_camera_read_reg(struct stk_camera *dev, u16 index, u8 *value) |
2065 | *value = *buf; |
2066 | |
2067 | kfree(buf); |
2068 | - return ret; |
2069 | + |
2070 | + if (ret < 0) |
2071 | + return ret; |
2072 | + else |
2073 | + return 0; |
2074 | } |
2075 | |
2076 | static int stk_start_stream(struct stk_camera *dev) |
2077 | diff --git a/drivers/misc/altera-stapl/altera.c b/drivers/misc/altera-stapl/altera.c |
2078 | index f53e217e963f..494e263daa74 100644 |
2079 | --- a/drivers/misc/altera-stapl/altera.c |
2080 | +++ b/drivers/misc/altera-stapl/altera.c |
2081 | @@ -2176,8 +2176,7 @@ static int altera_get_note(u8 *p, s32 program_size, |
2082 | key_ptr = &p[note_strings + |
2083 | get_unaligned_be32( |
2084 | &p[note_table + (8 * i)])]; |
2085 | - if ((strncasecmp(key, key_ptr, strlen(key_ptr)) == 0) && |
2086 | - (key != NULL)) { |
2087 | + if (key && !strncasecmp(key, key_ptr, strlen(key_ptr))) { |
2088 | status = 0; |
2089 | |
2090 | value_ptr = &p[note_strings + |
2091 | diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c |
2092 | index 009242bcc7be..65c0742356b9 100644 |
2093 | --- a/drivers/mmc/host/omap_hsmmc.c |
2094 | +++ b/drivers/mmc/host/omap_hsmmc.c |
2095 | @@ -1700,6 +1700,36 @@ static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card) |
2096 | |
2097 | if (mmc_pdata(host)->init_card) |
2098 | mmc_pdata(host)->init_card(card); |
2099 | + else if (card->type == MMC_TYPE_SDIO || |
2100 | + card->type == MMC_TYPE_SD_COMBO) { |
2101 | + struct device_node *np = mmc_dev(mmc)->of_node; |
2102 | + |
2103 | + /* |
2104 | + * REVISIT: should be moved to sdio core and made more |
2105 | + * general e.g. by expanding the DT bindings of child nodes |
2106 | + * to provide a mechanism to provide this information: |
2107 | + * Documentation/devicetree/bindings/mmc/mmc-card.txt |
2108 | + */ |
2109 | + |
2110 | + np = of_get_compatible_child(np, "ti,wl1251"); |
2111 | + if (np) { |
2112 | + /* |
2113 | + * We have TI wl1251 attached to MMC3. Pass this |
2114 | + * information to the SDIO core because it can't be |
2115 | + * probed by normal methods. |
2116 | + */ |
2117 | + |
2118 | + dev_info(host->dev, "found wl1251\n"); |
2119 | + card->quirks |= MMC_QUIRK_NONSTD_SDIO; |
2120 | + card->cccr.wide_bus = 1; |
2121 | + card->cis.vendor = 0x104c; |
2122 | + card->cis.device = 0x9066; |
2123 | + card->cis.blksize = 512; |
2124 | + card->cis.max_dtr = 24000000; |
2125 | + card->ocr = 0x80; |
2126 | + of_node_put(np); |
2127 | + } |
2128 | + } |
2129 | } |
2130 | |
2131 | static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable) |
2132 | diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c |
2133 | index dd5069876537..4a7da5fde714 100644 |
2134 | --- a/drivers/mtd/devices/spear_smi.c |
2135 | +++ b/drivers/mtd/devices/spear_smi.c |
2136 | @@ -595,6 +595,26 @@ static int spear_mtd_read(struct mtd_info *mtd, loff_t from, size_t len, |
2137 | return 0; |
2138 | } |
2139 | |
2140 | +/* |
2141 | + * The purpose of this function is to ensure a memcpy_toio() with byte writes |
2142 | + * only. Its structure is inspired from the ARM implementation of _memcpy_toio() |
2143 | + * which also does single byte writes but cannot be used here as this is just an |
2144 | + * implementation detail and not part of the API. Not mentioning the comment |
2145 | + * stating that _memcpy_toio() should be optimized. |
2146 | + */ |
2147 | +static void spear_smi_memcpy_toio_b(volatile void __iomem *dest, |
2148 | + const void *src, size_t len) |
2149 | +{ |
2150 | + const unsigned char *from = src; |
2151 | + |
2152 | + while (len) { |
2153 | + len--; |
2154 | + writeb(*from, dest); |
2155 | + from++; |
2156 | + dest++; |
2157 | + } |
2158 | +} |
2159 | + |
2160 | static inline int spear_smi_cpy_toio(struct spear_smi *dev, u32 bank, |
2161 | void __iomem *dest, const void *src, size_t len) |
2162 | { |
2163 | @@ -617,7 +637,23 @@ static inline int spear_smi_cpy_toio(struct spear_smi *dev, u32 bank, |
2164 | ctrlreg1 = readl(dev->io_base + SMI_CR1); |
2165 | writel((ctrlreg1 | WB_MODE) & ~SW_MODE, dev->io_base + SMI_CR1); |
2166 | |
2167 | - memcpy_toio(dest, src, len); |
2168 | + /* |
2169 | + * In Write Burst mode (WB_MODE), the specs states that writes must be: |
2170 | + * - incremental |
2171 | + * - of the same size |
2172 | + * The ARM implementation of memcpy_toio() will optimize the number of |
2173 | + * I/O by using as much 4-byte writes as possible, surrounded by |
2174 | + * 2-byte/1-byte access if: |
2175 | + * - the destination is not 4-byte aligned |
2176 | + * - the length is not a multiple of 4-byte. |
2177 | + * Avoid this alternance of write access size by using our own 'byte |
2178 | + * access' helper if at least one of the two conditions above is true. |
2179 | + */ |
2180 | + if (IS_ALIGNED(len, sizeof(u32)) && |
2181 | + IS_ALIGNED((uintptr_t)dest, sizeof(u32))) |
2182 | + memcpy_toio(dest, src, len); |
2183 | + else |
2184 | + spear_smi_memcpy_toio_b(dest, src, len); |
2185 | |
2186 | writel(ctrlreg1, dev->io_base + SMI_CR1); |
2187 | |
2188 | diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c |
2189 | index a2c4048c07be..020437900fce 100644 |
2190 | --- a/drivers/net/can/slcan.c |
2191 | +++ b/drivers/net/can/slcan.c |
2192 | @@ -613,6 +613,7 @@ err_free_chan: |
2193 | sl->tty = NULL; |
2194 | tty->disc_data = NULL; |
2195 | clear_bit(SLF_INUSE, &sl->flags); |
2196 | + slc_free_netdev(sl->dev); |
2197 | free_netdev(sl->dev); |
2198 | |
2199 | err_exit: |
2200 | diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c |
2201 | index a37481c04a87..9eb3071b69a4 100644 |
2202 | --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c |
2203 | +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c |
2204 | @@ -718,6 +718,10 @@ static int adapter_up(struct adapter *adapter) |
2205 | |
2206 | if (adapter->flags & USING_MSIX) |
2207 | name_msix_vecs(adapter); |
2208 | + |
2209 | + /* Initialize hash mac addr list*/ |
2210 | + INIT_LIST_HEAD(&adapter->mac_hlist); |
2211 | + |
2212 | adapter->flags |= FULL_INIT_DONE; |
2213 | } |
2214 | |
2215 | @@ -743,8 +747,6 @@ static int adapter_up(struct adapter *adapter) |
2216 | enable_rx(adapter); |
2217 | t4vf_sge_start(adapter); |
2218 | |
2219 | - /* Initialize hash mac addr list*/ |
2220 | - INIT_LIST_HEAD(&adapter->mac_hlist); |
2221 | return 0; |
2222 | } |
2223 | |
2224 | diff --git a/drivers/net/ethernet/cirrus/ep93xx_eth.c b/drivers/net/ethernet/cirrus/ep93xx_eth.c |
2225 | index 9a161e981529..24f69034f52c 100644 |
2226 | --- a/drivers/net/ethernet/cirrus/ep93xx_eth.c |
2227 | +++ b/drivers/net/ethernet/cirrus/ep93xx_eth.c |
2228 | @@ -780,6 +780,7 @@ static int ep93xx_eth_remove(struct platform_device *pdev) |
2229 | { |
2230 | struct net_device *dev; |
2231 | struct ep93xx_priv *ep; |
2232 | + struct resource *mem; |
2233 | |
2234 | dev = platform_get_drvdata(pdev); |
2235 | if (dev == NULL) |
2236 | @@ -795,8 +796,8 @@ static int ep93xx_eth_remove(struct platform_device *pdev) |
2237 | iounmap(ep->base_addr); |
2238 | |
2239 | if (ep->res != NULL) { |
2240 | - release_resource(ep->res); |
2241 | - kfree(ep->res); |
2242 | + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2243 | + release_mem_region(mem->start, resource_size(mem)); |
2244 | } |
2245 | |
2246 | free_netdev(dev); |
2247 | diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c |
2248 | index 068789e694c9..93c29094ceff 100644 |
2249 | --- a/drivers/net/ethernet/intel/e100.c |
2250 | +++ b/drivers/net/ethernet/intel/e100.c |
2251 | @@ -1370,8 +1370,8 @@ static inline int e100_load_ucode_wait(struct nic *nic) |
2252 | |
2253 | fw = e100_request_firmware(nic); |
2254 | /* If it's NULL, then no ucode is required */ |
2255 | - if (!fw || IS_ERR(fw)) |
2256 | - return PTR_ERR(fw); |
2257 | + if (IS_ERR_OR_NULL(fw)) |
2258 | + return PTR_ERR_OR_ZERO(fw); |
2259 | |
2260 | if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode))) |
2261 | netif_err(nic, probe, nic->netdev, |
2262 | diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c |
2263 | index cb7c3ef97134..781642d47133 100644 |
2264 | --- a/drivers/net/ethernet/mellanox/mlx4/main.c |
2265 | +++ b/drivers/net/ethernet/mellanox/mlx4/main.c |
2266 | @@ -198,7 +198,7 @@ int mlx4_check_port_params(struct mlx4_dev *dev, |
2267 | for (i = 0; i < dev->caps.num_ports - 1; i++) { |
2268 | if (port_type[i] != port_type[i + 1]) { |
2269 | mlx4_err(dev, "Only same port types supported on this HCA, aborting\n"); |
2270 | - return -EINVAL; |
2271 | + return -EOPNOTSUPP; |
2272 | } |
2273 | } |
2274 | } |
2275 | @@ -207,7 +207,7 @@ int mlx4_check_port_params(struct mlx4_dev *dev, |
2276 | if (!(port_type[i] & dev->caps.supported_type[i+1])) { |
2277 | mlx4_err(dev, "Requested port type for port %d is not supported on this HCA\n", |
2278 | i + 1); |
2279 | - return -EINVAL; |
2280 | + return -EOPNOTSUPP; |
2281 | } |
2282 | } |
2283 | return 0; |
2284 | @@ -1122,8 +1122,7 @@ static int __set_port_type(struct mlx4_port_info *info, |
2285 | mlx4_err(mdev, |
2286 | "Requested port type for port %d is not supported on this HCA\n", |
2287 | info->port); |
2288 | - err = -EINVAL; |
2289 | - goto err_sup; |
2290 | + return -EOPNOTSUPP; |
2291 | } |
2292 | |
2293 | mlx4_stop_sense(mdev); |
2294 | @@ -1145,7 +1144,7 @@ static int __set_port_type(struct mlx4_port_info *info, |
2295 | for (i = 1; i <= mdev->caps.num_ports; i++) { |
2296 | if (mdev->caps.possible_type[i] == MLX4_PORT_TYPE_AUTO) { |
2297 | mdev->caps.possible_type[i] = mdev->caps.port_type[i]; |
2298 | - err = -EINVAL; |
2299 | + err = -EOPNOTSUPP; |
2300 | } |
2301 | } |
2302 | } |
2303 | @@ -1171,7 +1170,7 @@ static int __set_port_type(struct mlx4_port_info *info, |
2304 | out: |
2305 | mlx4_start_sense(mdev); |
2306 | mutex_unlock(&priv->port_mutex); |
2307 | -err_sup: |
2308 | + |
2309 | return err; |
2310 | } |
2311 | |
2312 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2313 | index e42ece20cd0b..e13a6cd5163f 100644 |
2314 | --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2315 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
2316 | @@ -1368,7 +1368,7 @@ static int mlx5e_get_module_info(struct net_device *netdev, |
2317 | break; |
2318 | case MLX5_MODULE_ID_SFP: |
2319 | modinfo->type = ETH_MODULE_SFF_8472; |
2320 | - modinfo->eeprom_len = MLX5_EEPROM_PAGE_LENGTH; |
2321 | + modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; |
2322 | break; |
2323 | default: |
2324 | netdev_err(priv->netdev, "%s: cable type not recognized:0x%x\n", |
2325 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
2326 | index 9346f3985edf..354338c8a510 100644 |
2327 | --- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
2328 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c |
2329 | @@ -125,7 +125,7 @@ void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type) |
2330 | if (!is_event_type_allowed((rsn >> MLX5_USER_INDEX_LEN), event_type)) { |
2331 | mlx5_core_warn(dev, "event 0x%.2x is not allowed on resource 0x%.8x\n", |
2332 | event_type, rsn); |
2333 | - return; |
2334 | + goto out; |
2335 | } |
2336 | |
2337 | switch (common->res) { |
2338 | @@ -139,7 +139,7 @@ void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type) |
2339 | default: |
2340 | mlx5_core_warn(dev, "invalid resource type for 0x%x\n", rsn); |
2341 | } |
2342 | - |
2343 | +out: |
2344 | mlx5_core_put_rsc(common); |
2345 | } |
2346 | |
2347 | diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h |
2348 | index 6d2de4e01f6d..e11920d12774 100644 |
2349 | --- a/drivers/net/ethernet/stmicro/stmmac/common.h |
2350 | +++ b/drivers/net/ethernet/stmicro/stmmac/common.h |
2351 | @@ -354,7 +354,7 @@ struct dma_features { |
2352 | struct stmmac_desc_ops { |
2353 | /* DMA RX descriptor ring initialization */ |
2354 | void (*init_rx_desc) (struct dma_desc *p, int disable_rx_ic, int mode, |
2355 | - int end); |
2356 | + int end, int bfsize); |
2357 | /* DMA TX descriptor ring initialization */ |
2358 | void (*init_tx_desc) (struct dma_desc *p, int mode, int end); |
2359 | |
2360 | diff --git a/drivers/net/ethernet/stmicro/stmmac/descs_com.h b/drivers/net/ethernet/stmicro/stmmac/descs_com.h |
2361 | index 1d181e205d6e..f9cbba2d2cc0 100644 |
2362 | --- a/drivers/net/ethernet/stmicro/stmmac/descs_com.h |
2363 | +++ b/drivers/net/ethernet/stmicro/stmmac/descs_com.h |
2364 | @@ -33,11 +33,14 @@ |
2365 | /* Specific functions used for Ring mode */ |
2366 | |
2367 | /* Enhanced descriptors */ |
2368 | -static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end) |
2369 | +static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end, |
2370 | + int bfsize) |
2371 | { |
2372 | - p->des1 |= cpu_to_le32(((BUF_SIZE_8KiB - 1) |
2373 | - << ERDES1_BUFFER2_SIZE_SHIFT) |
2374 | - & ERDES1_BUFFER2_SIZE_MASK); |
2375 | + if (bfsize == BUF_SIZE_16KiB) |
2376 | + p->des1 |= cpu_to_le32((BUF_SIZE_8KiB |
2377 | + << ERDES1_BUFFER2_SIZE_SHIFT) |
2378 | + & ERDES1_BUFFER2_SIZE_MASK); |
2379 | + |
2380 | |
2381 | if (end) |
2382 | p->des1 |= cpu_to_le32(ERDES1_END_RING); |
2383 | @@ -63,11 +66,15 @@ static inline void enh_set_tx_desc_len_on_ring(struct dma_desc *p, int len) |
2384 | } |
2385 | |
2386 | /* Normal descriptors */ |
2387 | -static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end) |
2388 | +static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end, int bfsize) |
2389 | { |
2390 | - p->des1 |= cpu_to_le32(((BUF_SIZE_2KiB - 1) |
2391 | - << RDES1_BUFFER2_SIZE_SHIFT) |
2392 | - & RDES1_BUFFER2_SIZE_MASK); |
2393 | + if (bfsize >= BUF_SIZE_2KiB) { |
2394 | + int bfsize2; |
2395 | + |
2396 | + bfsize2 = min(bfsize - BUF_SIZE_2KiB + 1, BUF_SIZE_2KiB - 1); |
2397 | + p->des1 |= cpu_to_le32((bfsize2 << RDES1_BUFFER2_SIZE_SHIFT) |
2398 | + & RDES1_BUFFER2_SIZE_MASK); |
2399 | + } |
2400 | |
2401 | if (end) |
2402 | p->des1 |= cpu_to_le32(RDES1_END_RING); |
2403 | diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |
2404 | index 3f5056858535..a90b02926e4d 100644 |
2405 | --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |
2406 | +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c |
2407 | @@ -289,7 +289,7 @@ exit: |
2408 | } |
2409 | |
2410 | static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, |
2411 | - int mode, int end) |
2412 | + int mode, int end, int bfsize) |
2413 | { |
2414 | p->des3 = cpu_to_le32(RDES3_OWN | RDES3_BUFFER1_VALID_ADDR); |
2415 | |
2416 | diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
2417 | index 77dc5842bd0b..47f4fe50c848 100644 |
2418 | --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
2419 | +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c |
2420 | @@ -269,15 +269,19 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, |
2421 | } |
2422 | |
2423 | static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, |
2424 | - int mode, int end) |
2425 | + int mode, int end, int bfsize) |
2426 | { |
2427 | + int bfsize1; |
2428 | + |
2429 | p->des0 |= cpu_to_le32(RDES0_OWN); |
2430 | - p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK); |
2431 | + |
2432 | + bfsize1 = min(bfsize, BUF_SIZE_8KiB); |
2433 | + p->des1 |= cpu_to_le32(bfsize1 & ERDES1_BUFFER1_SIZE_MASK); |
2434 | |
2435 | if (mode == STMMAC_CHAIN_MODE) |
2436 | ehn_desc_rx_set_on_chain(p); |
2437 | else |
2438 | - ehn_desc_rx_set_on_ring(p, end); |
2439 | + ehn_desc_rx_set_on_ring(p, end, bfsize); |
2440 | |
2441 | if (disable_rx_ic) |
2442 | p->des1 |= cpu_to_le32(ERDES1_DISABLE_IC); |
2443 | diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
2444 | index 01f8f2e94c0f..5a06a5a1f6ea 100644 |
2445 | --- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
2446 | +++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
2447 | @@ -137,15 +137,19 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, |
2448 | } |
2449 | |
2450 | static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, |
2451 | - int end) |
2452 | + int end, int bfsize) |
2453 | { |
2454 | + int bfsize1; |
2455 | + |
2456 | p->des0 |= cpu_to_le32(RDES0_OWN); |
2457 | - p->des1 |= cpu_to_le32((BUF_SIZE_2KiB - 1) & RDES1_BUFFER1_SIZE_MASK); |
2458 | + |
2459 | + bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1); |
2460 | + p->des1 |= cpu_to_le32(bfsize1 & RDES1_BUFFER1_SIZE_MASK); |
2461 | |
2462 | if (mode == STMMAC_CHAIN_MODE) |
2463 | ndesc_rx_set_on_chain(p, end); |
2464 | else |
2465 | - ndesc_rx_set_on_ring(p, end); |
2466 | + ndesc_rx_set_on_ring(p, end, bfsize); |
2467 | |
2468 | if (disable_rx_ic) |
2469 | p->des1 |= cpu_to_le32(RDES1_DISABLE_IC); |
2470 | diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2471 | index 2c04a0739fd6..5ac48a594951 100644 |
2472 | --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2473 | +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2474 | @@ -956,11 +956,11 @@ static void stmmac_clear_descriptors(struct stmmac_priv *priv) |
2475 | if (priv->extend_desc) |
2476 | priv->hw->desc->init_rx_desc(&priv->dma_erx[i].basic, |
2477 | priv->use_riwt, priv->mode, |
2478 | - (i == DMA_RX_SIZE - 1)); |
2479 | + (i == DMA_RX_SIZE - 1), priv->dma_buf_sz); |
2480 | else |
2481 | priv->hw->desc->init_rx_desc(&priv->dma_rx[i], |
2482 | priv->use_riwt, priv->mode, |
2483 | - (i == DMA_RX_SIZE - 1)); |
2484 | + (i == DMA_RX_SIZE - 1), priv->dma_buf_sz); |
2485 | for (i = 0; i < DMA_TX_SIZE; i++) |
2486 | if (priv->extend_desc) |
2487 | priv->hw->desc->init_tx_desc(&priv->dma_etx[i].basic, |
2488 | @@ -2479,7 +2479,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) |
2489 | wmb(); |
2490 | |
2491 | if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00)) |
2492 | - priv->hw->desc->init_rx_desc(p, priv->use_riwt, 0, 0); |
2493 | + priv->hw->desc->init_rx_desc(p, priv->use_riwt, 0, 0, priv->dma_buf_sz); |
2494 | else |
2495 | priv->hw->desc->set_rx_owner(p); |
2496 | |
2497 | @@ -2499,8 +2499,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) |
2498 | */ |
2499 | static int stmmac_rx(struct stmmac_priv *priv, int limit) |
2500 | { |
2501 | - unsigned int entry = priv->cur_rx; |
2502 | - unsigned int next_entry; |
2503 | + unsigned int next_entry = priv->cur_rx; |
2504 | unsigned int count = 0; |
2505 | int coe = priv->hw->rx_csum; |
2506 | |
2507 | @@ -2516,10 +2515,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) |
2508 | priv->hw->desc->display_ring(rx_head, DMA_RX_SIZE, true); |
2509 | } |
2510 | while (count < limit) { |
2511 | - int status; |
2512 | + int entry, status; |
2513 | struct dma_desc *p; |
2514 | struct dma_desc *np; |
2515 | |
2516 | + entry = next_entry; |
2517 | + |
2518 | if (priv->extend_desc) |
2519 | p = (struct dma_desc *)(priv->dma_erx + entry); |
2520 | else |
2521 | @@ -2584,7 +2585,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) |
2522 | priv->dev->name, frame_len, |
2523 | priv->dma_buf_sz); |
2524 | priv->dev->stats.rx_length_errors++; |
2525 | - break; |
2526 | + continue; |
2527 | } |
2528 | |
2529 | /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3 |
2530 | @@ -2615,7 +2616,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) |
2531 | dev_warn(priv->device, |
2532 | "packet dropped\n"); |
2533 | priv->dev->stats.rx_dropped++; |
2534 | - break; |
2535 | + continue; |
2536 | } |
2537 | |
2538 | dma_sync_single_for_cpu(priv->device, |
2539 | @@ -2638,7 +2639,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) |
2540 | pr_err("%s: Inconsistent Rx chain\n", |
2541 | priv->dev->name); |
2542 | priv->dev->stats.rx_dropped++; |
2543 | - break; |
2544 | + continue; |
2545 | } |
2546 | prefetch(skb->data - NET_IP_ALIGN); |
2547 | priv->rx_skbuff[entry] = NULL; |
2548 | @@ -2672,7 +2673,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) |
2549 | priv->dev->stats.rx_packets++; |
2550 | priv->dev->stats.rx_bytes += frame_len; |
2551 | } |
2552 | - entry = next_entry; |
2553 | } |
2554 | |
2555 | stmmac_rx_refill(priv); |
2556 | diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c |
2557 | index 892b06852e15..687f0c20b47f 100644 |
2558 | --- a/drivers/net/ethernet/ti/cpsw.c |
2559 | +++ b/drivers/net/ethernet/ti/cpsw.c |
2560 | @@ -773,8 +773,8 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id) |
2561 | { |
2562 | struct cpsw_common *cpsw = dev_id; |
2563 | |
2564 | - cpdma_ctlr_eoi(cpsw->dma, CPDMA_EOI_RX); |
2565 | writel(0, &cpsw->wr_regs->rx_en); |
2566 | + cpdma_ctlr_eoi(cpsw->dma, CPDMA_EOI_RX); |
2567 | |
2568 | if (cpsw->quirk_irq) { |
2569 | disable_irq_nosync(cpsw->irqs_table[0]); |
2570 | diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c |
2571 | index 7a60d2e652da..e492c7f0d311 100644 |
2572 | --- a/drivers/net/wireless/ath/ar5523/ar5523.c |
2573 | +++ b/drivers/net/wireless/ath/ar5523/ar5523.c |
2574 | @@ -255,7 +255,8 @@ static int ar5523_cmd(struct ar5523 *ar, u32 code, const void *idata, |
2575 | |
2576 | if (flags & AR5523_CMD_FLAG_MAGIC) |
2577 | hdr->magic = cpu_to_be32(1 << 24); |
2578 | - memcpy(hdr + 1, idata, ilen); |
2579 | + if (ilen) |
2580 | + memcpy(hdr + 1, idata, ilen); |
2581 | |
2582 | cmd->odata = odata; |
2583 | cmd->olen = olen; |
2584 | diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c |
2585 | index d84a362a084a..d96e062647fd 100644 |
2586 | --- a/drivers/net/wireless/ath/ath10k/pci.c |
2587 | +++ b/drivers/net/wireless/ath/ath10k/pci.c |
2588 | @@ -1765,6 +1765,11 @@ static void ath10k_pci_hif_stop(struct ath10k *ar) |
2589 | |
2590 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n"); |
2591 | |
2592 | + ath10k_pci_irq_disable(ar); |
2593 | + ath10k_pci_irq_sync(ar); |
2594 | + napi_synchronize(&ar->napi); |
2595 | + napi_disable(&ar->napi); |
2596 | + |
2597 | /* Most likely the device has HTT Rx ring configured. The only way to |
2598 | * prevent the device from accessing (and possible corrupting) host |
2599 | * memory is to reset the chip now. |
2600 | @@ -1778,10 +1783,6 @@ static void ath10k_pci_hif_stop(struct ath10k *ar) |
2601 | */ |
2602 | ath10k_pci_safe_chip_reset(ar); |
2603 | |
2604 | - ath10k_pci_irq_disable(ar); |
2605 | - ath10k_pci_irq_sync(ar); |
2606 | - napi_synchronize(&ar->napi); |
2607 | - napi_disable(&ar->napi); |
2608 | ath10k_pci_flush(ar); |
2609 | |
2610 | spin_lock_irqsave(&ar_pci->ps_lock, flags); |
2611 | diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
2612 | index 92557cd31a39..d91ab2b8d667 100644 |
2613 | --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
2614 | +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
2615 | @@ -805,6 +805,21 @@ static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, |
2616 | !ieee80211_is_action(hdr->frame_control))) |
2617 | sta = NULL; |
2618 | |
2619 | + /* If there is no sta, and it's not offchannel - send through AP */ |
2620 | + if (info->control.vif->type == NL80211_IFTYPE_STATION && |
2621 | + info->hw_queue != IWL_MVM_OFFCHANNEL_QUEUE && !sta) { |
2622 | + struct iwl_mvm_vif *mvmvif = |
2623 | + iwl_mvm_vif_from_mac80211(info->control.vif); |
2624 | + u8 ap_sta_id = READ_ONCE(mvmvif->ap_sta_id); |
2625 | + |
2626 | + if (ap_sta_id < IWL_MVM_STATION_COUNT) { |
2627 | + /* mac80211 holds rcu read lock */ |
2628 | + sta = rcu_dereference(mvm->fw_id_to_mac_id[ap_sta_id]); |
2629 | + if (IS_ERR_OR_NULL(sta)) |
2630 | + goto drop; |
2631 | + } |
2632 | + } |
2633 | + |
2634 | if (sta) { |
2635 | if (iwl_mvm_defer_tx(mvm, sta, skb)) |
2636 | return; |
2637 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c |
2638 | index d91f8bbfe7a0..2c23c9edab5c 100644 |
2639 | --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c |
2640 | +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/hw.c |
2641 | @@ -1209,6 +1209,7 @@ void rtl92de_enable_interrupt(struct ieee80211_hw *hw) |
2642 | |
2643 | rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); |
2644 | rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); |
2645 | + rtlpci->irq_enabled = true; |
2646 | } |
2647 | |
2648 | void rtl92de_disable_interrupt(struct ieee80211_hw *hw) |
2649 | @@ -1218,7 +1219,7 @@ void rtl92de_disable_interrupt(struct ieee80211_hw *hw) |
2650 | |
2651 | rtl_write_dword(rtlpriv, REG_HIMR, IMR8190_DISABLED); |
2652 | rtl_write_dword(rtlpriv, REG_HIMRE, IMR8190_DISABLED); |
2653 | - synchronize_irq(rtlpci->pdev->irq); |
2654 | + rtlpci->irq_enabled = false; |
2655 | } |
2656 | |
2657 | static void _rtl92de_poweroff_adapter(struct ieee80211_hw *hw) |
2658 | @@ -1389,7 +1390,7 @@ void rtl92de_set_beacon_related_registers(struct ieee80211_hw *hw) |
2659 | |
2660 | bcn_interval = mac->beacon_interval; |
2661 | atim_window = 2; |
2662 | - /*rtl92de_disable_interrupt(hw); */ |
2663 | + rtl92de_disable_interrupt(hw); |
2664 | rtl_write_word(rtlpriv, REG_ATIMWND, atim_window); |
2665 | rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); |
2666 | rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660f); |
2667 | @@ -1409,9 +1410,9 @@ void rtl92de_set_beacon_interval(struct ieee80211_hw *hw) |
2668 | |
2669 | RT_TRACE(rtlpriv, COMP_BEACON, DBG_DMESG, |
2670 | "beacon_interval:%d\n", bcn_interval); |
2671 | - /* rtl92de_disable_interrupt(hw); */ |
2672 | + rtl92de_disable_interrupt(hw); |
2673 | rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); |
2674 | - /* rtl92de_enable_interrupt(hw); */ |
2675 | + rtl92de_enable_interrupt(hw); |
2676 | } |
2677 | |
2678 | void rtl92de_update_interrupt_mask(struct ieee80211_hw *hw, |
2679 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c |
2680 | index 1ebfee18882f..63cad2f875b8 100644 |
2681 | --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c |
2682 | +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c |
2683 | @@ -243,6 +243,7 @@ static struct rtl_hal_ops rtl8192de_hal_ops = { |
2684 | .led_control = rtl92de_led_control, |
2685 | .set_desc = rtl92de_set_desc, |
2686 | .get_desc = rtl92de_get_desc, |
2687 | + .is_tx_desc_closed = rtl92de_is_tx_desc_closed, |
2688 | .tx_polling = rtl92de_tx_polling, |
2689 | .enable_hw_sec = rtl92de_enable_hw_security_config, |
2690 | .set_key = rtl92de_set_key, |
2691 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c |
2692 | index e998e98d74cb..bddf57cb47f0 100644 |
2693 | --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c |
2694 | +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c |
2695 | @@ -843,13 +843,15 @@ u32 rtl92de_get_desc(u8 *p_desc, bool istx, u8 desc_name) |
2696 | break; |
2697 | } |
2698 | } else { |
2699 | - struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc; |
2700 | switch (desc_name) { |
2701 | case HW_DESC_OWN: |
2702 | - ret = GET_RX_DESC_OWN(pdesc); |
2703 | + ret = GET_RX_DESC_OWN(p_desc); |
2704 | break; |
2705 | case HW_DESC_RXPKT_LEN: |
2706 | - ret = GET_RX_DESC_PKT_LEN(pdesc); |
2707 | + ret = GET_RX_DESC_PKT_LEN(p_desc); |
2708 | + break; |
2709 | + case HW_DESC_RXBUFF_ADDR: |
2710 | + ret = GET_RX_DESC_BUFF_ADDR(p_desc); |
2711 | break; |
2712 | default: |
2713 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", |
2714 | @@ -860,6 +862,23 @@ u32 rtl92de_get_desc(u8 *p_desc, bool istx, u8 desc_name) |
2715 | return ret; |
2716 | } |
2717 | |
2718 | +bool rtl92de_is_tx_desc_closed(struct ieee80211_hw *hw, |
2719 | + u8 hw_queue, u16 index) |
2720 | +{ |
2721 | + struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
2722 | + struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; |
2723 | + u8 *entry = (u8 *)(&ring->desc[ring->idx]); |
2724 | + u8 own = (u8)rtl92de_get_desc(entry, true, HW_DESC_OWN); |
2725 | + |
2726 | + /* a beacon packet will only use the first |
2727 | + * descriptor by defaut, and the own bit may not |
2728 | + * be cleared by the hardware |
2729 | + */ |
2730 | + if (own) |
2731 | + return false; |
2732 | + return true; |
2733 | +} |
2734 | + |
2735 | void rtl92de_tx_polling(struct ieee80211_hw *hw, u8 hw_queue) |
2736 | { |
2737 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
2738 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h |
2739 | index 194d99f8bacf..d061f33b9f68 100644 |
2740 | --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h |
2741 | +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h |
2742 | @@ -740,6 +740,8 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, |
2743 | void rtl92de_set_desc(struct ieee80211_hw *hw, u8 *pdesc, bool istx, |
2744 | u8 desc_name, u8 *val); |
2745 | u32 rtl92de_get_desc(u8 *pdesc, bool istx, u8 desc_name); |
2746 | +bool rtl92de_is_tx_desc_closed(struct ieee80211_hw *hw, |
2747 | + u8 hw_queue, u16 index); |
2748 | void rtl92de_tx_polling(struct ieee80211_hw *hw, u8 hw_queue); |
2749 | void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, |
2750 | bool b_firstseg, bool b_lastseg, |
2751 | diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c |
2752 | index 06a157c63416..7eab97585f22 100644 |
2753 | --- a/drivers/nfc/nxp-nci/i2c.c |
2754 | +++ b/drivers/nfc/nxp-nci/i2c.c |
2755 | @@ -238,8 +238,10 @@ static irqreturn_t nxp_nci_i2c_irq_thread_fn(int irq, void *phy_id) |
2756 | |
2757 | if (r == -EREMOTEIO) { |
2758 | phy->hard_fault = r; |
2759 | - skb = NULL; |
2760 | - } else if (r < 0) { |
2761 | + if (info->mode == NXP_NCI_MODE_FW) |
2762 | + nxp_nci_fw_recv_frame(phy->ndev, NULL); |
2763 | + } |
2764 | + if (r < 0) { |
2765 | nfc_err(&client->dev, "Read failed with error %d\n", r); |
2766 | goto exit_irq_handled; |
2767 | } |
2768 | diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
2769 | index 8705bfe7bb73..9561a247d0dc 100644 |
2770 | --- a/drivers/nvme/host/core.c |
2771 | +++ b/drivers/nvme/host/core.c |
2772 | @@ -1043,7 +1043,7 @@ static int nvme_pr_reserve(struct block_device *bdev, u64 key, |
2773 | static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, |
2774 | enum pr_type type, bool abort) |
2775 | { |
2776 | - u32 cdw10 = nvme_pr_type(type) << 8 | abort ? 2 : 1; |
2777 | + u32 cdw10 = nvme_pr_type(type) << 8 | (abort ? 2 : 1); |
2778 | return nvme_pr_command(bdev, cdw10, old, new, nvme_cmd_resv_acquire); |
2779 | } |
2780 | |
2781 | @@ -1055,7 +1055,7 @@ static int nvme_pr_clear(struct block_device *bdev, u64 key) |
2782 | |
2783 | static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) |
2784 | { |
2785 | - u32 cdw10 = nvme_pr_type(type) << 8 | key ? 1 << 3 : 0; |
2786 | + u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); |
2787 | return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); |
2788 | } |
2789 | |
2790 | diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c |
2791 | index 37f393f27efc..55ca14fbdd2a 100644 |
2792 | --- a/drivers/pci/msi.c |
2793 | +++ b/drivers/pci/msi.c |
2794 | @@ -230,7 +230,7 @@ u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag) |
2795 | return 0; |
2796 | |
2797 | mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT; |
2798 | - if (flag) |
2799 | + if (flag & PCI_MSIX_ENTRY_CTRL_MASKBIT) |
2800 | mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT; |
2801 | writel(mask_bits, pci_msix_desc_addr(desc) + PCI_MSIX_ENTRY_VECTOR_CTRL); |
2802 | |
2803 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
2804 | index f474899073e0..496296bc3581 100644 |
2805 | --- a/drivers/pci/quirks.c |
2806 | +++ b/drivers/pci/quirks.c |
2807 | @@ -4446,7 +4446,7 @@ int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags) |
2808 | #define INTEL_BSPR_REG_BPPD (1 << 9) |
2809 | |
2810 | /* Upstream Peer Decode Configuration Register */ |
2811 | -#define INTEL_UPDCR_REG 0x1114 |
2812 | +#define INTEL_UPDCR_REG 0x1014 |
2813 | /* 5:0 Peer Decode Enable bits */ |
2814 | #define INTEL_UPDCR_REG_MASK 0x3f |
2815 | |
2816 | diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c |
2817 | index e86c4de2f6db..92855f45bc53 100644 |
2818 | --- a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c |
2819 | +++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c |
2820 | @@ -762,12 +762,23 @@ static int pm8xxx_gpio_probe(struct platform_device *pdev) |
2821 | return ret; |
2822 | } |
2823 | |
2824 | - ret = gpiochip_add_pin_range(&pctrl->chip, |
2825 | - dev_name(pctrl->dev), |
2826 | - 0, 0, pctrl->chip.ngpio); |
2827 | - if (ret) { |
2828 | - dev_err(pctrl->dev, "failed to add pin range\n"); |
2829 | - goto unregister_gpiochip; |
2830 | + /* |
2831 | + * For DeviceTree-supported systems, the gpio core checks the |
2832 | + * pinctrl's device node for the "gpio-ranges" property. |
2833 | + * If it is present, it takes care of adding the pin ranges |
2834 | + * for the driver. In this case the driver can skip ahead. |
2835 | + * |
2836 | + * In order to remain compatible with older, existing DeviceTree |
2837 | + * files which don't set the "gpio-ranges" property or systems that |
2838 | + * utilize ACPI the driver has to call gpiochip_add_pin_range(). |
2839 | + */ |
2840 | + if (!of_property_read_bool(pctrl->dev->of_node, "gpio-ranges")) { |
2841 | + ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), |
2842 | + 0, 0, pctrl->chip.ngpio); |
2843 | + if (ret) { |
2844 | + dev_err(pctrl->dev, "failed to add pin range\n"); |
2845 | + goto unregister_gpiochip; |
2846 | + } |
2847 | } |
2848 | |
2849 | platform_set_drvdata(pdev, pctrl); |
2850 | diff --git a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c |
2851 | index 3d92f827da7a..0839b70a30ee 100644 |
2852 | --- a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c |
2853 | +++ b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c |
2854 | @@ -495,8 +495,10 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d) |
2855 | return -ENODEV; |
2856 | |
2857 | eint_data = devm_kzalloc(dev, sizeof(*eint_data), GFP_KERNEL); |
2858 | - if (!eint_data) |
2859 | + if (!eint_data) { |
2860 | + of_node_put(eint_np); |
2861 | return -ENOMEM; |
2862 | + } |
2863 | |
2864 | eint_data->drvdata = d; |
2865 | |
2866 | @@ -508,12 +510,14 @@ static int s3c24xx_eint_init(struct samsung_pinctrl_drv_data *d) |
2867 | irq = irq_of_parse_and_map(eint_np, i); |
2868 | if (!irq) { |
2869 | dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i); |
2870 | + of_node_put(eint_np); |
2871 | return -ENXIO; |
2872 | } |
2873 | |
2874 | eint_data->parents[i] = irq; |
2875 | irq_set_chained_handler_and_data(irq, handlers[i], eint_data); |
2876 | } |
2877 | + of_node_put(eint_np); |
2878 | |
2879 | bank = d->pin_banks; |
2880 | for (i = 0; i < d->nr_banks; ++i, ++bank) { |
2881 | diff --git a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c |
2882 | index 43407ab248f5..0cd9f3a7bb11 100644 |
2883 | --- a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c |
2884 | +++ b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c |
2885 | @@ -713,6 +713,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) |
2886 | data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); |
2887 | if (!data) { |
2888 | dev_err(dev, "could not allocate memory for wkup eint data\n"); |
2889 | + of_node_put(eint0_np); |
2890 | return -ENOMEM; |
2891 | } |
2892 | data->drvdata = d; |
2893 | @@ -723,6 +724,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) |
2894 | irq = irq_of_parse_and_map(eint0_np, i); |
2895 | if (!irq) { |
2896 | dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i); |
2897 | + of_node_put(eint0_np); |
2898 | return -ENXIO; |
2899 | } |
2900 | |
2901 | @@ -730,6 +732,7 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) |
2902 | s3c64xx_eint0_handlers[i], |
2903 | data); |
2904 | } |
2905 | + of_node_put(eint0_np); |
2906 | |
2907 | bank = d->pin_banks; |
2908 | for (i = 0; i < d->nr_banks; ++i, ++bank) { |
2909 | diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c |
2910 | index 620727fabe64..6b77a1bb5b20 100644 |
2911 | --- a/drivers/pinctrl/samsung/pinctrl-samsung.c |
2912 | +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c |
2913 | @@ -281,6 +281,7 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev, |
2914 | &reserved_maps, num_maps); |
2915 | if (ret < 0) { |
2916 | samsung_dt_free_map(pctldev, *map, *num_maps); |
2917 | + of_node_put(np); |
2918 | return ret; |
2919 | } |
2920 | } |
2921 | @@ -770,8 +771,10 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( |
2922 | if (!of_get_child_count(cfg_np)) { |
2923 | ret = samsung_pinctrl_create_function(dev, drvdata, |
2924 | cfg_np, func); |
2925 | - if (ret < 0) |
2926 | + if (ret < 0) { |
2927 | + of_node_put(cfg_np); |
2928 | return ERR_PTR(ret); |
2929 | + } |
2930 | if (ret > 0) { |
2931 | ++func; |
2932 | ++func_cnt; |
2933 | @@ -782,8 +785,11 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( |
2934 | for_each_child_of_node(cfg_np, func_np) { |
2935 | ret = samsung_pinctrl_create_function(dev, drvdata, |
2936 | func_np, func); |
2937 | - if (ret < 0) |
2938 | + if (ret < 0) { |
2939 | + of_node_put(func_np); |
2940 | + of_node_put(cfg_np); |
2941 | return ERR_PTR(ret); |
2942 | + } |
2943 | if (ret > 0) { |
2944 | ++func; |
2945 | ++func_cnt; |
2946 | diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
2947 | index 47e6c8acd5e2..18d57c0efe9f 100644 |
2948 | --- a/drivers/regulator/core.c |
2949 | +++ b/drivers/regulator/core.c |
2950 | @@ -4452,7 +4452,7 @@ static int __init regulator_init(void) |
2951 | /* init early to allow our consumers to complete system booting */ |
2952 | core_initcall(regulator_init); |
2953 | |
2954 | -static int regulator_late_cleanup(struct device *dev, void *data) |
2955 | +static int __init regulator_late_cleanup(struct device *dev, void *data) |
2956 | { |
2957 | struct regulator_dev *rdev = dev_to_rdev(dev); |
2958 | const struct regulator_ops *ops = rdev->desc->ops; |
2959 | @@ -4501,8 +4501,17 @@ unlock: |
2960 | return 0; |
2961 | } |
2962 | |
2963 | -static void regulator_init_complete_work_function(struct work_struct *work) |
2964 | +static int __init regulator_init_complete(void) |
2965 | { |
2966 | + /* |
2967 | + * Since DT doesn't provide an idiomatic mechanism for |
2968 | + * enabling full constraints and since it's much more natural |
2969 | + * with DT to provide them just assume that a DT enabled |
2970 | + * system has full constraints. |
2971 | + */ |
2972 | + if (of_have_populated_dt()) |
2973 | + has_full_constraints = true; |
2974 | + |
2975 | /* |
2976 | * Regulators may had failed to resolve their input supplies |
2977 | * when were registered, either because the input supply was |
2978 | @@ -4520,35 +4529,6 @@ static void regulator_init_complete_work_function(struct work_struct *work) |
2979 | */ |
2980 | class_for_each_device(®ulator_class, NULL, NULL, |
2981 | regulator_late_cleanup); |
2982 | -} |
2983 | - |
2984 | -static DECLARE_DELAYED_WORK(regulator_init_complete_work, |
2985 | - regulator_init_complete_work_function); |
2986 | - |
2987 | -static int __init regulator_init_complete(void) |
2988 | -{ |
2989 | - /* |
2990 | - * Since DT doesn't provide an idiomatic mechanism for |
2991 | - * enabling full constraints and since it's much more natural |
2992 | - * with DT to provide them just assume that a DT enabled |
2993 | - * system has full constraints. |
2994 | - */ |
2995 | - if (of_have_populated_dt()) |
2996 | - has_full_constraints = true; |
2997 | - |
2998 | - /* |
2999 | - * We punt completion for an arbitrary amount of time since |
3000 | - * systems like distros will load many drivers from userspace |
3001 | - * so consumers might not always be ready yet, this is |
3002 | - * particularly an issue with laptops where this might bounce |
3003 | - * the display off then on. Ideally we'd get a notification |
3004 | - * from userspace when this happens but we don't so just wait |
3005 | - * a bit and hope we waited long enough. It'd be better if |
3006 | - * we'd only do this on systems that need it, and a kernel |
3007 | - * command line option might be useful. |
3008 | - */ |
3009 | - schedule_delayed_work(®ulator_init_complete_work, |
3010 | - msecs_to_jiffies(30000)); |
3011 | |
3012 | return 0; |
3013 | } |
3014 | diff --git a/drivers/rtc/rtc-max8997.c b/drivers/rtc/rtc-max8997.c |
3015 | index db984d4bf952..4cce5bd448f6 100644 |
3016 | --- a/drivers/rtc/rtc-max8997.c |
3017 | +++ b/drivers/rtc/rtc-max8997.c |
3018 | @@ -221,7 +221,7 @@ static int max8997_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
3019 | |
3020 | out: |
3021 | mutex_unlock(&info->lock); |
3022 | - return 0; |
3023 | + return ret; |
3024 | } |
3025 | |
3026 | static int max8997_rtc_stop_alarm(struct max8997_rtc_info *info) |
3027 | diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c |
3028 | index b6caad0fee24..c53ea0ac5f46 100644 |
3029 | --- a/drivers/s390/scsi/zfcp_dbf.c |
3030 | +++ b/drivers/s390/scsi/zfcp_dbf.c |
3031 | @@ -93,11 +93,9 @@ void zfcp_dbf_hba_fsf_res(char *tag, int level, struct zfcp_fsf_req *req) |
3032 | memcpy(rec->u.res.fsf_status_qual, &q_head->fsf_status_qual, |
3033 | FSF_STATUS_QUALIFIER_SIZE); |
3034 | |
3035 | - if (req->fsf_command != FSF_QTCB_FCP_CMND) { |
3036 | - rec->pl_len = q_head->log_length; |
3037 | - zfcp_dbf_pl_write(dbf, (char *)q_pref + q_head->log_start, |
3038 | - rec->pl_len, "fsf_res", req->req_id); |
3039 | - } |
3040 | + rec->pl_len = q_head->log_length; |
3041 | + zfcp_dbf_pl_write(dbf, (char *)q_pref + q_head->log_start, |
3042 | + rec->pl_len, "fsf_res", req->req_id); |
3043 | |
3044 | debug_event(dbf->hba, level, rec, sizeof(*rec)); |
3045 | spin_unlock_irqrestore(&dbf->hba_lock, flags); |
3046 | diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c |
3047 | index cc62d8cc8cfd..d5214c4eb9dd 100644 |
3048 | --- a/drivers/s390/scsi/zfcp_erp.c |
3049 | +++ b/drivers/s390/scsi/zfcp_erp.c |
3050 | @@ -178,9 +178,6 @@ static int zfcp_erp_handle_failed(int want, struct zfcp_adapter *adapter, |
3051 | adapter, ZFCP_STATUS_COMMON_ERP_FAILED); |
3052 | } |
3053 | break; |
3054 | - default: |
3055 | - need = 0; |
3056 | - break; |
3057 | } |
3058 | |
3059 | return need; |
3060 | diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c |
3061 | index 2ffe10453e30..c4336b01db23 100644 |
3062 | --- a/drivers/scsi/libiscsi.c |
3063 | +++ b/drivers/scsi/libiscsi.c |
3064 | @@ -1982,7 +1982,7 @@ static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) |
3065 | |
3066 | ISCSI_DBG_EH(session, "scsi cmd %p timedout\n", sc); |
3067 | |
3068 | - spin_lock(&session->frwd_lock); |
3069 | + spin_lock_bh(&session->frwd_lock); |
3070 | task = (struct iscsi_task *)sc->SCp.ptr; |
3071 | if (!task) { |
3072 | /* |
3073 | @@ -2109,7 +2109,7 @@ static enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) |
3074 | done: |
3075 | if (task) |
3076 | task->last_timeout = jiffies; |
3077 | - spin_unlock(&session->frwd_lock); |
3078 | + spin_unlock_bh(&session->frwd_lock); |
3079 | ISCSI_DBG_EH(session, "return %s\n", rc == BLK_EH_RESET_TIMER ? |
3080 | "timer reset" : "shutdown or nh"); |
3081 | return rc; |
3082 | diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h |
3083 | index b484859464f6..f0f6d71d28b8 100644 |
3084 | --- a/drivers/scsi/lpfc/lpfc.h |
3085 | +++ b/drivers/scsi/lpfc/lpfc.h |
3086 | @@ -878,7 +878,8 @@ struct lpfc_hba { |
3087 | struct list_head port_list; |
3088 | struct lpfc_vport *pport; /* physical lpfc_vport pointer */ |
3089 | uint16_t max_vpi; /* Maximum virtual nports */ |
3090 | -#define LPFC_MAX_VPI 0xFFFF /* Max number of VPI supported */ |
3091 | +#define LPFC_MAX_VPI 0xFF /* Max number VPI supported 0 - 0xff */ |
3092 | +#define LPFC_MAX_VPORTS 0x100 /* Max vports per port, with pport */ |
3093 | uint16_t max_vports; /* |
3094 | * For IOV HBAs max_vpi can change |
3095 | * after a reset. max_vports is max |
3096 | diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c |
3097 | index cf15b9754402..aa0435b1ea1e 100644 |
3098 | --- a/drivers/scsi/lpfc/lpfc_attr.c |
3099 | +++ b/drivers/scsi/lpfc/lpfc_attr.c |
3100 | @@ -1214,6 +1214,9 @@ lpfc_get_hba_info(struct lpfc_hba *phba, |
3101 | max_vpi = (bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config) > 0) ? |
3102 | (bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config) - 1) : 0; |
3103 | |
3104 | + /* Limit the max we support */ |
3105 | + if (max_vpi > LPFC_MAX_VPI) |
3106 | + max_vpi = LPFC_MAX_VPI; |
3107 | if (mvpi) |
3108 | *mvpi = max_vpi; |
3109 | if (avpi) |
3110 | @@ -1229,8 +1232,13 @@ lpfc_get_hba_info(struct lpfc_hba *phba, |
3111 | *axri = pmb->un.varRdConfig.avail_xri; |
3112 | if (mvpi) |
3113 | *mvpi = pmb->un.varRdConfig.max_vpi; |
3114 | - if (avpi) |
3115 | - *avpi = pmb->un.varRdConfig.avail_vpi; |
3116 | + if (avpi) { |
3117 | + /* avail_vpi is only valid if link is up and ready */ |
3118 | + if (phba->link_state == LPFC_HBA_READY) |
3119 | + *avpi = pmb->un.varRdConfig.avail_vpi; |
3120 | + else |
3121 | + *avpi = pmb->un.varRdConfig.max_vpi; |
3122 | + } |
3123 | } |
3124 | |
3125 | mempool_free(pmboxq, phba->mbox_mem_pool); |
3126 | diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
3127 | index 2f80b2c0409e..8c640bcf107b 100644 |
3128 | --- a/drivers/scsi/lpfc/lpfc_init.c |
3129 | +++ b/drivers/scsi/lpfc/lpfc_init.c |
3130 | @@ -6973,6 +6973,9 @@ lpfc_sli4_read_config(struct lpfc_hba *phba) |
3131 | bf_get(lpfc_mbx_rd_conf_xri_base, rd_config); |
3132 | phba->sli4_hba.max_cfg_param.max_vpi = |
3133 | bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config); |
3134 | + /* Limit the max we support */ |
3135 | + if (phba->sli4_hba.max_cfg_param.max_vpi > LPFC_MAX_VPORTS) |
3136 | + phba->sli4_hba.max_cfg_param.max_vpi = LPFC_MAX_VPORTS; |
3137 | phba->sli4_hba.max_cfg_param.vpi_base = |
3138 | bf_get(lpfc_mbx_rd_conf_vpi_base, rd_config); |
3139 | phba->sli4_hba.max_cfg_param.max_rpi = |
3140 | diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c |
3141 | index 5c3dfd92ea02..33f4181ba9f7 100644 |
3142 | --- a/drivers/scsi/qla2xxx/qla_attr.c |
3143 | +++ b/drivers/scsi/qla2xxx/qla_attr.c |
3144 | @@ -682,7 +682,8 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, |
3145 | break; |
3146 | } else { |
3147 | /* Make sure FC side is not in reset */ |
3148 | - qla2x00_wait_for_hba_online(vha); |
3149 | + WARN_ON_ONCE(qla2x00_wait_for_hba_online(vha) != |
3150 | + QLA_SUCCESS); |
3151 | |
3152 | /* Issue MPI reset */ |
3153 | scsi_block_requests(vha->host); |
3154 | diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c |
3155 | index 33e4dceb895f..09f7a8cfed4d 100644 |
3156 | --- a/drivers/scsi/qla2xxx/qla_bsg.c |
3157 | +++ b/drivers/scsi/qla2xxx/qla_bsg.c |
3158 | @@ -336,6 +336,8 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) |
3159 | dma_map_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, |
3160 | bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); |
3161 | if (!req_sg_cnt) { |
3162 | + dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list, |
3163 | + bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE); |
3164 | rval = -ENOMEM; |
3165 | goto done_free_fcport; |
3166 | } |
3167 | @@ -343,6 +345,8 @@ qla2x00_process_els(struct fc_bsg_job *bsg_job) |
3168 | rsp_sg_cnt = dma_map_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, |
3169 | bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); |
3170 | if (!rsp_sg_cnt) { |
3171 | + dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list, |
3172 | + bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE); |
3173 | rval = -ENOMEM; |
3174 | goto done_free_fcport; |
3175 | } |
3176 | @@ -1740,8 +1744,8 @@ qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job) |
3177 | uint16_t nextlid = 0; |
3178 | uint32_t tot_dsds; |
3179 | srb_t *sp = NULL; |
3180 | - uint32_t req_data_len = 0; |
3181 | - uint32_t rsp_data_len = 0; |
3182 | + uint32_t req_data_len; |
3183 | + uint32_t rsp_data_len; |
3184 | |
3185 | /* Check the type of the adapter */ |
3186 | if (!IS_BIDI_CAPABLE(ha)) { |
3187 | @@ -1846,6 +1850,9 @@ qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job) |
3188 | goto done_unmap_sg; |
3189 | } |
3190 | |
3191 | + req_data_len = bsg_job->request_payload.payload_len; |
3192 | + rsp_data_len = bsg_job->reply_payload.payload_len; |
3193 | + |
3194 | if (req_data_len != rsp_data_len) { |
3195 | rval = EXT_STATUS_BUSY; |
3196 | ql_log(ql_log_warn, vha, 0x70aa, |
3197 | @@ -1853,10 +1860,6 @@ qla24xx_process_bidir_cmd(struct fc_bsg_job *bsg_job) |
3198 | goto done_unmap_sg; |
3199 | } |
3200 | |
3201 | - req_data_len = bsg_job->request_payload.payload_len; |
3202 | - rsp_data_len = bsg_job->reply_payload.payload_len; |
3203 | - |
3204 | - |
3205 | /* Alloc SRB structure */ |
3206 | sp = qla2x00_get_sp(vha, &(vha->bidir_fcport), GFP_KERNEL); |
3207 | if (!sp) { |
3208 | diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
3209 | index d13e91e16425..b889caa556a0 100644 |
3210 | --- a/drivers/scsi/qla2xxx/qla_target.c |
3211 | +++ b/drivers/scsi/qla2xxx/qla_target.c |
3212 | @@ -5893,7 +5893,6 @@ static void qlt_abort_work(struct qla_tgt *tgt, |
3213 | struct qla_hw_data *ha = vha->hw; |
3214 | struct qla_tgt_sess *sess = NULL; |
3215 | unsigned long flags = 0, flags2 = 0; |
3216 | - uint32_t be_s_id; |
3217 | uint8_t s_id[3]; |
3218 | int rc; |
3219 | |
3220 | @@ -5906,8 +5905,7 @@ static void qlt_abort_work(struct qla_tgt *tgt, |
3221 | s_id[1] = prm->abts.fcp_hdr_le.s_id[1]; |
3222 | s_id[2] = prm->abts.fcp_hdr_le.s_id[0]; |
3223 | |
3224 | - sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, |
3225 | - (unsigned char *)&be_s_id); |
3226 | + sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, s_id); |
3227 | if (!sess) { |
3228 | spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); |
3229 | |
3230 | @@ -6343,7 +6341,8 @@ qlt_enable_vha(struct scsi_qla_host *vha) |
3231 | |
3232 | set_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags); |
3233 | qla2xxx_wake_dpc(base_vha); |
3234 | - qla2x00_wait_for_hba_online(base_vha); |
3235 | + WARN_ON_ONCE(qla2x00_wait_for_hba_online(base_vha) != |
3236 | + QLA_SUCCESS); |
3237 | } |
3238 | } |
3239 | EXPORT_SYMBOL(qlt_enable_vha); |
3240 | @@ -6373,7 +6372,9 @@ static void qlt_disable_vha(struct scsi_qla_host *vha) |
3241 | |
3242 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
3243 | qla2xxx_wake_dpc(vha); |
3244 | - qla2x00_wait_for_hba_online(vha); |
3245 | + if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) |
3246 | + ql_dbg(ql_dbg_tgt, vha, 0xe081, |
3247 | + "qla2x00_wait_for_hba_online() failed\n"); |
3248 | } |
3249 | |
3250 | /* |
3251 | diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c |
3252 | index 44be6b593b30..691c04b3e5b6 100644 |
3253 | --- a/drivers/spi/spi-atmel.c |
3254 | +++ b/drivers/spi/spi-atmel.c |
3255 | @@ -1209,10 +1209,8 @@ static int atmel_spi_setup(struct spi_device *spi) |
3256 | as = spi_master_get_devdata(spi->master); |
3257 | |
3258 | /* see notes above re chipselect */ |
3259 | - if (!atmel_spi_is_v2(as) |
3260 | - && spi->chip_select == 0 |
3261 | - && (spi->mode & SPI_CS_HIGH)) { |
3262 | - dev_dbg(&spi->dev, "setup: can't be active-high\n"); |
3263 | + if (!as->use_cs_gpios && (spi->mode & SPI_CS_HIGH)) { |
3264 | + dev_warn(&spi->dev, "setup: non GPIO CS can't be active-high\n"); |
3265 | return -EINVAL; |
3266 | } |
3267 | |
3268 | diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c |
3269 | index 0ccf192b9a03..5950225e45d1 100644 |
3270 | --- a/drivers/staging/iio/addac/adt7316-i2c.c |
3271 | +++ b/drivers/staging/iio/addac/adt7316-i2c.c |
3272 | @@ -35,6 +35,8 @@ static int adt7316_i2c_read(void *client, u8 reg, u8 *data) |
3273 | return ret; |
3274 | } |
3275 | |
3276 | + *data = ret; |
3277 | + |
3278 | return 0; |
3279 | } |
3280 | |
3281 | diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c |
3282 | index 1732c3857b8e..2785cc03c529 100644 |
3283 | --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c |
3284 | +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c |
3285 | @@ -580,7 +580,7 @@ unlock: |
3286 | else |
3287 | pulse8->config_pending = true; |
3288 | mutex_unlock(&pulse8->config_lock); |
3289 | - return err; |
3290 | + return log_addr == CEC_LOG_ADDR_INVALID ? 0 : err; |
3291 | } |
3292 | |
3293 | static int pulse8_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, |
3294 | diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
3295 | index d4a7d740fc62..bfcf9e55f3c6 100644 |
3296 | --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
3297 | +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c |
3298 | @@ -78,7 +78,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) |
3299 | phost_conf = pusbd->actconfig; |
3300 | pconf_desc = &phost_conf->desc; |
3301 | |
3302 | - phost_iface = &usb_intf->altsetting[0]; |
3303 | + phost_iface = usb_intf->cur_altsetting; |
3304 | piface_desc = &phost_iface->desc; |
3305 | |
3306 | pdvobjpriv->NumInterfaces = pconf_desc->bNumInterfaces; |
3307 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c |
3308 | index 897d4621a5ce..d0ba42dfafeb 100644 |
3309 | --- a/drivers/staging/rtl8712/usb_intf.c |
3310 | +++ b/drivers/staging/rtl8712/usb_intf.c |
3311 | @@ -275,7 +275,7 @@ static uint r8712_usb_dvobj_init(struct _adapter *padapter) |
3312 | |
3313 | pdvobjpriv->padapter = padapter; |
3314 | padapter->EepromAddressSize = 6; |
3315 | - phost_iface = &pintf->altsetting[0]; |
3316 | + phost_iface = pintf->cur_altsetting; |
3317 | piface_desc = &phost_iface->desc; |
3318 | pdvobjpriv->nr_endpoint = piface_desc->bNumEndpoints; |
3319 | if (pusbd->speed == USB_SPEED_HIGH) { |
3320 | diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c |
3321 | index 57603be42c50..90c033b4ec98 100644 |
3322 | --- a/drivers/thermal/thermal_core.c |
3323 | +++ b/drivers/thermal/thermal_core.c |
3324 | @@ -402,7 +402,7 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, |
3325 | mod_delayed_work(system_freezable_wq, &tz->poll_queue, |
3326 | msecs_to_jiffies(delay)); |
3327 | else |
3328 | - cancel_delayed_work_sync(&tz->poll_queue); |
3329 | + cancel_delayed_work(&tz->poll_queue); |
3330 | } |
3331 | |
3332 | static void monitor_thermal_zone(struct thermal_zone_device *tz) |
3333 | @@ -2073,7 +2073,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) |
3334 | |
3335 | mutex_unlock(&thermal_list_lock); |
3336 | |
3337 | - thermal_zone_device_set_polling(tz, 0); |
3338 | + cancel_delayed_work_sync(&tz->poll_queue); |
3339 | |
3340 | if (tz->type[0]) |
3341 | device_remove_file(&tz->device, &dev_attr_type); |
3342 | diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c |
3343 | index 8d6253903f24..0c12dec110bc 100644 |
3344 | --- a/drivers/tty/n_hdlc.c |
3345 | +++ b/drivers/tty/n_hdlc.c |
3346 | @@ -614,7 +614,7 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, |
3347 | } |
3348 | |
3349 | /* no data */ |
3350 | - if (file->f_flags & O_NONBLOCK) { |
3351 | + if (tty_io_nonblock(tty, file)) { |
3352 | ret = -EAGAIN; |
3353 | break; |
3354 | } |
3355 | @@ -681,7 +681,7 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, |
3356 | if (tbuf) |
3357 | break; |
3358 | |
3359 | - if (file->f_flags & O_NONBLOCK) { |
3360 | + if (tty_io_nonblock(tty, file)) { |
3361 | error = -EAGAIN; |
3362 | break; |
3363 | } |
3364 | diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c |
3365 | index 345111467b85..ee0e07b4a13d 100644 |
3366 | --- a/drivers/tty/n_r3964.c |
3367 | +++ b/drivers/tty/n_r3964.c |
3368 | @@ -1080,7 +1080,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file, |
3369 | pMsg = remove_msg(pInfo, pClient); |
3370 | if (pMsg == NULL) { |
3371 | /* no messages available. */ |
3372 | - if (file->f_flags & O_NONBLOCK) { |
3373 | + if (tty_io_nonblock(tty, file)) { |
3374 | ret = -EAGAIN; |
3375 | goto unlock; |
3376 | } |
3377 | diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c |
3378 | index 904fc9c37fde..8214b0326b3a 100644 |
3379 | --- a/drivers/tty/n_tty.c |
3380 | +++ b/drivers/tty/n_tty.c |
3381 | @@ -1704,7 +1704,7 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, |
3382 | |
3383 | down_read(&tty->termios_rwsem); |
3384 | |
3385 | - while (1) { |
3386 | + do { |
3387 | /* |
3388 | * When PARMRK is set, each input char may take up to 3 chars |
3389 | * in the read buf; reduce the buffer space avail by 3x |
3390 | @@ -1746,7 +1746,7 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, |
3391 | fp += n; |
3392 | count -= n; |
3393 | rcvd += n; |
3394 | - } |
3395 | + } while (!test_bit(TTY_LDISC_CHANGING, &tty->flags)); |
3396 | |
3397 | tty->receive_room = room; |
3398 | |
3399 | @@ -2213,7 +2213,7 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, |
3400 | break; |
3401 | if (!timeout) |
3402 | break; |
3403 | - if (file->f_flags & O_NONBLOCK) { |
3404 | + if (tty_io_nonblock(tty, file)) { |
3405 | retval = -EAGAIN; |
3406 | break; |
3407 | } |
3408 | @@ -2367,7 +2367,7 @@ static ssize_t n_tty_write(struct tty_struct *tty, struct file *file, |
3409 | } |
3410 | if (!nr) |
3411 | break; |
3412 | - if (file->f_flags & O_NONBLOCK) { |
3413 | + if (tty_io_nonblock(tty, file)) { |
3414 | retval = -EAGAIN; |
3415 | break; |
3416 | } |
3417 | diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c |
3418 | index 2d8089fc2139..f6586a8681b9 100644 |
3419 | --- a/drivers/tty/serial/amba-pl011.c |
3420 | +++ b/drivers/tty/serial/amba-pl011.c |
3421 | @@ -811,10 +811,8 @@ __acquires(&uap->port.lock) |
3422 | if (!uap->using_tx_dma) |
3423 | return; |
3424 | |
3425 | - /* Avoid deadlock with the DMA engine callback */ |
3426 | - spin_unlock(&uap->port.lock); |
3427 | - dmaengine_terminate_all(uap->dmatx.chan); |
3428 | - spin_lock(&uap->port.lock); |
3429 | + dmaengine_terminate_async(uap->dmatx.chan); |
3430 | + |
3431 | if (uap->dmatx.queued) { |
3432 | dma_unmap_sg(uap->dmatx.chan->device->dev, &uap->dmatx.sg, 1, |
3433 | DMA_TO_DEVICE); |
3434 | diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c |
3435 | index 800996522fdc..5b6093dc3ff2 100644 |
3436 | --- a/drivers/tty/serial/fsl_lpuart.c |
3437 | +++ b/drivers/tty/serial/fsl_lpuart.c |
3438 | @@ -346,8 +346,8 @@ static void lpuart_dma_tx(struct lpuart_port *sport) |
3439 | } |
3440 | |
3441 | sport->dma_tx_desc = dmaengine_prep_slave_sg(sport->dma_tx_chan, sgl, |
3442 | - sport->dma_tx_nents, |
3443 | - DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); |
3444 | + ret, DMA_MEM_TO_DEV, |
3445 | + DMA_PREP_INTERRUPT); |
3446 | if (!sport->dma_tx_desc) { |
3447 | dma_unmap_sg(dev, sgl, sport->dma_tx_nents, DMA_TO_DEVICE); |
3448 | dev_err(dev, "Cannot prepare TX slave DMA!\n"); |
3449 | diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c |
3450 | index 91d2ddd6ef88..180b77334fdd 100644 |
3451 | --- a/drivers/tty/serial/ifx6x60.c |
3452 | +++ b/drivers/tty/serial/ifx6x60.c |
3453 | @@ -1244,6 +1244,9 @@ static int ifx_spi_spi_remove(struct spi_device *spi) |
3454 | struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); |
3455 | /* stop activity */ |
3456 | tasklet_kill(&ifx_dev->io_work_tasklet); |
3457 | + |
3458 | + pm_runtime_disable(&spi->dev); |
3459 | + |
3460 | /* free irq */ |
3461 | free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), ifx_dev); |
3462 | free_irq(gpio_to_irq(ifx_dev->gpio.srdy), ifx_dev); |
3463 | diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c |
3464 | index 0d82be145c68..6d596c635159 100644 |
3465 | --- a/drivers/tty/serial/imx.c |
3466 | +++ b/drivers/tty/serial/imx.c |
3467 | @@ -1943,7 +1943,7 @@ imx_console_setup(struct console *co, char *options) |
3468 | |
3469 | retval = clk_prepare(sport->clk_per); |
3470 | if (retval) |
3471 | - clk_disable_unprepare(sport->clk_ipg); |
3472 | + clk_unprepare(sport->clk_ipg); |
3473 | |
3474 | error_console: |
3475 | return retval; |
3476 | diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c |
3477 | index 9027455c6be1..2ed219c837c9 100644 |
3478 | --- a/drivers/tty/serial/msm_serial.c |
3479 | +++ b/drivers/tty/serial/msm_serial.c |
3480 | @@ -988,6 +988,7 @@ static unsigned int msm_get_mctrl(struct uart_port *port) |
3481 | static void msm_reset(struct uart_port *port) |
3482 | { |
3483 | struct msm_port *msm_port = UART_TO_MSM(port); |
3484 | + unsigned int mr; |
3485 | |
3486 | /* reset everything */ |
3487 | msm_write(port, UART_CR_CMD_RESET_RX, UART_CR); |
3488 | @@ -995,7 +996,10 @@ static void msm_reset(struct uart_port *port) |
3489 | msm_write(port, UART_CR_CMD_RESET_ERR, UART_CR); |
3490 | msm_write(port, UART_CR_CMD_RESET_BREAK_INT, UART_CR); |
3491 | msm_write(port, UART_CR_CMD_RESET_CTS, UART_CR); |
3492 | - msm_write(port, UART_CR_CMD_SET_RFR, UART_CR); |
3493 | + msm_write(port, UART_CR_CMD_RESET_RFR, UART_CR); |
3494 | + mr = msm_read(port, UART_MR1); |
3495 | + mr &= ~UART_MR1_RX_RDY_CTL; |
3496 | + msm_write(port, mr, UART_MR1); |
3497 | |
3498 | /* Disable DM modes */ |
3499 | if (msm_port->is_uartdm) |
3500 | diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
3501 | index 04c023f7f633..ae118e68b406 100644 |
3502 | --- a/drivers/tty/serial/serial_core.c |
3503 | +++ b/drivers/tty/serial/serial_core.c |
3504 | @@ -1106,7 +1106,7 @@ static int uart_break_ctl(struct tty_struct *tty, int break_state) |
3505 | if (!uport) |
3506 | goto out; |
3507 | |
3508 | - if (uport->type != PORT_UNKNOWN) |
3509 | + if (uport->type != PORT_UNKNOWN && uport->ops->break_ctl) |
3510 | uport->ops->break_ctl(uport, break_state); |
3511 | ret = 0; |
3512 | out: |
3513 | diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c |
3514 | index 3eb3f2a03bbb..706faca834f2 100644 |
3515 | --- a/drivers/tty/tty_ldisc.c |
3516 | +++ b/drivers/tty/tty_ldisc.c |
3517 | @@ -348,6 +348,11 @@ int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout) |
3518 | { |
3519 | int ret; |
3520 | |
3521 | + /* Kindly asking blocked readers to release the read side */ |
3522 | + set_bit(TTY_LDISC_CHANGING, &tty->flags); |
3523 | + wake_up_interruptible_all(&tty->read_wait); |
3524 | + wake_up_interruptible_all(&tty->write_wait); |
3525 | + |
3526 | ret = __tty_ldisc_lock(tty, timeout); |
3527 | if (!ret) |
3528 | return -EBUSY; |
3529 | @@ -358,6 +363,8 @@ int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout) |
3530 | void tty_ldisc_unlock(struct tty_struct *tty) |
3531 | { |
3532 | clear_bit(TTY_LDISC_HALTED, &tty->flags); |
3533 | + /* Can be cleared here - ldisc_unlock will wake up writers firstly */ |
3534 | + clear_bit(TTY_LDISC_CHANGING, &tty->flags); |
3535 | __tty_ldisc_unlock(tty); |
3536 | } |
3537 | |
3538 | diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c |
3539 | index e8a917a23ed9..b4e7a7317713 100644 |
3540 | --- a/drivers/tty/vt/keyboard.c |
3541 | +++ b/drivers/tty/vt/keyboard.c |
3542 | @@ -1460,7 +1460,7 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type, |
3543 | |
3544 | if (event_type == EV_MSC && event_code == MSC_RAW && HW_RAW(handle->dev)) |
3545 | kbd_rawcode(value); |
3546 | - if (event_type == EV_KEY) |
3547 | + if (event_type == EV_KEY && event_code <= KEY_MAX) |
3548 | kbd_keycode(event_code, value, HW_RAW(handle->dev)); |
3549 | |
3550 | spin_unlock(&kbd_event_lock); |
3551 | diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c |
3552 | index df67815f74e6..127fcaf13856 100644 |
3553 | --- a/drivers/usb/atm/ueagle-atm.c |
3554 | +++ b/drivers/usb/atm/ueagle-atm.c |
3555 | @@ -2167,10 +2167,11 @@ resubmit: |
3556 | /* |
3557 | * Start the modem : init the data and start kernel thread |
3558 | */ |
3559 | -static int uea_boot(struct uea_softc *sc) |
3560 | +static int uea_boot(struct uea_softc *sc, struct usb_interface *intf) |
3561 | { |
3562 | - int ret, size; |
3563 | struct intr_pkt *intr; |
3564 | + int ret = -ENOMEM; |
3565 | + int size; |
3566 | |
3567 | uea_enters(INS_TO_USBDEV(sc)); |
3568 | |
3569 | @@ -2195,6 +2196,11 @@ static int uea_boot(struct uea_softc *sc) |
3570 | if (UEA_CHIP_VERSION(sc) == ADI930) |
3571 | load_XILINX_firmware(sc); |
3572 | |
3573 | + if (intf->cur_altsetting->desc.bNumEndpoints < 1) { |
3574 | + ret = -ENODEV; |
3575 | + goto err0; |
3576 | + } |
3577 | + |
3578 | intr = kmalloc(size, GFP_KERNEL); |
3579 | if (!intr) |
3580 | goto err0; |
3581 | @@ -2206,8 +2212,7 @@ static int uea_boot(struct uea_softc *sc) |
3582 | usb_fill_int_urb(sc->urb_int, sc->usb_dev, |
3583 | usb_rcvintpipe(sc->usb_dev, UEA_INTR_PIPE), |
3584 | intr, size, uea_intr, sc, |
3585 | - sc->usb_dev->actconfig->interface[0]->altsetting[0]. |
3586 | - endpoint[0].desc.bInterval); |
3587 | + intf->cur_altsetting->endpoint[0].desc.bInterval); |
3588 | |
3589 | ret = usb_submit_urb(sc->urb_int, GFP_KERNEL); |
3590 | if (ret < 0) { |
3591 | @@ -2222,6 +2227,7 @@ static int uea_boot(struct uea_softc *sc) |
3592 | sc->kthread = kthread_create(uea_kthread, sc, "ueagle-atm"); |
3593 | if (IS_ERR(sc->kthread)) { |
3594 | uea_err(INS_TO_USBDEV(sc), "failed to create thread\n"); |
3595 | + ret = PTR_ERR(sc->kthread); |
3596 | goto err2; |
3597 | } |
3598 | |
3599 | @@ -2236,7 +2242,7 @@ err1: |
3600 | kfree(intr); |
3601 | err0: |
3602 | uea_leaves(INS_TO_USBDEV(sc)); |
3603 | - return -ENOMEM; |
3604 | + return ret; |
3605 | } |
3606 | |
3607 | /* |
3608 | @@ -2597,7 +2603,7 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, |
3609 | if (ret < 0) |
3610 | goto error; |
3611 | |
3612 | - ret = uea_boot(sc); |
3613 | + ret = uea_boot(sc, intf); |
3614 | if (ret < 0) |
3615 | goto error_rm_grp; |
3616 | |
3617 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
3618 | index 4a87cc478340..acf4752302a6 100644 |
3619 | --- a/drivers/usb/core/hub.c |
3620 | +++ b/drivers/usb/core/hub.c |
3621 | @@ -5620,7 +5620,7 @@ re_enumerate_no_bos: |
3622 | |
3623 | /** |
3624 | * usb_reset_device - warn interface drivers and perform a USB port reset |
3625 | - * @udev: device to reset (not in SUSPENDED or NOTATTACHED state) |
3626 | + * @udev: device to reset (not in NOTATTACHED state) |
3627 | * |
3628 | * Warns all drivers bound to registered interfaces (using their pre_reset |
3629 | * method), performs the port reset, and then lets the drivers know that |
3630 | @@ -5648,8 +5648,7 @@ int usb_reset_device(struct usb_device *udev) |
3631 | struct usb_host_config *config = udev->actconfig; |
3632 | struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent); |
3633 | |
3634 | - if (udev->state == USB_STATE_NOTATTACHED || |
3635 | - udev->state == USB_STATE_SUSPENDED) { |
3636 | + if (udev->state == USB_STATE_NOTATTACHED) { |
3637 | dev_dbg(&udev->dev, "device reset not allowed in state %d\n", |
3638 | udev->state); |
3639 | return -EINVAL; |
3640 | diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c |
3641 | index 5133ab965229..7b81bcfa19cb 100644 |
3642 | --- a/drivers/usb/core/urb.c |
3643 | +++ b/drivers/usb/core/urb.c |
3644 | @@ -40,6 +40,7 @@ void usb_init_urb(struct urb *urb) |
3645 | if (urb) { |
3646 | memset(urb, 0, sizeof(*urb)); |
3647 | kref_init(&urb->kref); |
3648 | + INIT_LIST_HEAD(&urb->urb_list); |
3649 | INIT_LIST_HEAD(&urb->anchor_list); |
3650 | } |
3651 | } |
3652 | diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
3653 | index 7154a93f0114..30bc5996a2f2 100644 |
3654 | --- a/drivers/usb/dwc3/core.c |
3655 | +++ b/drivers/usb/dwc3/core.c |
3656 | @@ -1102,7 +1102,8 @@ static int dwc3_probe(struct platform_device *pdev) |
3657 | |
3658 | ret = dwc3_core_init(dwc); |
3659 | if (ret) { |
3660 | - dev_err(dev, "failed to initialize core\n"); |
3661 | + if (ret != -EPROBE_DEFER) |
3662 | + dev_err(dev, "failed to initialize core: %d\n", ret); |
3663 | goto err4; |
3664 | } |
3665 | |
3666 | diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c |
3667 | index b5315a47f0b9..3f1662b64bab 100644 |
3668 | --- a/drivers/usb/gadget/configfs.c |
3669 | +++ b/drivers/usb/gadget/configfs.c |
3670 | @@ -1541,6 +1541,7 @@ static struct config_group *gadgets_make( |
3671 | gi->composite.resume = NULL; |
3672 | gi->composite.max_speed = USB_SPEED_SUPER; |
3673 | |
3674 | + spin_lock_init(&gi->spinlock); |
3675 | mutex_init(&gi->lock); |
3676 | INIT_LIST_HEAD(&gi->string_list); |
3677 | INIT_LIST_HEAD(&gi->available_func); |
3678 | diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c |
3679 | index 2f151e0aa6da..510a54f88963 100644 |
3680 | --- a/drivers/usb/gadget/function/u_serial.c |
3681 | +++ b/drivers/usb/gadget/function/u_serial.c |
3682 | @@ -1391,8 +1391,10 @@ int gserial_alloc_line(unsigned char *line_num) |
3683 | __func__, port_num, PTR_ERR(tty_dev)); |
3684 | |
3685 | ret = PTR_ERR(tty_dev); |
3686 | + mutex_lock(&ports[port_num].lock); |
3687 | port = ports[port_num].port; |
3688 | ports[port_num].port = NULL; |
3689 | + mutex_unlock(&ports[port_num].lock); |
3690 | gserial_free_port(port); |
3691 | goto err; |
3692 | } |
3693 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
3694 | index 39e2d3271035..5cf5f3d9c1e5 100644 |
3695 | --- a/drivers/usb/host/xhci-hub.c |
3696 | +++ b/drivers/usb/host/xhci-hub.c |
3697 | @@ -728,7 +728,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, |
3698 | struct xhci_bus_state *bus_state, |
3699 | __le32 __iomem **port_array, |
3700 | u16 wIndex, u32 raw_port_status, |
3701 | - unsigned long flags) |
3702 | + unsigned long *flags) |
3703 | __releases(&xhci->lock) |
3704 | __acquires(&xhci->lock) |
3705 | { |
3706 | @@ -760,6 +760,14 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, |
3707 | status |= USB_PORT_STAT_C_BH_RESET << 16; |
3708 | if ((raw_port_status & PORT_CEC)) |
3709 | status |= USB_PORT_STAT_C_CONFIG_ERROR << 16; |
3710 | + |
3711 | + /* USB3 remote wake resume signaling completed */ |
3712 | + if (bus_state->port_remote_wakeup & (1 << wIndex) && |
3713 | + (raw_port_status & PORT_PLS_MASK) != XDEV_RESUME && |
3714 | + (raw_port_status & PORT_PLS_MASK) != XDEV_RECOVERY) { |
3715 | + bus_state->port_remote_wakeup &= ~(1 << wIndex); |
3716 | + usb_hcd_end_port_resume(&hcd->self, wIndex); |
3717 | + } |
3718 | } |
3719 | |
3720 | if (hcd->speed < HCD_USB3) { |
3721 | @@ -810,12 +818,12 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, |
3722 | xhci_set_link_state(xhci, port_array, wIndex, |
3723 | XDEV_U0); |
3724 | |
3725 | - spin_unlock_irqrestore(&xhci->lock, flags); |
3726 | + spin_unlock_irqrestore(&xhci->lock, *flags); |
3727 | time_left = wait_for_completion_timeout( |
3728 | &bus_state->rexit_done[wIndex], |
3729 | msecs_to_jiffies( |
3730 | XHCI_MAX_REXIT_TIMEOUT_MS)); |
3731 | - spin_lock_irqsave(&xhci->lock, flags); |
3732 | + spin_lock_irqsave(&xhci->lock, *flags); |
3733 | |
3734 | if (time_left) { |
3735 | slot_id = xhci_find_slot_id_by_port(hcd, |
3736 | @@ -961,7 +969,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
3737 | break; |
3738 | } |
3739 | status = xhci_get_port_status(hcd, bus_state, port_array, |
3740 | - wIndex, temp, flags); |
3741 | + wIndex, temp, &flags); |
3742 | if (status == 0xffffffff) |
3743 | goto error; |
3744 | |
3745 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
3746 | index 7199e400fbac..aad64a26a767 100644 |
3747 | --- a/drivers/usb/host/xhci-mem.c |
3748 | +++ b/drivers/usb/host/xhci-mem.c |
3749 | @@ -1940,10 +1940,14 @@ no_bw: |
3750 | kfree(xhci->port_array); |
3751 | kfree(xhci->rh_bw); |
3752 | kfree(xhci->ext_caps); |
3753 | + kfree(xhci->usb2_rhub.psi); |
3754 | + kfree(xhci->usb3_rhub.psi); |
3755 | |
3756 | xhci->usb2_ports = NULL; |
3757 | xhci->usb3_ports = NULL; |
3758 | xhci->port_array = NULL; |
3759 | + xhci->usb2_rhub.psi = NULL; |
3760 | + xhci->usb3_rhub.psi = NULL; |
3761 | xhci->rh_bw = NULL; |
3762 | xhci->ext_caps = NULL; |
3763 | |
3764 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
3765 | index b5140555a8d5..99bef8518fd2 100644 |
3766 | --- a/drivers/usb/host/xhci-pci.c |
3767 | +++ b/drivers/usb/host/xhci-pci.c |
3768 | @@ -470,6 +470,18 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) |
3769 | } |
3770 | #endif /* CONFIG_PM */ |
3771 | |
3772 | +static void xhci_pci_shutdown(struct usb_hcd *hcd) |
3773 | +{ |
3774 | + struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
3775 | + struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
3776 | + |
3777 | + xhci_shutdown(hcd); |
3778 | + |
3779 | + /* Yet another workaround for spurious wakeups at shutdown with HSW */ |
3780 | + if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) |
3781 | + pci_set_power_state(pdev, PCI_D3hot); |
3782 | +} |
3783 | + |
3784 | /*-------------------------------------------------------------------------*/ |
3785 | |
3786 | /* PCI driver selection metadata; PCI hotplugging uses this */ |
3787 | @@ -505,6 +517,7 @@ static int __init xhci_pci_init(void) |
3788 | #ifdef CONFIG_PM |
3789 | xhci_pci_hc_driver.pci_suspend = xhci_pci_suspend; |
3790 | xhci_pci_hc_driver.pci_resume = xhci_pci_resume; |
3791 | + xhci_pci_hc_driver.shutdown = xhci_pci_shutdown; |
3792 | #endif |
3793 | return pci_register_driver(&xhci_pci_driver); |
3794 | } |
3795 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
3796 | index 69ad9817076a..b426c83ecb9b 100644 |
3797 | --- a/drivers/usb/host/xhci-ring.c |
3798 | +++ b/drivers/usb/host/xhci-ring.c |
3799 | @@ -1609,9 +1609,6 @@ static void handle_port_status(struct xhci_hcd *xhci, |
3800 | usb_hcd_resume_root_hub(hcd); |
3801 | } |
3802 | |
3803 | - if (hcd->speed >= HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE) |
3804 | - bus_state->port_remote_wakeup &= ~(1 << faked_port_index); |
3805 | - |
3806 | if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) { |
3807 | xhci_dbg(xhci, "port resume event for port %d\n", port_id); |
3808 | |
3809 | @@ -1630,6 +1627,7 @@ static void handle_port_status(struct xhci_hcd *xhci, |
3810 | bus_state->port_remote_wakeup |= 1 << faked_port_index; |
3811 | xhci_test_and_clear_bit(xhci, port_array, |
3812 | faked_port_index, PORT_PLC); |
3813 | + usb_hcd_start_port_resume(&hcd->self, faked_port_index); |
3814 | xhci_set_link_state(xhci, port_array, faked_port_index, |
3815 | XDEV_U0); |
3816 | /* Need to wait until the next link state change |
3817 | @@ -1667,8 +1665,6 @@ static void handle_port_status(struct xhci_hcd *xhci, |
3818 | if (slot_id && xhci->devs[slot_id]) |
3819 | xhci_ring_device(xhci, slot_id); |
3820 | if (bus_state->port_remote_wakeup & (1 << faked_port_index)) { |
3821 | - bus_state->port_remote_wakeup &= |
3822 | - ~(1 << faked_port_index); |
3823 | xhci_test_and_clear_bit(xhci, port_array, |
3824 | faked_port_index, PORT_PLC); |
3825 | usb_wakeup_notification(hcd->self.root_hub, |
3826 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
3827 | index 755016729f12..baacc442ec6a 100644 |
3828 | --- a/drivers/usb/host/xhci.c |
3829 | +++ b/drivers/usb/host/xhci.c |
3830 | @@ -758,11 +758,8 @@ void xhci_shutdown(struct usb_hcd *hcd) |
3831 | xhci_dbg_trace(xhci, trace_xhci_dbg_init, |
3832 | "xhci_shutdown completed - status = %x", |
3833 | readl(&xhci->op_regs->status)); |
3834 | - |
3835 | - /* Yet another workaround for spurious wakeups at shutdown with HSW */ |
3836 | - if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) |
3837 | - pci_set_power_state(to_pci_dev(hcd->self.controller), PCI_D3hot); |
3838 | } |
3839 | +EXPORT_SYMBOL_GPL(xhci_shutdown); |
3840 | |
3841 | #ifdef CONFIG_PM |
3842 | static void xhci_save_registers(struct xhci_hcd *xhci) |
3843 | @@ -933,7 +930,7 @@ static bool xhci_pending_portevent(struct xhci_hcd *xhci) |
3844 | int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) |
3845 | { |
3846 | int rc = 0; |
3847 | - unsigned int delay = XHCI_MAX_HALT_USEC; |
3848 | + unsigned int delay = XHCI_MAX_HALT_USEC * 2; |
3849 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
3850 | u32 command; |
3851 | |
3852 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
3853 | index de4771ce0df6..2b603ef5c10c 100644 |
3854 | --- a/drivers/usb/host/xhci.h |
3855 | +++ b/drivers/usb/host/xhci.h |
3856 | @@ -316,6 +316,7 @@ struct xhci_op_regs { |
3857 | #define XDEV_U3 (0x3 << 5) |
3858 | #define XDEV_INACTIVE (0x6 << 5) |
3859 | #define XDEV_POLLING (0x7 << 5) |
3860 | +#define XDEV_RECOVERY (0x8 << 5) |
3861 | #define XDEV_COMP_MODE (0xa << 5) |
3862 | #define XDEV_RESUME (0xf << 5) |
3863 | /* true: port has power (see HCC_PPC) */ |
3864 | @@ -1865,6 +1866,7 @@ int xhci_run(struct usb_hcd *hcd); |
3865 | void xhci_stop(struct usb_hcd *hcd); |
3866 | void xhci_shutdown(struct usb_hcd *hcd); |
3867 | int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); |
3868 | +void xhci_shutdown(struct usb_hcd *hcd); |
3869 | void xhci_init_driver(struct hc_driver *drv, |
3870 | const struct xhci_driver_overrides *over); |
3871 | |
3872 | diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c |
3873 | index f0c071da68d1..7fb0590187d4 100644 |
3874 | --- a/drivers/usb/misc/adutux.c |
3875 | +++ b/drivers/usb/misc/adutux.c |
3876 | @@ -685,7 +685,7 @@ static int adu_probe(struct usb_interface *interface, |
3877 | init_waitqueue_head(&dev->read_wait); |
3878 | init_waitqueue_head(&dev->write_wait); |
3879 | |
3880 | - iface_desc = &interface->altsetting[0]; |
3881 | + iface_desc = &interface->cur_altsetting[0]; |
3882 | |
3883 | /* set up the endpoint information */ |
3884 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
3885 | diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c |
3886 | index 9a67ae39185b..9cf8a9b16336 100644 |
3887 | --- a/drivers/usb/misc/idmouse.c |
3888 | +++ b/drivers/usb/misc/idmouse.c |
3889 | @@ -342,7 +342,7 @@ static int idmouse_probe(struct usb_interface *interface, |
3890 | int result; |
3891 | |
3892 | /* check if we have gotten the data or the hid interface */ |
3893 | - iface_desc = &interface->altsetting[0]; |
3894 | + iface_desc = interface->cur_altsetting; |
3895 | if (iface_desc->desc.bInterfaceClass != 0x0A) |
3896 | return -ENODEV; |
3897 | |
3898 | diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c |
3899 | index 80b37d214beb..bd1a8dc285f5 100644 |
3900 | --- a/drivers/usb/mon/mon_bin.c |
3901 | +++ b/drivers/usb/mon/mon_bin.c |
3902 | @@ -1036,12 +1036,18 @@ static long mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg |
3903 | |
3904 | mutex_lock(&rp->fetch_lock); |
3905 | spin_lock_irqsave(&rp->b_lock, flags); |
3906 | - mon_free_buff(rp->b_vec, rp->b_size/CHUNK_SIZE); |
3907 | - kfree(rp->b_vec); |
3908 | - rp->b_vec = vec; |
3909 | - rp->b_size = size; |
3910 | - rp->b_read = rp->b_in = rp->b_out = rp->b_cnt = 0; |
3911 | - rp->cnt_lost = 0; |
3912 | + if (rp->mmap_active) { |
3913 | + mon_free_buff(vec, size/CHUNK_SIZE); |
3914 | + kfree(vec); |
3915 | + ret = -EBUSY; |
3916 | + } else { |
3917 | + mon_free_buff(rp->b_vec, rp->b_size/CHUNK_SIZE); |
3918 | + kfree(rp->b_vec); |
3919 | + rp->b_vec = vec; |
3920 | + rp->b_size = size; |
3921 | + rp->b_read = rp->b_in = rp->b_out = rp->b_cnt = 0; |
3922 | + rp->cnt_lost = 0; |
3923 | + } |
3924 | spin_unlock_irqrestore(&rp->b_lock, flags); |
3925 | mutex_unlock(&rp->fetch_lock); |
3926 | } |
3927 | @@ -1213,13 +1219,21 @@ mon_bin_poll(struct file *file, struct poll_table_struct *wait) |
3928 | static void mon_bin_vma_open(struct vm_area_struct *vma) |
3929 | { |
3930 | struct mon_reader_bin *rp = vma->vm_private_data; |
3931 | + unsigned long flags; |
3932 | + |
3933 | + spin_lock_irqsave(&rp->b_lock, flags); |
3934 | rp->mmap_active++; |
3935 | + spin_unlock_irqrestore(&rp->b_lock, flags); |
3936 | } |
3937 | |
3938 | static void mon_bin_vma_close(struct vm_area_struct *vma) |
3939 | { |
3940 | + unsigned long flags; |
3941 | + |
3942 | struct mon_reader_bin *rp = vma->vm_private_data; |
3943 | + spin_lock_irqsave(&rp->b_lock, flags); |
3944 | rp->mmap_active--; |
3945 | + spin_unlock_irqrestore(&rp->b_lock, flags); |
3946 | } |
3947 | |
3948 | /* |
3949 | @@ -1231,16 +1245,12 @@ static int mon_bin_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
3950 | unsigned long offset, chunk_idx; |
3951 | struct page *pageptr; |
3952 | |
3953 | - mutex_lock(&rp->fetch_lock); |
3954 | offset = vmf->pgoff << PAGE_SHIFT; |
3955 | - if (offset >= rp->b_size) { |
3956 | - mutex_unlock(&rp->fetch_lock); |
3957 | + if (offset >= rp->b_size) |
3958 | return VM_FAULT_SIGBUS; |
3959 | - } |
3960 | chunk_idx = offset / CHUNK_SIZE; |
3961 | pageptr = rp->b_vec[chunk_idx].pg; |
3962 | get_page(pageptr); |
3963 | - mutex_unlock(&rp->fetch_lock); |
3964 | vmf->page = pageptr; |
3965 | return 0; |
3966 | } |
3967 | diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c |
3968 | index de61271f2ba3..e5649adcc84c 100644 |
3969 | --- a/drivers/usb/serial/io_edgeport.c |
3970 | +++ b/drivers/usb/serial/io_edgeport.c |
3971 | @@ -2852,16 +2852,18 @@ static int edge_startup(struct usb_serial *serial) |
3972 | response = 0; |
3973 | |
3974 | if (edge_serial->is_epic) { |
3975 | + struct usb_host_interface *alt; |
3976 | + |
3977 | + alt = serial->interface->cur_altsetting; |
3978 | + |
3979 | /* EPIC thing, set up our interrupt polling now and our read |
3980 | * urb, so that the device knows it really is connected. */ |
3981 | interrupt_in_found = bulk_in_found = bulk_out_found = false; |
3982 | - for (i = 0; i < serial->interface->altsetting[0] |
3983 | - .desc.bNumEndpoints; ++i) { |
3984 | + for (i = 0; i < alt->desc.bNumEndpoints; ++i) { |
3985 | struct usb_endpoint_descriptor *endpoint; |
3986 | int buffer_size; |
3987 | |
3988 | - endpoint = &serial->interface->altsetting[0]. |
3989 | - endpoint[i].desc; |
3990 | + endpoint = &alt->endpoint[i].desc; |
3991 | buffer_size = usb_endpoint_maxp(endpoint); |
3992 | if (!interrupt_in_found && |
3993 | (usb_endpoint_is_int_in(endpoint))) { |
3994 | diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
3995 | index 597bc550034f..a6999042e7ad 100644 |
3996 | --- a/drivers/usb/storage/uas.c |
3997 | +++ b/drivers/usb/storage/uas.c |
3998 | @@ -832,6 +832,10 @@ static int uas_slave_configure(struct scsi_device *sdev) |
3999 | sdev->wce_default_on = 1; |
4000 | } |
4001 | |
4002 | + /* Some disks cannot handle READ_CAPACITY_16 */ |
4003 | + if (devinfo->flags & US_FL_NO_READ_CAPACITY_16) |
4004 | + sdev->no_read_capacity_16 = 1; |
4005 | + |
4006 | /* |
4007 | * Some disks return the total number of blocks in response |
4008 | * to READ CAPACITY rather than the highest block number. |
4009 | @@ -840,6 +844,12 @@ static int uas_slave_configure(struct scsi_device *sdev) |
4010 | if (devinfo->flags & US_FL_FIX_CAPACITY) |
4011 | sdev->fix_capacity = 1; |
4012 | |
4013 | + /* |
4014 | + * in some cases we have to guess |
4015 | + */ |
4016 | + if (devinfo->flags & US_FL_CAPACITY_HEURISTICS) |
4017 | + sdev->guess_capacity = 1; |
4018 | + |
4019 | /* |
4020 | * Some devices don't like MODE SENSE with page=0x3f, |
4021 | * which is the command used for checking if a device |
4022 | diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c |
4023 | index 1c46045b0e7f..94594dc63c41 100644 |
4024 | --- a/drivers/vfio/pci/vfio_pci_intrs.c |
4025 | +++ b/drivers/vfio/pci/vfio_pci_intrs.c |
4026 | @@ -297,8 +297,8 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev, |
4027 | irq = pci_irq_vector(pdev, vector); |
4028 | |
4029 | if (vdev->ctx[vector].trigger) { |
4030 | - free_irq(irq, vdev->ctx[vector].trigger); |
4031 | irq_bypass_unregister_producer(&vdev->ctx[vector].producer); |
4032 | + free_irq(irq, vdev->ctx[vector].trigger); |
4033 | kfree(vdev->ctx[vector].name); |
4034 | eventfd_ctx_put(vdev->ctx[vector].trigger); |
4035 | vdev->ctx[vector].trigger = NULL; |
4036 | diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c |
4037 | index b73520aaf697..2e325fea4446 100644 |
4038 | --- a/drivers/video/hdmi.c |
4039 | +++ b/drivers/video/hdmi.c |
4040 | @@ -1032,12 +1032,12 @@ static int hdmi_avi_infoframe_unpack(struct hdmi_avi_infoframe *frame, |
4041 | if (ptr[0] & 0x10) |
4042 | frame->active_aspect = ptr[1] & 0xf; |
4043 | if (ptr[0] & 0x8) { |
4044 | - frame->top_bar = (ptr[5] << 8) + ptr[6]; |
4045 | - frame->bottom_bar = (ptr[7] << 8) + ptr[8]; |
4046 | + frame->top_bar = (ptr[6] << 8) | ptr[5]; |
4047 | + frame->bottom_bar = (ptr[8] << 8) | ptr[7]; |
4048 | } |
4049 | if (ptr[0] & 0x4) { |
4050 | - frame->left_bar = (ptr[9] << 8) + ptr[10]; |
4051 | - frame->right_bar = (ptr[11] << 8) + ptr[12]; |
4052 | + frame->left_bar = (ptr[10] << 8) | ptr[9]; |
4053 | + frame->right_bar = (ptr[12] << 8) | ptr[11]; |
4054 | } |
4055 | frame->scan_mode = ptr[0] & 0x3; |
4056 | |
4057 | diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c |
4058 | index 30076956a096..4e64a3befa35 100644 |
4059 | --- a/drivers/virtio/virtio_balloon.c |
4060 | +++ b/drivers/virtio/virtio_balloon.c |
4061 | @@ -482,6 +482,17 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info, |
4062 | |
4063 | get_page(newpage); /* balloon reference */ |
4064 | |
4065 | + /* |
4066 | + * When we migrate a page to a different zone and adjusted the |
4067 | + * managed page count when inflating, we have to fixup the count of |
4068 | + * both involved zones. |
4069 | + */ |
4070 | + if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM) && |
4071 | + page_zone(page) != page_zone(newpage)) { |
4072 | + adjust_managed_page_count(page, 1); |
4073 | + adjust_managed_page_count(newpage, -1); |
4074 | + } |
4075 | + |
4076 | /* balloon's page migration 1st step -- inflate "newpage" */ |
4077 | spin_lock_irqsave(&vb_dev_info->pages_lock, flags); |
4078 | balloon_page_insert(vb_dev_info, newpage); |
4079 | diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c |
4080 | index 2e1f50e467f1..02f0d373adbf 100644 |
4081 | --- a/fs/autofs4/expire.c |
4082 | +++ b/fs/autofs4/expire.c |
4083 | @@ -469,9 +469,10 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, |
4084 | */ |
4085 | flags &= ~AUTOFS_EXP_LEAVES; |
4086 | found = should_expire(expired, mnt, timeout, how); |
4087 | - if (!found || found != expired) |
4088 | - /* Something has changed, continue */ |
4089 | + if (found != expired) { // something has changed, continue |
4090 | + dput(found); |
4091 | goto next; |
4092 | + } |
4093 | |
4094 | if (expired != dentry) |
4095 | dput(dentry); |
4096 | diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
4097 | index 6cdf27325576..03661b744eaf 100644 |
4098 | --- a/fs/btrfs/file.c |
4099 | +++ b/fs/btrfs/file.c |
4100 | @@ -1555,6 +1555,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, |
4101 | break; |
4102 | } |
4103 | |
4104 | + only_release_metadata = false; |
4105 | sector_offset = pos & (root->sectorsize - 1); |
4106 | reserve_bytes = round_up(write_bytes + sector_offset, |
4107 | root->sectorsize); |
4108 | @@ -1704,7 +1705,6 @@ again: |
4109 | set_extent_bit(&BTRFS_I(inode)->io_tree, lockstart, |
4110 | lockend, EXTENT_NORESERVE, NULL, |
4111 | NULL, GFP_NOFS); |
4112 | - only_release_metadata = false; |
4113 | } |
4114 | |
4115 | btrfs_drop_pages(pages, num_pages); |
4116 | diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c |
4117 | index 69a3c11af9d4..a84a1ceb260a 100644 |
4118 | --- a/fs/btrfs/free-space-cache.c |
4119 | +++ b/fs/btrfs/free-space-cache.c |
4120 | @@ -391,6 +391,12 @@ static int io_ctl_prepare_pages(struct btrfs_io_ctl *io_ctl, struct inode *inode |
4121 | if (uptodate && !PageUptodate(page)) { |
4122 | btrfs_readpage(NULL, page); |
4123 | lock_page(page); |
4124 | + if (page->mapping != inode->i_mapping) { |
4125 | + btrfs_err(BTRFS_I(inode)->root->fs_info, |
4126 | + "free space cache page truncated"); |
4127 | + io_ctl_drop_pages(io_ctl); |
4128 | + return -EIO; |
4129 | + } |
4130 | if (!PageUptodate(page)) { |
4131 | btrfs_err(BTRFS_I(inode)->root->fs_info, |
4132 | "error reading free space cache"); |
4133 | diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
4134 | index 1b1a9e35e082..80937c5ca477 100644 |
4135 | --- a/fs/btrfs/inode.c |
4136 | +++ b/fs/btrfs/inode.c |
4137 | @@ -9616,6 +9616,9 @@ static int btrfs_rename_exchange(struct inode *old_dir, |
4138 | goto out_notrans; |
4139 | } |
4140 | |
4141 | + if (dest != root) |
4142 | + btrfs_record_root_in_trans(trans, dest); |
4143 | + |
4144 | /* |
4145 | * We need to find a free sequence number both in the source and |
4146 | * in the destination directory for the exchange. |
4147 | diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c |
4148 | index d9e49705a289..edfc7ba38b33 100644 |
4149 | --- a/fs/btrfs/send.c |
4150 | +++ b/fs/btrfs/send.c |
4151 | @@ -36,6 +36,14 @@ |
4152 | #include "transaction.h" |
4153 | #include "compression.h" |
4154 | |
4155 | +/* |
4156 | + * Maximum number of references an extent can have in order for us to attempt to |
4157 | + * issue clone operations instead of write operations. This currently exists to |
4158 | + * avoid hitting limitations of the backreference walking code (taking a lot of |
4159 | + * time and using too much memory for extents with large number of references). |
4160 | + */ |
4161 | +#define SEND_MAX_EXTENT_REFS 64 |
4162 | + |
4163 | /* |
4164 | * A fs_path is a helper to dynamically build path names with unknown size. |
4165 | * It reallocates the internal buffer on demand. |
4166 | @@ -1327,6 +1335,7 @@ static int find_extent_clone(struct send_ctx *sctx, |
4167 | struct clone_root *cur_clone_root; |
4168 | struct btrfs_key found_key; |
4169 | struct btrfs_path *tmp_path; |
4170 | + struct btrfs_extent_item *ei; |
4171 | int compressed; |
4172 | u32 i; |
4173 | |
4174 | @@ -1376,7 +1385,6 @@ static int find_extent_clone(struct send_ctx *sctx, |
4175 | ret = extent_from_logical(fs_info, disk_byte, tmp_path, |
4176 | &found_key, &flags); |
4177 | up_read(&fs_info->commit_root_sem); |
4178 | - btrfs_release_path(tmp_path); |
4179 | |
4180 | if (ret < 0) |
4181 | goto out; |
4182 | @@ -1385,6 +1393,21 @@ static int find_extent_clone(struct send_ctx *sctx, |
4183 | goto out; |
4184 | } |
4185 | |
4186 | + ei = btrfs_item_ptr(tmp_path->nodes[0], tmp_path->slots[0], |
4187 | + struct btrfs_extent_item); |
4188 | + /* |
4189 | + * Backreference walking (iterate_extent_inodes() below) is currently |
4190 | + * too expensive when an extent has a large number of references, both |
4191 | + * in time spent and used memory. So for now just fallback to write |
4192 | + * operations instead of clone operations when an extent has more than |
4193 | + * a certain amount of references. |
4194 | + */ |
4195 | + if (btrfs_extent_refs(tmp_path->nodes[0], ei) > SEND_MAX_EXTENT_REFS) { |
4196 | + ret = -ENOENT; |
4197 | + goto out; |
4198 | + } |
4199 | + btrfs_release_path(tmp_path); |
4200 | + |
4201 | /* |
4202 | * Setup the clone roots. |
4203 | */ |
4204 | diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h |
4205 | index 663d66828cca..96c1b847def6 100644 |
4206 | --- a/fs/btrfs/volumes.h |
4207 | +++ b/fs/btrfs/volumes.h |
4208 | @@ -312,7 +312,6 @@ struct btrfs_bio { |
4209 | u64 map_type; /* get from map_lookup->type */ |
4210 | bio_end_io_t *end_io; |
4211 | struct bio *orig_bio; |
4212 | - unsigned long flags; |
4213 | void *private; |
4214 | atomic_t error; |
4215 | int max_errors; |
4216 | diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
4217 | index 1c3f262d9c4d..09d83275c20b 100644 |
4218 | --- a/fs/cifs/file.c |
4219 | +++ b/fs/cifs/file.c |
4220 | @@ -312,9 +312,6 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, |
4221 | INIT_LIST_HEAD(&fdlocks->locks); |
4222 | fdlocks->cfile = cfile; |
4223 | cfile->llist = fdlocks; |
4224 | - cifs_down_write(&cinode->lock_sem); |
4225 | - list_add(&fdlocks->llist, &cinode->llist); |
4226 | - up_write(&cinode->lock_sem); |
4227 | |
4228 | cfile->count = 1; |
4229 | cfile->pid = current->tgid; |
4230 | @@ -338,6 +335,10 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, |
4231 | oplock = 0; |
4232 | } |
4233 | |
4234 | + cifs_down_write(&cinode->lock_sem); |
4235 | + list_add(&fdlocks->llist, &cinode->llist); |
4236 | + up_write(&cinode->lock_sem); |
4237 | + |
4238 | spin_lock(&tcon->open_file_lock); |
4239 | if (fid->pending_open->oplock != CIFS_OPLOCK_NO_CHANGE && oplock) |
4240 | oplock = fid->pending_open->oplock; |
4241 | @@ -721,6 +722,13 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) |
4242 | if (backup_cred(cifs_sb)) |
4243 | create_options |= CREATE_OPEN_BACKUP_INTENT; |
4244 | |
4245 | + /* O_SYNC also has bit for O_DSYNC so following check picks up either */ |
4246 | + if (cfile->f_flags & O_SYNC) |
4247 | + create_options |= CREATE_WRITE_THROUGH; |
4248 | + |
4249 | + if (cfile->f_flags & O_DIRECT) |
4250 | + create_options |= CREATE_NO_BUFFER; |
4251 | + |
4252 | if (server->ops->get_lease_key) |
4253 | server->ops->get_lease_key(inode, &cfile->fid); |
4254 | |
4255 | diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c |
4256 | index 9994d15a32fc..7b7b47e26dbd 100644 |
4257 | --- a/fs/cifs/smb2misc.c |
4258 | +++ b/fs/cifs/smb2misc.c |
4259 | @@ -617,10 +617,10 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) |
4260 | spin_lock(&cifs_tcp_ses_lock); |
4261 | list_for_each(tmp, &server->smb_ses_list) { |
4262 | ses = list_entry(tmp, struct cifs_ses, smb_ses_list); |
4263 | + |
4264 | list_for_each(tmp1, &ses->tcon_list) { |
4265 | tcon = list_entry(tmp1, struct cifs_tcon, tcon_list); |
4266 | |
4267 | - cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks); |
4268 | spin_lock(&tcon->open_file_lock); |
4269 | list_for_each(tmp2, &tcon->openFileList) { |
4270 | cfile = list_entry(tmp2, struct cifsFileInfo, |
4271 | @@ -632,6 +632,8 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) |
4272 | continue; |
4273 | |
4274 | cifs_dbg(FYI, "file id match, oplock break\n"); |
4275 | + cifs_stats_inc( |
4276 | + &tcon->stats.cifs_stats.num_oplock_brks); |
4277 | cinode = CIFS_I(d_inode(cfile->dentry)); |
4278 | spin_lock(&cfile->file_info_lock); |
4279 | if (!CIFS_CACHE_WRITE(cinode) && |
4280 | @@ -664,9 +666,6 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) |
4281 | return true; |
4282 | } |
4283 | spin_unlock(&tcon->open_file_lock); |
4284 | - spin_unlock(&cifs_tcp_ses_lock); |
4285 | - cifs_dbg(FYI, "No matching file for oplock break\n"); |
4286 | - return true; |
4287 | } |
4288 | } |
4289 | spin_unlock(&cifs_tcp_ses_lock); |
4290 | diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c |
4291 | index 30e4e01db35a..b14bb2c46042 100644 |
4292 | --- a/fs/dlm/lockspace.c |
4293 | +++ b/fs/dlm/lockspace.c |
4294 | @@ -800,6 +800,7 @@ static int release_lockspace(struct dlm_ls *ls, int force) |
4295 | |
4296 | dlm_delete_debug_file(ls); |
4297 | |
4298 | + idr_destroy(&ls->ls_recover_idr); |
4299 | kfree(ls->ls_recover_buf); |
4300 | |
4301 | /* |
4302 | diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c |
4303 | index 7cd24bccd4fe..37be29f21d04 100644 |
4304 | --- a/fs/dlm/memory.c |
4305 | +++ b/fs/dlm/memory.c |
4306 | @@ -38,10 +38,8 @@ int __init dlm_memory_init(void) |
4307 | |
4308 | void dlm_memory_exit(void) |
4309 | { |
4310 | - if (lkb_cache) |
4311 | - kmem_cache_destroy(lkb_cache); |
4312 | - if (rsb_cache) |
4313 | - kmem_cache_destroy(rsb_cache); |
4314 | + kmem_cache_destroy(lkb_cache); |
4315 | + kmem_cache_destroy(rsb_cache); |
4316 | } |
4317 | |
4318 | char *dlm_allocate_lvb(struct dlm_ls *ls) |
4319 | @@ -86,8 +84,7 @@ void dlm_free_lkb(struct dlm_lkb *lkb) |
4320 | struct dlm_user_args *ua; |
4321 | ua = lkb->lkb_ua; |
4322 | if (ua) { |
4323 | - if (ua->lksb.sb_lvbptr) |
4324 | - kfree(ua->lksb.sb_lvbptr); |
4325 | + kfree(ua->lksb.sb_lvbptr); |
4326 | kfree(ua); |
4327 | } |
4328 | } |
4329 | diff --git a/fs/dlm/user.c b/fs/dlm/user.c |
4330 | index 57f2aacec97f..bb0d307deadd 100644 |
4331 | --- a/fs/dlm/user.c |
4332 | +++ b/fs/dlm/user.c |
4333 | @@ -25,6 +25,7 @@ |
4334 | #include "lvb_table.h" |
4335 | #include "user.h" |
4336 | #include "ast.h" |
4337 | +#include "config.h" |
4338 | |
4339 | static const char name_prefix[] = "dlm"; |
4340 | static const struct file_operations device_fops; |
4341 | @@ -402,7 +403,7 @@ static int device_create_lockspace(struct dlm_lspace_params *params) |
4342 | if (!capable(CAP_SYS_ADMIN)) |
4343 | return -EPERM; |
4344 | |
4345 | - error = dlm_new_lockspace(params->name, NULL, params->flags, |
4346 | + error = dlm_new_lockspace(params->name, dlm_config.ci_cluster_name, params->flags, |
4347 | DLM_USER_LVB_LEN, NULL, NULL, NULL, |
4348 | &lockspace); |
4349 | if (error) |
4350 | diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c |
4351 | index 7a7bba7c2328..3706939e5dd5 100644 |
4352 | --- a/fs/exportfs/expfs.c |
4353 | +++ b/fs/exportfs/expfs.c |
4354 | @@ -506,26 +506,33 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, |
4355 | * inode is actually connected to the parent. |
4356 | */ |
4357 | err = exportfs_get_name(mnt, target_dir, nbuf, result); |
4358 | - if (!err) { |
4359 | - inode_lock(target_dir->d_inode); |
4360 | - nresult = lookup_one_len(nbuf, target_dir, |
4361 | - strlen(nbuf)); |
4362 | - inode_unlock(target_dir->d_inode); |
4363 | - if (!IS_ERR(nresult)) { |
4364 | - if (nresult->d_inode) { |
4365 | - dput(result); |
4366 | - result = nresult; |
4367 | - } else |
4368 | - dput(nresult); |
4369 | - } |
4370 | + if (err) { |
4371 | + dput(target_dir); |
4372 | + goto err_result; |
4373 | } |
4374 | |
4375 | + inode_lock(target_dir->d_inode); |
4376 | + nresult = lookup_one_len(nbuf, target_dir, strlen(nbuf)); |
4377 | + if (!IS_ERR(nresult)) { |
4378 | + if (unlikely(nresult->d_inode != result->d_inode)) { |
4379 | + dput(nresult); |
4380 | + nresult = ERR_PTR(-ESTALE); |
4381 | + } |
4382 | + } |
4383 | + inode_unlock(target_dir->d_inode); |
4384 | /* |
4385 | * At this point we are done with the parent, but it's pinned |
4386 | * by the child dentry anyway. |
4387 | */ |
4388 | dput(target_dir); |
4389 | |
4390 | + if (IS_ERR(nresult)) { |
4391 | + err = PTR_ERR(nresult); |
4392 | + goto err_result; |
4393 | + } |
4394 | + dput(result); |
4395 | + result = nresult; |
4396 | + |
4397 | /* |
4398 | * And finally make sure the dentry is actually acceptable |
4399 | * to NFSD. |
4400 | diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c |
4401 | index 85449a6ddc56..fe664949d442 100644 |
4402 | --- a/fs/ext2/inode.c |
4403 | +++ b/fs/ext2/inode.c |
4404 | @@ -697,10 +697,13 @@ static int ext2_get_blocks(struct inode *inode, |
4405 | if (!partial) { |
4406 | count++; |
4407 | mutex_unlock(&ei->truncate_mutex); |
4408 | - if (err) |
4409 | - goto cleanup; |
4410 | goto got_it; |
4411 | } |
4412 | + |
4413 | + if (err) { |
4414 | + mutex_unlock(&ei->truncate_mutex); |
4415 | + goto cleanup; |
4416 | + } |
4417 | } |
4418 | |
4419 | /* |
4420 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
4421 | index a73056e06bde..00c320e2ba1e 100644 |
4422 | --- a/fs/ext4/inode.c |
4423 | +++ b/fs/ext4/inode.c |
4424 | @@ -5080,11 +5080,15 @@ static void ext4_wait_for_tail_page_commit(struct inode *inode) |
4425 | |
4426 | offset = inode->i_size & (PAGE_SIZE - 1); |
4427 | /* |
4428 | - * All buffers in the last page remain valid? Then there's nothing to |
4429 | - * do. We do the check mainly to optimize the common PAGE_SIZE == |
4430 | - * blocksize case |
4431 | + * If the page is fully truncated, we don't need to wait for any commit |
4432 | + * (and we even should not as __ext4_journalled_invalidatepage() may |
4433 | + * strip all buffers from the page but keep the page dirty which can then |
4434 | + * confuse e.g. concurrent ext4_writepage() seeing dirty page without |
4435 | + * buffers). Also we don't need to wait for any commit if all buffers in |
4436 | + * the page remain valid. This is most beneficial for the common case of |
4437 | + * blocksize == PAGESIZE. |
4438 | */ |
4439 | - if (offset > PAGE_SIZE - i_blocksize(inode)) |
4440 | + if (!offset || offset > (PAGE_SIZE - i_blocksize(inode))) |
4441 | return; |
4442 | while (1) { |
4443 | page = find_lock_page(inode->i_mapping, |
4444 | diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c |
4445 | index 1d9fec9c714b..9af23f436558 100644 |
4446 | --- a/fs/fuse/dir.c |
4447 | +++ b/fs/fuse/dir.c |
4448 | @@ -234,7 +234,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) |
4449 | kfree(forget); |
4450 | if (ret == -ENOMEM) |
4451 | goto out; |
4452 | - if (ret || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) |
4453 | + if (ret || fuse_invalid_attr(&outarg.attr) || |
4454 | + (outarg.attr.mode ^ inode->i_mode) & S_IFMT) |
4455 | goto invalid; |
4456 | |
4457 | forget_all_cached_acls(inode); |
4458 | @@ -297,6 +298,12 @@ int fuse_valid_type(int m) |
4459 | S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m); |
4460 | } |
4461 | |
4462 | +bool fuse_invalid_attr(struct fuse_attr *attr) |
4463 | +{ |
4464 | + return !fuse_valid_type(attr->mode) || |
4465 | + attr->size > LLONG_MAX; |
4466 | +} |
4467 | + |
4468 | int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name, |
4469 | struct fuse_entry_out *outarg, struct inode **inode) |
4470 | { |
4471 | @@ -328,7 +335,7 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name |
4472 | err = -EIO; |
4473 | if (!outarg->nodeid) |
4474 | goto out_put_forget; |
4475 | - if (!fuse_valid_type(outarg->attr.mode)) |
4476 | + if (fuse_invalid_attr(&outarg->attr)) |
4477 | goto out_put_forget; |
4478 | |
4479 | *inode = fuse_iget(sb, outarg->nodeid, outarg->generation, |
4480 | @@ -451,7 +458,8 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, |
4481 | goto out_free_ff; |
4482 | |
4483 | err = -EIO; |
4484 | - if (!S_ISREG(outentry.attr.mode) || invalid_nodeid(outentry.nodeid)) |
4485 | + if (!S_ISREG(outentry.attr.mode) || invalid_nodeid(outentry.nodeid) || |
4486 | + fuse_invalid_attr(&outentry.attr)) |
4487 | goto out_free_ff; |
4488 | |
4489 | ff->fh = outopen.fh; |
4490 | @@ -557,7 +565,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args, |
4491 | goto out_put_forget_req; |
4492 | |
4493 | err = -EIO; |
4494 | - if (invalid_nodeid(outarg.nodeid)) |
4495 | + if (invalid_nodeid(outarg.nodeid) || fuse_invalid_attr(&outarg.attr)) |
4496 | goto out_put_forget_req; |
4497 | |
4498 | if ((outarg.attr.mode ^ mode) & S_IFMT) |
4499 | @@ -830,7 +838,8 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, |
4500 | |
4501 | spin_lock(&fc->lock); |
4502 | fi->attr_version = ++fc->attr_version; |
4503 | - inc_nlink(inode); |
4504 | + if (likely(inode->i_nlink < UINT_MAX)) |
4505 | + inc_nlink(inode); |
4506 | spin_unlock(&fc->lock); |
4507 | fuse_invalidate_attr(inode); |
4508 | fuse_update_ctime(inode); |
4509 | @@ -910,7 +919,8 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat, |
4510 | args.out.args[0].value = &outarg; |
4511 | err = fuse_simple_request(fc, &args); |
4512 | if (!err) { |
4513 | - if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
4514 | + if (fuse_invalid_attr(&outarg.attr) || |
4515 | + (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
4516 | make_bad_inode(inode); |
4517 | err = -EIO; |
4518 | } else { |
4519 | @@ -1218,7 +1228,7 @@ static int fuse_direntplus_link(struct file *file, |
4520 | |
4521 | if (invalid_nodeid(o->nodeid)) |
4522 | return -EIO; |
4523 | - if (!fuse_valid_type(o->attr.mode)) |
4524 | + if (fuse_invalid_attr(&o->attr)) |
4525 | return -EIO; |
4526 | |
4527 | fc = get_fuse_conn(dir); |
4528 | @@ -1695,7 +1705,8 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, |
4529 | goto error; |
4530 | } |
4531 | |
4532 | - if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
4533 | + if (fuse_invalid_attr(&outarg.attr) || |
4534 | + (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
4535 | make_bad_inode(inode); |
4536 | err = -EIO; |
4537 | goto error; |
4538 | diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h |
4539 | index 1c905c7666de..f84dd6d87d90 100644 |
4540 | --- a/fs/fuse/fuse_i.h |
4541 | +++ b/fs/fuse/fuse_i.h |
4542 | @@ -898,6 +898,8 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc); |
4543 | */ |
4544 | int fuse_valid_type(int m); |
4545 | |
4546 | +bool fuse_invalid_attr(struct fuse_attr *attr); |
4547 | + |
4548 | /** |
4549 | * Is current process allowed to perform filesystem operation? |
4550 | */ |
4551 | diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c |
4552 | index 66eaeb1e8c2c..dc9586feab31 100644 |
4553 | --- a/fs/nfsd/nfs4recover.c |
4554 | +++ b/fs/nfsd/nfs4recover.c |
4555 | @@ -661,7 +661,7 @@ struct cld_net { |
4556 | struct cld_upcall { |
4557 | struct list_head cu_list; |
4558 | struct cld_net *cu_net; |
4559 | - struct task_struct *cu_task; |
4560 | + struct completion cu_done; |
4561 | struct cld_msg cu_msg; |
4562 | }; |
4563 | |
4564 | @@ -670,23 +670,18 @@ __cld_pipe_upcall(struct rpc_pipe *pipe, struct cld_msg *cmsg) |
4565 | { |
4566 | int ret; |
4567 | struct rpc_pipe_msg msg; |
4568 | + struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, cu_msg); |
4569 | |
4570 | memset(&msg, 0, sizeof(msg)); |
4571 | msg.data = cmsg; |
4572 | msg.len = sizeof(*cmsg); |
4573 | |
4574 | - /* |
4575 | - * Set task state before we queue the upcall. That prevents |
4576 | - * wake_up_process in the downcall from racing with schedule. |
4577 | - */ |
4578 | - set_current_state(TASK_UNINTERRUPTIBLE); |
4579 | ret = rpc_queue_upcall(pipe, &msg); |
4580 | if (ret < 0) { |
4581 | - set_current_state(TASK_RUNNING); |
4582 | goto out; |
4583 | } |
4584 | |
4585 | - schedule(); |
4586 | + wait_for_completion(&cup->cu_done); |
4587 | |
4588 | if (msg.errno < 0) |
4589 | ret = msg.errno; |
4590 | @@ -753,7 +748,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) |
4591 | if (copy_from_user(&cup->cu_msg, src, mlen) != 0) |
4592 | return -EFAULT; |
4593 | |
4594 | - wake_up_process(cup->cu_task); |
4595 | + complete(&cup->cu_done); |
4596 | return mlen; |
4597 | } |
4598 | |
4599 | @@ -768,7 +763,7 @@ cld_pipe_destroy_msg(struct rpc_pipe_msg *msg) |
4600 | if (msg->errno >= 0) |
4601 | return; |
4602 | |
4603 | - wake_up_process(cup->cu_task); |
4604 | + complete(&cup->cu_done); |
4605 | } |
4606 | |
4607 | static const struct rpc_pipe_ops cld_upcall_ops = { |
4608 | @@ -899,7 +894,7 @@ restart_search: |
4609 | goto restart_search; |
4610 | } |
4611 | } |
4612 | - new->cu_task = current; |
4613 | + init_completion(&new->cu_done); |
4614 | new->cu_msg.cm_vers = CLD_UPCALL_VERSION; |
4615 | put_unaligned(cn->cn_xid++, &new->cu_msg.cm_xid); |
4616 | new->cu_net = cn; |
4617 | diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c |
4618 | index 8f0b19a3ca81..b8cd100cfcd6 100644 |
4619 | --- a/fs/nfsd/vfs.c |
4620 | +++ b/fs/nfsd/vfs.c |
4621 | @@ -395,10 +395,23 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, |
4622 | bool get_write_count; |
4623 | bool size_change = (iap->ia_valid & ATTR_SIZE); |
4624 | |
4625 | - if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) |
4626 | + if (iap->ia_valid & ATTR_SIZE) { |
4627 | accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; |
4628 | - if (iap->ia_valid & ATTR_SIZE) |
4629 | ftype = S_IFREG; |
4630 | + } |
4631 | + |
4632 | + /* |
4633 | + * If utimes(2) and friends are called with times not NULL, we should |
4634 | + * not set NFSD_MAY_WRITE bit. Otherwise fh_verify->nfsd_permission |
4635 | + * will return EACCESS, when the caller's effective UID does not match |
4636 | + * the owner of the file, and the caller is not privileged. In this |
4637 | + * situation, we should return EPERM(notify_change will return this). |
4638 | + */ |
4639 | + if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME)) { |
4640 | + accmode |= NFSD_MAY_OWNER_OVERRIDE; |
4641 | + if (!(iap->ia_valid & (ATTR_ATIME_SET | ATTR_MTIME_SET))) |
4642 | + accmode |= NFSD_MAY_WRITE; |
4643 | + } |
4644 | |
4645 | /* Callers that do fh_verify should do the fh_want_write: */ |
4646 | get_write_count = !fhp->fh_dentry; |
4647 | diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c |
4648 | index 87e577a49b0d..542fa21aeaa9 100644 |
4649 | --- a/fs/ocfs2/quota_global.c |
4650 | +++ b/fs/ocfs2/quota_global.c |
4651 | @@ -714,7 +714,7 @@ static int ocfs2_release_dquot(struct dquot *dquot) |
4652 | |
4653 | mutex_lock(&dquot->dq_lock); |
4654 | /* Check whether we are not racing with some other dqget() */ |
4655 | - if (atomic_read(&dquot->dq_count) > 1) |
4656 | + if (dquot_is_busy(dquot)) |
4657 | goto out; |
4658 | /* Running from downconvert thread? Postpone quota processing to wq */ |
4659 | if (current == osb->dc_task) { |
4660 | diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c |
4661 | index f9246ac4eef8..a7c6611e0056 100644 |
4662 | --- a/fs/quota/dquot.c |
4663 | +++ b/fs/quota/dquot.c |
4664 | @@ -479,7 +479,7 @@ int dquot_release(struct dquot *dquot) |
4665 | |
4666 | mutex_lock(&dquot->dq_lock); |
4667 | /* Check whether we are not racing with some other dqget() */ |
4668 | - if (atomic_read(&dquot->dq_count) > 1) |
4669 | + if (dquot_is_busy(dquot)) |
4670 | goto out_dqlock; |
4671 | mutex_lock(&dqopt->dqio_mutex); |
4672 | if (dqopt->ops[dquot->dq_id.type]->release_dqblk) { |
4673 | @@ -611,7 +611,7 @@ EXPORT_SYMBOL(dquot_scan_active); |
4674 | /* Write all dquot structures to quota files */ |
4675 | int dquot_writeback_dquots(struct super_block *sb, int type) |
4676 | { |
4677 | - struct list_head *dirty; |
4678 | + struct list_head dirty; |
4679 | struct dquot *dquot; |
4680 | struct quota_info *dqopt = sb_dqopt(sb); |
4681 | int cnt; |
4682 | @@ -624,9 +624,10 @@ int dquot_writeback_dquots(struct super_block *sb, int type) |
4683 | if (!sb_has_quota_active(sb, cnt)) |
4684 | continue; |
4685 | spin_lock(&dq_list_lock); |
4686 | - dirty = &dqopt->info[cnt].dqi_dirty_list; |
4687 | - while (!list_empty(dirty)) { |
4688 | - dquot = list_first_entry(dirty, struct dquot, |
4689 | + /* Move list away to avoid livelock. */ |
4690 | + list_replace_init(&dqopt->info[cnt].dqi_dirty_list, &dirty); |
4691 | + while (!list_empty(&dirty)) { |
4692 | + dquot = list_first_entry(&dirty, struct dquot, |
4693 | dq_dirty); |
4694 | /* Dirty and inactive can be only bad dquot... */ |
4695 | if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { |
4696 | diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c |
4697 | index bd4c727f4610..9531b6c18ac7 100644 |
4698 | --- a/fs/reiserfs/inode.c |
4699 | +++ b/fs/reiserfs/inode.c |
4700 | @@ -2102,6 +2102,15 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, |
4701 | goto out_inserted_sd; |
4702 | } |
4703 | |
4704 | + /* |
4705 | + * Mark it private if we're creating the privroot |
4706 | + * or something under it. |
4707 | + */ |
4708 | + if (IS_PRIVATE(dir) || dentry == REISERFS_SB(sb)->priv_root) { |
4709 | + inode->i_flags |= S_PRIVATE; |
4710 | + inode->i_opflags &= ~IOP_XATTR; |
4711 | + } |
4712 | + |
4713 | if (reiserfs_posixacl(inode->i_sb)) { |
4714 | reiserfs_write_unlock(inode->i_sb); |
4715 | retval = reiserfs_inherit_default_acl(th, dir, dentry, inode); |
4716 | @@ -2116,8 +2125,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, |
4717 | reiserfs_warning(inode->i_sb, "jdm-13090", |
4718 | "ACLs aren't enabled in the fs, " |
4719 | "but vfs thinks they are!"); |
4720 | - } else if (IS_PRIVATE(dir)) |
4721 | - inode->i_flags |= S_PRIVATE; |
4722 | + } |
4723 | |
4724 | if (security->name) { |
4725 | reiserfs_write_unlock(inode->i_sb); |
4726 | diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c |
4727 | index 1ec728cf82d1..1c900f322089 100644 |
4728 | --- a/fs/reiserfs/namei.c |
4729 | +++ b/fs/reiserfs/namei.c |
4730 | @@ -377,10 +377,13 @@ static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry, |
4731 | |
4732 | /* |
4733 | * Propagate the private flag so we know we're |
4734 | - * in the priv tree |
4735 | + * in the priv tree. Also clear IOP_XATTR |
4736 | + * since we don't have xattrs on xattr files. |
4737 | */ |
4738 | - if (IS_PRIVATE(dir)) |
4739 | + if (IS_PRIVATE(dir)) { |
4740 | inode->i_flags |= S_PRIVATE; |
4741 | + inode->i_opflags &= ~IOP_XATTR; |
4742 | + } |
4743 | } |
4744 | reiserfs_write_unlock(dir->i_sb); |
4745 | if (retval == IO_ERROR) { |
4746 | diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h |
4747 | index d920a646b578..3e78a394fdb8 100644 |
4748 | --- a/fs/reiserfs/reiserfs.h |
4749 | +++ b/fs/reiserfs/reiserfs.h |
4750 | @@ -1167,6 +1167,8 @@ static inline int bmap_would_wrap(unsigned bmap_nr) |
4751 | return bmap_nr > ((1LL << 16) - 1); |
4752 | } |
4753 | |
4754 | +extern const struct xattr_handler *reiserfs_xattr_handlers[]; |
4755 | + |
4756 | /* |
4757 | * this says about version of key of all items (but stat data) the |
4758 | * object consists of |
4759 | diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c |
4760 | index dec6c93044fa..cd2d555b3a6d 100644 |
4761 | --- a/fs/reiserfs/super.c |
4762 | +++ b/fs/reiserfs/super.c |
4763 | @@ -2026,6 +2026,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) |
4764 | if (replay_only(s)) |
4765 | goto error_unlocked; |
4766 | |
4767 | + s->s_xattr = reiserfs_xattr_handlers; |
4768 | + |
4769 | if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) { |
4770 | SWARN(silent, s, "clm-7000", |
4771 | "Detected readonly device, marking FS readonly"); |
4772 | diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c |
4773 | index 9e313fc7fdc7..dbc2ada9884f 100644 |
4774 | --- a/fs/reiserfs/xattr.c |
4775 | +++ b/fs/reiserfs/xattr.c |
4776 | @@ -121,13 +121,13 @@ static struct dentry *open_xa_root(struct super_block *sb, int flags) |
4777 | struct dentry *xaroot; |
4778 | |
4779 | if (d_really_is_negative(privroot)) |
4780 | - return ERR_PTR(-ENODATA); |
4781 | + return ERR_PTR(-EOPNOTSUPP); |
4782 | |
4783 | inode_lock_nested(d_inode(privroot), I_MUTEX_XATTR); |
4784 | |
4785 | xaroot = dget(REISERFS_SB(sb)->xattr_root); |
4786 | if (!xaroot) |
4787 | - xaroot = ERR_PTR(-ENODATA); |
4788 | + xaroot = ERR_PTR(-EOPNOTSUPP); |
4789 | else if (d_really_is_negative(xaroot)) { |
4790 | int err = -ENODATA; |
4791 | |
4792 | @@ -609,6 +609,10 @@ int reiserfs_xattr_set(struct inode *inode, const char *name, |
4793 | int error, error2; |
4794 | size_t jbegin_count = reiserfs_xattr_nblocks(inode, buffer_size); |
4795 | |
4796 | + /* Check before we start a transaction and then do nothing. */ |
4797 | + if (!d_really_is_positive(REISERFS_SB(inode->i_sb)->priv_root)) |
4798 | + return -EOPNOTSUPP; |
4799 | + |
4800 | if (!(flags & XATTR_REPLACE)) |
4801 | jbegin_count += reiserfs_xattr_jcreate_nblocks(inode); |
4802 | |
4803 | @@ -831,8 +835,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) |
4804 | if (d_really_is_negative(dentry)) |
4805 | return -EINVAL; |
4806 | |
4807 | - if (!dentry->d_sb->s_xattr || |
4808 | - get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
4809 | + if (get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) |
4810 | return -EOPNOTSUPP; |
4811 | |
4812 | dir = open_xa_dir(d_inode(dentry), XATTR_REPLACE); |
4813 | @@ -872,6 +875,7 @@ static int create_privroot(struct dentry *dentry) |
4814 | } |
4815 | |
4816 | d_inode(dentry)->i_flags |= S_PRIVATE; |
4817 | + d_inode(dentry)->i_opflags &= ~IOP_XATTR; |
4818 | reiserfs_info(dentry->d_sb, "Created %s - reserved for xattr " |
4819 | "storage.\n", PRIVROOT_NAME); |
4820 | |
4821 | @@ -885,7 +889,7 @@ static int create_privroot(struct dentry *dentry) { return 0; } |
4822 | #endif |
4823 | |
4824 | /* Actual operations that are exported to VFS-land */ |
4825 | -static const struct xattr_handler *reiserfs_xattr_handlers[] = { |
4826 | +const struct xattr_handler *reiserfs_xattr_handlers[] = { |
4827 | #ifdef CONFIG_REISERFS_FS_XATTR |
4828 | &reiserfs_xattr_user_handler, |
4829 | &reiserfs_xattr_trusted_handler, |
4830 | @@ -956,8 +960,10 @@ int reiserfs_lookup_privroot(struct super_block *s) |
4831 | if (!IS_ERR(dentry)) { |
4832 | REISERFS_SB(s)->priv_root = dentry; |
4833 | d_set_d_op(dentry, &xattr_lookup_poison_ops); |
4834 | - if (d_really_is_positive(dentry)) |
4835 | + if (d_really_is_positive(dentry)) { |
4836 | d_inode(dentry)->i_flags |= S_PRIVATE; |
4837 | + d_inode(dentry)->i_opflags &= ~IOP_XATTR; |
4838 | + } |
4839 | } else |
4840 | err = PTR_ERR(dentry); |
4841 | inode_unlock(d_inode(s->s_root)); |
4842 | @@ -986,7 +992,6 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags) |
4843 | } |
4844 | |
4845 | if (d_really_is_positive(privroot)) { |
4846 | - s->s_xattr = reiserfs_xattr_handlers; |
4847 | inode_lock(d_inode(privroot)); |
4848 | if (!REISERFS_SB(s)->xattr_root) { |
4849 | struct dentry *dentry; |
4850 | diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c |
4851 | index d92a1dc6ee70..1f1fdfd3bc5c 100644 |
4852 | --- a/fs/reiserfs/xattr_acl.c |
4853 | +++ b/fs/reiserfs/xattr_acl.c |
4854 | @@ -316,10 +316,8 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, |
4855 | * would be useless since permissions are ignored, and a pain because |
4856 | * it introduces locking cycles |
4857 | */ |
4858 | - if (IS_PRIVATE(dir)) { |
4859 | - inode->i_flags |= S_PRIVATE; |
4860 | + if (IS_PRIVATE(inode)) |
4861 | goto apply_umask; |
4862 | - } |
4863 | |
4864 | err = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); |
4865 | if (err) |
4866 | diff --git a/include/linux/acpi.h b/include/linux/acpi.h |
4867 | index 719eb97217a3..5670bb9788bb 100644 |
4868 | --- a/include/linux/acpi.h |
4869 | +++ b/include/linux/acpi.h |
4870 | @@ -77,7 +77,7 @@ static inline bool has_acpi_companion(struct device *dev) |
4871 | static inline void acpi_preset_companion(struct device *dev, |
4872 | struct acpi_device *parent, u64 addr) |
4873 | { |
4874 | - ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, NULL)); |
4875 | + ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, false)); |
4876 | } |
4877 | |
4878 | static inline const char *acpi_dev_name(struct acpi_device *adev) |
4879 | diff --git a/include/linux/atalk.h b/include/linux/atalk.h |
4880 | index af43ed404ff4..4be0e14b38fc 100644 |
4881 | --- a/include/linux/atalk.h |
4882 | +++ b/include/linux/atalk.h |
4883 | @@ -107,7 +107,7 @@ static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) |
4884 | #define AARP_RESOLVE_TIME (10 * HZ) |
4885 | |
4886 | extern struct datalink_proto *ddp_dl, *aarp_dl; |
4887 | -extern void aarp_proto_init(void); |
4888 | +extern int aarp_proto_init(void); |
4889 | |
4890 | /* Inter module exports */ |
4891 | |
4892 | diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h |
4893 | index 704caae69c42..97f817f4eb78 100644 |
4894 | --- a/include/linux/dma-mapping.h |
4895 | +++ b/include/linux/dma-mapping.h |
4896 | @@ -618,8 +618,7 @@ static inline unsigned int dma_get_max_seg_size(struct device *dev) |
4897 | return SZ_64K; |
4898 | } |
4899 | |
4900 | -static inline unsigned int dma_set_max_seg_size(struct device *dev, |
4901 | - unsigned int size) |
4902 | +static inline int dma_set_max_seg_size(struct device *dev, unsigned int size) |
4903 | { |
4904 | if (dev->dma_parms) { |
4905 | dev->dma_parms->max_segment_size = size; |
4906 | diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h |
4907 | index d073470cb342..344eb873f6f5 100644 |
4908 | --- a/include/linux/jbd2.h |
4909 | +++ b/include/linux/jbd2.h |
4910 | @@ -1560,7 +1560,7 @@ static inline int jbd2_space_needed(journal_t *journal) |
4911 | static inline unsigned long jbd2_log_space_left(journal_t *journal) |
4912 | { |
4913 | /* Allow for rounding errors */ |
4914 | - unsigned long free = journal->j_free - 32; |
4915 | + long free = journal->j_free - 32; |
4916 | |
4917 | if (journal->j_committing_transaction) { |
4918 | unsigned long committing = atomic_read(&journal-> |
4919 | @@ -1569,7 +1569,7 @@ static inline unsigned long jbd2_log_space_left(journal_t *journal) |
4920 | /* Transaction + control blocks */ |
4921 | free -= committing + (committing >> JBD2_CONTROL_BLOCKS_SHIFT); |
4922 | } |
4923 | - return free; |
4924 | + return max_t(long, free, 0); |
4925 | } |
4926 | |
4927 | /* |
4928 | diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h |
4929 | index 13f8052b9ff9..13ddba5e531d 100644 |
4930 | --- a/include/linux/mtd/mtd.h |
4931 | +++ b/include/linux/mtd/mtd.h |
4932 | @@ -392,7 +392,7 @@ static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd) |
4933 | return mtd->dev.of_node; |
4934 | } |
4935 | |
4936 | -static inline int mtd_oobavail(struct mtd_info *mtd, struct mtd_oob_ops *ops) |
4937 | +static inline u32 mtd_oobavail(struct mtd_info *mtd, struct mtd_oob_ops *ops) |
4938 | { |
4939 | return ops->mode == MTD_OPS_AUTO_OOB ? mtd->oobavail : mtd->oobsize; |
4940 | } |
4941 | diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
4942 | index 29ed5977ac04..81c85ba6e2b8 100644 |
4943 | --- a/include/linux/netdevice.h |
4944 | +++ b/include/linux/netdevice.h |
4945 | @@ -1730,6 +1730,11 @@ struct net_device { |
4946 | unsigned char if_port; |
4947 | unsigned char dma; |
4948 | |
4949 | + /* Note : dev->mtu is often read without holding a lock. |
4950 | + * Writers usually hold RTNL. |
4951 | + * It is recommended to use READ_ONCE() to annotate the reads, |
4952 | + * and to use WRITE_ONCE() to annotate the writes. |
4953 | + */ |
4954 | unsigned int mtu; |
4955 | unsigned short type; |
4956 | unsigned short hard_header_len; |
4957 | diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h |
4958 | index 87733344768c..0a60fe354bc5 100644 |
4959 | --- a/include/linux/quotaops.h |
4960 | +++ b/include/linux/quotaops.h |
4961 | @@ -54,6 +54,16 @@ static inline struct dquot *dqgrab(struct dquot *dquot) |
4962 | atomic_inc(&dquot->dq_count); |
4963 | return dquot; |
4964 | } |
4965 | + |
4966 | +static inline bool dquot_is_busy(struct dquot *dquot) |
4967 | +{ |
4968 | + if (test_bit(DQ_MOD_B, &dquot->dq_flags)) |
4969 | + return true; |
4970 | + if (atomic_read(&dquot->dq_count) > 1) |
4971 | + return true; |
4972 | + return false; |
4973 | +} |
4974 | + |
4975 | void dqput(struct dquot *dquot); |
4976 | int dquot_scan_active(struct super_block *sb, |
4977 | int (*fn)(struct dquot *dquot, unsigned long priv), |
4978 | diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h |
4979 | index 692108222271..bab9236e4367 100644 |
4980 | --- a/include/linux/regulator/consumer.h |
4981 | +++ b/include/linux/regulator/consumer.h |
4982 | @@ -479,7 +479,7 @@ static inline unsigned int regulator_get_mode(struct regulator *regulator) |
4983 | |
4984 | static inline int regulator_set_load(struct regulator *regulator, int load_uA) |
4985 | { |
4986 | - return REGULATOR_MODE_NORMAL; |
4987 | + return 0; |
4988 | } |
4989 | |
4990 | static inline int regulator_allow_bypass(struct regulator *regulator, |
4991 | diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h |
4992 | index eb4f6456521e..cd95b5e395a3 100644 |
4993 | --- a/include/linux/serial_core.h |
4994 | +++ b/include/linux/serial_core.h |
4995 | @@ -161,6 +161,7 @@ struct uart_port { |
4996 | struct console *cons; /* struct console, if any */ |
4997 | #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ) |
4998 | unsigned long sysrq; /* sysrq timeout */ |
4999 | + unsigned int sysrq_ch; /* char for sysrq */ |
5000 | #endif |
5001 | |
5002 | /* flags must be updated while holding port mutex */ |
5003 | @@ -470,8 +471,42 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) |
5004 | } |
5005 | return 0; |
5006 | } |
5007 | +static inline int |
5008 | +uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) |
5009 | +{ |
5010 | + if (port->sysrq) { |
5011 | + if (ch && time_before(jiffies, port->sysrq)) { |
5012 | + port->sysrq_ch = ch; |
5013 | + port->sysrq = 0; |
5014 | + return 1; |
5015 | + } |
5016 | + port->sysrq = 0; |
5017 | + } |
5018 | + return 0; |
5019 | +} |
5020 | +static inline void |
5021 | +uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) |
5022 | +{ |
5023 | + int sysrq_ch; |
5024 | + |
5025 | + sysrq_ch = port->sysrq_ch; |
5026 | + port->sysrq_ch = 0; |
5027 | + |
5028 | + spin_unlock_irqrestore(&port->lock, irqflags); |
5029 | + |
5030 | + if (sysrq_ch) |
5031 | + handle_sysrq(sysrq_ch); |
5032 | +} |
5033 | #else |
5034 | -#define uart_handle_sysrq_char(port,ch) ({ (void)port; 0; }) |
5035 | +static inline int |
5036 | +uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) { return 0; } |
5037 | +static inline int |
5038 | +uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) { return 0; } |
5039 | +static inline void |
5040 | +uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) |
5041 | +{ |
5042 | + spin_unlock_irqrestore(&port->lock, irqflags); |
5043 | +} |
5044 | #endif |
5045 | |
5046 | /* |
5047 | diff --git a/include/linux/time.h b/include/linux/time.h |
5048 | index 4cea09d94208..60fd50559241 100644 |
5049 | --- a/include/linux/time.h |
5050 | +++ b/include/linux/time.h |
5051 | @@ -275,4 +275,16 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns) |
5052 | a->tv_nsec = ns; |
5053 | } |
5054 | |
5055 | +/** |
5056 | + * time_between32 - check if a 32-bit timestamp is within a given time range |
5057 | + * @t: the time which may be within [l,h] |
5058 | + * @l: the lower bound of the range |
5059 | + * @h: the higher bound of the range |
5060 | + * |
5061 | + * time_before32(t, l, h) returns true if @l <= @t <= @h. All operands are |
5062 | + * treated as 32-bit integers. |
5063 | + * |
5064 | + * Equivalent to !(time_before32(@t, @l) || time_after32(@t, @h)). |
5065 | + */ |
5066 | +#define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l)) |
5067 | #endif |
5068 | diff --git a/include/linux/tty.h b/include/linux/tty.h |
5069 | index fe1b8623a3a1..fe483976b119 100644 |
5070 | --- a/include/linux/tty.h |
5071 | +++ b/include/linux/tty.h |
5072 | @@ -356,6 +356,7 @@ struct tty_file_private { |
5073 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ |
5074 | #define TTY_HUPPED 18 /* Post driver->hangup() */ |
5075 | #define TTY_HUPPING 19 /* Hangup in progress */ |
5076 | +#define TTY_LDISC_CHANGING 20 /* Change pending - non-block IO */ |
5077 | #define TTY_LDISC_HALTED 22 /* Line discipline is halted */ |
5078 | |
5079 | /* Values for tty->flow_change */ |
5080 | @@ -373,6 +374,12 @@ static inline void tty_set_flow_change(struct tty_struct *tty, int val) |
5081 | smp_mb(); |
5082 | } |
5083 | |
5084 | +static inline bool tty_io_nonblock(struct tty_struct *tty, struct file *file) |
5085 | +{ |
5086 | + return file->f_flags & O_NONBLOCK || |
5087 | + test_bit(TTY_LDISC_CHANGING, &tty->flags); |
5088 | +} |
5089 | + |
5090 | static inline bool tty_io_error(struct tty_struct *tty) |
5091 | { |
5092 | return test_bit(TTY_IO_ERROR, &tty->flags); |
5093 | diff --git a/include/math-emu/soft-fp.h b/include/math-emu/soft-fp.h |
5094 | index 3f284bc03180..5650c1628383 100644 |
5095 | --- a/include/math-emu/soft-fp.h |
5096 | +++ b/include/math-emu/soft-fp.h |
5097 | @@ -138,7 +138,7 @@ do { \ |
5098 | _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \ |
5099 | } while (0) |
5100 | |
5101 | -#define _FP_ROUND_ZERO(wc, X) 0 |
5102 | +#define _FP_ROUND_ZERO(wc, X) (void)0 |
5103 | |
5104 | #define _FP_ROUND_PINF(wc, X) \ |
5105 | do { \ |
5106 | diff --git a/include/net/ip.h b/include/net/ip.h |
5107 | index a3c1b9dfc9a1..d577fb5647c5 100644 |
5108 | --- a/include/net/ip.h |
5109 | +++ b/include/net/ip.h |
5110 | @@ -620,4 +620,9 @@ extern int sysctl_icmp_msgs_burst; |
5111 | int ip_misc_proc_init(void); |
5112 | #endif |
5113 | |
5114 | +static inline bool inetdev_valid_mtu(unsigned int mtu) |
5115 | +{ |
5116 | + return likely(mtu >= IPV4_MIN_MTU); |
5117 | +} |
5118 | + |
5119 | #endif /* _IP_H */ |
5120 | diff --git a/include/net/tcp.h b/include/net/tcp.h |
5121 | index 23814d997e86..0e3a88f808c6 100644 |
5122 | --- a/include/net/tcp.h |
5123 | +++ b/include/net/tcp.h |
5124 | @@ -494,19 +494,27 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb); |
5125 | */ |
5126 | static inline void tcp_synq_overflow(const struct sock *sk) |
5127 | { |
5128 | - unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp; |
5129 | + unsigned long last_overflow = READ_ONCE(tcp_sk(sk)->rx_opt.ts_recent_stamp); |
5130 | unsigned long now = jiffies; |
5131 | |
5132 | - if (time_after(now, last_overflow + HZ)) |
5133 | - tcp_sk(sk)->rx_opt.ts_recent_stamp = now; |
5134 | + if (!time_between32(now, last_overflow, last_overflow + HZ)) |
5135 | + WRITE_ONCE(tcp_sk(sk)->rx_opt.ts_recent_stamp, now); |
5136 | } |
5137 | |
5138 | /* syncookies: no recent synqueue overflow on this listening socket? */ |
5139 | static inline bool tcp_synq_no_recent_overflow(const struct sock *sk) |
5140 | { |
5141 | - unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp; |
5142 | + unsigned long last_overflow = READ_ONCE(tcp_sk(sk)->rx_opt.ts_recent_stamp); |
5143 | |
5144 | - return time_after(jiffies, last_overflow + TCP_SYNCOOKIE_VALID); |
5145 | + /* If last_overflow <= jiffies <= last_overflow + TCP_SYNCOOKIE_VALID, |
5146 | + * then we're under synflood. However, we have to use |
5147 | + * 'last_overflow - HZ' as lower bound. That's because a concurrent |
5148 | + * tcp_synq_overflow() could update .ts_recent_stamp after we read |
5149 | + * jiffies but before we store .ts_recent_stamp into last_overflow, |
5150 | + * which could lead to rejecting a valid syncookie. |
5151 | + */ |
5152 | + return !time_between32(jiffies, last_overflow - HZ, |
5153 | + last_overflow + TCP_SYNCOOKIE_VALID); |
5154 | } |
5155 | |
5156 | static inline u32 tcp_cookie_time(void) |
5157 | diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c |
5158 | index f036b6ada6ef..712469a3103a 100644 |
5159 | --- a/kernel/audit_watch.c |
5160 | +++ b/kernel/audit_watch.c |
5161 | @@ -365,12 +365,12 @@ static int audit_get_nd(struct audit_watch *watch, struct path *parent) |
5162 | struct dentry *d = kern_path_locked(watch->path, parent); |
5163 | if (IS_ERR(d)) |
5164 | return PTR_ERR(d); |
5165 | - inode_unlock(d_backing_inode(parent->dentry)); |
5166 | if (d_is_positive(d)) { |
5167 | /* update watch filter fields */ |
5168 | watch->dev = d->d_sb->s_dev; |
5169 | watch->ino = d_backing_inode(d)->i_ino; |
5170 | } |
5171 | + inode_unlock(d_backing_inode(parent->dentry)); |
5172 | dput(d); |
5173 | return 0; |
5174 | } |
5175 | diff --git a/kernel/cgroup_pids.c b/kernel/cgroup_pids.c |
5176 | index a57242e0d5a6..b8b898e21c19 100644 |
5177 | --- a/kernel/cgroup_pids.c |
5178 | +++ b/kernel/cgroup_pids.c |
5179 | @@ -48,7 +48,7 @@ struct pids_cgroup { |
5180 | * %PIDS_MAX = (%PID_MAX_LIMIT + 1). |
5181 | */ |
5182 | atomic64_t counter; |
5183 | - int64_t limit; |
5184 | + atomic64_t limit; |
5185 | |
5186 | /* Handle for "pids.events" */ |
5187 | struct cgroup_file events_file; |
5188 | @@ -76,8 +76,8 @@ pids_css_alloc(struct cgroup_subsys_state *parent) |
5189 | if (!pids) |
5190 | return ERR_PTR(-ENOMEM); |
5191 | |
5192 | - pids->limit = PIDS_MAX; |
5193 | atomic64_set(&pids->counter, 0); |
5194 | + atomic64_set(&pids->limit, PIDS_MAX); |
5195 | atomic64_set(&pids->events_limit, 0); |
5196 | return &pids->css; |
5197 | } |
5198 | @@ -149,13 +149,14 @@ static int pids_try_charge(struct pids_cgroup *pids, int num) |
5199 | |
5200 | for (p = pids; parent_pids(p); p = parent_pids(p)) { |
5201 | int64_t new = atomic64_add_return(num, &p->counter); |
5202 | + int64_t limit = atomic64_read(&p->limit); |
5203 | |
5204 | /* |
5205 | * Since new is capped to the maximum number of pid_t, if |
5206 | * p->limit is %PIDS_MAX then we know that this test will never |
5207 | * fail. |
5208 | */ |
5209 | - if (new > p->limit) |
5210 | + if (new > limit) |
5211 | goto revert; |
5212 | } |
5213 | |
5214 | @@ -280,7 +281,7 @@ set_limit: |
5215 | * Limit updates don't need to be mutex'd, since it isn't |
5216 | * critical that any racing fork()s follow the new limit. |
5217 | */ |
5218 | - pids->limit = limit; |
5219 | + atomic64_set(&pids->limit, limit); |
5220 | return nbytes; |
5221 | } |
5222 | |
5223 | @@ -288,7 +289,7 @@ static int pids_max_show(struct seq_file *sf, void *v) |
5224 | { |
5225 | struct cgroup_subsys_state *css = seq_css(sf); |
5226 | struct pids_cgroup *pids = css_pids(css); |
5227 | - int64_t limit = pids->limit; |
5228 | + int64_t limit = atomic64_read(&pids->limit); |
5229 | |
5230 | if (limit >= PIDS_MAX) |
5231 | seq_printf(sf, "%s\n", PIDS_MAX_STR); |
5232 | diff --git a/kernel/module.c b/kernel/module.c |
5233 | index fb9e07aec49e..9cb1437151ae 100644 |
5234 | --- a/kernel/module.c |
5235 | +++ b/kernel/module.c |
5236 | @@ -995,6 +995,8 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, |
5237 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); |
5238 | |
5239 | free_module(mod); |
5240 | + /* someone could wait for the module in add_unformed_module() */ |
5241 | + wake_up_all(&module_wq); |
5242 | return 0; |
5243 | out: |
5244 | mutex_unlock(&module_mutex); |
5245 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
5246 | index b765a58cf20f..5e65c7eea872 100644 |
5247 | --- a/kernel/sched/fair.c |
5248 | +++ b/kernel/sched/fair.c |
5249 | @@ -4391,20 +4391,28 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) |
5250 | if (++count > 3) { |
5251 | u64 new, old = ktime_to_ns(cfs_b->period); |
5252 | |
5253 | - new = (old * 147) / 128; /* ~115% */ |
5254 | - new = min(new, max_cfs_quota_period); |
5255 | - |
5256 | - cfs_b->period = ns_to_ktime(new); |
5257 | - |
5258 | - /* since max is 1s, this is limited to 1e9^2, which fits in u64 */ |
5259 | - cfs_b->quota *= new; |
5260 | - cfs_b->quota = div64_u64(cfs_b->quota, old); |
5261 | - |
5262 | - pr_warn_ratelimited( |
5263 | - "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n", |
5264 | - smp_processor_id(), |
5265 | - div_u64(new, NSEC_PER_USEC), |
5266 | - div_u64(cfs_b->quota, NSEC_PER_USEC)); |
5267 | + /* |
5268 | + * Grow period by a factor of 2 to avoid losing precision. |
5269 | + * Precision loss in the quota/period ratio can cause __cfs_schedulable |
5270 | + * to fail. |
5271 | + */ |
5272 | + new = old * 2; |
5273 | + if (new < max_cfs_quota_period) { |
5274 | + cfs_b->period = ns_to_ktime(new); |
5275 | + cfs_b->quota *= 2; |
5276 | + |
5277 | + pr_warn_ratelimited( |
5278 | + "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us = %lld, cfs_quota_us = %lld)\n", |
5279 | + smp_processor_id(), |
5280 | + div_u64(new, NSEC_PER_USEC), |
5281 | + div_u64(cfs_b->quota, NSEC_PER_USEC)); |
5282 | + } else { |
5283 | + pr_warn_ratelimited( |
5284 | + "cfs_period_timer[cpu%d]: period too short, but cannot scale up without losing precision (cfs_period_us = %lld, cfs_quota_us = %lld)\n", |
5285 | + smp_processor_id(), |
5286 | + div_u64(old, NSEC_PER_USEC), |
5287 | + div_u64(cfs_b->quota, NSEC_PER_USEC)); |
5288 | + } |
5289 | |
5290 | /* reset count so we don't come right back in here */ |
5291 | count = 0; |
5292 | diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
5293 | index 1961dd408bc5..7d970b565c4d 100644 |
5294 | --- a/kernel/workqueue.c |
5295 | +++ b/kernel/workqueue.c |
5296 | @@ -2344,8 +2344,14 @@ repeat: |
5297 | */ |
5298 | if (need_to_create_worker(pool)) { |
5299 | spin_lock(&wq_mayday_lock); |
5300 | - get_pwq(pwq); |
5301 | - list_move_tail(&pwq->mayday_node, &wq->maydays); |
5302 | + /* |
5303 | + * Queue iff we aren't racing destruction |
5304 | + * and somebody else hasn't queued it already. |
5305 | + */ |
5306 | + if (wq->rescuer && list_empty(&pwq->mayday_node)) { |
5307 | + get_pwq(pwq); |
5308 | + list_add_tail(&pwq->mayday_node, &wq->maydays); |
5309 | + } |
5310 | spin_unlock(&wq_mayday_lock); |
5311 | } |
5312 | } |
5313 | @@ -4031,9 +4037,29 @@ void destroy_workqueue(struct workqueue_struct *wq) |
5314 | struct pool_workqueue *pwq; |
5315 | int node; |
5316 | |
5317 | + /* |
5318 | + * Remove it from sysfs first so that sanity check failure doesn't |
5319 | + * lead to sysfs name conflicts. |
5320 | + */ |
5321 | + workqueue_sysfs_unregister(wq); |
5322 | + |
5323 | /* drain it before proceeding with destruction */ |
5324 | drain_workqueue(wq); |
5325 | |
5326 | + /* kill rescuer, if sanity checks fail, leave it w/o rescuer */ |
5327 | + if (wq->rescuer) { |
5328 | + struct worker *rescuer = wq->rescuer; |
5329 | + |
5330 | + /* this prevents new queueing */ |
5331 | + spin_lock_irq(&wq_mayday_lock); |
5332 | + wq->rescuer = NULL; |
5333 | + spin_unlock_irq(&wq_mayday_lock); |
5334 | + |
5335 | + /* rescuer will empty maydays list before exiting */ |
5336 | + kthread_stop(rescuer->task); |
5337 | + kfree(rescuer); |
5338 | + } |
5339 | + |
5340 | /* sanity checks */ |
5341 | mutex_lock(&wq->mutex); |
5342 | for_each_pwq(pwq, wq) { |
5343 | @@ -4063,11 +4089,6 @@ void destroy_workqueue(struct workqueue_struct *wq) |
5344 | list_del_rcu(&wq->list); |
5345 | mutex_unlock(&wq_pool_mutex); |
5346 | |
5347 | - workqueue_sysfs_unregister(wq); |
5348 | - |
5349 | - if (wq->rescuer) |
5350 | - kthread_stop(wq->rescuer->task); |
5351 | - |
5352 | if (!(wq->flags & WQ_UNBOUND)) { |
5353 | /* |
5354 | * The base ref is never dropped on per-cpu pwqs. Directly |
5355 | @@ -4344,7 +4365,8 @@ static void show_pwq(struct pool_workqueue *pwq) |
5356 | pr_info(" pwq %d:", pool->id); |
5357 | pr_cont_pool_info(pool); |
5358 | |
5359 | - pr_cont(" active=%d/%d%s\n", pwq->nr_active, pwq->max_active, |
5360 | + pr_cont(" active=%d/%d refcnt=%d%s\n", |
5361 | + pwq->nr_active, pwq->max_active, pwq->refcnt, |
5362 | !list_empty(&pwq->mayday_node) ? " MAYDAY" : ""); |
5363 | |
5364 | hash_for_each(pool->busy_hash, bkt, worker, hentry) { |
5365 | diff --git a/lib/raid6/unroll.awk b/lib/raid6/unroll.awk |
5366 | index c6aa03631df8..0809805a7e23 100644 |
5367 | --- a/lib/raid6/unroll.awk |
5368 | +++ b/lib/raid6/unroll.awk |
5369 | @@ -13,7 +13,7 @@ BEGIN { |
5370 | for (i = 0; i < rep; ++i) { |
5371 | tmp = $0 |
5372 | gsub(/\$\$/, i, tmp) |
5373 | - gsub(/\$\#/, n, tmp) |
5374 | + gsub(/\$#/, n, tmp) |
5375 | gsub(/\$\*/, "$", tmp) |
5376 | print tmp |
5377 | } |
5378 | diff --git a/mm/shmem.c b/mm/shmem.c |
5379 | index 6266a7d1ba00..90ccbb35458b 100644 |
5380 | --- a/mm/shmem.c |
5381 | +++ b/mm/shmem.c |
5382 | @@ -2695,7 +2695,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset, |
5383 | } |
5384 | |
5385 | shmem_falloc.waitq = &shmem_falloc_waitq; |
5386 | - shmem_falloc.start = unmap_start >> PAGE_SHIFT; |
5387 | + shmem_falloc.start = (u64)unmap_start >> PAGE_SHIFT; |
5388 | shmem_falloc.next = (unmap_end + 1) >> PAGE_SHIFT; |
5389 | spin_lock(&inode->i_lock); |
5390 | inode->i_private = &shmem_falloc; |
5391 | diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c |
5392 | index 8ad3ec2610b6..b9e85a4751a6 100644 |
5393 | --- a/net/appletalk/aarp.c |
5394 | +++ b/net/appletalk/aarp.c |
5395 | @@ -879,15 +879,24 @@ static struct notifier_block aarp_notifier = { |
5396 | |
5397 | static unsigned char aarp_snap_id[] = { 0x00, 0x00, 0x00, 0x80, 0xF3 }; |
5398 | |
5399 | -void __init aarp_proto_init(void) |
5400 | +int __init aarp_proto_init(void) |
5401 | { |
5402 | + int rc; |
5403 | + |
5404 | aarp_dl = register_snap_client(aarp_snap_id, aarp_rcv); |
5405 | - if (!aarp_dl) |
5406 | + if (!aarp_dl) { |
5407 | printk(KERN_CRIT "Unable to register AARP with SNAP.\n"); |
5408 | + return -ENOMEM; |
5409 | + } |
5410 | setup_timer(&aarp_timer, aarp_expire_timeout, 0); |
5411 | aarp_timer.expires = jiffies + sysctl_aarp_expiry_time; |
5412 | add_timer(&aarp_timer); |
5413 | - register_netdevice_notifier(&aarp_notifier); |
5414 | + rc = register_netdevice_notifier(&aarp_notifier); |
5415 | + if (rc) { |
5416 | + del_timer_sync(&aarp_timer); |
5417 | + unregister_snap_client(aarp_dl); |
5418 | + } |
5419 | + return rc; |
5420 | } |
5421 | |
5422 | /* Remove the AARP entries associated with a device. */ |
5423 | diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c |
5424 | index d74092cc639a..93209c009df5 100644 |
5425 | --- a/net/appletalk/ddp.c |
5426 | +++ b/net/appletalk/ddp.c |
5427 | @@ -1911,9 +1911,6 @@ static unsigned char ddp_snap_id[] = { 0x08, 0x00, 0x07, 0x80, 0x9B }; |
5428 | EXPORT_SYMBOL(atrtr_get_dev); |
5429 | EXPORT_SYMBOL(atalk_find_dev_addr); |
5430 | |
5431 | -static const char atalk_err_snap[] __initconst = |
5432 | - KERN_CRIT "Unable to register DDP with SNAP.\n"; |
5433 | - |
5434 | /* Called by proto.c on kernel start up */ |
5435 | static int __init atalk_init(void) |
5436 | { |
5437 | @@ -1928,17 +1925,23 @@ static int __init atalk_init(void) |
5438 | goto out_proto; |
5439 | |
5440 | ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv); |
5441 | - if (!ddp_dl) |
5442 | - printk(atalk_err_snap); |
5443 | + if (!ddp_dl) { |
5444 | + pr_crit("Unable to register DDP with SNAP.\n"); |
5445 | + rc = -ENOMEM; |
5446 | + goto out_sock; |
5447 | + } |
5448 | |
5449 | dev_add_pack(<alk_packet_type); |
5450 | dev_add_pack(&ppptalk_packet_type); |
5451 | |
5452 | rc = register_netdevice_notifier(&ddp_notifier); |
5453 | if (rc) |
5454 | - goto out_sock; |
5455 | + goto out_snap; |
5456 | + |
5457 | + rc = aarp_proto_init(); |
5458 | + if (rc) |
5459 | + goto out_dev; |
5460 | |
5461 | - aarp_proto_init(); |
5462 | rc = atalk_proc_init(); |
5463 | if (rc) |
5464 | goto out_aarp; |
5465 | @@ -1952,11 +1955,13 @@ out_proc: |
5466 | atalk_proc_exit(); |
5467 | out_aarp: |
5468 | aarp_cleanup_module(); |
5469 | +out_dev: |
5470 | unregister_netdevice_notifier(&ddp_notifier); |
5471 | -out_sock: |
5472 | +out_snap: |
5473 | dev_remove_pack(&ppptalk_packet_type); |
5474 | dev_remove_pack(<alk_packet_type); |
5475 | unregister_snap_client(ddp_dl); |
5476 | +out_sock: |
5477 | sock_unregister(PF_APPLETALK); |
5478 | out_proto: |
5479 | proto_unregister(&ddp_proto); |
5480 | diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c |
5481 | index 5f5e28f210e0..928bd5515f02 100644 |
5482 | --- a/net/bridge/br_device.c |
5483 | +++ b/net/bridge/br_device.c |
5484 | @@ -210,6 +210,12 @@ static int br_set_mac_address(struct net_device *dev, void *p) |
5485 | if (!is_valid_ether_addr(addr->sa_data)) |
5486 | return -EADDRNOTAVAIL; |
5487 | |
5488 | + /* dev_set_mac_addr() can be called by a master device on bridge's |
5489 | + * NETDEV_UNREGISTER, but since it's being destroyed do nothing |
5490 | + */ |
5491 | + if (dev->reg_state != NETREG_REGISTERED) |
5492 | + return -EBUSY; |
5493 | + |
5494 | spin_lock_bh(&br->lock); |
5495 | if (!ether_addr_equal(dev->dev_addr, addr->sa_data)) { |
5496 | /* Mac address will be changed in br_stp_change_bridge_id(). */ |
5497 | diff --git a/net/core/dev.c b/net/core/dev.c |
5498 | index c6fb7e61cb40..842654302110 100644 |
5499 | --- a/net/core/dev.c |
5500 | +++ b/net/core/dev.c |
5501 | @@ -6584,7 +6584,8 @@ static int __dev_set_mtu(struct net_device *dev, int new_mtu) |
5502 | if (ops->ndo_change_mtu) |
5503 | return ops->ndo_change_mtu(dev, new_mtu); |
5504 | |
5505 | - dev->mtu = new_mtu; |
5506 | + /* Pairs with all the lockless reads of dev->mtu in the stack */ |
5507 | + WRITE_ONCE(dev->mtu, new_mtu); |
5508 | return 0; |
5509 | } |
5510 | |
5511 | diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c |
5512 | index 93438113d136..6c873cb829ca 100644 |
5513 | --- a/net/ipv4/devinet.c |
5514 | +++ b/net/ipv4/devinet.c |
5515 | @@ -1386,11 +1386,6 @@ skip: |
5516 | } |
5517 | } |
5518 | |
5519 | -static bool inetdev_valid_mtu(unsigned int mtu) |
5520 | -{ |
5521 | - return mtu >= IPV4_MIN_MTU; |
5522 | -} |
5523 | - |
5524 | static void inetdev_send_gratuitous_arp(struct net_device *dev, |
5525 | struct in_device *in_dev) |
5526 | |
5527 | diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c |
5528 | index 7f1a85c6a614..4f3decbe6a3a 100644 |
5529 | --- a/net/ipv4/ip_output.c |
5530 | +++ b/net/ipv4/ip_output.c |
5531 | @@ -1159,13 +1159,17 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, |
5532 | rt = *rtp; |
5533 | if (unlikely(!rt)) |
5534 | return -EFAULT; |
5535 | - /* |
5536 | - * We steal reference to this route, caller should not release it |
5537 | - */ |
5538 | - *rtp = NULL; |
5539 | + |
5540 | cork->fragsize = ip_sk_use_pmtu(sk) ? |
5541 | - dst_mtu(&rt->dst) : rt->dst.dev->mtu; |
5542 | + dst_mtu(&rt->dst) : READ_ONCE(rt->dst.dev->mtu); |
5543 | + |
5544 | + if (!inetdev_valid_mtu(cork->fragsize)) |
5545 | + return -ENETUNREACH; |
5546 | + |
5547 | cork->dst = &rt->dst; |
5548 | + /* We stole this route, caller should not release it. */ |
5549 | + *rtp = NULL; |
5550 | + |
5551 | cork->length = 0; |
5552 | cork->ttl = ipc->ttl; |
5553 | cork->tos = ipc->tos; |
5554 | diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c |
5555 | index 2e77e78ab226..73766c9c485d 100644 |
5556 | --- a/net/ipv4/tcp_output.c |
5557 | +++ b/net/ipv4/tcp_output.c |
5558 | @@ -707,8 +707,9 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb |
5559 | min_t(unsigned int, eff_sacks, |
5560 | (remaining - TCPOLEN_SACK_BASE_ALIGNED) / |
5561 | TCPOLEN_SACK_PERBLOCK); |
5562 | - size += TCPOLEN_SACK_BASE_ALIGNED + |
5563 | - opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK; |
5564 | + if (likely(opts->num_sack_blocks)) |
5565 | + size += TCPOLEN_SACK_BASE_ALIGNED + |
5566 | + opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK; |
5567 | } |
5568 | |
5569 | return size; |
5570 | diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c |
5571 | index d9e364c4863a..761a198ed5f3 100644 |
5572 | --- a/net/ipv4/tcp_timer.c |
5573 | +++ b/net/ipv4/tcp_timer.c |
5574 | @@ -372,7 +372,7 @@ static void tcp_probe_timer(struct sock *sk) |
5575 | return; |
5576 | } |
5577 | |
5578 | - if (icsk->icsk_probes_out > max_probes) { |
5579 | + if (icsk->icsk_probes_out >= max_probes) { |
5580 | abort: tcp_write_err(sk); |
5581 | } else { |
5582 | /* Only send another probe if we didn't close things up. */ |
5583 | @@ -478,11 +478,12 @@ void tcp_retransmit_timer(struct sock *sk) |
5584 | goto out_reset_timer; |
5585 | } |
5586 | |
5587 | + __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPTIMEOUTS); |
5588 | if (tcp_write_timeout(sk)) |
5589 | goto out; |
5590 | |
5591 | if (icsk->icsk_retransmits == 0) { |
5592 | - int mib_idx; |
5593 | + int mib_idx = 0; |
5594 | |
5595 | if (icsk->icsk_ca_state == TCP_CA_Recovery) { |
5596 | if (tcp_is_sack(tp)) |
5597 | @@ -497,10 +498,9 @@ void tcp_retransmit_timer(struct sock *sk) |
5598 | mib_idx = LINUX_MIB_TCPSACKFAILURES; |
5599 | else |
5600 | mib_idx = LINUX_MIB_TCPRENOFAILURES; |
5601 | - } else { |
5602 | - mib_idx = LINUX_MIB_TCPTIMEOUTS; |
5603 | } |
5604 | - __NET_INC_STATS(sock_net(sk), mib_idx); |
5605 | + if (mib_idx) |
5606 | + __NET_INC_STATS(sock_net(sk), mib_idx); |
5607 | } |
5608 | |
5609 | tcp_enter_loss(sk); |
5610 | diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c |
5611 | index 02d6f38f7869..beb2897d8ddf 100644 |
5612 | --- a/net/openvswitch/conntrack.c |
5613 | +++ b/net/openvswitch/conntrack.c |
5614 | @@ -709,6 +709,17 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, |
5615 | } |
5616 | err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype); |
5617 | |
5618 | + if (err == NF_ACCEPT && |
5619 | + ct->status & IPS_SRC_NAT && ct->status & IPS_DST_NAT) { |
5620 | + if (maniptype == NF_NAT_MANIP_SRC) |
5621 | + maniptype = NF_NAT_MANIP_DST; |
5622 | + else |
5623 | + maniptype = NF_NAT_MANIP_SRC; |
5624 | + |
5625 | + err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, |
5626 | + maniptype); |
5627 | + } |
5628 | + |
5629 | /* Mark NAT done if successful and update the flow key. */ |
5630 | if (err == NF_ACCEPT) |
5631 | ovs_nat_update_key(key, skb, maniptype); |
5632 | diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c |
5633 | index cdcc0fea9f5a..24e42919a480 100644 |
5634 | --- a/net/sunrpc/cache.c |
5635 | +++ b/net/sunrpc/cache.c |
5636 | @@ -54,9 +54,6 @@ static void cache_init(struct cache_head *h, struct cache_detail *detail) |
5637 | h->last_refresh = now; |
5638 | } |
5639 | |
5640 | -static inline int cache_is_valid(struct cache_head *h); |
5641 | -static void cache_fresh_locked(struct cache_head *head, time_t expiry, |
5642 | - struct cache_detail *detail); |
5643 | static void cache_fresh_unlocked(struct cache_head *head, |
5644 | struct cache_detail *detail); |
5645 | |
5646 | @@ -101,9 +98,6 @@ struct cache_head *sunrpc_cache_lookup(struct cache_detail *detail, |
5647 | if (cache_is_expired(detail, tmp)) { |
5648 | hlist_del_init(&tmp->cache_list); |
5649 | detail->entries --; |
5650 | - if (cache_is_valid(tmp) == -EAGAIN) |
5651 | - set_bit(CACHE_NEGATIVE, &tmp->flags); |
5652 | - cache_fresh_locked(tmp, 0, detail); |
5653 | freeme = tmp; |
5654 | break; |
5655 | } |
5656 | diff --git a/net/tipc/core.c b/net/tipc/core.c |
5657 | index 59980dea2ad7..799900c0f2c9 100644 |
5658 | --- a/net/tipc/core.c |
5659 | +++ b/net/tipc/core.c |
5660 | @@ -116,14 +116,6 @@ static int __init tipc_init(void) |
5661 | sysctl_tipc_rmem[1] = RCVBUF_DEF; |
5662 | sysctl_tipc_rmem[2] = RCVBUF_MAX; |
5663 | |
5664 | - err = tipc_netlink_start(); |
5665 | - if (err) |
5666 | - goto out_netlink; |
5667 | - |
5668 | - err = tipc_netlink_compat_start(); |
5669 | - if (err) |
5670 | - goto out_netlink_compat; |
5671 | - |
5672 | err = tipc_register_sysctl(); |
5673 | if (err) |
5674 | goto out_sysctl; |
5675 | @@ -144,8 +136,21 @@ static int __init tipc_init(void) |
5676 | if (err) |
5677 | goto out_bearer; |
5678 | |
5679 | + err = tipc_netlink_start(); |
5680 | + if (err) |
5681 | + goto out_netlink; |
5682 | + |
5683 | + err = tipc_netlink_compat_start(); |
5684 | + if (err) |
5685 | + goto out_netlink_compat; |
5686 | + |
5687 | pr_info("Started in single node mode\n"); |
5688 | return 0; |
5689 | + |
5690 | +out_netlink_compat: |
5691 | + tipc_netlink_stop(); |
5692 | +out_netlink: |
5693 | + tipc_bearer_cleanup(); |
5694 | out_bearer: |
5695 | unregister_pernet_device(&tipc_topsrv_net_ops); |
5696 | out_pernet_topsrv: |
5697 | @@ -155,22 +160,18 @@ out_socket: |
5698 | out_pernet: |
5699 | tipc_unregister_sysctl(); |
5700 | out_sysctl: |
5701 | - tipc_netlink_compat_stop(); |
5702 | -out_netlink_compat: |
5703 | - tipc_netlink_stop(); |
5704 | -out_netlink: |
5705 | pr_err("Unable to start in single node mode\n"); |
5706 | return err; |
5707 | } |
5708 | |
5709 | static void __exit tipc_exit(void) |
5710 | { |
5711 | + tipc_netlink_compat_stop(); |
5712 | + tipc_netlink_stop(); |
5713 | tipc_bearer_cleanup(); |
5714 | unregister_pernet_device(&tipc_topsrv_net_ops); |
5715 | tipc_socket_stop(); |
5716 | unregister_pernet_device(&tipc_net_ops); |
5717 | - tipc_netlink_stop(); |
5718 | - tipc_netlink_compat_stop(); |
5719 | tipc_unregister_sysctl(); |
5720 | |
5721 | pr_info("Deactivated\n"); |
5722 | diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c |
5723 | index 770ababb8f92..6c2560f3f95b 100644 |
5724 | --- a/net/x25/af_x25.c |
5725 | +++ b/net/x25/af_x25.c |
5726 | @@ -100,7 +100,7 @@ int x25_parse_address_block(struct sk_buff *skb, |
5727 | } |
5728 | |
5729 | len = *skb->data; |
5730 | - needed = 1 + (len >> 4) + (len & 0x0f); |
5731 | + needed = 1 + ((len >> 4) + (len & 0x0f) + 1) / 2; |
5732 | |
5733 | if (!pskb_may_pull(skb, needed)) { |
5734 | /* packet is too short to hold the addresses it claims |
5735 | @@ -288,7 +288,7 @@ static struct sock *x25_find_listener(struct x25_address *addr, |
5736 | sk_for_each(s, &x25_list) |
5737 | if ((!strcmp(addr->x25_addr, |
5738 | x25_sk(s)->source_addr.x25_addr) || |
5739 | - !strcmp(addr->x25_addr, |
5740 | + !strcmp(x25_sk(s)->source_addr.x25_addr, |
5741 | null_x25_address.x25_addr)) && |
5742 | s->sk_state == TCP_LISTEN) { |
5743 | /* |
5744 | @@ -684,11 +684,15 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
5745 | goto out; |
5746 | } |
5747 | |
5748 | - len = strlen(addr->sx25_addr.x25_addr); |
5749 | - for (i = 0; i < len; i++) { |
5750 | - if (!isdigit(addr->sx25_addr.x25_addr[i])) { |
5751 | - rc = -EINVAL; |
5752 | - goto out; |
5753 | + /* check for the null_x25_address */ |
5754 | + if (strcmp(addr->sx25_addr.x25_addr, null_x25_address.x25_addr)) { |
5755 | + |
5756 | + len = strlen(addr->sx25_addr.x25_addr); |
5757 | + for (i = 0; i < len; i++) { |
5758 | + if (!isdigit(addr->sx25_addr.x25_addr[i])) { |
5759 | + rc = -EINVAL; |
5760 | + goto out; |
5761 | + } |
5762 | } |
5763 | } |
5764 | |
5765 | diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c |
5766 | index fdf5bbfd00cd..9abcdf2e8dfe 100644 |
5767 | --- a/scripts/mod/modpost.c |
5768 | +++ b/scripts/mod/modpost.c |
5769 | @@ -1157,6 +1157,14 @@ static const struct sectioncheck *section_mismatch( |
5770 | * fromsec = text section |
5771 | * refsymname = *.constprop.* |
5772 | * |
5773 | + * Pattern 6: |
5774 | + * Hide section mismatch warnings for ELF local symbols. The goal |
5775 | + * is to eliminate false positive modpost warnings caused by |
5776 | + * compiler-generated ELF local symbol names such as ".LANCHOR1". |
5777 | + * Autogenerated symbol names bypass modpost's "Pattern 2" |
5778 | + * whitelisting, which relies on pattern-matching against symbol |
5779 | + * names to work. (One situation where gcc can autogenerate ELF |
5780 | + * local symbols is when "-fsection-anchors" is used.) |
5781 | **/ |
5782 | static int secref_whitelist(const struct sectioncheck *mismatch, |
5783 | const char *fromsec, const char *fromsym, |
5784 | @@ -1195,6 +1203,10 @@ static int secref_whitelist(const struct sectioncheck *mismatch, |
5785 | match(fromsym, optim_symbols)) |
5786 | return 0; |
5787 | |
5788 | + /* Check for pattern 6 */ |
5789 | + if (strstarts(fromsym, ".L")) |
5790 | + return 0; |
5791 | + |
5792 | return 1; |
5793 | } |
5794 | |
5795 | diff --git a/sound/core/oss/linear.c b/sound/core/oss/linear.c |
5796 | index 2045697f449d..797d838a2f9e 100644 |
5797 | --- a/sound/core/oss/linear.c |
5798 | +++ b/sound/core/oss/linear.c |
5799 | @@ -107,6 +107,8 @@ static snd_pcm_sframes_t linear_transfer(struct snd_pcm_plugin *plugin, |
5800 | } |
5801 | } |
5802 | #endif |
5803 | + if (frames > dst_channels[0].frames) |
5804 | + frames = dst_channels[0].frames; |
5805 | convert(plugin, src_channels, dst_channels, frames); |
5806 | return frames; |
5807 | } |
5808 | diff --git a/sound/core/oss/mulaw.c b/sound/core/oss/mulaw.c |
5809 | index 7915564bd394..3788906421a7 100644 |
5810 | --- a/sound/core/oss/mulaw.c |
5811 | +++ b/sound/core/oss/mulaw.c |
5812 | @@ -269,6 +269,8 @@ static snd_pcm_sframes_t mulaw_transfer(struct snd_pcm_plugin *plugin, |
5813 | } |
5814 | } |
5815 | #endif |
5816 | + if (frames > dst_channels[0].frames) |
5817 | + frames = dst_channels[0].frames; |
5818 | data = (struct mulaw_priv *)plugin->extra_data; |
5819 | data->func(plugin, src_channels, dst_channels, frames); |
5820 | return frames; |
5821 | diff --git a/sound/core/oss/route.c b/sound/core/oss/route.c |
5822 | index c8171f5783c8..72dea04197ef 100644 |
5823 | --- a/sound/core/oss/route.c |
5824 | +++ b/sound/core/oss/route.c |
5825 | @@ -57,6 +57,8 @@ static snd_pcm_sframes_t route_transfer(struct snd_pcm_plugin *plugin, |
5826 | return -ENXIO; |
5827 | if (frames == 0) |
5828 | return 0; |
5829 | + if (frames > dst_channels[0].frames) |
5830 | + frames = dst_channels[0].frames; |
5831 | |
5832 | nsrcs = plugin->src_format.channels; |
5833 | ndsts = plugin->dst_format.channels; |
5834 | diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c |
5835 | index 3acb373674c3..f09ae7efc695 100644 |
5836 | --- a/sound/core/pcm_lib.c |
5837 | +++ b/sound/core/pcm_lib.c |
5838 | @@ -1877,11 +1877,14 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream) |
5839 | struct snd_pcm_runtime *runtime; |
5840 | unsigned long flags; |
5841 | |
5842 | - if (PCM_RUNTIME_CHECK(substream)) |
5843 | + if (snd_BUG_ON(!substream)) |
5844 | return; |
5845 | - runtime = substream->runtime; |
5846 | |
5847 | snd_pcm_stream_lock_irqsave(substream, flags); |
5848 | + if (PCM_RUNTIME_CHECK(substream)) |
5849 | + goto _unlock; |
5850 | + runtime = substream->runtime; |
5851 | + |
5852 | if (!snd_pcm_running(substream) || |
5853 | snd_pcm_update_hw_ptr0(substream, 1) < 0) |
5854 | goto _end; |
5855 | @@ -1892,6 +1895,7 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream) |
5856 | #endif |
5857 | _end: |
5858 | kill_fasync(&runtime->fasync, SIGIO, POLL_IN); |
5859 | + _unlock: |
5860 | snd_pcm_stream_unlock_irqrestore(substream, flags); |
5861 | } |
5862 | |
5863 | diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c |
5864 | index 7ea201c05e5d..d0d6dfbfcfdf 100644 |
5865 | --- a/sound/pci/hda/hda_bind.c |
5866 | +++ b/sound/pci/hda/hda_bind.c |
5867 | @@ -42,6 +42,10 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev) |
5868 | { |
5869 | struct hda_codec *codec = container_of(dev, struct hda_codec, core); |
5870 | |
5871 | + /* ignore unsol events during shutdown */ |
5872 | + if (codec->bus->shutdown) |
5873 | + return; |
5874 | + |
5875 | if (codec->patch_ops.unsol_event) |
5876 | codec->patch_ops.unsol_event(codec, ev); |
5877 | } |
5878 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
5879 | index f2f1d9fd848c..3234e9ca02ce 100644 |
5880 | --- a/sound/pci/hda/hda_intel.c |
5881 | +++ b/sound/pci/hda/hda_intel.c |
5882 | @@ -1275,8 +1275,11 @@ static int azx_free(struct azx *chip) |
5883 | static int azx_dev_disconnect(struct snd_device *device) |
5884 | { |
5885 | struct azx *chip = device->device_data; |
5886 | + struct hdac_bus *bus = azx_bus(chip); |
5887 | |
5888 | chip->bus.shutdown = 1; |
5889 | + cancel_work_sync(&bus->unsol_work); |
5890 | + |
5891 | return 0; |
5892 | } |
5893 | |
5894 | diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c |
5895 | index fbaa1bb41102..00d7902ad427 100644 |
5896 | --- a/sound/soc/soc-jack.c |
5897 | +++ b/sound/soc/soc-jack.c |
5898 | @@ -80,10 +80,9 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) |
5899 | unsigned int sync = 0; |
5900 | int enable; |
5901 | |
5902 | - trace_snd_soc_jack_report(jack, mask, status); |
5903 | - |
5904 | if (!jack) |
5905 | return; |
5906 | + trace_snd_soc_jack_report(jack, mask, status); |
5907 | |
5908 | dapm = &jack->card->dapm; |
5909 |