diff options
-rw-r--r-- | 0000_README | 4 | ||||
-rw-r--r-- | 1202_linux-4.9.203.patch | 6484 |
2 files changed, 6488 insertions, 0 deletions
diff --git a/0000_README b/0000_README index 33f58586..fed0c831 100644 --- a/0000_README +++ b/0000_README @@ -851,6 +851,10 @@ Patch: 1201_linux-4.9.202.patch From: http://www.kernel.org Desc: Linux 4.9.202 +Patch: 1202_linux-4.9.203.patch +From: http://www.kernel.org +Desc: Linux 4.9.203 + Patch: 1500_XATTR_USER_PREFIX.patch From: https://bugs.gentoo.org/show_bug.cgi?id=470644 Desc: Support for namespace user.pax.* on tmpfs. diff --git a/1202_linux-4.9.203.patch b/1202_linux-4.9.203.patch new file mode 100644 index 00000000..edf7158f --- /dev/null +++ b/1202_linux-4.9.203.patch @@ -0,0 +1,6484 @@ +diff --git a/Makefile b/Makefile +index 1e322e669301..174c0e2526ac 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + VERSION = 4 + PATCHLEVEL = 9 +-SUBLEVEL = 202 ++SUBLEVEL = 203 + EXTRAVERSION = + NAME = Roaring Lionus + +diff --git a/arch/arm/boot/compressed/libfdt_env.h b/arch/arm/boot/compressed/libfdt_env.h +index 17ae0f3efac8..005bf4ff1b4c 100644 +--- a/arch/arm/boot/compressed/libfdt_env.h ++++ b/arch/arm/boot/compressed/libfdt_env.h +@@ -5,6 +5,8 @@ + #include <linux/string.h> + #include <asm/byteorder.h> + ++#define INT_MAX ((int)(~0U>>1)) ++ + typedef __be16 fdt16_t; + typedef __be32 fdt32_t; + typedef __be64 fdt64_t; +diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts +index e82432c79f85..3f3ad09c7cd5 100644 +--- a/arch/arm/boot/dts/am335x-evm.dts ++++ b/arch/arm/boot/dts/am335x-evm.dts +@@ -701,6 +701,7 @@ + pinctrl-0 = <&cpsw_default>; + pinctrl-1 = <&cpsw_sleep>; + status = "okay"; ++ slaves = <1>; + }; + + &davinci_mdio { +@@ -708,15 +709,14 @@ + pinctrl-0 = <&davinci_mdio_default>; + pinctrl-1 = <&davinci_mdio_sleep>; + status = "okay"; +-}; + +-&cpsw_emac0 { +- phy_id = <&davinci_mdio>, <0>; +- phy-mode = "rgmii-txid"; ++ ethphy0: ethernet-phy@0 { ++ reg = <0>; ++ }; + }; + +-&cpsw_emac1 { +- phy_id = <&davinci_mdio>, <1>; ++&cpsw_emac0 { ++ phy-handle = <ðphy0>; + phy-mode = "rgmii-txid"; + }; + +diff --git a/arch/arm/boot/dts/arm-realview-eb.dtsi b/arch/arm/boot/dts/arm-realview-eb.dtsi +index e2e9599596e2..05379b6c1c13 100644 +--- a/arch/arm/boot/dts/arm-realview-eb.dtsi ++++ b/arch/arm/boot/dts/arm-realview-eb.dtsi +@@ -334,7 +334,7 @@ + clock-names = "uartclk", "apb_pclk"; + }; + +- ssp: ssp@1000d000 { ++ ssp: spi@1000d000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x1000d000 0x1000>; + clocks = <&sspclk>, <&pclk>; +diff --git a/arch/arm/boot/dts/arm-realview-pb1176.dts b/arch/arm/boot/dts/arm-realview-pb1176.dts +index c789564f2803..c1fd5615ddfe 100644 +--- a/arch/arm/boot/dts/arm-realview-pb1176.dts ++++ b/arch/arm/boot/dts/arm-realview-pb1176.dts +@@ -343,7 +343,7 @@ + clock-names = "apb_pclk"; + }; + +- pb1176_ssp: ssp@1010b000 { ++ pb1176_ssp: spi@1010b000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x1010b000 0x1000>; + interrupt-parent = <&intc_dc1176>; +diff --git a/arch/arm/boot/dts/arm-realview-pb11mp.dts b/arch/arm/boot/dts/arm-realview-pb11mp.dts +index 3944765ac4b0..e306f1cceb4e 100644 +--- a/arch/arm/boot/dts/arm-realview-pb11mp.dts ++++ b/arch/arm/boot/dts/arm-realview-pb11mp.dts +@@ -480,7 +480,7 @@ + clock-names = "uartclk", "apb_pclk"; + }; + +- ssp@1000d000 { ++ spi@1000d000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x1000d000 0x1000>; + interrupt-parent = <&intc_pb11mp>; +diff --git a/arch/arm/boot/dts/arm-realview-pbx.dtsi b/arch/arm/boot/dts/arm-realview-pbx.dtsi +index aeb49c4bd773..2bf3958b2e6b 100644 +--- a/arch/arm/boot/dts/arm-realview-pbx.dtsi ++++ b/arch/arm/boot/dts/arm-realview-pbx.dtsi +@@ -318,7 +318,7 @@ + clock-names = "uartclk", "apb_pclk"; + }; + +- ssp: ssp@1000d000 { ++ ssp: spi@1000d000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x1000d000 0x1000>; + clocks = <&sspclk>, <&pclk>; +diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi +index b3501ae2a3bd..4fba898b8f4f 100644 +--- a/arch/arm/boot/dts/at91sam9g45.dtsi ++++ b/arch/arm/boot/dts/at91sam9g45.dtsi +@@ -546,7 +546,7 @@ + }; + }; + +- uart1 { ++ usart1 { + pinctrl_usart1: usart1-0 { + atmel,pins = + <AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB4 periph A with pullup */ +diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts +index af3cb633135f..ee32315e3d3a 100644 +--- a/arch/arm/boot/dts/dove-cubox.dts ++++ b/arch/arm/boot/dts/dove-cubox.dts +@@ -86,7 +86,7 @@ + status = "okay"; + clock-frequency = <100000>; + +- si5351: clock-generator { ++ si5351: clock-generator@60 { + compatible = "silabs,si5351a-msop"; + reg = <0x60>; + #address-cells = <1>; +diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi +index 698d58cea20d..11342aeccb73 100644 +--- a/arch/arm/boot/dts/dove.dtsi ++++ b/arch/arm/boot/dts/dove.dtsi +@@ -152,7 +152,7 @@ + 0xffffe000 MBUS_ID(0x03, 0x01) 0 0x0000800 /* CESA SRAM 2k */ + 0xfffff000 MBUS_ID(0x0d, 0x00) 0 0x0000800>; /* PMU SRAM 2k */ + +- spi0: spi-ctrl@10600 { ++ spi0: spi@10600 { + compatible = "marvell,orion-spi"; + #address-cells = <1>; + #size-cells = <0>; +@@ -165,7 +165,7 @@ + status = "disabled"; + }; + +- i2c: i2c-ctrl@11000 { ++ i2c: i2c@11000 { + compatible = "marvell,mv64xxx-i2c"; + reg = <0x11000 0x20>; + #address-cells = <1>; +@@ -215,7 +215,7 @@ + status = "disabled"; + }; + +- spi1: spi-ctrl@14600 { ++ spi1: spi@14600 { + compatible = "marvell,orion-spi"; + #address-cells = <1>; + #size-cells = <0>; +diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts +index 6098dacd09f1..1b2709af2a42 100644 +--- a/arch/arm/boot/dts/exynos5250-arndale.dts ++++ b/arch/arm/boot/dts/exynos5250-arndale.dts +@@ -170,6 +170,8 @@ + reg = <0x66>; + interrupt-parent = <&gpx3>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&s5m8767_irq>; + + vinb1-supply = <&main_dc_reg>; + vinb2-supply = <&main_dc_reg>; +@@ -547,6 +549,13 @@ + cap-sd-highspeed; + }; + ++&pinctrl_0 { ++ s5m8767_irq: s5m8767-irq { ++ samsung,pins = "gpx3-2"; ++ samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; ++ }; ++}; ++ + &rtc { + status = "okay"; + }; +diff --git a/arch/arm/boot/dts/exynos5250-snow-rev5.dts b/arch/arm/boot/dts/exynos5250-snow-rev5.dts +index 90560c316f64..cb986175b69b 100644 +--- a/arch/arm/boot/dts/exynos5250-snow-rev5.dts ++++ b/arch/arm/boot/dts/exynos5250-snow-rev5.dts +@@ -23,6 +23,14 @@ + + samsung,model = "Snow-I2S-MAX98090"; + samsung,audio-codec = <&max98090>; ++ ++ cpu { ++ sound-dai = <&i2s0 0>; ++ }; ++ ++ codec { ++ sound-dai = <&max98090 0>, <&hdmi>; ++ }; + }; + }; + +@@ -34,6 +42,9 @@ + interrupt-parent = <&gpx0>; + pinctrl-names = "default"; + pinctrl-0 = <&max98090_irq>; ++ clocks = <&pmu_system_controller 0>; ++ clock-names = "mclk"; ++ #sound-dai-cells = <1>; + }; + }; + +diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts +index 8b754ae8c8f7..c9d379b1a166 100644 +--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts ++++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts +@@ -302,6 +302,7 @@ + regulator-name = "vdd_1v35"; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +@@ -323,6 +324,7 @@ + regulator-name = "vdd_2v"; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +@@ -333,6 +335,7 @@ + regulator-name = "vdd_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts +index 1f90df2d7ecd..ae58b8d6f614 100644 +--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts ++++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts +@@ -302,6 +302,7 @@ + regulator-name = "vdd_1v35"; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +@@ -323,6 +324,7 @@ + regulator-name = "vdd_2v"; + regulator-min-microvolt = <2000000>; + regulator-max-microvolt = <2000000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +@@ -333,6 +335,7 @@ + regulator-name = "vdd_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; ++ regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; +diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi +index 0d20aadc78bb..5fa3111731cb 100644 +--- a/arch/arm/boot/dts/lpc32xx.dtsi ++++ b/arch/arm/boot/dts/lpc32xx.dtsi +@@ -179,7 +179,7 @@ + * ssp0 and spi1 are shared pins; + * enable one in your board dts, as needed. + */ +- ssp0: ssp@20084000 { ++ ssp0: spi@20084000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x20084000 0x1000>; + interrupts = <20 IRQ_TYPE_LEVEL_HIGH>; +@@ -199,7 +199,7 @@ + * ssp1 and spi2 are shared pins; + * enable one in your board dts, as needed. + */ +- ssp1: ssp@2008c000 { ++ ssp1: spi@2008c000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x2008c000 0x1000>; + interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; +diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi +index b3a8b1f24499..719150693449 100644 +--- a/arch/arm/boot/dts/omap3-gta04.dtsi ++++ b/arch/arm/boot/dts/omap3-gta04.dtsi +@@ -28,6 +28,7 @@ + + aliases { + display0 = &lcd; ++ display1 = &tv0; + }; + + gpio-keys { +@@ -70,7 +71,7 @@ + #sound-dai-cells = <0>; + }; + +- spi_lcd { ++ spi_lcd: spi_lcd { + compatible = "spi-gpio"; + #address-cells = <0x1>; + #size-cells = <0x0>; +@@ -122,7 +123,7 @@ + }; + + tv0: connector { +- compatible = "svideo-connector"; ++ compatible = "composite-video-connector"; + label = "tv"; + + port { +@@ -134,7 +135,7 @@ + + tv_amp: opa362 { + compatible = "ti,opa362"; +- enable-gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; ++ enable-gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; /* GPIO_23 to enable video out amplifier */ + + ports { + #address-cells = <1>; +@@ -273,6 +274,13 @@ + OMAP3_CORE1_IOPAD(0x2134, PIN_INPUT_PULLUP | MUX_MODE4) /* gpio112 */ + >; + }; ++ ++ penirq_pins: pinmux_penirq_pins { ++ pinctrl-single,pins = < ++ /* here we could enable to wakeup the cpu from suspend by a pen touch */ ++ OMAP3_CORE1_IOPAD(0x2194, PIN_INPUT_PULLUP | MUX_MODE4) /* gpio160 */ ++ >; ++ }; + }; + + &omap3_pmx_core2 { +@@ -410,10 +418,19 @@ + tsc2007@48 { + compatible = "ti,tsc2007"; + reg = <0x48>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&penirq_pins>; + interrupt-parent = <&gpio6>; + interrupts = <0 IRQ_TYPE_EDGE_FALLING>; /* GPIO_160 */ +- gpios = <&gpio6 0 GPIO_ACTIVE_LOW>; ++ gpios = <&gpio6 0 GPIO_ACTIVE_LOW>; /* GPIO_160 */ + ti,x-plate-ohms = <600>; ++ touchscreen-size-x = <480>; ++ touchscreen-size-y = <640>; ++ touchscreen-max-pressure = <1000>; ++ touchscreen-fuzz-x = <3>; ++ touchscreen-fuzz-y = <8>; ++ touchscreen-fuzz-pressure = <10>; ++ touchscreen-inverted-y; + }; + + /* RFID EEPROM */ +@@ -519,6 +536,12 @@ + regulator-max-microvolt = <3150000>; + }; + ++/* Needed to power the DPI pins */ ++ ++&vpll2 { ++ regulator-always-on; ++}; ++ + &dss { + pinctrl-names = "default"; + pinctrl-0 = < &dss_dpi_pins >; +@@ -539,10 +562,14 @@ + + vdda-supply = <&vdac>; + ++ #address-cells = <1>; ++ #size-cells = <0>; ++ + port { ++ reg = <0>; + venc_out: endpoint { + remote-endpoint = <&opa_in>; +- ti,channels = <2>; ++ ti,channels = <1>; + ti,invert-polarity; + }; + }; +@@ -586,22 +613,22 @@ + + bootloaders@80000 { + label = "U-Boot"; +- reg = <0x80000 0x1e0000>; ++ reg = <0x80000 0x1c0000>; + }; + +- bootloaders_env@260000 { ++ bootloaders_env@240000 { + label = "U-Boot Env"; +- reg = <0x260000 0x20000>; ++ reg = <0x240000 0x40000>; + }; + + kernel@280000 { + label = "Kernel"; +- reg = <0x280000 0x400000>; ++ reg = <0x280000 0x600000>; + }; + +- filesystem@680000 { ++ filesystem@880000 { + label = "File System"; +- reg = <0x680000 0xf980000>; ++ reg = <0x880000 0>; /* 0 = MTDPART_SIZ_FULL */ + }; + }; + }; +diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi +index 4caadb253249..e412373fe7bf 100644 +--- a/arch/arm/boot/dts/omap5-board-common.dtsi ++++ b/arch/arm/boot/dts/omap5-board-common.dtsi +@@ -694,6 +694,11 @@ + vbus-supply = <&smps10_out1_reg>; + }; + ++&dwc3 { ++ extcon = <&extcon_usb3>; ++ dr_mode = "otg"; ++}; ++ + &mcspi1 { + + }; +diff --git a/arch/arm/boot/dts/orion5x-linkstation.dtsi b/arch/arm/boot/dts/orion5x-linkstation.dtsi +index ed456ab35fd8..c1bc8376d4eb 100644 +--- a/arch/arm/boot/dts/orion5x-linkstation.dtsi ++++ b/arch/arm/boot/dts/orion5x-linkstation.dtsi +@@ -156,7 +156,7 @@ + &i2c { + status = "okay"; + +- rtc { ++ rtc@32 { + compatible = "ricoh,rs5c372a"; + reg = <0x32>; + }; +diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi +index 9e73dc6b3ed3..0e1320afa156 100644 +--- a/arch/arm/boot/dts/pxa27x.dtsi ++++ b/arch/arm/boot/dts/pxa27x.dtsi +@@ -70,7 +70,7 @@ + clocks = <&clks CLK_PWM1>; + }; + +- pwri2c: i2c@40f000180 { ++ pwri2c: i2c@40f00180 { + compatible = "mrvl,pxa-i2c"; + reg = <0x40f00180 0x24>; + interrupts = <6>; +diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi b/arch/arm/boot/dts/qcom-ipq4019.dtsi +index 4b7d97275c62..5ee84e3cb3e9 100644 +--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi ++++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi +@@ -211,7 +211,7 @@ + + saw0: regulator@b089000 { + compatible = "qcom,saw2"; +- reg = <0x02089000 0x1000>, <0x0b009000 0x1000>; ++ reg = <0x0b089000 0x1000>, <0x0b009000 0x1000>; + regulator; + }; + +diff --git a/arch/arm/boot/dts/rk3036.dtsi b/arch/arm/boot/dts/rk3036.dtsi +index a935523a1eb8..147c73f68f1d 100644 +--- a/arch/arm/boot/dts/rk3036.dtsi ++++ b/arch/arm/boot/dts/rk3036.dtsi +@@ -744,7 +744,7 @@ + /* no rts / cts for uart2 */ + }; + +- spi { ++ spi-pins { + spi_txd:spi-txd { + rockchip,pins = <1 29 RK_FUNC_3 &pcfg_pull_default>; + }; +diff --git a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts +index afea3645ada4..89d55894d916 100644 +--- a/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts ++++ b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts +@@ -88,7 +88,7 @@ + status = "okay"; + speed-mode = <0>; + +- adxl345: adxl345@0 { ++ adxl345: adxl345@53 { + compatible = "adi,adxl345"; + reg = <0x53>; + +diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi +index d309314f3a36..5f1769209526 100644 +--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi ++++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi +@@ -188,7 +188,7 @@ + <0xa0410100 0x100>; + }; + +- scu@a04100000 { ++ scu@a0410000 { + compatible = "arm,cortex-a9-scu"; + reg = <0xa0410000 0x100>; + }; +@@ -864,7 +864,7 @@ + power-domains = <&pm_domains DOMAIN_VAPE>; + }; + +- ssp@80002000 { ++ spi@80002000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x80002000 0x1000>; + interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; +@@ -878,7 +878,7 @@ + power-domains = <&pm_domains DOMAIN_VAPE>; + }; + +- ssp@80003000 { ++ spi@80003000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x80003000 0x1000>; + interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; +diff --git a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi +index 5c5cea232743..1ec193b0c506 100644 +--- a/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi ++++ b/arch/arm/boot/dts/ste-href-family-pinctrl.dtsi +@@ -607,16 +607,20 @@ + + mcde { + lcd_default_mode: lcd_default { +- default_mux { ++ default_mux1 { + /* Mux in VSI0 and all the data lines */ + function = "lcd"; + groups = + "lcdvsi0_a_1", /* VSI0 for LCD */ + "lcd_d0_d7_a_1", /* Data lines */ + "lcd_d8_d11_a_1", /* TV-out */ +- "lcdaclk_b_1", /* Clock line for TV-out */ + "lcdvsi1_a_1"; /* VSI1 for HDMI */ + }; ++ default_mux2 { ++ function = "lcda"; ++ groups = ++ "lcdaclk_b_1"; /* Clock line for TV-out */ ++ }; + default_cfg1 { + pins = + "GPIO68_E1", /* VSI0 */ +diff --git a/arch/arm/boot/dts/ste-hrefprev60.dtsi b/arch/arm/boot/dts/ste-hrefprev60.dtsi +index ece222d51717..cf8d03bc42c1 100644 +--- a/arch/arm/boot/dts/ste-hrefprev60.dtsi ++++ b/arch/arm/boot/dts/ste-hrefprev60.dtsi +@@ -57,7 +57,7 @@ + }; + }; + +- ssp@80002000 { ++ spi@80002000 { + /* + * On the first generation boards, this SSP/SPI port was connected + * to the AB8500. +diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts +index 386eee6de232..272d36c3d223 100644 +--- a/arch/arm/boot/dts/ste-snowball.dts ++++ b/arch/arm/boot/dts/ste-snowball.dts +@@ -386,7 +386,7 @@ + pinctrl-1 = <&i2c3_sleep_mode>; + }; + +- ssp@80002000 { ++ spi@80002000 { + pinctrl-names = "default"; + pinctrl-0 = <&ssp0_snowball_mode>; + }; +diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts +index 2f5107ffeef0..ea6768b96a9d 100644 +--- a/arch/arm/boot/dts/ste-u300.dts ++++ b/arch/arm/boot/dts/ste-u300.dts +@@ -441,7 +441,7 @@ + dma-names = "rx"; + }; + +- spi: ssp@c0006000 { ++ spi: spi@c0006000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0xc0006000 0x1000>; + interrupt-parent = <&vica>; +diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts +index b4bfa5586c23..23d4c837b87a 100644 +--- a/arch/arm/boot/dts/tegra20-paz00.dts ++++ b/arch/arm/boot/dts/tegra20-paz00.dts +@@ -521,10 +521,10 @@ + gpio-keys { + compatible = "gpio-keys"; + +- power { +- label = "Power"; ++ wakeup { ++ label = "Wakeup"; + gpios = <&gpio TEGRA_GPIO(J, 7) GPIO_ACTIVE_LOW>; +- linux,code = <KEY_POWER>; ++ linux,code = <KEY_WAKEUP>; + wakeup-source; + }; + }; +diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi b/arch/arm/boot/dts/tegra30-apalis.dtsi +index 192b95177aac..826bdd0b8a25 100644 +--- a/arch/arm/boot/dts/tegra30-apalis.dtsi ++++ b/arch/arm/boot/dts/tegra30-apalis.dtsi +@@ -147,14 +147,14 @@ + + /* Apalis MMC1 */ + sdmmc3_clk_pa6 { +- nvidia,pins = "sdmmc3_clk_pa6", +- "sdmmc3_cmd_pa7"; ++ nvidia,pins = "sdmmc3_clk_pa6"; + nvidia,function = "sdmmc3"; + nvidia,pull = <TEGRA_PIN_PULL_NONE>; + nvidia,tristate = <TEGRA_PIN_DISABLE>; + }; + sdmmc3_dat0_pb7 { +- nvidia,pins = "sdmmc3_dat0_pb7", ++ nvidia,pins = "sdmmc3_cmd_pa7", ++ "sdmmc3_dat0_pb7", + "sdmmc3_dat1_pb6", + "sdmmc3_dat2_pb5", + "sdmmc3_dat3_pb4", +diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi +index 5030065cbdfe..ad30d2a51af1 100644 +--- a/arch/arm/boot/dts/tegra30.dtsi ++++ b/arch/arm/boot/dts/tegra30.dtsi +@@ -823,7 +823,7 @@ + nvidia,elastic-limit = <16>; + nvidia,term-range-adj = <6>; + nvidia,xcvr-setup = <51>; +- nvidia.xcvr-setup-use-fuses; ++ nvidia,xcvr-setup-use-fuses; + nvidia,xcvr-lsfslew = <1>; + nvidia,xcvr-lsrslew = <1>; + nvidia,xcvr-hsslew = <32>; +@@ -860,7 +860,7 @@ + nvidia,elastic-limit = <16>; + nvidia,term-range-adj = <6>; + nvidia,xcvr-setup = <51>; +- nvidia.xcvr-setup-use-fuses; ++ nvidia,xcvr-setup-use-fuses; + nvidia,xcvr-lsfslew = <2>; + nvidia,xcvr-lsrslew = <2>; + nvidia,xcvr-hsslew = <32>; +@@ -896,7 +896,7 @@ + nvidia,elastic-limit = <16>; + nvidia,term-range-adj = <6>; + nvidia,xcvr-setup = <51>; +- nvidia.xcvr-setup-use-fuses; ++ nvidia,xcvr-setup-use-fuses; + nvidia,xcvr-lsfslew = <2>; + nvidia,xcvr-lsrslew = <2>; + nvidia,xcvr-hsslew = <32>; +diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts +index 409e069b3a84..00d7d28e86f0 100644 +--- a/arch/arm/boot/dts/versatile-ab.dts ++++ b/arch/arm/boot/dts/versatile-ab.dts +@@ -303,7 +303,7 @@ + clock-names = "apb_pclk"; + }; + +- ssp@101f4000 { ++ spi@101f4000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x101f4000 0x1000>; + interrupts = <11>; +diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S +index d69adfb3d79e..178a2a960659 100644 +--- a/arch/arm/kernel/entry-common.S ++++ b/arch/arm/kernel/entry-common.S +@@ -263,16 +263,15 @@ __sys_trace: + cmp scno, #-1 @ skip the syscall? + bne 2b + add sp, sp, #S_OFF @ restore stack +- b ret_slow_syscall + +-__sys_trace_return: +- str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 ++__sys_trace_return_nosave: ++ enable_irq_notrace + mov r0, sp + bl syscall_trace_exit + b ret_slow_syscall + +-__sys_trace_return_nosave: +- enable_irq_notrace ++__sys_trace_return: ++ str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 + mov r0, sp + bl syscall_trace_exit + b ret_slow_syscall +diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c +index b3d268a79f05..bb0d5e21d60b 100644 +--- a/arch/arm/kvm/mmu.c ++++ b/arch/arm/kvm/mmu.c +@@ -366,7 +366,8 @@ static void stage2_flush_memslot(struct kvm *kvm, + pgd = kvm->arch.pgd + stage2_pgd_index(addr); + do { + next = stage2_pgd_addr_end(addr, end); +- stage2_flush_puds(kvm, pgd, addr, next); ++ if (!stage2_pgd_none(*pgd)) ++ stage2_flush_puds(kvm, pgd, addr, next); + } while (pgd++, addr = next, addr != end); + } + +diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c +index 1515e498d348..dd9eb3f14f45 100644 +--- a/arch/arm/mach-imx/pm-imx6.c ++++ b/arch/arm/mach-imx/pm-imx6.c +@@ -602,6 +602,28 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata + IMX6Q_GPR1_GINT); + } + ++static void imx6_pm_stby_poweroff(void) ++{ ++ imx6_set_lpm(STOP_POWER_OFF); ++ imx6q_suspend_finish(0); ++ ++ mdelay(1000); ++ ++ pr_emerg("Unable to poweroff system\n"); ++} ++ ++static int imx6_pm_stby_poweroff_probe(void) ++{ ++ if (pm_power_off) { ++ pr_warn("%s: pm_power_off already claimed %p %pf!\n", ++ __func__, pm_power_off, pm_power_off); ++ return -EBUSY; ++ } ++ ++ pm_power_off = imx6_pm_stby_poweroff; ++ return 0; ++} ++ + void __init imx6_pm_ccm_init(const char *ccm_compat) + { + struct device_node *np; +@@ -618,6 +640,9 @@ void __init imx6_pm_ccm_init(const char *ccm_compat) + val = readl_relaxed(ccm_base + CLPCR); + val &= ~BM_CLPCR_LPM; + writel_relaxed(val, ccm_base + CLPCR); ++ ++ if (of_property_read_bool(np, "fsl,pmic-stby-poweroff")) ++ imx6_pm_stby_poweroff_probe(); + } + + void __init imx6q_pm_init(void) +diff --git a/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi b/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi +index bd3adeac374f..2973a14523ea 100644 +--- a/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi ++++ b/arch/arm64/boot/dts/amd/amd-seattle-soc.dtsi +@@ -106,7 +106,7 @@ + clock-names = "uartclk", "apb_pclk"; + }; + +- spi0: ssp@e1020000 { ++ spi0: spi@e1020000 { + status = "disabled"; + compatible = "arm,pl022", "arm,primecell"; + reg = <0 0xe1020000 0 0x1000>; +@@ -116,7 +116,7 @@ + clock-names = "apb_pclk"; + }; + +- spi1: ssp@e1030000 { ++ spi1: spi@e1030000 { + status = "disabled"; + compatible = "arm,pl022", "arm,primecell"; + reg = <0 0xe1030000 0 0x1000>; +diff --git a/arch/arm64/boot/dts/lg/lg1312.dtsi b/arch/arm64/boot/dts/lg/lg1312.dtsi +index fbafa24cd533..5e0c5dc973e3 100644 +--- a/arch/arm64/boot/dts/lg/lg1312.dtsi ++++ b/arch/arm64/boot/dts/lg/lg1312.dtsi +@@ -167,14 +167,14 @@ + clock-names = "apb_pclk"; + status="disabled"; + }; +- spi0: ssp@fe800000 { ++ spi0: spi@fe800000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x0 0xfe800000 0x1000>; + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk_bus>; + clock-names = "apb_pclk"; + }; +- spi1: ssp@fe900000 { ++ spi1: spi@fe900000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x0 0xfe900000 0x1000>; + interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; +diff --git a/arch/arm64/boot/dts/lg/lg1313.dtsi b/arch/arm64/boot/dts/lg/lg1313.dtsi +index e703e1149c75..f3b1ba6f7422 100644 +--- a/arch/arm64/boot/dts/lg/lg1313.dtsi ++++ b/arch/arm64/boot/dts/lg/lg1313.dtsi +@@ -167,14 +167,14 @@ + clock-names = "apb_pclk"; + status="disabled"; + }; +- spi0: ssp@fe800000 { ++ spi0: spi@fe800000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x0 0xfe800000 0x1000>; + interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk_bus>; + clock-names = "apb_pclk"; + }; +- spi1: ssp@fe900000 { ++ spi1: spi@fe900000 { + compatible = "arm,pl022", "arm,primecell"; + reg = <0x0 0xfe900000 0x1000>; + interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; +diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +index 6a51d282ec63..d1e687b4911f 100644 +--- a/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi ++++ b/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi +@@ -281,6 +281,7 @@ + status = "okay"; + bus-width = <8>; + non-removable; ++ vqmmc-supply = <&vdd_1v8>; + }; + + clocks { +diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S +index efbf610eaf4e..a814f32033b0 100644 +--- a/arch/arm64/lib/clear_user.S ++++ b/arch/arm64/lib/clear_user.S +@@ -62,5 +62,7 @@ ENDPROC(__arch_clear_user) + .section .fixup,"ax" + .align 2 + 9: mov x0, x2 // return the original size ++ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \ ++ CONFIG_ARM64_PAN) + ret + .previous +diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S +index 4fd67ea03bb0..580aca96c53c 100644 +--- a/arch/arm64/lib/copy_from_user.S ++++ b/arch/arm64/lib/copy_from_user.S +@@ -80,5 +80,7 @@ ENDPROC(__arch_copy_from_user) + .section .fixup,"ax" + .align 2 + 9998: sub x0, end, dst // bytes not copied ++ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \ ++ CONFIG_ARM64_PAN) + ret + .previous +diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S +index 841bf8f7fab7..d9ca6a4f33b3 100644 +--- a/arch/arm64/lib/copy_in_user.S ++++ b/arch/arm64/lib/copy_in_user.S +@@ -81,5 +81,7 @@ ENDPROC(__arch_copy_in_user) + .section .fixup,"ax" + .align 2 + 9998: sub x0, end, dst // bytes not copied ++ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \ ++ CONFIG_ARM64_PAN) + ret + .previous +diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S +index 7a7efe255034..e8bd40dc00cd 100644 +--- a/arch/arm64/lib/copy_to_user.S ++++ b/arch/arm64/lib/copy_to_user.S +@@ -79,5 +79,7 @@ ENDPROC(__arch_copy_to_user) + .section .fixup,"ax" + .align 2 + 9998: sub x0, end, dst // bytes not copied ++ALTERNATIVE("nop", __stringify(SET_PSTATE_PAN(1)), ARM64_ALT_PAN_NOT_UAO, \ ++ CONFIG_ARM64_PAN) + ret + .previous +diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c +index 4b32168cf91a..b1e42bad69ac 100644 +--- a/arch/arm64/mm/numa.c ++++ b/arch/arm64/mm/numa.c +@@ -424,7 +424,7 @@ static int __init dummy_numa_init(void) + if (numa_off) + pr_info("NUMA disabled\n"); /* Forced off on command line. */ + pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n", +- 0LLU, PFN_PHYS(max_pfn) - 1); ++ memblock_start_of_DRAM(), memblock_end_of_DRAM() - 1); + + for_each_memblock(memory, mblk) { + ret = numa_add_memblk(0, mblk->base, mblk->base + mblk->size); +diff --git a/arch/mips/bcm47xx/workarounds.c b/arch/mips/bcm47xx/workarounds.c +index e81ce4623070..06fb94370c7c 100644 +--- a/arch/mips/bcm47xx/workarounds.c ++++ b/arch/mips/bcm47xx/workarounds.c +@@ -4,9 +4,8 @@ + #include <bcm47xx_board.h> + #include <bcm47xx.h> + +-static void __init bcm47xx_workarounds_netgear_wnr3500l(void) ++static void __init bcm47xx_workarounds_enable_usb_power(int usb_power) + { +- const int usb_power = 12; + int err; + + err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power"); +@@ -22,7 +21,10 @@ void __init bcm47xx_workarounds(void) + + switch (board) { + case BCM47XX_BOARD_NETGEAR_WNR3500L: +- bcm47xx_workarounds_netgear_wnr3500l(); ++ bcm47xx_workarounds_enable_usb_power(12); ++ break; ++ case BCM47XX_BOARD_NETGEAR_WNDR3400_V3: ++ bcm47xx_workarounds_enable_usb_power(21); + break; + default: + /* No workaround(s) needed */ +diff --git a/arch/mips/include/asm/kexec.h b/arch/mips/include/asm/kexec.h +index 493a3cc7c39a..cfdbe66575f4 100644 +--- a/arch/mips/include/asm/kexec.h ++++ b/arch/mips/include/asm/kexec.h +@@ -12,11 +12,11 @@ + #include <asm/stacktrace.h> + + /* Maximum physical address we can use pages from */ +-#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000) ++#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) + /* Maximum address we can reach in physical address mode */ +-#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000) ++#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) + /* Maximum address we can use for the control code buffer */ +-#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000) ++#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL) + /* Reserve 3*4096 bytes for board-specific info */ + #define KEXEC_CONTROL_PAGE_SIZE (4096 + 3*4096) + +diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c +index a1d98b5c8fd6..5c53b8aa43d2 100644 +--- a/arch/mips/txx9/generic/setup.c ++++ b/arch/mips/txx9/generic/setup.c +@@ -959,12 +959,11 @@ void __init txx9_sramc_init(struct resource *r) + goto exit_put; + err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); + if (err) { +- device_unregister(&dev->dev); + iounmap(dev->base); +- kfree(dev); ++ device_unregister(&dev->dev); + } + return; + exit_put: ++ iounmap(dev->base); + put_device(&dev->dev); +- return; + } +diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h +index 7e3789ea396b..0b3db6322c79 100644 +--- a/arch/powerpc/boot/libfdt_env.h ++++ b/arch/powerpc/boot/libfdt_env.h +@@ -4,6 +4,8 @@ + #include <types.h> + #include <string.h> + ++#define INT_MAX ((int)(~0U>>1)) ++ + #include "of.h" + + typedef u32 uint32_t; +diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c +index 5f202a566ec5..9bfdd2510fd5 100644 +--- a/arch/powerpc/kernel/iommu.c ++++ b/arch/powerpc/kernel/iommu.c +@@ -765,9 +765,9 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl, + + vaddr = page_address(page) + offset; + uaddr = (unsigned long)vaddr; +- npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl)); + + if (tbl) { ++ npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE(tbl)); + align = 0; + if (tbl->it_page_shift < PAGE_SHIFT && size >= PAGE_SIZE && + ((unsigned long)vaddr & ~PAGE_MASK) == 0) +diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c +index a309a7a29cc6..641f3e4c3380 100644 +--- a/arch/powerpc/kernel/rtas.c ++++ b/arch/powerpc/kernel/rtas.c +@@ -984,6 +984,7 @@ int rtas_ibm_suspend_me(u64 handle) + goto out; + } + ++ cpu_hotplug_disable(); + stop_topology_update(); + + /* Call function on all CPUs. One of us will make the +@@ -998,6 +999,7 @@ int rtas_ibm_suspend_me(u64 handle) + printk(KERN_ERR "Error doing global join\n"); + + start_topology_update(); ++ cpu_hotplug_enable(); + + /* Take down CPUs not online prior to suspend */ + cpuret = rtas_offline_cpus_mask(offline_mask); +diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S +index 3745113fcc65..2a7eb5452aba 100644 +--- a/arch/powerpc/kernel/vdso32/datapage.S ++++ b/arch/powerpc/kernel/vdso32/datapage.S +@@ -37,6 +37,7 @@ data_page_branch: + mtlr r0 + addi r3, r3, __kernel_datapage_offset-data_page_branch + lwz r0,0(r3) ++ .cfi_restore lr + add r3,r0,r3 + blr + .cfi_endproc +diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S +index 6b2b69616e77..7b341b86216c 100644 +--- a/arch/powerpc/kernel/vdso32/gettimeofday.S ++++ b/arch/powerpc/kernel/vdso32/gettimeofday.S +@@ -139,6 +139,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) + */ + 99: + li r0,__NR_clock_gettime ++ .cfi_restore lr + sc + blr + .cfi_endproc +diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S +index abf17feffe40..bf9668691511 100644 +--- a/arch/powerpc/kernel/vdso64/datapage.S ++++ b/arch/powerpc/kernel/vdso64/datapage.S +@@ -37,6 +37,7 @@ data_page_branch: + mtlr r0 + addi r3, r3, __kernel_datapage_offset-data_page_branch + lwz r0,0(r3) ++ .cfi_restore lr + add r3,r0,r3 + blr + .cfi_endproc +diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S +index 382021324883..09b2a49f6dd5 100644 +--- a/arch/powerpc/kernel/vdso64/gettimeofday.S ++++ b/arch/powerpc/kernel/vdso64/gettimeofday.S +@@ -124,6 +124,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) + */ + 99: + li r0,__NR_clock_gettime ++ .cfi_restore lr + sc + blr + .cfi_endproc +diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c +index 73c3c127d858..209cad89a11a 100644 +--- a/arch/powerpc/kvm/book3s.c ++++ b/arch/powerpc/kvm/book3s.c +@@ -78,8 +78,11 @@ void kvmppc_unfixup_split_real(struct kvm_vcpu *vcpu) + { + if (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) { + ulong pc = kvmppc_get_pc(vcpu); ++ ulong lr = kvmppc_get_lr(vcpu); + if ((pc & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS) + kvmppc_set_pc(vcpu, pc & ~SPLIT_HACK_MASK); ++ if ((lr & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS) ++ kvmppc_set_lr(vcpu, lr & ~SPLIT_HACK_MASK); + vcpu->arch.hflags &= ~BOOK3S_HFLAG_SPLIT_HACK; + } + } +diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c +index 64c9a91773af..96c41b55b106 100644 +--- a/arch/powerpc/mm/slb.c ++++ b/arch/powerpc/mm/slb.c +@@ -321,7 +321,7 @@ void slb_initialize(void) + #endif + } + +- get_paca()->stab_rr = SLB_NUM_BOLTED; ++ get_paca()->stab_rr = SLB_NUM_BOLTED - 1; + + lflags = SLB_VSID_KERNEL | linear_llp; + vflags = SLB_VSID_KERNEL | vmalloc_llp; +diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c +index 39049e4884fb..7a4d172c9376 100644 +--- a/arch/powerpc/platforms/pseries/dtl.c ++++ b/arch/powerpc/platforms/pseries/dtl.c +@@ -150,7 +150,7 @@ static int dtl_start(struct dtl *dtl) + + /* Register our dtl buffer with the hypervisor. The HV expects the + * buffer size to be passed in the second word of the buffer */ +- ((u32 *)dtl->buf)[1] = DISPATCH_LOG_BYTES; ++ ((u32 *)dtl->buf)[1] = cpu_to_be32(DISPATCH_LOG_BYTES); + + hwcpu = get_hard_smp_processor_id(dtl->cpu); + addr = __pa(dtl->buf); +@@ -185,7 +185,7 @@ static void dtl_stop(struct dtl *dtl) + + static u64 dtl_current_index(struct dtl *dtl) + { +- return lppaca_of(dtl->cpu).dtl_idx; ++ return be64_to_cpu(lppaca_of(dtl->cpu).dtl_idx); + } + #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ + +diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile +index ca7c3c34f94b..2bb3a255e51a 100644 +--- a/arch/s390/kernel/vdso32/Makefile ++++ b/arch/s390/kernel/vdso32/Makefile +@@ -24,9 +24,10 @@ obj-y += vdso32_wrapper.o + extra-y += vdso32.lds + CPPFLAGS_vdso32.lds += -P -C -U$(ARCH) + +-# Disable gcov profiling and ubsan for VDSO code ++# Disable gcov profiling, ubsan and kasan for VDSO code + GCOV_PROFILE := n + UBSAN_SANITIZE := n ++KASAN_SANITIZE := n + + # Force dependency (incbin is bad) + $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile +index 84af2b6b64c4..76c56b5382be 100644 +--- a/arch/s390/kernel/vdso64/Makefile ++++ b/arch/s390/kernel/vdso64/Makefile +@@ -24,9 +24,10 @@ obj-y += vdso64_wrapper.o + extra-y += vdso64.lds + CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) + +-# Disable gcov profiling and ubsan for VDSO code ++# Disable gcov profiling, ubsan and kasan for VDSO code + GCOV_PROFILE := n + UBSAN_SANITIZE := n ++KASAN_SANITIZE := n + + # Force dependency (incbin is bad) + $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index 1067f7668c4e..80636caee07c 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -2614,8 +2614,7 @@ config OLPC + + config OLPC_XO1_PM + bool "OLPC XO-1 Power Management" +- depends on OLPC && MFD_CS5535 && PM_SLEEP +- select MFD_CORE ++ depends on OLPC && MFD_CS5535=y && PM_SLEEP + ---help--- + Add support for poweroff and suspend of the OLPC XO-1 laptop. + +diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h +index 14635c5ea025..76a35c1213d2 100644 +--- a/arch/x86/include/asm/atomic.h ++++ b/arch/x86/include/asm/atomic.h +@@ -49,7 +49,7 @@ static __always_inline void atomic_add(int i, atomic_t *v) + { + asm volatile(LOCK_PREFIX "addl %1,%0" + : "+m" (v->counter) +- : "ir" (i)); ++ : "ir" (i) : "memory"); + } + + /** +@@ -63,7 +63,7 @@ static __always_inline void atomic_sub(int i, atomic_t *v) + { + asm volatile(LOCK_PREFIX "subl %1,%0" + : "+m" (v->counter) +- : "ir" (i)); ++ : "ir" (i) : "memory"); + } + + /** +@@ -89,7 +89,7 @@ static __always_inline bool atomic_sub_and_test(int i, atomic_t *v) + static __always_inline void atomic_inc(atomic_t *v) + { + asm volatile(LOCK_PREFIX "incl %0" +- : "+m" (v->counter)); ++ : "+m" (v->counter) :: "memory"); + } + + /** +@@ -101,7 +101,7 @@ static __always_inline void atomic_inc(atomic_t *v) + static __always_inline void atomic_dec(atomic_t *v) + { + asm volatile(LOCK_PREFIX "decl %0" +- : "+m" (v->counter)); ++ : "+m" (v->counter) :: "memory"); + } + + /** +diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h +index 89ed2f6ae2f7..a3248402c36b 100644 +--- a/arch/x86/include/asm/atomic64_64.h ++++ b/arch/x86/include/asm/atomic64_64.h +@@ -44,7 +44,7 @@ static __always_inline void atomic64_add(long i, atomic64_t *v) + { + asm volatile(LOCK_PREFIX "addq %1,%0" + : "=m" (v->counter) +- : "er" (i), "m" (v->counter)); ++ : "er" (i), "m" (v->counter) : "memory"); + } + + /** +@@ -58,7 +58,7 @@ static inline void atomic64_sub(long i, atomic64_t *v) + { + asm volatile(LOCK_PREFIX "subq %1,%0" + : "=m" (v->counter) +- : "er" (i), "m" (v->counter)); ++ : "er" (i), "m" (v->counter) : "memory"); + } + + /** +@@ -85,7 +85,7 @@ static __always_inline void atomic64_inc(atomic64_t *v) + { + asm volatile(LOCK_PREFIX "incq %0" + : "=m" (v->counter) +- : "m" (v->counter)); ++ : "m" (v->counter) : "memory"); + } + + /** +@@ -98,7 +98,7 @@ static __always_inline void atomic64_dec(atomic64_t *v) + { + asm volatile(LOCK_PREFIX "decq %0" + : "=m" (v->counter) +- : "m" (v->counter)); ++ : "m" (v->counter) : "memory"); + } + + /** +diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h +index eb53c2c78a1f..a0f450b21d67 100644 +--- a/arch/x86/include/asm/barrier.h ++++ b/arch/x86/include/asm/barrier.h +@@ -105,8 +105,8 @@ do { \ + #endif + + /* Atomic operations are already serializing on x86 */ +-#define __smp_mb__before_atomic() barrier() +-#define __smp_mb__after_atomic() barrier() ++#define __smp_mb__before_atomic() do { } while (0) ++#define __smp_mb__after_atomic() do { } while (0) + + #include <asm-generic/barrier.h> + +diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h +index b3e32b010ab1..c2c01f84df75 100644 +--- a/arch/x86/include/asm/insn.h ++++ b/arch/x86/include/asm/insn.h +@@ -208,4 +208,22 @@ static inline int insn_offset_immediate(struct insn *insn) + return insn_offset_displacement(insn) + insn->displacement.nbytes; + } + ++#define POP_SS_OPCODE 0x1f ++#define MOV_SREG_OPCODE 0x8e ++ ++/* ++ * Intel SDM Vol.3A 6.8.3 states; ++ * "Any single-step trap that would be delivered following the MOV to SS ++ * instruction or POP to SS instruction (because EFLAGS.TF is 1) is ++ * suppressed." ++ * This function returns true if @insn is MOV SS or POP SS. On these ++ * instructions, single stepping is suppressed. ++ */ ++static inline int insn_masking_exception(struct insn *insn) ++{ ++ return insn->opcode.bytes[0] == POP_SS_OPCODE || ++ (insn->opcode.bytes[0] == MOV_SREG_OPCODE && ++ X86_MODRM_REG(insn->modrm.bytes[0]) == 2); ++} ++ + #endif /* _ASM_X86_INSN_H */ +diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h +index 282630e4c6ea..1624a7ffa95d 100644 +--- a/arch/x86/include/asm/kexec.h ++++ b/arch/x86/include/asm/kexec.h +@@ -66,7 +66,7 @@ struct kimage; + + /* Memory to backup during crash kdump */ + #define KEXEC_BACKUP_SRC_START (0UL) +-#define KEXEC_BACKUP_SRC_END (640 * 1024UL) /* 640K */ ++#define KEXEC_BACKUP_SRC_END (640 * 1024UL - 1) /* 640K */ + + /* + * CPU does not save ss and sp on stack if execution is already +diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c +index 311d0fad17e6..a4f6e0ec4ba0 100644 +--- a/arch/x86/kernel/cpu/cyrix.c ++++ b/arch/x86/kernel/cpu/cyrix.c +@@ -434,7 +434,7 @@ static void cyrix_identify(struct cpuinfo_x86 *c) + /* enable MAPEN */ + setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); + /* enable cpuid */ +- setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80); ++ setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x80); + /* disable MAPEN */ + setCx86(CX86_CCR3, ccr3); + local_irq_restore(flags); +diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c +index 3f3cfeca1083..dcd6df5943d6 100644 +--- a/arch/x86/kernel/kprobes/core.c ++++ b/arch/x86/kernel/kprobes/core.c +@@ -376,6 +376,10 @@ int __copy_instruction(u8 *dest, u8 *src) + return 0; + memcpy(dest, insn.kaddr, length); + ++ /* We should not singlestep on the exception masking instructions */ ++ if (insn_masking_exception(&insn)) ++ return 0; ++ + #ifdef CONFIG_X86_64 + if (insn_rip_relative(&insn)) { + s64 newdisp; +diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c +index e35466afe989..73391c1bd2a9 100644 +--- a/arch/x86/kernel/uprobes.c ++++ b/arch/x86/kernel/uprobes.c +@@ -296,6 +296,10 @@ static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool + if (is_prefix_bad(insn)) + return -ENOTSUPP; + ++ /* We should not singlestep on the exception masking instructions */ ++ if (insn_masking_exception(insn)) ++ return -ENOTSUPP; ++ + if (x86_64) + good_insns = good_insns_64; + else +@@ -983,7 +987,7 @@ arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs + pr_err("uprobe: return address clobbered: pid=%d, %%sp=%#lx, " + "%%ip=%#lx\n", current->pid, regs->sp, regs->ip); + +- force_sig_info(SIGSEGV, SEND_SIG_FORCED, current); ++ force_sig(SIGSEGV, current); + } + + return -1; +diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c +index 7830d304dff6..d58224d80867 100644 +--- a/crypto/rsa-pkcs1pad.c ++++ b/crypto/rsa-pkcs1pad.c +@@ -267,15 +267,6 @@ static int pkcs1pad_encrypt(struct akcipher_request *req) + pkcs1pad_sg_set_buf(req_ctx->in_sg, req_ctx->in_buf, + ctx->key_size - 1 - req->src_len, req->src); + +- req_ctx->out_buf = kmalloc(ctx->key_size, GFP_KERNEL); +- if (!req_ctx->out_buf) { +- kfree(req_ctx->in_buf); +- return -ENOMEM; +- } +- +- pkcs1pad_sg_set_buf(req_ctx->out_sg, req_ctx->out_buf, +- ctx->key_size, NULL); +- + akcipher_request_set_tfm(&req_ctx->child_req, ctx->child); + akcipher_request_set_callback(&req_ctx->child_req, req->base.flags, + pkcs1pad_encrypt_sign_complete_cb, req); +diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h +index 92fa47c6498c..20fd17aaa918 100644 +--- a/drivers/acpi/acpica/acevents.h ++++ b/drivers/acpi/acpica/acevents.h +@@ -247,6 +247,8 @@ acpi_status + acpi_ev_initialize_region(union acpi_operand_object *region_obj, + u8 acpi_ns_locked); + ++u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); ++ + /* + * evsci - SCI (System Control Interrupt) handling/dispatch + */ +diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h +index dff1207a6078..219bc576d127 100644 +--- a/drivers/acpi/acpica/aclocal.h ++++ b/drivers/acpi/acpica/aclocal.h +@@ -428,9 +428,9 @@ struct acpi_simple_repair_info { + /* Info for running the _REG methods */ + + struct acpi_reg_walk_info { +- acpi_adr_space_type space_id; + u32 function; + u32 reg_run_count; ++ acpi_adr_space_type space_id; + }; + + /***************************************************************************** +diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c +index 4c6f79514040..9cb60fdc77e5 100644 +--- a/drivers/acpi/acpica/evregion.c ++++ b/drivers/acpi/acpica/evregion.c +@@ -677,6 +677,19 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, + + ACPI_FUNCTION_TRACE(ev_execute_reg_methods); + ++ /* ++ * These address spaces do not need a call to _REG, since the ACPI ++ * specification defines them as: "must always be accessible". Since ++ * they never change state (never become unavailable), no need to ever ++ * call _REG on them. Also, a data_table is not a "real" address space, ++ * so do not call _REG. September 2018. ++ */ ++ if ((space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) || ++ (space_id == ACPI_ADR_SPACE_SYSTEM_IO) || ++ (space_id == ACPI_ADR_SPACE_DATA_TABLE)) { ++ return_VOID; ++ } ++ + info.space_id = space_id; + info.function = function; + info.reg_run_count = 0; +@@ -738,8 +751,8 @@ acpi_ev_reg_run(acpi_handle obj_handle, + } + + /* +- * We only care about regions.and objects that are allowed to have address +- * space handlers ++ * We only care about regions and objects that are allowed to have ++ * address space handlers + */ + if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { + return (AE_OK); +diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c +index 75ddd160a716..c8646c397786 100644 +--- a/drivers/acpi/acpica/evrgnini.c ++++ b/drivers/acpi/acpica/evrgnini.c +@@ -50,9 +50,6 @@ + #define _COMPONENT ACPI_EVENTS + ACPI_MODULE_NAME("evrgnini") + +-/* Local prototypes */ +-static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); +- + /******************************************************************************* + * + * FUNCTION: acpi_ev_system_memory_region_setup +@@ -67,7 +64,6 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); + * DESCRIPTION: Setup a system_memory operation region + * + ******************************************************************************/ +- + acpi_status + acpi_ev_system_memory_region_setup(acpi_handle handle, + u32 function, +@@ -347,7 +343,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, + * + ******************************************************************************/ + +-static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) ++u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) + { + acpi_status status; + struct acpi_pnp_device_id *hid; +diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c +index d2743067126a..f87d59a05c68 100644 +--- a/drivers/acpi/acpica/evxfregn.c ++++ b/drivers/acpi/acpica/evxfregn.c +@@ -227,7 +227,6 @@ acpi_remove_address_space_handler(acpi_handle device, + */ + region_obj = + handler_obj->address_space.region_list; +- + } + + /* Remove this Handler object from the list */ +diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c +index 416953a42510..b9fade7a3bcf 100644 +--- a/drivers/acpi/osl.c ++++ b/drivers/acpi/osl.c +@@ -1126,6 +1126,7 @@ void acpi_os_wait_events_complete(void) + flush_workqueue(kacpid_wq); + flush_workqueue(kacpi_notify_wq); + } ++EXPORT_SYMBOL(acpi_os_wait_events_complete); + + struct acpi_hp_work { + struct work_struct work; +diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c +index b66815f35be6..317ecc2e5757 100644 +--- a/drivers/acpi/pci_root.c ++++ b/drivers/acpi/pci_root.c +@@ -454,8 +454,9 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm) + decode_osc_support(root, "OS supports", support); + status = acpi_pci_osc_support(root, support); + if (ACPI_FAILURE(status)) { +- dev_info(&device->dev, "_OSC failed (%s); disabling ASPM\n", +- acpi_format_exception(status)); ++ dev_info(&device->dev, "_OSC failed (%s)%s\n", ++ acpi_format_exception(status), ++ pcie_aspm_support_enabled() ? "; disabling ASPM" : ""); + *no_aspm = 1; + return; + } +diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c +index 7a3431018e0a..5008ead4609a 100644 +--- a/drivers/acpi/sbshc.c ++++ b/drivers/acpi/sbshc.c +@@ -196,6 +196,7 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc) + hc->callback = NULL; + hc->context = NULL; + mutex_unlock(&hc->lock); ++ acpi_os_wait_events_complete(); + return 0; + } + +@@ -292,6 +293,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device) + + hc = acpi_driver_data(device); + acpi_ec_remove_query_handler(hc->ec, hc->query_bit); ++ acpi_os_wait_events_complete(); + kfree(hc); + device->driver_data = NULL; + return 0; +diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig +index 5d16fc4fa46c..a8d4f4b5a77e 100644 +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -100,7 +100,8 @@ config SATA_AHCI_PLATFORM + + config AHCI_BRCM + tristate "Broadcom AHCI SATA support" +- depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_NSP ++ depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_NSP || \ ++ ARCH_BCM_63XX + help + This option enables support for the AHCI SATA3 controller found on + Broadcom SoC's. +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c +index a3d60ccafd9a..f5eb102a2cf7 100644 +--- a/drivers/ata/libata-scsi.c ++++ b/drivers/ata/libata-scsi.c +@@ -1734,6 +1734,21 @@ nothing_to_do: + return 1; + } + ++static bool ata_check_nblocks(struct scsi_cmnd *scmd, u32 n_blocks) ++{ ++ struct request *rq = scmd->request; ++ u32 req_blocks; ++ ++ if (!blk_rq_is_passthrough(rq)) ++ return true; ++ ++ req_blocks = blk_rq_bytes(rq) / scmd->device->sector_size; ++ if (n_blocks > req_blocks) ++ return false; ++ ++ return true; ++} ++ + /** + * ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one + * @qc: Storage for translated ATA taskfile +@@ -1776,6 +1791,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) + scsi_10_lba_len(cdb, &block, &n_block); + if (cdb[1] & (1 << 3)) + tf_flags |= ATA_TFLAG_FUA; ++ if (!ata_check_nblocks(scmd, n_block)) ++ goto invalid_fld; + break; + case READ_6: + case WRITE_6: +@@ -1790,6 +1807,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) + */ + if (!n_block) + n_block = 256; ++ if (!ata_check_nblocks(scmd, n_block)) ++ goto invalid_fld; + break; + case READ_16: + case WRITE_16: +@@ -1800,6 +1819,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) + scsi_16_lba_len(cdb, &block, &n_block); + if (cdb[1] & (1 << 3)) + tf_flags |= ATA_TFLAG_FUA; ++ if (!ata_check_nblocks(scmd, n_block)) ++ goto invalid_fld; + break; + default: + DPRINTK("no-byte command\n"); +diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c +index bd6b089c67a3..634c814cbeda 100644 +--- a/drivers/ata/pata_ep93xx.c ++++ b/drivers/ata/pata_ep93xx.c +@@ -659,7 +659,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) + * start of new transfer. + */ + drv_data->dma_rx_data.port = EP93XX_DMA_IDE; +- drv_data->dma_rx_data.direction = DMA_FROM_DEVICE; ++ drv_data->dma_rx_data.direction = DMA_DEV_TO_MEM; + drv_data->dma_rx_data.name = "ep93xx-pata-rx"; + drv_data->dma_rx_channel = dma_request_channel(mask, + ep93xx_pata_dma_filter, &drv_data->dma_rx_data); +@@ -667,7 +667,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) + return; + + drv_data->dma_tx_data.port = EP93XX_DMA_IDE; +- drv_data->dma_tx_data.direction = DMA_TO_DEVICE; ++ drv_data->dma_tx_data.direction = DMA_MEM_TO_DEV; + drv_data->dma_tx_data.name = "ep93xx-pata-tx"; + drv_data->dma_tx_channel = dma_request_channel(mask, + ep93xx_pata_dma_filter, &drv_data->dma_tx_data); +@@ -678,7 +678,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) + + /* Configure receive channel direction and source address */ + memset(&conf, 0, sizeof(conf)); +- conf.direction = DMA_FROM_DEVICE; ++ conf.direction = DMA_DEV_TO_MEM; + conf.src_addr = drv_data->udma_in_phys; + conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + if (dmaengine_slave_config(drv_data->dma_rx_channel, &conf)) { +@@ -689,7 +689,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) + + /* Configure transmit channel direction and destination address */ + memset(&conf, 0, sizeof(conf)); +- conf.direction = DMA_TO_DEVICE; ++ conf.direction = DMA_MEM_TO_DEV; + conf.dst_addr = drv_data->udma_out_phys; + conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + if (dmaengine_slave_config(drv_data->dma_tx_channel, &conf)) { +diff --git a/drivers/base/component.c b/drivers/base/component.c +index 89b032f2ffd2..08da6160e94d 100644 +--- a/drivers/base/component.c ++++ b/drivers/base/component.c +@@ -461,9 +461,9 @@ int component_bind_all(struct device *master_dev, void *data) + } + + if (ret != 0) { +- for (; i--; ) +- if (!master->match->compare[i].duplicate) { +- c = master->match->compare[i].component; ++ for (; i > 0; i--) ++ if (!master->match->compare[i - 1].duplicate) { ++ c = master->match->compare[i - 1].component; + component_unbind(c, master, data); + } + } +diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c +index 8bf7e805fd34..1271315b0c25 100644 +--- a/drivers/clk/samsung/clk-cpu.c ++++ b/drivers/clk/samsung/clk-cpu.c +@@ -152,7 +152,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, + struct exynos_cpuclk *cpuclk, void __iomem *base) + { + const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg; +- unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent); ++ unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent); + unsigned long alt_div = 0, alt_div_mask = DIV_MASK; + unsigned long div0, div1 = 0, mux_reg; + unsigned long flags; +@@ -280,7 +280,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, + struct exynos_cpuclk *cpuclk, void __iomem *base) + { + const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg; +- unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent); ++ unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent); + unsigned long alt_div = 0, alt_div_mask = DIV_MASK; + unsigned long div0, div1 = 0, mux_reg; + unsigned long flags; +@@ -432,7 +432,7 @@ int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, + else + cpuclk->clk_nb.notifier_call = exynos_cpuclk_notifier_cb; + +- cpuclk->alt_parent = __clk_lookup(alt_parent); ++ cpuclk->alt_parent = __clk_get_hw(__clk_lookup(alt_parent)); + if (!cpuclk->alt_parent) { + pr_err("%s: could not lookup alternate parent %s\n", + __func__, alt_parent); +diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h +index d4b6b517fe1b..bd38c6aa3897 100644 +--- a/drivers/clk/samsung/clk-cpu.h ++++ b/drivers/clk/samsung/clk-cpu.h +@@ -49,7 +49,7 @@ struct exynos_cpuclk_cfg_data { + */ + struct exynos_cpuclk { + struct clk_hw hw; +- struct clk *alt_parent; ++ struct clk_hw *alt_parent; + void __iomem *ctrl_base; + spinlock_t *lock; + const struct exynos_cpuclk_cfg_data *cfg; +diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c +index decaed448ebb..b4bd34429cc1 100644 +--- a/drivers/crypto/mxs-dcp.c ++++ b/drivers/crypto/mxs-dcp.c +@@ -28,9 +28,24 @@ + + #define DCP_MAX_CHANS 4 + #define DCP_BUF_SZ PAGE_SIZE ++#define DCP_SHA_PAY_SZ 64 + + #define DCP_ALIGNMENT 64 + ++/* ++ * Null hashes to align with hw behavior on imx6sl and ull ++ * these are flipped for consistency with hw output ++ */ ++const uint8_t sha1_null_hash[] = ++ "\x09\x07\xd8\xaf\x90\x18\x60\x95\xef\xbf" ++ "\x55\x32\x0d\x4b\x6b\x5e\xee\xa3\x39\xda"; ++ ++const uint8_t sha256_null_hash[] = ++ "\x55\xb8\x52\x78\x1b\x99\x95\xa4" ++ "\x4c\x93\x9b\x64\xe4\x41\xae\x27" ++ "\x24\xb9\x6f\x99\xc8\xf4\xfb\x9a" ++ "\x14\x1c\xfc\x98\x42\xc4\xb0\xe3"; ++ + /* DCP DMA descriptor. */ + struct dcp_dma_desc { + uint32_t next_cmd_addr; +@@ -48,6 +63,7 @@ struct dcp_coherent_block { + uint8_t aes_in_buf[DCP_BUF_SZ]; + uint8_t aes_out_buf[DCP_BUF_SZ]; + uint8_t sha_in_buf[DCP_BUF_SZ]; ++ uint8_t sha_out_buf[DCP_SHA_PAY_SZ]; + + uint8_t aes_key[2 * AES_KEYSIZE_128]; + +@@ -209,6 +225,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, + dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf, + DCP_BUF_SZ, DMA_FROM_DEVICE); + ++ if (actx->fill % AES_BLOCK_SIZE) { ++ dev_err(sdcp->dev, "Invalid block size!\n"); ++ ret = -EINVAL; ++ goto aes_done_run; ++ } ++ + /* Fill in the DMA descriptor. */ + desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE | + MXS_DCP_CONTROL0_INTERRUPT | +@@ -238,6 +260,7 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, + + ret = mxs_dcp_start_dma(actx); + ++aes_done_run: + dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128, + DMA_TO_DEVICE); + dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE); +@@ -264,13 +287,15 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) + + uint8_t *out_tmp, *src_buf, *dst_buf = NULL; + uint32_t dst_off = 0; ++ uint32_t last_out_len = 0; + + uint8_t *key = sdcp->coh->aes_key; + + int ret = 0; + int split = 0; +- unsigned int i, len, clen, rem = 0; ++ unsigned int i, len, clen, rem = 0, tlen = 0; + int init = 0; ++ bool limit_hit = false; + + actx->fill = 0; + +@@ -289,6 +314,11 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) + for_each_sg(req->src, src, nents, i) { + src_buf = sg_virt(src); + len = sg_dma_len(src); ++ tlen += len; ++ limit_hit = tlen > req->nbytes; ++ ++ if (limit_hit) ++ len = req->nbytes - (tlen - len); + + do { + if (actx->fill + len > out_off) +@@ -305,13 +335,15 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) + * If we filled the buffer or this is the last SG, + * submit the buffer. + */ +- if (actx->fill == out_off || sg_is_last(src)) { ++ if (actx->fill == out_off || sg_is_last(src) || ++ limit_hit) { + ret = mxs_dcp_run_aes(actx, req, init); + if (ret) + return ret; + init = 0; + + out_tmp = out_buf; ++ last_out_len = actx->fill; + while (dst && actx->fill) { + if (!split) { + dst_buf = sg_virt(dst); +@@ -334,6 +366,19 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) + } + } + } while (len); ++ ++ if (limit_hit) ++ break; ++ } ++ ++ /* Copy the IV for CBC for chaining */ ++ if (!rctx->ecb) { ++ if (rctx->enc) ++ memcpy(req->info, out_buf+(last_out_len-AES_BLOCK_SIZE), ++ AES_BLOCK_SIZE); ++ else ++ memcpy(req->info, in_buf+(last_out_len-AES_BLOCK_SIZE), ++ AES_BLOCK_SIZE); + } + + return ret; +@@ -513,8 +558,6 @@ static int mxs_dcp_run_sha(struct ahash_request *req) + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); + struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm); + struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req); +- struct hash_alg_common *halg = crypto_hash_alg_common(tfm); +- + struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; + + dma_addr_t digest_phys = 0; +@@ -536,10 +579,23 @@ static int mxs_dcp_run_sha(struct ahash_request *req) + desc->payload = 0; + desc->status = 0; + ++ /* ++ * Align driver with hw behavior when generating null hashes ++ */ ++ if (rctx->init && rctx->fini && desc->size == 0) { ++ struct hash_alg_common *halg = crypto_hash_alg_common(tfm); ++ const uint8_t *sha_buf = ++ (actx->alg == MXS_DCP_CONTROL1_HASH_SELECT_SHA1) ? ++ sha1_null_hash : sha256_null_hash; ++ memcpy(sdcp->coh->sha_out_buf, sha_buf, halg->digestsize); ++ ret = 0; ++ goto done_run; ++ } ++ + /* Set HASH_TERM bit for last transfer block. */ + if (rctx->fini) { +- digest_phys = dma_map_single(sdcp->dev, req->result, +- halg->digestsize, DMA_FROM_DEVICE); ++ digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf, ++ DCP_SHA_PAY_SZ, DMA_FROM_DEVICE); + desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM; + desc->payload = digest_phys; + } +@@ -547,9 +603,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req) + ret = mxs_dcp_start_dma(actx); + + if (rctx->fini) +- dma_unmap_single(sdcp->dev, digest_phys, halg->digestsize, ++ dma_unmap_single(sdcp->dev, digest_phys, DCP_SHA_PAY_SZ, + DMA_FROM_DEVICE); + ++done_run: + dma_unmap_single(sdcp->dev, buf_phys, DCP_BUF_SZ, DMA_TO_DEVICE); + + return ret; +@@ -567,6 +624,7 @@ static int dcp_sha_req_to_buf(struct crypto_async_request *arq) + const int nents = sg_nents(req->src); + + uint8_t *in_buf = sdcp->coh->sha_in_buf; ++ uint8_t *out_buf = sdcp->coh->sha_out_buf; + + uint8_t *src_buf; + +@@ -621,11 +679,9 @@ static int dcp_sha_req_to_buf(struct crypto_async_request *arq) + + actx->fill = 0; + +- /* For some reason, the result is flipped. */ +- for (i = 0; i < halg->digestsize / 2; i++) { +- swap(req->result[i], +- req->result[halg->digestsize - i - 1]); +- } ++ /* For some reason the result is flipped */ ++ for (i = 0; i < halg->digestsize; i++) ++ req->result[i] = out_buf[halg->digestsize - i - 1]; + } + + return 0; +diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c +index 500e4090e2fd..5a37c075ee55 100644 +--- a/drivers/crypto/s5p-sss.c ++++ b/drivers/crypto/s5p-sss.c +@@ -298,7 +298,7 @@ static void s5p_unset_indata(struct s5p_aes_dev *dev) + } + + static int s5p_make_sg_cpy(struct s5p_aes_dev *dev, struct scatterlist *src, +- struct scatterlist **dst) ++ struct scatterlist **dst) + { + void *pages; + int len; +@@ -510,7 +510,7 @@ static int s5p_set_indata_start(struct s5p_aes_dev *dev, + } + + static int s5p_set_outdata_start(struct s5p_aes_dev *dev, +- struct ablkcipher_request *req) ++ struct ablkcipher_request *req) + { + struct scatterlist *sg; + int err; +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index 141aefbe37ec..b0f798244a89 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -120,7 +120,7 @@ config DMA_JZ4740 + + config DMA_JZ4780 + tristate "JZ4780 DMA support" +- depends on MACH_JZ4780 || COMPILE_TEST ++ depends on MIPS || COMPILE_TEST + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + help +diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c +index 803cfb4523b0..aca2d6fd92d5 100644 +--- a/drivers/dma/dma-jz4780.c ++++ b/drivers/dma/dma-jz4780.c +@@ -580,7 +580,7 @@ static enum dma_status jz4780_dma_tx_status(struct dma_chan *chan, + to_jz4780_dma_desc(vdesc), 0); + } else if (cookie == jzchan->desc->vdesc.tx.cookie) { + txstate->residue = jz4780_dma_desc_residue(jzchan, jzchan->desc, +- (jzchan->curr_hwdesc + 1) % jzchan->desc->count); ++ jzchan->curr_hwdesc + 1); + } else + txstate->residue = 0; + +diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c +index d139706f01fe..9d936584d331 100644 +--- a/drivers/dma/ioat/init.c ++++ b/drivers/dma/ioat/init.c +@@ -129,7 +129,7 @@ static void + ioat_init_channel(struct ioatdma_device *ioat_dma, + struct ioatdma_chan *ioat_chan, int idx); + static void ioat_intr_quirk(struct ioatdma_device *ioat_dma); +-static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma); ++static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma); + static int ioat3_dma_self_test(struct ioatdma_device *ioat_dma); + + static int ioat_dca_enabled = 1; +@@ -573,7 +573,7 @@ static void ioat_dma_remove(struct ioatdma_device *ioat_dma) + * ioat_enumerate_channels - find and initialize the device's channels + * @ioat_dma: the ioat dma device to be enumerated + */ +-static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) ++static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma) + { + struct ioatdma_chan *ioat_chan; + struct device *dev = &ioat_dma->pdev->dev; +@@ -592,7 +592,7 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) + xfercap_log = readb(ioat_dma->reg_base + IOAT_XFERCAP_OFFSET); + xfercap_log &= 0x1f; /* bits [4:0] valid */ + if (xfercap_log == 0) +- return 0; ++ return; + dev_dbg(dev, "%s: xfercap = %d\n", __func__, 1 << xfercap_log); + + for (i = 0; i < dma->chancnt; i++) { +@@ -609,7 +609,6 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) + } + } + dma->chancnt = i; +- return i; + } + + /** +diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c +index 896bafb7a532..cf6588cc3efd 100644 +--- a/drivers/dma/timb_dma.c ++++ b/drivers/dma/timb_dma.c +@@ -545,7 +545,7 @@ static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan, + } + + dma_sync_single_for_device(chan2dmadev(chan), td_desc->txd.phys, +- td_desc->desc_list_len, DMA_MEM_TO_DEV); ++ td_desc->desc_list_len, DMA_TO_DEVICE); + + return &td_desc->txd; + } +diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c +index 537cec7583fc..cf88a0bfe99e 100644 +--- a/drivers/gpio/gpio-syscon.c ++++ b/drivers/gpio/gpio-syscon.c +@@ -122,7 +122,7 @@ static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val) + BIT(offs % SYSCON_REG_BITS)); + } + +- priv->data->set(chip, offset, val); ++ chip->set(chip, offset, val); + + return 0; + } +diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c +index e6b49500c52a..8c9555313fc3 100644 +--- a/drivers/hwmon/ina3221.c ++++ b/drivers/hwmon/ina3221.c +@@ -38,9 +38,9 @@ + #define INA3221_WARN3 0x0c + #define INA3221_MASK_ENABLE 0x0f + +-#define INA3221_CONFIG_MODE_SHUNT BIT(1) +-#define INA3221_CONFIG_MODE_BUS BIT(2) +-#define INA3221_CONFIG_MODE_CONTINUOUS BIT(3) ++#define INA3221_CONFIG_MODE_SHUNT BIT(0) ++#define INA3221_CONFIG_MODE_BUS BIT(1) ++#define INA3221_CONFIG_MODE_CONTINUOUS BIT(2) + + #define INA3221_RSHUNT_DEFAULT 10000 + +diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c +index fb03449de2e0..aa6333620c37 100644 +--- a/drivers/hwmon/pwm-fan.c ++++ b/drivers/hwmon/pwm-fan.c +@@ -231,8 +231,12 @@ static int pwm_fan_probe(struct platform_device *pdev) + + ctx->pwm = devm_of_pwm_get(&pdev->dev, pdev->dev.of_node, NULL); + if (IS_ERR(ctx->pwm)) { +- dev_err(&pdev->dev, "Could not get PWM\n"); +- return PTR_ERR(ctx->pwm); ++ ret = PTR_ERR(ctx->pwm); ++ ++ if (ret != -EPROBE_DEFER) ++ dev_err(&pdev->dev, "Could not get PWM: %d\n", ret); ++ ++ return ret; + } + + platform_set_drvdata(pdev, ctx); +diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c +index 44d6c29e2644..22079f886f45 100644 +--- a/drivers/hwtracing/coresight/coresight-etm4x.c ++++ b/drivers/hwtracing/coresight/coresight-etm4x.c +@@ -35,6 +35,7 @@ + #include <linux/pm_runtime.h> + #include <asm/sections.h> + #include <asm/local.h> ++#include <asm/virt.h> + + #include "coresight-etm4x.h" + #include "coresight-etm-perf.h" +@@ -615,7 +616,7 @@ static void etm4_set_default_config(struct etmv4_config *config) + config->vinst_ctrl |= BIT(0); + } + +-static u64 etm4_get_access_type(struct etmv4_config *config) ++static u64 etm4_get_ns_access_type(struct etmv4_config *config) + { + u64 access_type = 0; + +@@ -626,17 +627,26 @@ static u64 etm4_get_access_type(struct etmv4_config *config) + * Bit[13] Exception level 1 - OS + * Bit[14] Exception level 2 - Hypervisor + * Bit[15] Never implemented +- * +- * Always stay away from hypervisor mode. + */ +- access_type = ETM_EXLEVEL_NS_HYP; +- +- if (config->mode & ETM_MODE_EXCL_KERN) +- access_type |= ETM_EXLEVEL_NS_OS; ++ if (!is_kernel_in_hyp_mode()) { ++ /* Stay away from hypervisor mode for non-VHE */ ++ access_type = ETM_EXLEVEL_NS_HYP; ++ if (config->mode & ETM_MODE_EXCL_KERN) ++ access_type |= ETM_EXLEVEL_NS_OS; ++ } else if (config->mode & ETM_MODE_EXCL_KERN) { ++ access_type = ETM_EXLEVEL_NS_HYP; ++ } + + if (config->mode & ETM_MODE_EXCL_USER) + access_type |= ETM_EXLEVEL_NS_APP; + ++ return access_type; ++} ++ ++static u64 etm4_get_access_type(struct etmv4_config *config) ++{ ++ u64 access_type = etm4_get_ns_access_type(config); ++ + /* + * EXLEVEL_S, bits[11:8], don't trace anything happening + * in secure state. +@@ -890,20 +900,10 @@ void etm4_config_trace_mode(struct etmv4_config *config) + + addr_acc = config->addr_acc[ETM_DEFAULT_ADDR_COMP]; + /* clear default config */ +- addr_acc &= ~(ETM_EXLEVEL_NS_APP | ETM_EXLEVEL_NS_OS); ++ addr_acc &= ~(ETM_EXLEVEL_NS_APP | ETM_EXLEVEL_NS_OS | ++ ETM_EXLEVEL_NS_HYP); + +- /* +- * EXLEVEL_NS, bits[15:12] +- * The Exception levels are: +- * Bit[12] Exception level 0 - Application +- * Bit[13] Exception level 1 - OS +- * Bit[14] Exception level 2 - Hypervisor +- * Bit[15] Never implemented +- */ +- if (mode & ETM_MODE_EXCL_KERN) +- addr_acc |= ETM_EXLEVEL_NS_OS; +- else +- addr_acc |= ETM_EXLEVEL_NS_APP; ++ addr_acc |= etm4_get_ns_access_type(config); + + config->addr_acc[ETM_DEFAULT_ADDR_COMP] = addr_acc; + config->addr_acc[ETM_DEFAULT_ADDR_COMP + 1] = addr_acc; +diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c +index d6941ea24d8d..14df4e34c21c 100644 +--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c ++++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c +@@ -425,10 +425,10 @@ static void tmc_update_etf_buffer(struct coresight_device *csdev, + case TMC_MEM_INTF_WIDTH_32BITS: + case TMC_MEM_INTF_WIDTH_64BITS: + case TMC_MEM_INTF_WIDTH_128BITS: +- mask = GENMASK(31, 5); ++ mask = GENMASK(31, 4); + break; + case TMC_MEM_INTF_WIDTH_256BITS: +- mask = GENMASK(31, 6); ++ mask = GENMASK(31, 5); + break; + } + +diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c +index 398e44a9ec45..5ffabc388630 100644 +--- a/drivers/hwtracing/coresight/coresight.c ++++ b/drivers/hwtracing/coresight/coresight.c +@@ -132,12 +132,14 @@ static int coresight_enable_sink(struct coresight_device *csdev, u32 mode) + { + int ret; + +- if (!csdev->enable) { +- if (sink_ops(csdev)->enable) { +- ret = sink_ops(csdev)->enable(csdev, mode); +- if (ret) +- return ret; +- } ++ /* ++ * We need to make sure the "new" session is compatible with the ++ * existing "mode" of operation. ++ */ ++ if (sink_ops(csdev)->enable) { ++ ret = sink_ops(csdev)->enable(csdev, mode); ++ if (ret) ++ return ret; + csdev->enable = true; + } + +@@ -331,8 +333,14 @@ int coresight_enable_path(struct list_head *path, u32 mode) + switch (type) { + case CORESIGHT_DEV_TYPE_SINK: + ret = coresight_enable_sink(csdev, mode); ++ /* ++ * Sink is the first component turned on. If we ++ * failed to enable the sink, there are no components ++ * that need disabling. Disabling the path here ++ * would mean we could disrupt an existing session. ++ */ + if (ret) +- goto err; ++ goto out; + break; + case CORESIGHT_DEV_TYPE_SOURCE: + /* sources are enabled from either sysFS or Perf */ +diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig +index d252276feadf..759c621a860a 100644 +--- a/drivers/i2c/busses/Kconfig ++++ b/drivers/i2c/busses/Kconfig +@@ -397,12 +397,13 @@ config I2C_BCM_KONA + If you do not need KONA I2C interface, say N. + + config I2C_BRCMSTB +- tristate "BRCM Settop I2C controller" +- depends on ARCH_BRCMSTB || BMIPS_GENERIC || COMPILE_TEST ++ tristate "BRCM Settop/DSL I2C controller" ++ depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_63XX || \ ++ COMPILE_TEST + default y + help + If you say yes to this option, support will be included for the +- I2C interface on the Broadcom Settop SoCs. ++ I2C interface on the Broadcom Settop/DSL SoCs. + + If you do not need I2C interface, say N. + +diff --git a/drivers/iio/dac/mcp4922.c b/drivers/iio/dac/mcp4922.c +index 3854d201a5d6..68dd0be1ac07 100644 +--- a/drivers/iio/dac/mcp4922.c ++++ b/drivers/iio/dac/mcp4922.c +@@ -94,17 +94,22 @@ static int mcp4922_write_raw(struct iio_dev *indio_dev, + long mask) + { + struct mcp4922_state *state = iio_priv(indio_dev); ++ int ret; + + if (val2 != 0) + return -EINVAL; + + switch (mask) { + case IIO_CHAN_INFO_RAW: +- if (val > GENMASK(chan->scan_type.realbits-1, 0)) ++ if (val < 0 || val > GENMASK(chan->scan_type.realbits - 1, 0)) + return -EINVAL; + val <<= chan->scan_type.shift; +- state->value[chan->channel] = val; +- return mcp4922_spi_write(state, chan->channel, val); ++ ++ ret = mcp4922_spi_write(state, chan->channel, val); ++ if (!ret) ++ state->value[chan->channel] = val; ++ return ret; ++ + default: + return -EINVAL; + } +diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c +index 717626046ee5..fbe662602f0a 100644 +--- a/drivers/infiniband/hw/hfi1/pcie.c ++++ b/drivers/infiniband/hw/hfi1/pcie.c +@@ -377,7 +377,9 @@ int pcie_speeds(struct hfi1_devdata *dd) + /* + * bus->max_bus_speed is set from the bridge's linkcap Max Link Speed + */ +- if (parent && dd->pcidev->bus->max_bus_speed != PCIE_SPEED_8_0GT) { ++ if (parent && ++ (dd->pcidev->bus->max_bus_speed == PCIE_SPEED_2_5GT || ++ dd->pcidev->bus->max_bus_speed == PCIE_SPEED_5_0GT)) { + dd_dev_info(dd, "Parent PCIe bridge does not support Gen3\n"); + dd->link_gen3_capable = 0; + } +diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c +index 85637696f6e9..282a726351c8 100644 +--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c ++++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c +@@ -1652,7 +1652,7 @@ static enum i40iw_status_code i40iw_add_mqh_6(struct i40iw_device *iwdev, + unsigned long flags; + + rtnl_lock(); +- for_each_netdev_rcu(&init_net, ip_dev) { ++ for_each_netdev(&init_net, ip_dev) { + if ((((rdma_vlan_dev_vlan_id(ip_dev) < I40IW_NO_VLAN) && + (rdma_vlan_dev_real_dev(ip_dev) == iwdev->netdev)) || + (ip_dev == iwdev->netdev)) && (ip_dev->flags & IFF_UP)) { +diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c +index ded76c101dde..834b06aacc2b 100644 +--- a/drivers/infiniband/hw/mthca/mthca_main.c ++++ b/drivers/infiniband/hw/mthca/mthca_main.c +@@ -989,7 +989,8 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type) + goto err_free_dev; + } + +- if (mthca_cmd_init(mdev)) { ++ err = mthca_cmd_init(mdev); ++ if (err) { + mthca_err(mdev, "Failed to init command interface, aborting.\n"); + goto err_free_dev; + } +diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c +index df15b6d7b645..b03a6206d9be 100644 +--- a/drivers/infiniband/sw/rxe/rxe_comp.c ++++ b/drivers/infiniband/sw/rxe/rxe_comp.c +@@ -250,6 +250,17 @@ static inline enum comp_state check_ack(struct rxe_qp *qp, + case IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE: + if (pkt->opcode != IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE && + pkt->opcode != IB_OPCODE_RC_RDMA_READ_RESPONSE_LAST) { ++ /* read retries of partial data may restart from ++ * read response first or response only. ++ */ ++ if ((pkt->psn == wqe->first_psn && ++ pkt->opcode == ++ IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST) || ++ (wqe->first_psn == wqe->last_psn && ++ pkt->opcode == ++ IB_OPCODE_RC_RDMA_READ_RESPONSE_ONLY)) ++ break; ++ + return COMPST_ERROR; + } + break; +@@ -486,11 +497,11 @@ static inline enum comp_state complete_wqe(struct rxe_qp *qp, + struct rxe_pkt_info *pkt, + struct rxe_send_wqe *wqe) + { +- qp->comp.opcode = -1; +- +- if (pkt) { +- if (psn_compare(pkt->psn, qp->comp.psn) >= 0) +- qp->comp.psn = (pkt->psn + 1) & BTH_PSN_MASK; ++ if (pkt && wqe->state == wqe_state_pending) { ++ if (psn_compare(wqe->last_psn, qp->comp.psn) >= 0) { ++ qp->comp.psn = (wqe->last_psn + 1) & BTH_PSN_MASK; ++ qp->comp.opcode = -1; ++ } + + if (qp->req.wait_psn) { + qp->req.wait_psn = 0; +diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c +index 0f9fe2ca2a91..6fb771290c56 100644 +--- a/drivers/infiniband/sw/rxe/rxe_req.c ++++ b/drivers/infiniband/sw/rxe/rxe_req.c +@@ -72,9 +72,6 @@ static void req_retry(struct rxe_qp *qp) + int npsn; + int first = 1; + +- wqe = queue_head(qp->sq.queue); +- npsn = (qp->comp.psn - wqe->first_psn) & BTH_PSN_MASK; +- + qp->req.wqe_index = consumer_index(qp->sq.queue); + qp->req.psn = qp->comp.psn; + qp->req.opcode = -1; +@@ -106,11 +103,17 @@ static void req_retry(struct rxe_qp *qp) + if (first) { + first = 0; + +- if (mask & WR_WRITE_OR_SEND_MASK) ++ if (mask & WR_WRITE_OR_SEND_MASK) { ++ npsn = (qp->comp.psn - wqe->first_psn) & ++ BTH_PSN_MASK; + retry_first_write_send(qp, wqe, mask, npsn); ++ } + +- if (mask & WR_READ_MASK) ++ if (mask & WR_READ_MASK) { ++ npsn = (wqe->dma.length - wqe->dma.resid) / ++ qp->mtu; + wqe->iova += npsn * qp->mtu; ++ } + } + + wqe->state = wqe_state_posted; +@@ -439,7 +442,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp, + if (pkt->mask & RXE_RETH_MASK) { + reth_set_rkey(pkt, ibwr->wr.rdma.rkey); + reth_set_va(pkt, wqe->iova); +- reth_set_len(pkt, wqe->dma.length); ++ reth_set_len(pkt, wqe->dma.resid); + } + + if (pkt->mask & RXE_IMMDT_MASK) +diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c +index 81ae2e30dd12..27a7e4406f34 100644 +--- a/drivers/infiniband/ulp/iser/iser_initiator.c ++++ b/drivers/infiniband/ulp/iser/iser_initiator.c +@@ -590,13 +590,19 @@ void iser_login_rsp(struct ib_cq *cq, struct ib_wc *wc) + ib_conn->post_recv_buf_count--; + } + +-static inline void ++static inline int + iser_inv_desc(struct iser_fr_desc *desc, u32 rkey) + { +- if (likely(rkey == desc->rsc.mr->rkey)) ++ if (likely(rkey == desc->rsc.mr->rkey)) { + desc->rsc.mr_valid = 0; +- else if (likely(rkey == desc->pi_ctx->sig_mr->rkey)) ++ } else if (likely(desc->pi_ctx && rkey == desc->pi_ctx->sig_mr->rkey)) { + desc->pi_ctx->sig_mr_valid = 0; ++ } else { ++ iser_err("Bogus remote invalidation for rkey %#x\n", rkey); ++ return -EINVAL; ++ } ++ ++ return 0; + } + + static int +@@ -624,12 +630,14 @@ iser_check_remote_inv(struct iser_conn *iser_conn, + + if (iser_task->dir[ISER_DIR_IN]) { + desc = iser_task->rdma_reg[ISER_DIR_IN].mem_h; +- iser_inv_desc(desc, rkey); ++ if (unlikely(iser_inv_desc(desc, rkey))) ++ return -EINVAL; + } + + if (iser_task->dir[ISER_DIR_OUT]) { + desc = iser_task->rdma_reg[ISER_DIR_OUT].mem_h; +- iser_inv_desc(desc, rkey); ++ if (unlikely(iser_inv_desc(desc, rkey))) ++ return -EINVAL; + } + } else { + iser_err("failed to get task for itt=%d\n", hdr->itt); +diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c +index fcc6c3368182..ea3f0f5eb534 100644 +--- a/drivers/input/ff-memless.c ++++ b/drivers/input/ff-memless.c +@@ -501,6 +501,15 @@ static void ml_ff_destroy(struct ff_device *ff) + { + struct ml_device *ml = ff->private; + ++ /* ++ * Even though we stop all playing effects when tearing down ++ * an input device (via input_device_flush() that calls into ++ * input_ff_flush() that stops and erases all effects), we ++ * do not actually stop the timer, and therefore we should ++ * do it here. ++ */ ++ del_timer_sync(&ml->timer); ++ + kfree(ml->private); + } + +diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c +index 2e934aef3d2a..b669cdc8c8c6 100644 +--- a/drivers/input/rmi4/rmi_f54.c ++++ b/drivers/input/rmi4/rmi_f54.c +@@ -364,7 +364,7 @@ static const struct vb2_ops rmi_f54_queue_ops = { + static const struct vb2_queue rmi_f54_queue = { + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, + .io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF | VB2_READ, +- .buf_struct_size = sizeof(struct vb2_buffer), ++ .buf_struct_size = sizeof(struct vb2_v4l2_buffer), + .ops = &rmi_f54_queue_ops, + .mem_ops = &vb2_vmalloc_memops, + .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, +@@ -617,7 +617,7 @@ static int rmi_f54_config(struct rmi_function *fn) + { + struct rmi_driver *drv = fn->rmi_dev->driver; + +- drv->set_irq_bits(fn->rmi_dev, fn->irq_mask); ++ drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask); + + return 0; + } +@@ -744,6 +744,7 @@ static void rmi_f54_remove(struct rmi_function *fn) + + video_unregister_device(&f54->vdev); + v4l2_device_unregister(&f54->v4l2); ++ destroy_workqueue(f54->workqueue); + } + + struct rmi_function_handler rmi_f54_handler = { +diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c +index f502c8488be8..867772878c0c 100644 +--- a/drivers/input/touchscreen/silead.c ++++ b/drivers/input/touchscreen/silead.c +@@ -504,20 +504,33 @@ static int __maybe_unused silead_ts_suspend(struct device *dev) + static int __maybe_unused silead_ts_resume(struct device *dev) + { + struct i2c_client *client = to_i2c_client(dev); ++ bool second_try = false; + int error, status; + + silead_ts_set_power(client, SILEAD_POWER_ON); + ++ retry: + error = silead_ts_reset(client); + if (error) + return error; + ++ if (second_try) { ++ error = silead_ts_load_fw(client); ++ if (error) ++ return error; ++ } ++ + error = silead_ts_startup(client); + if (error) + return error; + + status = silead_ts_get_status(client); + if (status != SILEAD_STATUS_OK) { ++ if (!second_try) { ++ second_try = true; ++ dev_dbg(dev, "Reloading firmware after unsuccessful resume\n"); ++ goto retry; ++ } + dev_err(dev, "Resume error, status: 0x%02x\n", status); + return -ENODEV; + } +diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c +index e943678ce54c..f1c574d6be17 100644 +--- a/drivers/input/touchscreen/st1232.c ++++ b/drivers/input/touchscreen/st1232.c +@@ -203,6 +203,7 @@ static int st1232_ts_probe(struct i2c_client *client, + input_dev->id.bustype = BUS_I2C; + input_dev->dev.parent = &client->dev; + ++ __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); + __set_bit(EV_SYN, input_dev->evbit); + __set_bit(EV_KEY, input_dev->evbit); + __set_bit(EV_ABS, input_dev->evbit); +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index c5bc3e5e921e..080f9afcde8d 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -904,6 +904,7 @@ static void cached_dev_detach_finish(struct work_struct *w) + bch_write_bdev_super(dc, &cl); + closure_sync(&cl); + ++ calc_cached_dev_sectors(dc->disk.c); + bcache_device_detach(&dc->disk); + list_move(&dc->list, &uncached_devices); + +diff --git a/drivers/media/pci/ivtv/ivtv-yuv.c b/drivers/media/pci/ivtv/ivtv-yuv.c +index f7299d3d8244..bcb51e87c72f 100644 +--- a/drivers/media/pci/ivtv/ivtv-yuv.c ++++ b/drivers/media/pci/ivtv/ivtv-yuv.c +@@ -935,7 +935,7 @@ static void ivtv_yuv_init(struct ivtv *itv) + } + + /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ +- yi->blanking_ptr = kzalloc(720 * 16, GFP_KERNEL|__GFP_NOWARN); ++ yi->blanking_ptr = kzalloc(720 * 16, GFP_ATOMIC|__GFP_NOWARN); + if (yi->blanking_ptr) { + yi->blanking_dmaptr = pci_map_single(itv->pdev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE); + } else { +diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c +index ba887e8e1b17..a85c5199ccd3 100644 +--- a/drivers/media/pci/meye/meye.c ++++ b/drivers/media/pci/meye/meye.c +@@ -1469,7 +1469,7 @@ static int meye_mmap(struct file *file, struct vm_area_struct *vma) + unsigned long page, pos; + + mutex_lock(&meye.lock); +- if (size > gbuffers * gbufsize) { ++ if (size > gbuffers * gbufsize || offset > gbuffers * gbufsize - size) { + mutex_unlock(&meye.lock); + return -EINVAL; + } +diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c +index 99faea2e84c6..78e37cf3470f 100644 +--- a/drivers/media/platform/davinci/isif.c ++++ b/drivers/media/platform/davinci/isif.c +@@ -1106,7 +1106,8 @@ fail_nobase_res: + + while (i >= 0) { + res = platform_get_resource(pdev, IORESOURCE_MEM, i); +- release_mem_region(res->start, resource_size(res)); ++ if (res) ++ release_mem_region(res->start, resource_size(res)); + i--; + } + vpfe_unregister_ccdc_device(&isif_hw_dev); +diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c +index a9bc0175e4d3..c839003953a7 100644 +--- a/drivers/media/platform/davinci/vpbe_display.c ++++ b/drivers/media/platform/davinci/vpbe_display.c +@@ -518,7 +518,7 @@ vpbe_disp_calculate_scale_factor(struct vpbe_display *disp_dev, + else if (v_scale == 4) + layer_info->v_zoom = ZOOM_X4; + if (v_exp) +- layer_info->h_exp = V_EXP_6_OVER_5; ++ layer_info->v_exp = V_EXP_6_OVER_5; + } else { + /* no scaling, only cropping. Set display area to crop area */ + cfg->ysize = expected_ysize; +diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c +index 390d708c807a..3fab9f776afa 100644 +--- a/drivers/media/platform/pxa_camera.c ++++ b/drivers/media/platform/pxa_camera.c +@@ -2334,7 +2334,7 @@ static int pxa_camera_probe(struct platform_device *pdev) + pcdev->res = res; + + pcdev->pdata = pdev->dev.platform_data; +- if (&pdev->dev.of_node && !pcdev->pdata) { ++ if (pdev->dev.of_node && !pcdev->pdata) { + err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev, &pcdev->asd); + } else { + pcdev->platform_flags = pcdev->pdata->flags; +diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c +index 38e73ee5c8fb..78f0bf8ee084 100644 +--- a/drivers/media/usb/au0828/au0828-core.c ++++ b/drivers/media/usb/au0828/au0828-core.c +@@ -639,7 +639,7 @@ static int au0828_usb_probe(struct usb_interface *interface, + /* Analog TV */ + retval = au0828_analog_register(dev, interface); + if (retval) { +- pr_err("%s() au0282_dev_register failed to register on V4L2\n", ++ pr_err("%s() au0828_analog_register failed to register on V4L2\n", + __func__); + goto done; + } +@@ -647,7 +647,7 @@ static int au0828_usb_probe(struct usb_interface *interface, + /* Digital TV */ + retval = au0828_dvb_register(dev); + if (retval) +- pr_err("%s() au0282_dev_register failed\n", ++ pr_err("%s() au0828_dvb_register failed\n", + __func__); + + /* Remote controller */ +diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c +index 6414188ffdfa..cd973e780da9 100644 +--- a/drivers/media/usb/cx231xx/cx231xx-video.c ++++ b/drivers/media/usb/cx231xx/cx231xx-video.c +@@ -1389,7 +1389,7 @@ int cx231xx_g_register(struct file *file, void *priv, + ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, + (u16)reg->reg, value, 4); + reg->val = value[0] | value[1] << 8 | +- value[2] << 16 | value[3] << 24; ++ value[2] << 16 | (u32)value[3] << 24; + reg->size = 4; + break; + case 1: /* AFE - read byte */ +diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c +index 60286adbd6a1..e56f0844b98d 100644 +--- a/drivers/mfd/ti_am335x_tscadc.c ++++ b/drivers/mfd/ti_am335x_tscadc.c +@@ -295,11 +295,24 @@ static int ti_tscadc_remove(struct platform_device *pdev) + return 0; + } + ++static int __maybe_unused ti_tscadc_can_wakeup(struct device *dev, void *data) ++{ ++ return device_may_wakeup(dev); ++} ++ + static int __maybe_unused tscadc_suspend(struct device *dev) + { + struct ti_tscadc_dev *tscadc = dev_get_drvdata(dev); + + regmap_write(tscadc->regmap, REG_SE, 0x00); ++ if (device_for_each_child(dev, NULL, ti_tscadc_can_wakeup)) { ++ u32 ctrl; ++ ++ regmap_read(tscadc->regmap, REG_CTRL, &ctrl); ++ ctrl &= ~(CNTRLREG_POWERDOWN); ++ ctrl |= CNTRLREG_TSCSSENB; ++ regmap_write(tscadc->regmap, REG_CTRL, ctrl); ++ } + pm_runtime_put_sync(dev); + + return 0; +diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c +index 3e102cd6ed91..d08509cd978a 100644 +--- a/drivers/misc/cxl/guest.c ++++ b/drivers/misc/cxl/guest.c +@@ -1026,8 +1026,6 @@ err1: + + void cxl_guest_remove_afu(struct cxl_afu *afu) + { +- pr_devel("in %s - AFU(%d)\n", __func__, afu->slice); +- + if (!afu) + return; + +diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c +index b642b4fd731b..95584bffa4ea 100644 +--- a/drivers/misc/genwqe/card_utils.c ++++ b/drivers/misc/genwqe/card_utils.c +@@ -298,7 +298,7 @@ static int genwqe_sgl_size(int num_pages) + int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, + void __user *user_addr, size_t user_size) + { +- int rc; ++ int ret = -ENOMEM; + struct pci_dev *pci_dev = cd->pci_dev; + + sgl->fpage_offs = offset_in_page((unsigned long)user_addr); +@@ -317,7 +317,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, + if (get_order(sgl->sgl_size) > MAX_ORDER) { + dev_err(&pci_dev->dev, + "[%s] err: too much memory requested!\n", __func__); +- return -ENOMEM; ++ return ret; + } + + sgl->sgl = __genwqe_alloc_consistent(cd, sgl->sgl_size, +@@ -325,7 +325,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, + if (sgl->sgl == NULL) { + dev_err(&pci_dev->dev, + "[%s] err: no memory available!\n", __func__); +- return -ENOMEM; ++ return ret; + } + + /* Only use buffering on incomplete pages */ +@@ -338,7 +338,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, + /* Sync with user memory */ + if (copy_from_user(sgl->fpage + sgl->fpage_offs, + user_addr, sgl->fpage_size)) { +- rc = -EFAULT; ++ ret = -EFAULT; + goto err_out; + } + } +@@ -351,7 +351,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, + /* Sync with user memory */ + if (copy_from_user(sgl->lpage, user_addr + user_size - + sgl->lpage_size, sgl->lpage_size)) { +- rc = -EFAULT; ++ ret = -EFAULT; + goto err_out2; + } + } +@@ -373,7 +373,8 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, + sgl->sgl = NULL; + sgl->sgl_dma_addr = 0; + sgl->sgl_size = 0; +- return -ENOMEM; ++ ++ return ret; + } + + int genwqe_setup_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl, +diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c +index bb3a76ad80da..fc8cb855c6e6 100644 +--- a/drivers/misc/kgdbts.c ++++ b/drivers/misc/kgdbts.c +@@ -979,6 +979,12 @@ static void kgdbts_run_tests(void) + int nmi_sleep = 0; + int i; + ++ verbose = 0; ++ if (strstr(config, "V1")) ++ verbose = 1; ++ if (strstr(config, "V2")) ++ verbose = 2; ++ + ptr = strchr(config, 'F'); + if (ptr) + fork_test = simple_strtol(ptr + 1, NULL, 10); +@@ -1062,13 +1068,6 @@ static int kgdbts_option_setup(char *opt) + return -ENOSPC; + } + strcpy(config, opt); +- +- verbose = 0; +- if (strstr(config, "V1")) +- verbose = 1; +- if (strstr(config, "V2")) +- verbose = 2; +- + return 0; + } + +@@ -1080,9 +1079,6 @@ static int configure_kgdbts(void) + + if (!strlen(config) || isspace(config[0])) + goto noconfig; +- err = kgdbts_option_setup(config); +- if (err) +- goto noconfig; + + final_ack = 0; + run_plant_and_detach_test(1); +diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c +index 2ff6140ea0b7..7f7af312e7ad 100644 +--- a/drivers/mmc/host/sdhci-of-at91.c ++++ b/drivers/mmc/host/sdhci-of-at91.c +@@ -318,7 +318,7 @@ static int sdhci_at91_probe(struct platform_device *pdev) + pm_runtime_use_autosuspend(&pdev->dev); + + /* HS200 is broken at this moment */ +- host->quirks2 = SDHCI_QUIRK2_BROKEN_HS200; ++ host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200; + + ret = sdhci_add_host(host); + if (ret) +diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c +index 3fad35942895..7a716bed1158 100644 +--- a/drivers/mtd/maps/physmap_of.c ++++ b/drivers/mtd/maps/physmap_of.c +@@ -29,7 +29,6 @@ + struct of_flash_list { + struct mtd_info *mtd; + struct map_info map; +- struct resource *res; + }; + + struct of_flash { +@@ -54,18 +53,10 @@ static int of_flash_remove(struct platform_device *dev) + mtd_concat_destroy(info->cmtd); + } + +- for (i = 0; i < info->list_size; i++) { ++ for (i = 0; i < info->list_size; i++) + if (info->list[i].mtd) + map_destroy(info->list[i].mtd); + +- if (info->list[i].map.virt) +- iounmap(info->list[i].map.virt); +- +- if (info->list[i].res) { +- release_resource(info->list[i].res); +- kfree(info->list[i].res); +- } +- } + return 0; + } + +@@ -223,10 +214,11 @@ static int of_flash_probe(struct platform_device *dev) + + err = -EBUSY; + res_size = resource_size(&res); +- info->list[i].res = request_mem_region(res.start, res_size, +- dev_name(&dev->dev)); +- if (!info->list[i].res) ++ info->list[i].map.virt = devm_ioremap_resource(&dev->dev, &res); ++ if (IS_ERR(info->list[i].map.virt)) { ++ err = PTR_ERR(info->list[i].map.virt); + goto err_out; ++ } + + err = -ENXIO; + width = of_get_property(dp, "bank-width", NULL); +@@ -247,15 +239,6 @@ static int of_flash_probe(struct platform_device *dev) + return err; + } + +- err = -ENOMEM; +- info->list[i].map.virt = ioremap(info->list[i].map.phys, +- info->list[i].map.size); +- if (!info->list[i].map.virt) { +- dev_err(&dev->dev, "Failed to ioremap() flash" +- " region\n"); +- goto err_out; +- } +- + simple_map_init(&info->list[i].map); + + /* +diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c +index 442ce619b3b6..d6c013f93b8c 100644 +--- a/drivers/mtd/nand/sh_flctl.c ++++ b/drivers/mtd/nand/sh_flctl.c +@@ -480,7 +480,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset) + + /* initiate DMA transfer */ + if (flctl->chan_fifo0_rx && rlen >= 32 && +- flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_DEV_TO_MEM) > 0) ++ flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0) + goto convert; /* DMA success */ + + /* do polling transfer */ +@@ -539,7 +539,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen, + + /* initiate DMA transfer */ + if (flctl->chan_fifo0_tx && rlen >= 32 && +- flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_MEM_TO_DEV) > 0) ++ flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0) + return; /* DMA success */ + + /* do polling transfer */ +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c +index eb7173713bbc..a2c4048c07be 100644 +--- a/drivers/net/can/slcan.c ++++ b/drivers/net/can/slcan.c +@@ -613,6 +613,7 @@ err_free_chan: + sl->tty = NULL; + tty->disc_data = NULL; + clear_bit(SLF_INUSE, &sl->flags); ++ free_netdev(sl->dev); + + err_exit: + rtnl_unlock(); +diff --git a/drivers/net/ethernet/amd/am79c961a.c b/drivers/net/ethernet/amd/am79c961a.c +index fcdf5dda448f..77d99c532917 100644 +--- a/drivers/net/ethernet/amd/am79c961a.c ++++ b/drivers/net/ethernet/amd/am79c961a.c +@@ -440,7 +440,7 @@ static void am79c961_timeout(struct net_device *dev) + /* + * Transmit a packet + */ +-static int ++static netdev_tx_t + am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev) + { + struct dev_priv *priv = netdev_priv(dev); +diff --git a/drivers/net/ethernet/amd/atarilance.c b/drivers/net/ethernet/amd/atarilance.c +index d2bc8e5dcd23..35a9f252ceb6 100644 +--- a/drivers/net/ethernet/amd/atarilance.c ++++ b/drivers/net/ethernet/amd/atarilance.c +@@ -339,7 +339,8 @@ static unsigned long lance_probe1( struct net_device *dev, struct lance_addr + *init_rec ); + static int lance_open( struct net_device *dev ); + static void lance_init_ring( struct net_device *dev ); +-static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ); ++static netdev_tx_t lance_start_xmit(struct sk_buff *skb, ++ struct net_device *dev); + static irqreturn_t lance_interrupt( int irq, void *dev_id ); + static int lance_rx( struct net_device *dev ); + static int lance_close( struct net_device *dev ); +@@ -770,7 +771,8 @@ static void lance_tx_timeout (struct net_device *dev) + + /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ + +-static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) ++static netdev_tx_t ++lance_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct lance_private *lp = netdev_priv(dev); + struct lance_ioreg *IO = lp->iobase; +diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c +index 9e80a76c3dfe..76393ae4cf0a 100644 +--- a/drivers/net/ethernet/amd/declance.c ++++ b/drivers/net/ethernet/amd/declance.c +@@ -893,7 +893,7 @@ static void lance_tx_timeout(struct net_device *dev) + netif_wake_queue(dev); + } + +-static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t lance_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct lance_private *lp = netdev_priv(dev); + volatile struct lance_regs *ll = lp->ll; +diff --git a/drivers/net/ethernet/amd/sun3lance.c b/drivers/net/ethernet/amd/sun3lance.c +index 3d8c6b2cdea4..09271665712d 100644 +--- a/drivers/net/ethernet/amd/sun3lance.c ++++ b/drivers/net/ethernet/amd/sun3lance.c +@@ -235,7 +235,8 @@ struct lance_private { + static int lance_probe( struct net_device *dev); + static int lance_open( struct net_device *dev ); + static void lance_init_ring( struct net_device *dev ); +-static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ); ++static netdev_tx_t lance_start_xmit(struct sk_buff *skb, ++ struct net_device *dev); + static irqreturn_t lance_interrupt( int irq, void *dev_id); + static int lance_rx( struct net_device *dev ); + static int lance_close( struct net_device *dev ); +@@ -511,7 +512,8 @@ static void lance_init_ring( struct net_device *dev ) + } + + +-static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) ++static netdev_tx_t ++lance_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct lance_private *lp = netdev_priv(dev); + int entry, len; +diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c +index 3153465d4d02..acbbe4e5a2f8 100644 +--- a/drivers/net/ethernet/amd/sunlance.c ++++ b/drivers/net/ethernet/amd/sunlance.c +@@ -1106,7 +1106,7 @@ static void lance_tx_timeout(struct net_device *dev) + netif_wake_queue(dev); + } + +-static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t lance_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct lance_private *lp = netdev_priv(dev); + int entry, skblen, len; +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +index 1e4e8b245cd5..1df7f5da8411 100644 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +@@ -1390,7 +1390,7 @@ static int xgbe_close(struct net_device *netdev) + return 0; + } + +-static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) ++static netdev_tx_t xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) + { + struct xgbe_prv_data *pdata = netdev_priv(netdev); + struct xgbe_hw_if *hw_if = &pdata->hw_if; +@@ -1399,7 +1399,7 @@ static int xgbe_xmit(struct sk_buff *skb, struct net_device *netdev) + struct xgbe_ring *ring; + struct xgbe_packet_data *packet; + struct netdev_queue *txq; +- int ret; ++ netdev_tx_t ret; + + DBGPR("-->xgbe_xmit: skb->len = %d\n", skb->len); + +diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +index c4078401b7de..900f2f706cbc 100644 +--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c +@@ -571,12 +571,13 @@ static irqreturn_t bcm_enet_isr_dma(int irq, void *dev_id) + /* + * tx request callback + */ +-static int bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t ++bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct bcm_enet_priv *priv; + struct bcm_enet_desc *desc; + u32 len_stat; +- int ret; ++ netdev_tx_t ret; + + priv = netdev_priv(dev); + +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +index a9681b191304..ce8a777b1e97 100644 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +@@ -3540,6 +3540,16 @@ static void bnx2x_drv_info_iscsi_stat(struct bnx2x *bp) + */ + static void bnx2x_config_mf_bw(struct bnx2x *bp) + { ++ /* Workaround for MFW bug. ++ * MFW is not supposed to generate BW attention in ++ * single function mode. ++ */ ++ if (!IS_MF(bp)) { ++ DP(BNX2X_MSG_MCP, ++ "Ignoring MF BW config in single function mode\n"); ++ return; ++ } ++ + if (bp->link_vars.link_up) { + bnx2x_cmng_fns_init(bp, true, CMNG_FNS_MINMAX); + bnx2x_link_sync_notify(bp); +diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c +index f1b81187a201..dc7953894c35 100644 +--- a/drivers/net/ethernet/broadcom/sb1250-mac.c ++++ b/drivers/net/ethernet/broadcom/sb1250-mac.c +@@ -299,7 +299,7 @@ static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *, + static void sbmac_promiscuous_mode(struct sbmac_softc *sc, int onoff); + static uint64_t sbmac_addr2reg(unsigned char *ptr); + static irqreturn_t sbmac_intr(int irq, void *dev_instance); +-static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); ++static netdev_tx_t sbmac_start_tx(struct sk_buff *skb, struct net_device *dev); + static void sbmac_setmulti(struct sbmac_softc *sc); + static int sbmac_init(struct platform_device *pldev, long long base); + static int sbmac_set_speed(struct sbmac_softc *s, enum sbmac_speed speed); +@@ -2032,7 +2032,7 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance) + * Return value: + * nothing + ********************************************************************* */ +-static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t sbmac_start_tx(struct sk_buff *skb, struct net_device *dev) + { + struct sbmac_softc *sc = netdev_priv(dev); + unsigned long flags; +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +index 6ee2ed30626b..306b4b320616 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +@@ -266,8 +266,8 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap, + enum cxgb4_dcb_state_input input = + ((pcmd->u.dcb.control.all_syncd_pkd & + FW_PORT_CMD_ALL_SYNCD_F) +- ? CXGB4_DCB_STATE_FW_ALLSYNCED +- : CXGB4_DCB_STATE_FW_INCOMPLETE); ++ ? CXGB4_DCB_INPUT_FW_ALLSYNCED ++ : CXGB4_DCB_INPUT_FW_INCOMPLETE); + + if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) { + dcb_running_version = FW_PORT_CMD_DCB_VERSION_G( +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h +index ccf24d3dc982..2c418c405c50 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h +@@ -67,7 +67,7 @@ + do { \ + if ((__dcb)->dcb_version == FW_PORT_DCB_VER_IEEE) \ + cxgb4_dcb_state_fsm((__dev), \ +- CXGB4_DCB_STATE_FW_ALLSYNCED); \ ++ CXGB4_DCB_INPUT_FW_ALLSYNCED); \ + } while (0) + + /* States we can be in for a port's Data Center Bridging. +diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +index ebeeb3581b9c..b4b435276a18 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +@@ -3541,7 +3541,7 @@ int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op) + c.param[0].mnem = + cpu_to_be32(FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | + FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_FWCACHE)); +- c.param[0].val = (__force __be32)op; ++ c.param[0].val = cpu_to_be32(op); + + return t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), NULL); + } +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index 886378c5334f..043b69b5843b 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -11360,6 +11360,7 @@ static void i40e_remove(struct pci_dev *pdev) + mutex_destroy(&hw->aq.asq_mutex); + + /* Clear all dynamic memory lists of rings, q_vectors, and VSIs */ ++ rtnl_lock(); + i40e_clear_interrupt_scheme(pf); + for (i = 0; i < pf->num_alloc_vsi; i++) { + if (pf->vsi[i]) { +@@ -11368,6 +11369,7 @@ static void i40e_remove(struct pci_dev *pdev) + pf->vsi[i] = NULL; + } + } ++ rtnl_unlock(); + + for (i = 0; i < I40E_MAX_VEB; i++) { + kfree(pf->veb[i]); +@@ -11513,7 +11515,13 @@ static void i40e_shutdown(struct pci_dev *pdev) + wr32(hw, I40E_PFPM_WUFC, + (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); + ++ /* Since we're going to destroy queues during the ++ * i40e_clear_interrupt_scheme() we should hold the RTNL lock for this ++ * whole section ++ */ ++ rtnl_lock(); + i40e_clear_interrupt_scheme(pf); ++ rtnl_unlock(); + + if (system_state == SYSTEM_POWER_OFF) { + pci_wake_from_d3(pdev, pf->wol_en); +diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c +index f1feceab758a..41cbcb0ac2d9 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c +@@ -604,7 +604,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf) + if (!IS_ERR_OR_NULL(pf->ptp_clock)) + return 0; + +- strncpy(pf->ptp_caps.name, i40e_driver_name, sizeof(pf->ptp_caps.name)); ++ strncpy(pf->ptp_caps.name, i40e_driver_name, ++ sizeof(pf->ptp_caps.name) - 1); + pf->ptp_caps.owner = THIS_MODULE; + pf->ptp_caps.max_adj = 999999999; + pf->ptp_caps.n_ext_ts = 0; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +index 54b8ee2583f1..7484ad3c955d 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +@@ -2000,6 +2000,16 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) + ret = I40E_ERR_INVALID_MAC_ADDR; + goto error_param; + } ++ ++ if (vf->pf_set_mac && ++ ether_addr_equal(al->list[i].addr, ++ vf->default_lan_addr.addr)) { ++ dev_err(&pf->pdev->dev, ++ "MAC addr %pM has been set by PF, cannot delete it for VF %d, reset VF to change MAC addr\n", ++ vf->default_lan_addr.addr, vf->vf_id); ++ ret = I40E_ERR_PARAM; ++ goto error_param; ++ } + } + vsi = pf->vsi[vf->lan_vsi_idx]; + +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +index a5428b6abdac..8ad20b7852ed 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +@@ -4804,6 +4804,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) + struct ixgbe_hw *hw = &adapter->hw; + struct hlist_node *node2; + struct ixgbe_fdir_filter *filter; ++ u64 action; + + spin_lock(&adapter->fdir_perfect_lock); + +@@ -4812,12 +4813,17 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) + + hlist_for_each_entry_safe(filter, node2, + &adapter->fdir_filter_list, fdir_node) { ++ action = filter->action; ++ if (action != IXGBE_FDIR_DROP_QUEUE && action != 0) ++ action = ++ (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1; ++ + ixgbe_fdir_write_perfect_filter_82599(hw, + &filter->filter, + filter->sw_idx, +- (filter->action == IXGBE_FDIR_DROP_QUEUE) ? ++ (action == IXGBE_FDIR_DROP_QUEUE) ? + IXGBE_FDIR_DROP_QUEUE : +- adapter->rx_ring[filter->action]->reg_idx); ++ adapter->rx_ring[action]->reg_idx); + } + + spin_unlock(&adapter->fdir_perfect_lock); +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +index 585a40cc6470..8460c4807567 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +@@ -2191,6 +2191,13 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) + MLXSW_REG_QEEC_MAS_DIS); + if (err) + return err; ++ ++ err = mlxsw_sp_port_ets_maxrate_set(mlxsw_sp_port, ++ MLXSW_REG_QEEC_HIERARCY_TC, ++ i + 8, i, ++ MLXSW_REG_QEEC_MAS_DIS); ++ if (err) ++ return err; + } + + /* Map all priorities to traffic class 0. */ +diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c +index 20cb85bc0c5f..6135d90f368f 100644 +--- a/drivers/net/ethernet/micrel/ks8695net.c ++++ b/drivers/net/ethernet/micrel/ks8695net.c +@@ -1156,7 +1156,7 @@ ks8695_timeout(struct net_device *ndev) + * sk_buff and adds it to the TX ring. It then kicks the TX DMA + * engine to ensure transmission begins. + */ +-static int ++static netdev_tx_t + ks8695_start_xmit(struct sk_buff *skb, struct net_device *ndev) + { + struct ks8695_priv *ksp = netdev_priv(ndev); +diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c +index 2fc5cd56c0a8..8dc1f0277117 100644 +--- a/drivers/net/ethernet/micrel/ks8851_mll.c ++++ b/drivers/net/ethernet/micrel/ks8851_mll.c +@@ -1020,9 +1020,9 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) + * spin_lock_irqsave is required because tx and rx should be mutual exclusive. + * So while tx is in-progress, prevent IRQ interrupt from happenning. + */ +-static int ks_start_xmit(struct sk_buff *skb, struct net_device *netdev) ++static netdev_tx_t ks_start_xmit(struct sk_buff *skb, struct net_device *netdev) + { +- int retv = NETDEV_TX_OK; ++ netdev_tx_t retv = NETDEV_TX_OK; + struct ks_net *ks = netdev_priv(netdev); + + disable_irq(netdev->irq); +diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c +index cb49c9654f0a..323b3ac16bc0 100644 +--- a/drivers/net/ethernet/smsc/smc911x.c ++++ b/drivers/net/ethernet/smsc/smc911x.c +@@ -514,7 +514,8 @@ static void smc911x_hardware_send_pkt(struct net_device *dev) + * now, or set the card to generates an interrupt when ready + * for the packet. + */ +-static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t ++smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct smc911x_local *lp = netdev_priv(dev); + unsigned int free; +diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c +index 73212590d04a..b0c72167bade 100644 +--- a/drivers/net/ethernet/smsc/smc91x.c ++++ b/drivers/net/ethernet/smsc/smc91x.c +@@ -637,7 +637,8 @@ done: if (!THROTTLE_TX_PKTS) + * now, or set the card to generates an interrupt when ready + * for the packet. + */ +-static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t ++smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct smc_local *lp = netdev_priv(dev); + void __iomem *ioaddr = lp->base; +diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c +index 734caa7a557b..4143659615e1 100644 +--- a/drivers/net/ethernet/smsc/smsc911x.c ++++ b/drivers/net/ethernet/smsc/smsc911x.c +@@ -1776,7 +1776,8 @@ static int smsc911x_stop(struct net_device *dev) + } + + /* Entry point for transmitting a packet */ +-static int smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t ++smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct smsc911x_data *pdata = netdev_priv(dev); + unsigned int freespace; +diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c +index 272f2b1cb7ad..34f843795531 100644 +--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c ++++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c +@@ -845,9 +845,9 @@ static int gelic_card_kick_txdma(struct gelic_card *card, + * @skb: packet to send out + * @netdev: interface device structure + * +- * returns 0 on success, <0 on failure ++ * returns NETDEV_TX_OK on success, NETDEV_TX_BUSY on failure + */ +-int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev) ++netdev_tx_t gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev) + { + struct gelic_card *card = netdev_card(netdev); + struct gelic_descr *descr; +diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.h b/drivers/net/ethernet/toshiba/ps3_gelic_net.h +index 8505196be9f5..d123644bd720 100644 +--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.h ++++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.h +@@ -370,7 +370,7 @@ void gelic_card_up(struct gelic_card *card); + void gelic_card_down(struct gelic_card *card); + int gelic_net_open(struct net_device *netdev); + int gelic_net_stop(struct net_device *netdev); +-int gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev); ++netdev_tx_t gelic_net_xmit(struct sk_buff *skb, struct net_device *netdev); + void gelic_net_set_multi(struct net_device *netdev); + void gelic_net_tx_timeout(struct net_device *netdev); + int gelic_net_change_mtu(struct net_device *netdev, int new_mtu); +diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c +index 36a6e8b54d94..108598794621 100644 +--- a/drivers/net/ethernet/toshiba/spider_net.c ++++ b/drivers/net/ethernet/toshiba/spider_net.c +@@ -880,9 +880,9 @@ out: + * @skb: packet to send out + * @netdev: interface device structure + * +- * returns 0 on success, !0 on failure ++ * returns NETDEV_TX_OK on success, NETDEV_TX_BUSY on failure + */ +-static int ++static netdev_tx_t + spider_net_xmit(struct sk_buff *skb, struct net_device *netdev) + { + int cnt; +diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c +index 47ebac456ae5..9b84ee736fdc 100644 +--- a/drivers/net/ethernet/toshiba/tc35815.c ++++ b/drivers/net/ethernet/toshiba/tc35815.c +@@ -474,7 +474,8 @@ static void free_rxbuf_skb(struct pci_dev *hwdev, struct sk_buff *skb, dma_addr_ + /* Index to functions, as function prototypes. */ + + static int tc35815_open(struct net_device *dev); +-static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev); ++static netdev_tx_t tc35815_send_packet(struct sk_buff *skb, ++ struct net_device *dev); + static irqreturn_t tc35815_interrupt(int irq, void *dev_id); + static int tc35815_rx(struct net_device *dev, int limit); + static int tc35815_poll(struct napi_struct *napi, int budget); +@@ -1249,7 +1250,8 @@ tc35815_open(struct net_device *dev) + * invariant will hold if you make sure that the netif_*_queue() + * calls are done at the proper times. + */ +-static int tc35815_send_packet(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t ++tc35815_send_packet(struct sk_buff *skb, struct net_device *dev) + { + struct tc35815_local *lp = netdev_priv(dev); + struct TxFD *txfd; +diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c +index a9bd665fd122..545f60877bb7 100644 +--- a/drivers/net/ethernet/xilinx/ll_temac_main.c ++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c +@@ -673,7 +673,8 @@ static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag) + return 0; + } + +-static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) ++static netdev_tx_t ++temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) + { + struct temac_local *lp = netdev_priv(ndev); + struct cdmac_bd *cur_p; +diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +index 5f21ddff9e0f..46fcf3ec2caf 100644 +--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c ++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +@@ -655,7 +655,8 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp, + * start the transmission. Additionally if checksum offloading is supported, + * it populates AXI Stream Control fields with appropriate values. + */ +-static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) ++static netdev_tx_t ++axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) + { + u32 ii; + u32 num_frag; +diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c +index aa02a03a6d8d..034b36442ee7 100644 +--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c ++++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c +@@ -1005,9 +1005,10 @@ static int xemaclite_close(struct net_device *dev) + * deferred and the Tx queue is stopped so that the deferred socket buffer can + * be transmitted when the Emaclite device is free to transmit data. + * +- * Return: 0, always. ++ * Return: NETDEV_TX_OK, always. + */ +-static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) ++static netdev_tx_t ++xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) + { + struct net_local *lp = netdev_priv(dev); + struct sk_buff *new_skb; +@@ -1028,7 +1029,7 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) + /* Take the time stamp now, since we can't do this in an ISR. */ + skb_tx_timestamp(new_skb); + spin_unlock_irqrestore(&lp->reset_lock, flags); +- return 0; ++ return NETDEV_TX_OK; + } + spin_unlock_irqrestore(&lp->reset_lock, flags); + +@@ -1037,7 +1038,7 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) + dev->stats.tx_bytes += len; + dev_consume_skb_any(new_skb); + +- return 0; ++ return NETDEV_TX_OK; + } + + /** +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c +index 9ed6d1c1ee45..b2317b3a542a 100644 +--- a/drivers/net/slip/slip.c ++++ b/drivers/net/slip/slip.c +@@ -860,6 +860,7 @@ err_free_chan: + sl->tty = NULL; + tty->disc_data = NULL; + clear_bit(SLF_INUSE, &sl->flags); ++ free_netdev(sl->dev); + + err_exit: + rtnl_unlock(); +diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c +index 49a3bc107d05..2c50497cc4ed 100644 +--- a/drivers/net/usb/ax88172a.c ++++ b/drivers/net/usb/ax88172a.c +@@ -215,7 +215,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf) + + /* Get the MAC address */ + ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0); +- if (ret < 0) { ++ if (ret < ETH_ALEN) { + netdev_err(dev->net, "Failed to read MAC address: %d\n", ret); + goto free; + } +diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c +index cbb9b4343d1e..be4e56826daf 100644 +--- a/drivers/net/usb/cdc_ncm.c ++++ b/drivers/net/usb/cdc_ncm.c +@@ -577,7 +577,7 @@ static void cdc_ncm_set_dgram_size(struct usbnet *dev, int new_size) + err = usbnet_read_cmd(dev, USB_CDC_GET_MAX_DATAGRAM_SIZE, + USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, + 0, iface_no, &max_datagram_size, sizeof(max_datagram_size)); +- if (err < sizeof(max_datagram_size)) { ++ if (err != sizeof(max_datagram_size)) { + dev_dbg(&dev->intf->dev, "GET_MAX_DATAGRAM_SIZE failed\n"); + goto out; + } +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index e143a7fe9320..a3f9d8f05db4 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -2621,6 +2621,11 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf) + int i; + + ret = lan78xx_get_endpoints(dev, intf); ++ if (ret) { ++ netdev_warn(dev->net, "lan78xx_get_endpoints failed: %d\n", ++ ret); ++ return ret; ++ } + + dev->data[0] = (unsigned long)kzalloc(sizeof(*pdata), GFP_KERNEL); + +diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c +index da770af83036..125b5c31b2b0 100644 +--- a/drivers/net/wireless/ath/ath10k/ahb.c ++++ b/drivers/net/wireless/ath/ath10k/ahb.c +@@ -658,10 +658,10 @@ static void ath10k_ahb_hif_stop(struct ath10k *ar) + ath10k_ahb_irq_disable(ar); + synchronize_irq(ar_ahb->irq); + +- ath10k_pci_flush(ar); +- + napi_synchronize(&ar->napi); + napi_disable(&ar->napi); ++ ++ ath10k_pci_flush(ar); + } + + static int ath10k_ahb_hif_power_up(struct ath10k *ar) +diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h +index 90c0c4a7175d..414153cd5784 100644 +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -811,6 +811,7 @@ struct ath10k { + + struct completion install_key_done; + ++ int last_wmi_vdev_start_status; + struct completion vdev_setup_done; + + struct workqueue_struct *workqueue; +diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c +index 1588fe8110d0..2294ba311c47 100644 +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -947,7 +947,7 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar) + if (time_left == 0) + return -ETIMEDOUT; + +- return 0; ++ return ar->last_wmi_vdev_start_status; + } + + static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) +diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c +index 25b8d501d437..b7bac14d1487 100644 +--- a/drivers/net/wireless/ath/ath10k/pci.c ++++ b/drivers/net/wireless/ath/ath10k/pci.c +@@ -1781,9 +1781,9 @@ static void ath10k_pci_hif_stop(struct ath10k *ar) + + ath10k_pci_irq_disable(ar); + ath10k_pci_irq_sync(ar); +- ath10k_pci_flush(ar); + napi_synchronize(&ar->napi); + napi_disable(&ar->napi); ++ ath10k_pci_flush(ar); + + spin_lock_irqsave(&ar_pci->ps_lock, flags); + WARN_ON(ar_pci->ps_wake_refcount > 0); +diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c +index bbfe7be214e1..af3bc06b4aed 100644 +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -2384,7 +2384,8 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) + status->freq, status->band, status->signal, + status->rate_idx); + +- ieee80211_rx(ar->hw, skb); ++ ieee80211_rx_ni(ar->hw, skb); ++ + return 0; + } + +@@ -3102,18 +3103,31 @@ void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) + { + struct wmi_vdev_start_ev_arg arg = {}; + int ret; ++ u32 status; + + ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n"); + ++ ar->last_wmi_vdev_start_status = 0; ++ + ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg); + if (ret) { + ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret); +- return; ++ ar->last_wmi_vdev_start_status = ret; ++ goto out; + } + +- if (WARN_ON(__le32_to_cpu(arg.status))) +- return; ++ status = __le32_to_cpu(arg.status); ++ if (WARN_ON_ONCE(status)) { ++ ath10k_warn(ar, "vdev-start-response reports status error: %d (%s)\n", ++ status, (status == WMI_VDEV_START_CHAN_INVALID) ? ++ "chan-invalid" : "unknown"); ++ /* Setup is done one way or another though, so we should still ++ * do the completion, so don't return here. ++ */ ++ ar->last_wmi_vdev_start_status = -EINVAL; ++ } + ++out: + complete(&ar->vdev_setup_done); + } + +diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h +index 9b8562ff6698..cce028ea9b57 100644 +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -6248,11 +6248,17 @@ struct wmi_ch_info_ev_arg { + __le32 rx_frame_count; + }; + ++/* From 10.4 firmware, not sure all have the same values. */ ++enum wmi_vdev_start_status { ++ WMI_VDEV_START_OK = 0, ++ WMI_VDEV_START_CHAN_INVALID, ++}; ++ + struct wmi_vdev_start_ev_arg { + __le32 vdev_id; + __le32 req_id; + __le32 resp_type; /* %WMI_VDEV_RESP_ */ +- __le32 status; ++ __le32 status; /* See wmi_vdev_start_status enum above */ + }; + + struct wmi_peer_kick_ev_arg { +diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c +index eedf86b67cf5..807fbe31e930 100644 +--- a/drivers/net/wireless/ath/ath9k/common-spectral.c ++++ b/drivers/net/wireless/ath/ath9k/common-spectral.c +@@ -411,7 +411,7 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs, + + ath_dbg(common, SPECTRAL_SCAN, + "Calculated new upper max 0x%X at %i\n", +- tmp_mag, i); ++ tmp_mag, fft_sample_40.upper_max_index); + } else + for (i = dc_pos; i < SPECTRAL_HT20_40_NUM_BINS; i++) { + if (fft_sample_40.data[i] == (upper_mag >> max_exp)) +diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c +index b868f02ced89..abc997427bae 100644 +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -1250,7 +1250,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, + struct ath_node *an = &avp->mcast_node; + + mutex_lock(&sc->mutex); +- + if (IS_ENABLED(CONFIG_ATH9K_TX99)) { + if (sc->cur_chan->nvifs >= 1) { + mutex_unlock(&sc->mutex); +diff --git a/drivers/net/wireless/ath/ath9k/tx99.c b/drivers/net/wireless/ath/ath9k/tx99.c +index 8e9480cc33e1..096902e0fdf5 100644 +--- a/drivers/net/wireless/ath/ath9k/tx99.c ++++ b/drivers/net/wireless/ath/ath9k/tx99.c +@@ -56,11 +56,6 @@ static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc) + struct sk_buff *skb; + struct ath_vif *avp; + +- if (!sc->tx99_vif) +- return NULL; +- +- avp = (struct ath_vif *)sc->tx99_vif->drv_priv; +- + skb = alloc_skb(len, GFP_KERNEL); + if (!skb) + return NULL; +@@ -77,7 +72,10 @@ static struct sk_buff *ath9k_build_tx99_skb(struct ath_softc *sc) + memcpy(hdr->addr2, hw->wiphy->perm_addr, ETH_ALEN); + memcpy(hdr->addr3, hw->wiphy->perm_addr, ETH_ALEN); + +- hdr->seq_ctrl |= cpu_to_le16(avp->seq_no); ++ if (sc->tx99_vif) { ++ avp = (struct ath_vif *) sc->tx99_vif->drv_priv; ++ hdr->seq_ctrl |= cpu_to_le16(avp->seq_no); ++ } + + tx_info = IEEE80211_SKB_CB(skb); + memset(tx_info, 0, sizeof(*tx_info)); +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +index f78d91b69287..aac9c97d2255 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -74,7 +74,7 @@ + #define P2P_AF_MAX_WAIT_TIME msecs_to_jiffies(2000) + #define P2P_INVALID_CHANNEL -1 + #define P2P_CHANNEL_SYNC_RETRY 5 +-#define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(1500) ++#define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(450) + #define P2P_DEFAULT_SLEEP_TIME_VSDB 200 + + /* WiFi P2P Public Action Frame OUI Subtypes */ +@@ -1139,7 +1139,6 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) + { + struct afx_hdl *afx_hdl = &p2p->afx_hdl; + struct brcmf_cfg80211_vif *pri_vif; +- unsigned long duration; + s32 retry; + + brcmf_dbg(TRACE, "Enter\n"); +@@ -1155,7 +1154,6 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) + * pending action frame tx is cancelled. + */ + retry = 0; +- duration = msecs_to_jiffies(P2P_AF_FRM_SCAN_MAX_WAIT); + while ((retry < P2P_CHANNEL_SYNC_RETRY) && + (afx_hdl->peer_chan == P2P_INVALID_CHANNEL)) { + afx_hdl->is_listen = false; +@@ -1163,7 +1161,8 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) + retry); + /* search peer on peer's listen channel */ + schedule_work(&afx_hdl->afx_work); +- wait_for_completion_timeout(&afx_hdl->act_frm_scan, duration); ++ wait_for_completion_timeout(&afx_hdl->act_frm_scan, ++ P2P_AF_FRM_SCAN_MAX_WAIT); + if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || + (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, + &p2p->status))) +@@ -1176,7 +1175,7 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) + afx_hdl->is_listen = true; + schedule_work(&afx_hdl->afx_work); + wait_for_completion_timeout(&afx_hdl->act_frm_scan, +- duration); ++ P2P_AF_FRM_SCAN_MAX_WAIT); + } + if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || + (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, +@@ -1463,10 +1462,12 @@ int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp, + return 0; + + if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) { +- if (e->status == BRCMF_E_STATUS_SUCCESS) ++ if (e->status == BRCMF_E_STATUS_SUCCESS) { + set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, + &p2p->status); +- else { ++ if (!p2p->wait_for_offchan_complete) ++ complete(&p2p->send_af_done); ++ } else { + set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); + /* If there is no ack, we don't need to wait for + * WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE event +@@ -1517,6 +1518,17 @@ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p, + p2p->af_sent_channel = le32_to_cpu(af_params->channel); + p2p->af_tx_sent_jiffies = jiffies; + ++ if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status) && ++ p2p->af_sent_channel == ++ ieee80211_frequency_to_channel(p2p->remain_on_channel.center_freq)) ++ p2p->wait_for_offchan_complete = false; ++ else ++ p2p->wait_for_offchan_complete = true; ++ ++ brcmf_dbg(TRACE, "Waiting for %s tx completion event\n", ++ (p2p->wait_for_offchan_complete) ? ++ "off-channel" : "on-channel"); ++ + timeout = wait_for_completion_timeout(&p2p->send_af_done, + P2P_AF_MAX_WAIT_TIME); + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h +index 8ce9447533ef..fbee51148904 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h +@@ -124,6 +124,7 @@ struct afx_hdl { + * @gon_req_action: about to send go negotiation requets frame. + * @block_gon_req_tx: drop tx go negotiation requets frame. + * @p2pdev_dynamically: is p2p device if created by module param or supplicant. ++ * @wait_for_offchan_complete: wait for off-channel tx completion event. + */ + struct brcmf_p2p_info { + struct brcmf_cfg80211_info *cfg; +@@ -144,6 +145,7 @@ struct brcmf_p2p_info { + bool gon_req_action; + bool block_gon_req_tx; + bool p2pdev_dynamically; ++ bool wait_for_offchan_complete; + }; + + s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced); +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +index 207d8ae1e116..19052efe53f1 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +@@ -935,8 +935,10 @@ int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, + { + struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {}; + struct iwl_wowlan_tkip_params_cmd tkip_cmd = {}; ++ bool unified = fw_has_capa(&mvm->fw->ucode_capa, ++ IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); + struct wowlan_key_data key_data = { +- .configure_keys = !d0i3, ++ .configure_keys = !d0i3 && !unified, + .use_rsc_tsc = false, + .tkip = &tkip_cmd, + .use_tkip = false, +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +index 1aa74b87599f..63dcea640d07 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +@@ -1303,6 +1303,14 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, + break; + } + ++ /* ++ * If we are freeing multiple frames, mark all the frames ++ * but the first one as acked, since they were acknowledged ++ * before ++ * */ ++ if (skb_freed > 1) ++ info->flags |= IEEE80211_TX_STAT_ACK; ++ + iwl_mvm_tx_status_check_trigger(mvm, status); + + info->status.rates[0].count = tx_resp->failure_frame + 1; +diff --git a/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c b/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c +index c2d5b495c179..c089540116fa 100644 +--- a/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c ++++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c +@@ -146,7 +146,7 @@ static int rtl8187_register_led(struct ieee80211_hw *dev, + led->dev = dev; + led->ledpin = ledpin; + led->is_radio = is_radio; +- strncpy(led->name, name, sizeof(led->name)); ++ strlcpy(led->name, name, sizeof(led->name)); + + led->led_dev.name = led->name; + led->led_dev.default_trigger = default_trigger; +diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c +index e1f47b6ea3b7..46008f284550 100644 +--- a/drivers/net/xen-netback/interface.c ++++ b/drivers/net/xen-netback/interface.c +@@ -171,7 +171,8 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, + return vif->hash.mapping[skb_get_hash_raw(skb) % size]; + } + +-static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t ++xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct xenvif *vif = netdev_priv(dev); + struct xenvif_queue *queue = NULL; +diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c +index 9ca24e4d5d49..2a0c5f3b0e50 100644 +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -609,7 +609,7 @@ static struct nvmem_device *nvmem_find(const char *name) + d = bus_find_device(&nvmem_bus_type, NULL, (void *)name, nvmem_match); + + if (!d) +- return NULL; ++ return ERR_PTR(-ENOENT); + + return to_nvmem_device(d); + } +diff --git a/drivers/of/base.c b/drivers/of/base.c +index f366af135d5b..c66cdc4307fd 100644 +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -2281,7 +2281,7 @@ struct device_node *of_find_next_cache_node(const struct device_node *np) + /* OF on pmac has nodes instead of properties named "l2-cache" + * beneath CPU nodes. + */ +- if (!strcmp(np->type, "cpu")) ++ if (IS_ENABLED(CONFIG_PPC_PMAC) && !strcmp(np->type, "cpu")) + for_each_child_of_node(np, child) + if (!strcmp(child->type, "cache")) + return child; +diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c +index 547ca7b3f098..ddb530ee2255 100644 +--- a/drivers/phy/phy-twl4030-usb.c ++++ b/drivers/phy/phy-twl4030-usb.c +@@ -144,6 +144,7 @@ + #define PMBR1 0x0D + #define GPIO_USB_4PIN_ULPI_2430C (3 << 0) + ++static irqreturn_t twl4030_usb_irq(int irq, void *_twl); + /* + * If VBUS is valid or ID is ground, then we know a + * cable is present and we need to be runtime-enabled +@@ -392,6 +393,33 @@ static void __twl4030_phy_power(struct twl4030_usb *twl, int on) + WARN_ON(twl4030_usb_write_verify(twl, PHY_PWR_CTRL, pwr) < 0); + } + ++static int __maybe_unused twl4030_usb_suspend(struct device *dev) ++{ ++ struct twl4030_usb *twl = dev_get_drvdata(dev); ++ ++ /* ++ * we need enabled runtime on resume, ++ * so turn irq off here, so we do not get it early ++ * note: wakeup on usb plug works independently of this ++ */ ++ dev_dbg(twl->dev, "%s\n", __func__); ++ disable_irq(twl->irq); ++ ++ return 0; ++} ++ ++static int __maybe_unused twl4030_usb_resume(struct device *dev) ++{ ++ struct twl4030_usb *twl = dev_get_drvdata(dev); ++ ++ dev_dbg(twl->dev, "%s\n", __func__); ++ enable_irq(twl->irq); ++ /* check whether cable status changed */ ++ twl4030_usb_irq(0, twl); ++ ++ return 0; ++} ++ + static int __maybe_unused twl4030_usb_runtime_suspend(struct device *dev) + { + struct twl4030_usb *twl = dev_get_drvdata(dev); +@@ -652,6 +680,7 @@ static const struct phy_ops ops = { + static const struct dev_pm_ops twl4030_usb_pm_ops = { + SET_RUNTIME_PM_OPS(twl4030_usb_runtime_suspend, + twl4030_usb_runtime_resume, NULL) ++ SET_SYSTEM_SLEEP_PM_OPS(twl4030_usb_suspend, twl4030_usb_resume) + }; + + static int twl4030_usb_probe(struct platform_device *pdev) +diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c +index 88ba9c50cc8e..b596f45426ea 100644 +--- a/drivers/pinctrl/pinctrl-at91-pio4.c ++++ b/drivers/pinctrl/pinctrl-at91-pio4.c +@@ -479,7 +479,6 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev, + unsigned num_pins, num_configs, reserve; + unsigned long *configs; + struct property *pins; +- bool has_config; + u32 pinfunc; + int ret, i; + +@@ -495,9 +494,6 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev, + return ret; + } + +- if (num_configs) +- has_config = true; +- + num_pins = pins->length / sizeof(u32); + if (!num_pins) { + dev_err(pctldev->dev, "no pins found in node %s\n", +@@ -511,7 +507,7 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev, + * map for each pin. + */ + reserve = 1; +- if (has_config && num_pins >= 1) ++ if (num_configs) + reserve++; + reserve *= num_pins; + ret = pinctrl_utils_reserve_map(pctldev, map, reserved_maps, num_maps, +@@ -534,7 +530,7 @@ static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev, + pinctrl_utils_add_map_mux(pctldev, map, reserved_maps, num_maps, + group, func); + +- if (has_config) { ++ if (num_configs) { + ret = pinctrl_utils_add_map_configs(pctldev, map, + reserved_maps, num_maps, group, + configs, num_configs, +diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c +index 9f0904185909..9401a0630e80 100644 +--- a/drivers/pinctrl/pinctrl-at91.c ++++ b/drivers/pinctrl/pinctrl-at91.c +@@ -1545,16 +1545,6 @@ void at91_pinctrl_gpio_resume(void) + #define gpio_irq_set_wake NULL + #endif /* CONFIG_PM */ + +-static struct irq_chip gpio_irqchip = { +- .name = "GPIO", +- .irq_ack = gpio_irq_ack, +- .irq_disable = gpio_irq_mask, +- .irq_mask = gpio_irq_mask, +- .irq_unmask = gpio_irq_unmask, +- /* .irq_set_type is set dynamically */ +- .irq_set_wake = gpio_irq_set_wake, +-}; +- + static void gpio_irq_handler(struct irq_desc *desc) + { + struct irq_chip *chip = irq_desc_get_chip(desc); +@@ -1595,12 +1585,22 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, + struct gpio_chip *gpiochip_prev = NULL; + struct at91_gpio_chip *prev = NULL; + struct irq_data *d = irq_get_irq_data(at91_gpio->pioc_virq); ++ struct irq_chip *gpio_irqchip; + int ret, i; + ++ gpio_irqchip = devm_kzalloc(&pdev->dev, sizeof(*gpio_irqchip), GFP_KERNEL); ++ if (!gpio_irqchip) ++ return -ENOMEM; ++ + at91_gpio->pioc_hwirq = irqd_to_hwirq(d); + +- /* Setup proper .irq_set_type function */ +- gpio_irqchip.irq_set_type = at91_gpio->ops->irq_type; ++ gpio_irqchip->name = "GPIO"; ++ gpio_irqchip->irq_ack = gpio_irq_ack; ++ gpio_irqchip->irq_disable = gpio_irq_mask; ++ gpio_irqchip->irq_mask = gpio_irq_mask; ++ gpio_irqchip->irq_unmask = gpio_irq_unmask; ++ gpio_irqchip->irq_set_wake = gpio_irq_set_wake, ++ gpio_irqchip->irq_set_type = at91_gpio->ops->irq_type; + + /* Disable irqs of this PIO controller */ + writel_relaxed(~0, at91_gpio->regbase + PIO_IDR); +@@ -1611,7 +1611,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, + * interrupt. + */ + ret = gpiochip_irqchip_add(&at91_gpio->chip, +- &gpio_irqchip, ++ gpio_irqchip, + 0, + handle_edge_irq, + IRQ_TYPE_NONE); +@@ -1629,7 +1629,7 @@ static int at91_gpio_of_irq_setup(struct platform_device *pdev, + if (!gpiochip_prev) { + /* Then register the chain on the parent IRQ */ + gpiochip_set_chained_irqchip(&at91_gpio->chip, +- &gpio_irqchip, ++ gpio_irqchip, + at91_gpio->pioc_virq, + gpio_irq_handler); + return 0; +diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c +index 90b0b5a70ce5..04ca990e8f6c 100644 +--- a/drivers/power/reset/at91-sama5d2_shdwc.c ++++ b/drivers/power/reset/at91-sama5d2_shdwc.c +@@ -246,6 +246,9 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) + if (!pdev->dev.of_node) + return -ENODEV; + ++ if (at91_shdwc) ++ return -EBUSY; ++ + at91_shdwc = devm_kzalloc(&pdev->dev, sizeof(*at91_shdwc), GFP_KERNEL); + if (!at91_shdwc) + return -ENOMEM; +diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c +index 2199f673118c..ea8c26a108f0 100644 +--- a/drivers/power/supply/ab8500_fg.c ++++ b/drivers/power/supply/ab8500_fg.c +@@ -2437,17 +2437,14 @@ static ssize_t charge_full_store(struct ab8500_fg *di, const char *buf, + size_t count) + { + unsigned long charge_full; +- ssize_t ret; ++ int ret; + + ret = kstrtoul(buf, 10, &charge_full); ++ if (ret) ++ return ret; + +- dev_dbg(di->dev, "Ret %zd charge_full %lu", ret, charge_full); +- +- if (!ret) { +- di->bat_cap.max_mah = (int) charge_full; +- ret = count; +- } +- return ret; ++ di->bat_cap.max_mah = (int) charge_full; ++ return count; + } + + static ssize_t charge_now_show(struct ab8500_fg *di, char *buf) +@@ -2459,20 +2456,16 @@ static ssize_t charge_now_store(struct ab8500_fg *di, const char *buf, + size_t count) + { + unsigned long charge_now; +- ssize_t ret; ++ int ret; + + ret = kstrtoul(buf, 10, &charge_now); ++ if (ret) ++ return ret; + +- dev_dbg(di->dev, "Ret %zd charge_now %lu was %d", +- ret, charge_now, di->bat_cap.prev_mah); +- +- if (!ret) { +- di->bat_cap.user_mah = (int) charge_now; +- di->flags.user_cap = true; +- ret = count; +- queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); +- } +- return ret; ++ di->bat_cap.user_mah = (int) charge_now; ++ di->flags.user_cap = true; ++ queue_delayed_work(di->fg_wq, &di->fg_periodic_work, 0); ++ return count; + } + + static struct ab8500_fg_sysfs_entry charge_full_attr = +diff --git a/drivers/power/supply/max8998_charger.c b/drivers/power/supply/max8998_charger.c +index b64cf0f14142..66438029bdd0 100644 +--- a/drivers/power/supply/max8998_charger.c ++++ b/drivers/power/supply/max8998_charger.c +@@ -85,7 +85,7 @@ static const struct power_supply_desc max8998_battery_desc = { + static int max8998_battery_probe(struct platform_device *pdev) + { + struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); +- struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev); ++ struct max8998_platform_data *pdata = iodev->pdata; + struct power_supply_config psy_cfg = {}; + struct max8998_battery_data *max8998; + struct i2c_client *i2c; +diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c +index bcd4dc304f27..5b1f147b11cb 100644 +--- a/drivers/power/supply/twl4030_charger.c ++++ b/drivers/power/supply/twl4030_charger.c +@@ -449,7 +449,8 @@ static void twl4030_current_worker(struct work_struct *data) + + if (v < USB_MIN_VOLT) { + /* Back up and stop adjusting. */ +- bci->usb_cur -= USB_CUR_STEP; ++ if (bci->usb_cur >= USB_CUR_STEP) ++ bci->usb_cur -= USB_CUR_STEP; + bci->usb_cur_target = bci->usb_cur; + } else if (bci->usb_cur >= bci->usb_cur_target || + bci->usb_cur + USB_CUR_STEP > USB_MAX_CURRENT) { +@@ -468,6 +469,7 @@ static void twl4030_current_worker(struct work_struct *data) + static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable) + { + int ret; ++ u32 reg; + + if (bci->usb_mode == CHARGE_OFF) + enable = false; +@@ -481,14 +483,38 @@ static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable) + bci->usb_enabled = 1; + } + +- if (bci->usb_mode == CHARGE_AUTO) ++ if (bci->usb_mode == CHARGE_AUTO) { ++ /* Enable interrupts now. */ ++ reg = ~(u32)(TWL4030_ICHGLOW | TWL4030_ICHGEOC | ++ TWL4030_TBATOR2 | TWL4030_TBATOR1 | ++ TWL4030_BATSTS); ++ ret = twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, reg, ++ TWL4030_INTERRUPTS_BCIIMR1A); ++ if (ret < 0) { ++ dev_err(bci->dev, ++ "failed to unmask interrupts: %d\n", ++ ret); ++ return ret; ++ } + /* forcing the field BCIAUTOUSB (BOOT_BCI[1]) to 1 */ + ret = twl4030_clear_set_boot_bci(0, TWL4030_BCIAUTOUSB); ++ } + + /* forcing USBFASTMCHG(BCIMFSTS4[2]) to 1 */ + ret = twl4030_clear_set(TWL_MODULE_MAIN_CHARGE, 0, + TWL4030_USBFASTMCHG, TWL4030_BCIMFSTS4); + if (bci->usb_mode == CHARGE_LINEAR) { ++ /* Enable interrupts now. */ ++ reg = ~(u32)(TWL4030_ICHGLOW | TWL4030_TBATOR2 | ++ TWL4030_TBATOR1 | TWL4030_BATSTS); ++ ret = twl_i2c_write_u8(TWL4030_MODULE_INTERRUPTS, reg, ++ TWL4030_INTERRUPTS_BCIIMR1A); ++ if (ret < 0) { ++ dev_err(bci->dev, ++ "failed to unmask interrupts: %d\n", ++ ret); ++ return ret; ++ } + twl4030_clear_set_boot_bci(TWL4030_BCIAUTOAC|TWL4030_CVENAC, 0); + /* Watch dog key: WOVF acknowledge */ + ret = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0x33, +diff --git a/drivers/reset/core.c b/drivers/reset/core.c +index 188205a55261..d0ebca301afc 100644 +--- a/drivers/reset/core.c ++++ b/drivers/reset/core.c +@@ -324,28 +324,29 @@ struct reset_control *__of_reset_control_get(struct device_node *node, + break; + } + } +- of_node_put(args.np); + + if (!rcdev) { +- mutex_unlock(&reset_list_mutex); +- return ERR_PTR(-EPROBE_DEFER); ++ rstc = ERR_PTR(-EPROBE_DEFER); ++ goto out; + } + + if (WARN_ON(args.args_count != rcdev->of_reset_n_cells)) { +- mutex_unlock(&reset_list_mutex); +- return ERR_PTR(-EINVAL); ++ rstc = ERR_PTR(-EINVAL); ++ goto out; + } + + rstc_id = rcdev->of_xlate(rcdev, &args); + if (rstc_id < 0) { +- mutex_unlock(&reset_list_mutex); +- return ERR_PTR(rstc_id); ++ rstc = ERR_PTR(rstc_id); ++ goto out; + } + + /* reset_list_mutex also protects the rcdev's reset_control list */ + rstc = __reset_control_get_internal(rcdev, rstc_id, shared); + ++out: + mutex_unlock(&reset_list_mutex); ++ of_node_put(args.np); + + return rstc; + } +diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c +index 6ba4e921d2fd..51152681aba6 100644 +--- a/drivers/s390/net/qeth_l2_main.c ++++ b/drivers/s390/net/qeth_l2_main.c +@@ -991,7 +991,10 @@ static int __qeth_l2_open(struct net_device *dev) + + if (qdio_stop_irq(card->data.ccwdev, 0) >= 0) { + napi_enable(&card->napi); ++ local_bh_disable(); + napi_schedule(&card->napi); ++ /* kick-start the NAPI softirq: */ ++ local_bh_enable(); + } else + rc = -EIO; + return rc; +diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c +index 6e6ba1baf9c4..b40a61d9ad9e 100644 +--- a/drivers/s390/net/qeth_l3_main.c ++++ b/drivers/s390/net/qeth_l3_main.c +@@ -3005,7 +3005,10 @@ static int __qeth_l3_open(struct net_device *dev) + + if (qdio_stop_irq(card->data.ccwdev, 0) >= 0) { + napi_enable(&card->napi); ++ local_bh_disable(); + napi_schedule(&card->napi); ++ /* kick-start the NAPI softirq: */ ++ local_bh_enable(); + } else + rc = -EIO; + return rc; +diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c +index 3cfab8868c98..27270631c70c 100644 +--- a/drivers/scsi/NCR5380.c ++++ b/drivers/scsi/NCR5380.c +@@ -617,16 +617,15 @@ static void complete_cmd(struct Scsi_Host *instance, + + if (hostdata->sensing == cmd) { + /* Autosense processing ends here */ +- if ((cmd->result & 0xff) != SAM_STAT_GOOD) { ++ if (status_byte(cmd->result) != GOOD) { + scsi_eh_restore_cmnd(cmd, &hostdata->ses); +- set_host_byte(cmd, DID_ERROR); +- } else ++ } else { + scsi_eh_restore_cmnd(cmd, &hostdata->ses); ++ set_driver_byte(cmd, DRIVER_SENSE); ++ } + hostdata->sensing = NULL; + } + +- hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); +- + cmd->scsi_done(cmd); + } + +@@ -1798,6 +1797,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) + cmd->result = DID_ERROR << 16; + complete_cmd(instance, cmd); + hostdata->connected = NULL; ++ hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); + return; + #endif + case PHASE_DATAIN: +@@ -1880,6 +1880,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) + cmd, scmd_id(cmd), cmd->device->lun); + + hostdata->connected = NULL; ++ hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); + + cmd->result &= ~0xffff; + cmd->result |= cmd->SCp.Status; +@@ -2039,6 +2040,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) + NCR5380_transfer_pio(instance, &phase, &len, &data); + if (msgout == ABORT) { + hostdata->connected = NULL; ++ hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); + cmd->result = DID_ERROR << 16; + complete_cmd(instance, cmd); + maybe_release_dma_irq(instance); +@@ -2101,8 +2103,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance) + NCR5380_write(MODE_REG, MR_BASE); + + target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask); +- +- dsprintk(NDEBUG_RESELECTION, instance, "reselect\n"); ++ if (!target_mask || target_mask & (target_mask - 1)) { ++ shost_printk(KERN_WARNING, instance, ++ "reselect: bad target_mask 0x%02x\n", target_mask); ++ return; ++ } + + /* + * At this point, we have detected that our SCSI ID is on the bus, +@@ -2116,6 +2121,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) + NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY); + if (NCR5380_poll_politely(instance, + STATUS_REG, SR_SEL, 0, 2 * HZ) < 0) { ++ shost_printk(KERN_ERR, instance, "reselect: !SEL timeout\n"); + NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); + return; + } +@@ -2127,6 +2133,10 @@ static void NCR5380_reselect(struct Scsi_Host *instance) + + if (NCR5380_poll_politely(instance, + STATUS_REG, SR_REQ, SR_REQ, 2 * HZ) < 0) { ++ if ((NCR5380_read(STATUS_REG) & (SR_BSY | SR_SEL)) == 0) ++ /* BUS FREE phase */ ++ return; ++ shost_printk(KERN_ERR, instance, "reselect: REQ timeout\n"); + do_abort(instance); + return; + } +@@ -2188,13 +2198,16 @@ static void NCR5380_reselect(struct Scsi_Host *instance) + dsprintk(NDEBUG_RESELECTION | NDEBUG_QUEUES, instance, + "reselect: removed %p from disconnected queue\n", tmp); + } else { ++ int target = ffs(target_mask) - 1; ++ + shost_printk(KERN_ERR, instance, "target bitmask 0x%02x lun %d not in disconnected queue.\n", + target_mask, lun); + /* + * Since we have an established nexus that we can't do anything + * with, we must abort it. + */ +- do_abort(instance); ++ if (do_abort(instance) == 0) ++ hostdata->busy[target] &= ~(1 << lun); + return; + } + +@@ -2356,15 +2369,16 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) + if (list_del_cmd(&hostdata->autosense, cmd)) { + dsprintk(NDEBUG_ABORT, instance, + "abort: removed %p from sense queue\n", cmd); +- set_host_byte(cmd, DID_ERROR); + complete_cmd(instance, cmd); + } + + out: + if (result == FAILED) + dsprintk(NDEBUG_ABORT, instance, "abort: failed to abort %p\n", cmd); +- else ++ else { ++ hostdata->busy[scmd_id(cmd)] &= ~(1 << cmd->device->lun); + dsprintk(NDEBUG_ABORT, instance, "abort: successfully aborted %p\n", cmd); ++ } + + queue_work(hostdata->work_q, &hostdata->main_task); + maybe_release_dma_irq(instance); +@@ -2392,7 +2406,7 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd) + spin_lock_irqsave(&hostdata->lock, flags); + + #if (NDEBUG & NDEBUG_ANY) +- scmd_printk(KERN_INFO, cmd, __func__); ++ shost_printk(KERN_INFO, instance, __func__); + #endif + NCR5380_dprint(NDEBUG_ANY, instance); + NCR5380_dprint_phase(NDEBUG_ANY, instance); +@@ -2410,10 +2424,13 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd) + * commands! + */ + +- if (list_del_cmd(&hostdata->unissued, cmd)) { ++ list_for_each_entry(ncmd, &hostdata->unissued, list) { ++ struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); ++ + cmd->result = DID_RESET << 16; + cmd->scsi_done(cmd); + } ++ INIT_LIST_HEAD(&hostdata->unissued); + + if (hostdata->selecting) { + hostdata->selecting->result = DID_RESET << 16; +@@ -2432,7 +2449,6 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd) + list_for_each_entry(ncmd, &hostdata->autosense, list) { + struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd); + +- set_host_byte(cmd, DID_RESET); + cmd->scsi_done(cmd); + } + INIT_LIST_HEAD(&hostdata->autosense); +diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c +index 400eee9d7783..d44f18f773c0 100644 +--- a/drivers/scsi/libsas/sas_expander.c ++++ b/drivers/scsi/libsas/sas_expander.c +@@ -2049,14 +2049,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) + return res; + } + +- /* delete the old link */ +- if (SAS_ADDR(phy->attached_sas_addr) && +- SAS_ADDR(sas_addr) != SAS_ADDR(phy->attached_sas_addr)) { +- SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n", +- SAS_ADDR(dev->sas_addr), phy_id, +- SAS_ADDR(phy->attached_sas_addr)); +- sas_unregister_devs_sas_addr(dev, phy_id, last); +- } ++ /* we always have to delete the old device when we went here */ ++ SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n", ++ SAS_ADDR(dev->sas_addr), phy_id, ++ SAS_ADDR(phy->attached_sas_addr)); ++ sas_unregister_devs_sas_addr(dev, phy_id, last); + + return sas_discover_new(dev, phy_id); + } +diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c +index 10546faac58c..f374abfb7f1f 100644 +--- a/drivers/scsi/pm8001/pm8001_hwi.c ++++ b/drivers/scsi/pm8001/pm8001_hwi.c +@@ -1479,6 +1479,12 @@ u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha, + } else { + u32 producer_index; + void *pi_virt = circularQ->pi_virt; ++ /* spurious interrupt during setup if ++ * kexec-ing and driver doing a doorbell access ++ * with the pre-kexec oq interrupt setup ++ */ ++ if (!pi_virt) ++ break; + /* Update the producer index from SPC */ + producer_index = pm8001_read_32(pi_virt); + circularQ->producer_index = cpu_to_le32(producer_index); +diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c +index ce584c31d36e..e64a13f0bce1 100644 +--- a/drivers/scsi/pm8001/pm8001_sas.c ++++ b/drivers/scsi/pm8001/pm8001_sas.c +@@ -374,6 +374,13 @@ static int pm8001_task_exec(struct sas_task *task, + return 0; + } + pm8001_ha = pm8001_find_ha_by_dev(task->dev); ++ if (pm8001_ha->controller_fatal_error) { ++ struct task_status_struct *ts = &t->task_status; ++ ++ ts->resp = SAS_TASK_UNDELIVERED; ++ t->task_done(t); ++ return 0; ++ } + PM8001_IO_DBG(pm8001_ha, pm8001_printk("pm8001_task_exec device \n ")); + spin_lock_irqsave(&pm8001_ha->lock, flags); + do { +@@ -466,7 +473,7 @@ err_out: + dev_printk(KERN_ERR, pm8001_ha->dev, "pm8001 exec failed[%d]!\n", rc); + if (!sas_protocol_ata(t->task_proto)) + if (n_elem) +- dma_unmap_sg(pm8001_ha->dev, t->scatter, n_elem, ++ dma_unmap_sg(pm8001_ha->dev, t->scatter, t->num_scatter, + t->data_dir); + out_done: + spin_unlock_irqrestore(&pm8001_ha->lock, flags); +diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h +index 6628cc38316c..d8768ac41ebb 100644 +--- a/drivers/scsi/pm8001/pm8001_sas.h ++++ b/drivers/scsi/pm8001/pm8001_sas.h +@@ -531,6 +531,7 @@ struct pm8001_hba_info { + u32 logging_level; + u32 fw_status; + u32 smp_exp_mode; ++ bool controller_fatal_error; + const struct firmware *fw_image; + struct isr_param irq_vector[PM8001_MAX_MSIX_VEC]; + }; +diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c +index eb4fee61df72..9edd61c063a1 100644 +--- a/drivers/scsi/pm8001/pm80xx_hwi.c ++++ b/drivers/scsi/pm8001/pm80xx_hwi.c +@@ -572,6 +572,9 @@ static void update_main_config_table(struct pm8001_hba_info *pm8001_ha) + pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_size); + pm8001_mw32(address, MAIN_PCS_EVENT_LOG_OPTION, + pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity); ++ /* Update Fatal error interrupt vector */ ++ pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |= ++ ((pm8001_ha->number_of_intr - 1) << 8); + pm8001_mw32(address, MAIN_FATAL_ERROR_INTERRUPT, + pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt); + pm8001_mw32(address, MAIN_EVENT_CRC_CHECK, +@@ -1099,6 +1102,9 @@ static int pm80xx_chip_init(struct pm8001_hba_info *pm8001_ha) + return -EBUSY; + } + ++ /* Initialize the controller fatal error flag */ ++ pm8001_ha->controller_fatal_error = false; ++ + /* Initialize pci space address eg: mpi offset */ + init_pci_device_addresses(pm8001_ha); + init_default_table_values(pm8001_ha); +@@ -1207,13 +1213,17 @@ pm80xx_chip_soft_rst(struct pm8001_hba_info *pm8001_ha) + u32 bootloader_state; + u32 ibutton0, ibutton1; + +- /* Check if MPI is in ready state to reset */ +- if (mpi_uninit_check(pm8001_ha) != 0) { +- PM8001_FAIL_DBG(pm8001_ha, +- pm8001_printk("MPI state is not ready\n")); +- return -1; ++ /* Process MPI table uninitialization only if FW is ready */ ++ if (!pm8001_ha->controller_fatal_error) { ++ /* Check if MPI is in ready state to reset */ ++ if (mpi_uninit_check(pm8001_ha) != 0) { ++ regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); ++ PM8001_FAIL_DBG(pm8001_ha, pm8001_printk( ++ "MPI state is not ready scratch1 :0x%x\n", ++ regval)); ++ return -1; ++ } + } +- + /* checked for reset register normal state; 0x0 */ + regval = pm8001_cr32(pm8001_ha, 0, SPC_REG_SOFT_RESET); + PM8001_INIT_DBG(pm8001_ha, +@@ -3717,6 +3727,46 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb) + } + } + ++static void print_scratchpad_registers(struct pm8001_hba_info *pm8001_ha) ++{ ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_SCRATCH_PAD_0: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_0))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_SCRATCH_PAD_1:0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_SCRATCH_PAD_2: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_2))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_SCRATCH_PAD_3: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_3))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_0: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_0))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_1: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_1))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_2: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_2))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_3: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_3))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_4: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_4))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_HOST_SCRATCH_PAD_5: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_5))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_RSVD_SCRATCH_PAD_0: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_6))); ++ PM8001_FAIL_DBG(pm8001_ha, ++ pm8001_printk("MSGU_RSVD_SCRATCH_PAD_1: 0x%x\n", ++ pm8001_cr32(pm8001_ha, 0, MSGU_HOST_SCRATCH_PAD_7))); ++} ++ + static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) + { + struct outbound_queue_table *circularQ; +@@ -3724,10 +3774,28 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha, u8 vec) + u8 uninitialized_var(bc); + u32 ret = MPI_IO_STATUS_FAIL; + unsigned long flags; ++ u32 regval; + ++ if (vec == (pm8001_ha->number_of_intr - 1)) { ++ regval = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); ++ if ((regval & SCRATCH_PAD_MIPSALL_READY) != ++ SCRATCH_PAD_MIPSALL_READY) { ++ pm8001_ha->controller_fatal_error = true; ++ PM8001_FAIL_DBG(pm8001_ha, pm8001_printk( ++ "Firmware Fatal error! Regval:0x%x\n", regval)); ++ print_scratchpad_registers(pm8001_ha); ++ return ret; ++ } ++ } + spin_lock_irqsave(&pm8001_ha->lock, flags); + circularQ = &pm8001_ha->outbnd_q_tbl[vec]; + do { ++ /* spurious interrupt during setup if kexec-ing and ++ * driver doing a doorbell access w/ the pre-kexec oq ++ * interrupt setup. ++ */ ++ if (!circularQ->pi_virt) ++ break; + ret = pm8001_mpi_msg_consume(pm8001_ha, circularQ, &pMsg1, &bc); + if (MPI_IO_STATUS_SUCCESS == ret) { + /* process the outbound message */ +diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h +index 7a443bad6163..411b414a9a0e 100644 +--- a/drivers/scsi/pm8001/pm80xx_hwi.h ++++ b/drivers/scsi/pm8001/pm80xx_hwi.h +@@ -1288,6 +1288,9 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t; + #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0 + #define SCRATCH_PAD_IOP0_READY 0xC00 + #define SCRATCH_PAD_IOP1_READY 0x3000 ++#define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \ ++ SCRATCH_PAD_IOP0_READY | \ ++ SCRATCH_PAD_RAAE_READY) + + /* boot loader state */ + #define SCRATCH_PAD1_BOOTSTATE_MASK 0x70 /* Bit 4-6 */ +diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c +index c6425e3df5a0..f1c771437752 100644 +--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c ++++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c +@@ -4371,6 +4371,13 @@ static void sym_nego_rejected(struct sym_hcb *np, struct sym_tcb *tp, struct sym + OUTB(np, HS_PRT, HS_BUSY); + } + ++#define sym_printk(lvl, tp, cp, fmt, v...) do { \ ++ if (cp) \ ++ scmd_printk(lvl, cp->cmd, fmt, ##v); \ ++ else \ ++ starget_printk(lvl, tp->starget, fmt, ##v); \ ++} while (0) ++ + /* + * chip exception handler for programmed interrupts. + */ +@@ -4416,7 +4423,7 @@ static void sym_int_sir(struct sym_hcb *np) + * been selected with ATN. We do not want to handle that. + */ + case SIR_SEL_ATN_NO_MSG_OUT: +- scmd_printk(KERN_WARNING, cp->cmd, ++ sym_printk(KERN_WARNING, tp, cp, + "No MSG OUT phase after selection with ATN\n"); + goto out_stuck; + /* +@@ -4424,7 +4431,7 @@ static void sym_int_sir(struct sym_hcb *np) + * having reselected the initiator. + */ + case SIR_RESEL_NO_MSG_IN: +- scmd_printk(KERN_WARNING, cp->cmd, ++ sym_printk(KERN_WARNING, tp, cp, + "No MSG IN phase after reselection\n"); + goto out_stuck; + /* +@@ -4432,7 +4439,7 @@ static void sym_int_sir(struct sym_hcb *np) + * an IDENTIFY. + */ + case SIR_RESEL_NO_IDENTIFY: +- scmd_printk(KERN_WARNING, cp->cmd, ++ sym_printk(KERN_WARNING, tp, cp, + "No IDENTIFY after reselection\n"); + goto out_stuck; + /* +@@ -4461,7 +4468,7 @@ static void sym_int_sir(struct sym_hcb *np) + case SIR_RESEL_ABORTED: + np->lastmsg = np->msgout[0]; + np->msgout[0] = M_NOOP; +- scmd_printk(KERN_WARNING, cp->cmd, ++ sym_printk(KERN_WARNING, tp, cp, + "message %x sent on bad reselection\n", np->lastmsg); + goto out; + /* +diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c +index fefb688a3432..2f4df804c4d8 100644 +--- a/drivers/spi/spi-pic32.c ++++ b/drivers/spi/spi-pic32.c +@@ -320,7 +320,7 @@ static int pic32_spi_dma_transfer(struct pic32_spi *pic32s, + desc_rx = dmaengine_prep_slave_sg(master->dma_rx, + xfer->rx_sg.sgl, + xfer->rx_sg.nents, +- DMA_FROM_DEVICE, ++ DMA_DEV_TO_MEM, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + if (!desc_rx) { + ret = -EINVAL; +@@ -330,7 +330,7 @@ static int pic32_spi_dma_transfer(struct pic32_spi *pic32s, + desc_tx = dmaengine_prep_slave_sg(master->dma_tx, + xfer->tx_sg.sgl, + xfer->tx_sg.nents, +- DMA_TO_DEVICE, ++ DMA_MEM_TO_DEV, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + if (!desc_tx) { + ret = -EINVAL; +diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c +index 0f89c2169c24..3a94f465e8e0 100644 +--- a/drivers/spi/spi-rockchip.c ++++ b/drivers/spi/spi-rockchip.c +@@ -443,6 +443,9 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) + struct dma_slave_config rxconf, txconf; + struct dma_async_tx_descriptor *rxdesc, *txdesc; + ++ memset(&rxconf, 0, sizeof(rxconf)); ++ memset(&txconf, 0, sizeof(txconf)); ++ + spin_lock_irqsave(&rs->lock, flags); + rs->state &= ~RXBUSY; + rs->state &= ~TXBUSY; +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 2e05046f866b..f4ea286b0121 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -751,11 +751,9 @@ static int spidev_probe(struct spi_device *spi) + * compatible string, it is a Linux implementation thing + * rather than a description of the hardware. + */ +- if (spi->dev.of_node && !of_match_device(spidev_dt_ids, &spi->dev)) { +- dev_err(&spi->dev, "buggy DT: spidev listed directly in DT\n"); +- WARN_ON(spi->dev.of_node && +- !of_match_device(spidev_dt_ids, &spi->dev)); +- } ++ WARN(spi->dev.of_node && ++ of_device_is_compatible(spi->dev.of_node, "spidev"), ++ "%pOF: buggy DT: spidev listed directly in DT\n", spi->dev.of_node); + + spidev_probe_acpi(spi); + +diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c +index 1d9d778828ba..515bf18c8294 100644 +--- a/drivers/tty/serial/mxs-auart.c ++++ b/drivers/tty/serial/mxs-auart.c +@@ -1635,8 +1635,9 @@ static int mxs_auart_request_gpio_irq(struct mxs_auart_port *s) + + /* + * If something went wrong, rollback. ++ * Be careful: i may be unsigned. + */ +- while (err && (--i >= 0)) ++ while (err && (i-- > 0)) + if (irq[i] >= 0) + free_irq(irq[i], s); + +diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c +index f36a1ac3bfbd..b8650210be0f 100644 +--- a/drivers/usb/chipidea/otg.c ++++ b/drivers/usb/chipidea/otg.c +@@ -206,14 +206,17 @@ static void ci_otg_work(struct work_struct *work) + } + + pm_runtime_get_sync(ci->dev); ++ + if (ci->id_event) { + ci->id_event = false; + ci_handle_id_switch(ci); +- } else if (ci->b_sess_valid_event) { ++ } ++ ++ if (ci->b_sess_valid_event) { + ci->b_sess_valid_event = false; + ci_handle_vbus_change(ci); +- } else +- dev_err(ci->dev, "unexpected event occurs at %s\n", __func__); ++ } ++ + pm_runtime_put_sync(ci->dev); + + enable_irq(ci->irq); +diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c +index 20d02a5e418d..c6577f489d0f 100644 +--- a/drivers/usb/chipidea/usbmisc_imx.c ++++ b/drivers/usb/chipidea/usbmisc_imx.c +@@ -273,6 +273,8 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data) + } else if (data->oc_polarity == 1) { + /* High active */ + reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY); ++ } else { ++ reg &= ~(MX6_BM_OVER_CUR_DIS); + } + writel(reg, usbmisc->base + data->index * 4); + +diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c +index d7dcd39fe12c..3d843e14447b 100644 +--- a/drivers/usb/gadget/function/uvc_configfs.c ++++ b/drivers/usb/gadget/function/uvc_configfs.c +@@ -543,6 +543,7 @@ static int uvcg_control_class_allow_link(struct config_item *src, + unlock: + mutex_unlock(&opts->lock); + out: ++ config_item_put(header); + mutex_unlock(su_mutex); + return ret; + } +@@ -584,6 +585,7 @@ static int uvcg_control_class_drop_link(struct config_item *src, + unlock: + mutex_unlock(&opts->lock); + out: ++ config_item_put(header); + mutex_unlock(su_mutex); + return ret; + } +@@ -770,6 +772,7 @@ static int uvcg_streaming_header_allow_link(struct config_item *src, + format_ptr->fmt = target_fmt; + list_add_tail(&format_ptr->entry, &src_hdr->formats); + ++src_hdr->num_fmt; ++ ++target_fmt->linked; + + out: + mutex_unlock(&opts->lock); +@@ -808,6 +811,8 @@ static int uvcg_streaming_header_drop_link(struct config_item *src, + break; + } + ++ --target_fmt->linked; ++ + out: + mutex_unlock(&opts->lock); + mutex_unlock(su_mutex); +@@ -2047,6 +2052,7 @@ static int uvcg_streaming_class_allow_link(struct config_item *src, + unlock: + mutex_unlock(&opts->lock); + out: ++ config_item_put(header); + mutex_unlock(su_mutex); + return ret; + } +@@ -2091,6 +2097,7 @@ static int uvcg_streaming_class_drop_link(struct config_item *src, + unlock: + mutex_unlock(&opts->lock); + out: ++ config_item_put(header); + mutex_unlock(su_mutex); + return ret; + } +diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c +index 0f01c04d7cbd..d6bab12b0b47 100644 +--- a/drivers/usb/gadget/function/uvc_video.c ++++ b/drivers/usb/gadget/function/uvc_video.c +@@ -129,6 +129,21 @@ uvc_video_encode_isoc(struct usb_request *req, struct uvc_video *video, + * Request handling + */ + ++static int uvcg_video_ep_queue(struct uvc_video *video, struct usb_request *req) ++{ ++ int ret; ++ ++ ret = usb_ep_queue(video->ep, req, GFP_ATOMIC); ++ if (ret < 0) { ++ printk(KERN_INFO "Failed to queue request (%d).\n", ret); ++ /* Isochronous endpoints can't be halted. */ ++ if (usb_endpoint_xfer_bulk(video->ep->desc)) ++ usb_ep_set_halt(video->ep); ++ } ++ ++ return ret; ++} ++ + /* + * I somehow feel that synchronisation won't be easy to achieve here. We have + * three events that control USB requests submission: +@@ -193,14 +208,13 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req) + + video->encode(req, video, buf); + +- if ((ret = usb_ep_queue(ep, req, GFP_ATOMIC)) < 0) { +- printk(KERN_INFO "Failed to queue request (%d).\n", ret); +- usb_ep_set_halt(ep); +- spin_unlock_irqrestore(&video->queue.irqlock, flags); ++ ret = uvcg_video_ep_queue(video, req); ++ spin_unlock_irqrestore(&video->queue.irqlock, flags); ++ ++ if (ret < 0) { + uvcg_queue_cancel(queue, 0); + goto requeue; + } +- spin_unlock_irqrestore(&video->queue.irqlock, flags); + + return; + +@@ -320,15 +334,13 @@ int uvcg_video_pump(struct uvc_video *video) + video->encode(req, video, buf); + + /* Queue the USB request */ +- ret = usb_ep_queue(video->ep, req, GFP_ATOMIC); ++ ret = uvcg_video_ep_queue(video, req); ++ spin_unlock_irqrestore(&queue->irqlock, flags); ++ + if (ret < 0) { +- printk(KERN_INFO "Failed to queue request (%d)\n", ret); +- usb_ep_set_halt(video->ep); +- spin_unlock_irqrestore(&queue->irqlock, flags); + uvcg_queue_cancel(queue, 0); + break; + } +- spin_unlock_irqrestore(&queue->irqlock, flags); + } + + spin_lock_irqsave(&video->req_lock, flags); +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c +index 95df2b3bb6a1..76e991557116 100644 +--- a/drivers/usb/gadget/udc/fotg210-udc.c ++++ b/drivers/usb/gadget/udc/fotg210-udc.c +@@ -744,7 +744,7 @@ static void fotg210_get_status(struct fotg210_udc *fotg210, + fotg210->ep0_req->length = 2; + + spin_unlock(&fotg210->lock); +- fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_KERNEL); ++ fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_ATOMIC); + spin_lock(&fotg210->lock); + } + +diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c +index 73f763c4f5f5..144674913c78 100644 +--- a/drivers/usb/host/xhci-mtk-sch.c ++++ b/drivers/usb/host/xhci-mtk-sch.c +@@ -122,7 +122,9 @@ static void setup_sch_info(struct usb_device *udev, + } + + if (ep_type == ISOC_IN_EP || ep_type == ISOC_OUT_EP) { +- if (esit_pkts <= sch_ep->esit) ++ if (sch_ep->esit == 1) ++ sch_ep->pkts = esit_pkts; ++ else if (esit_pkts <= sch_ep->esit) + sch_ep->pkts = 1; + else + sch_ep->pkts = roundup_pow_of_two(esit_pkts) +diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c +index bbeeb2bd55a8..2c915be1db4c 100644 +--- a/drivers/usb/serial/cypress_m8.c ++++ b/drivers/usb/serial/cypress_m8.c +@@ -773,7 +773,7 @@ send: + + usb_fill_int_urb(port->interrupt_out_urb, port->serial->dev, + usb_sndintpipe(port->serial->dev, port->interrupt_out_endpointAddress), +- port->interrupt_out_buffer, port->interrupt_out_size, ++ port->interrupt_out_buffer, actual_size, + cypress_write_int_callback, port, priv->write_urb_interval); + result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); + if (result) { +diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c +index a1a712d18e02..da3f0ed18c76 100644 +--- a/drivers/vfio/pci/vfio_pci.c ++++ b/drivers/vfio/pci/vfio_pci.c +@@ -426,10 +426,14 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) + { + if (irq_type == VFIO_PCI_INTX_IRQ_INDEX) { + u8 pin; ++ ++ if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX) || ++ vdev->nointx || vdev->pdev->is_virtfn) ++ return 0; ++ + pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin); +- if (IS_ENABLED(CONFIG_VFIO_PCI_INTX) && !vdev->nointx && pin) +- return 1; + ++ return pin ? 1 : 0; + } else if (irq_type == VFIO_PCI_MSI_IRQ_INDEX) { + u8 pos; + u16 flags; +diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c +index 7b8a957b008d..84905d074c4f 100644 +--- a/drivers/vfio/pci/vfio_pci_config.c ++++ b/drivers/vfio/pci/vfio_pci_config.c +@@ -1182,8 +1182,10 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos) + return -ENOMEM; + + ret = init_pci_cap_msi_perm(vdev->msi_perm, len, flags); +- if (ret) ++ if (ret) { ++ kfree(vdev->msi_perm); + return ret; ++ } + + return len; + } +@@ -1606,6 +1608,15 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev) + return 0; + } + ++/* ++ * Nag about hardware bugs, hopefully to have vendors fix them, but at least ++ * to collect a list of dependencies for the VF INTx pin quirk below. ++ */ ++static const struct pci_device_id known_bogus_vf_intx_pin[] = { ++ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x270c) }, ++ {} ++}; ++ + /* + * For each device we allocate a pci_config_map that indicates the + * capability occupying each dword and thus the struct perm_bits we +@@ -1671,6 +1682,24 @@ int vfio_config_init(struct vfio_pci_device *vdev) + if (pdev->is_virtfn) { + *(__le16 *)&vconfig[PCI_VENDOR_ID] = cpu_to_le16(pdev->vendor); + *(__le16 *)&vconfig[PCI_DEVICE_ID] = cpu_to_le16(pdev->device); ++ ++ /* ++ * Per SR-IOV spec rev 1.1, 3.4.1.18 the interrupt pin register ++ * does not apply to VFs and VFs must implement this register ++ * as read-only with value zero. Userspace is not readily able ++ * to identify whether a device is a VF and thus that the pin ++ * definition on the device is bogus should it violate this ++ * requirement. We already virtualize the pin register for ++ * other purposes, so we simply need to replace the bogus value ++ * and consider VFs when we determine INTx IRQ count. ++ */ ++ if (vconfig[PCI_INTERRUPT_PIN] && ++ !pci_match_id(known_bogus_vf_intx_pin, pdev)) ++ pci_warn(pdev, ++ "Hardware bug: VF reports bogus INTx pin %d\n", ++ vconfig[PCI_INTERRUPT_PIN]); ++ ++ vconfig[PCI_INTERRUPT_PIN] = 0; /* Gratuitous for good VFs */ + } + + if (!IS_ENABLED(CONFIG_VFIO_PCI_INTX) || vdev->nointx) +diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c +index cd50df5807ea..086611c7bc03 100644 +--- a/drivers/video/backlight/lm3639_bl.c ++++ b/drivers/video/backlight/lm3639_bl.c +@@ -400,10 +400,8 @@ static int lm3639_remove(struct i2c_client *client) + + regmap_write(pchip->regmap, REG_ENABLE, 0x00); + +- if (&pchip->cdev_torch) +- led_classdev_unregister(&pchip->cdev_torch); +- if (&pchip->cdev_flash) +- led_classdev_unregister(&pchip->cdev_flash); ++ led_classdev_unregister(&pchip->cdev_torch); ++ led_classdev_unregister(&pchip->cdev_flash); + if (pchip->bled) + device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode); + return 0; +diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c +index 62c0cf79674f..63ec9c71fe84 100644 +--- a/drivers/video/fbdev/core/fbmon.c ++++ b/drivers/video/fbdev/core/fbmon.c +@@ -997,97 +997,6 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) + DPRINTK("========================================\n"); + } + +-/** +- * fb_edid_add_monspecs() - add monitor video modes from E-EDID data +- * @edid: 128 byte array with an E-EDID block +- * @spacs: monitor specs to be extended +- */ +-void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) +-{ +- unsigned char *block; +- struct fb_videomode *m; +- int num = 0, i; +- u8 svd[64], edt[(128 - 4) / DETAILED_TIMING_DESCRIPTION_SIZE]; +- u8 pos = 4, svd_n = 0; +- +- if (!edid) +- return; +- +- if (!edid_checksum(edid)) +- return; +- +- if (edid[0] != 0x2 || +- edid[2] < 4 || edid[2] > 128 - DETAILED_TIMING_DESCRIPTION_SIZE) +- return; +- +- DPRINTK(" Short Video Descriptors\n"); +- +- while (pos < edid[2]) { +- u8 len = edid[pos] & 0x1f, type = (edid[pos] >> 5) & 7; +- pr_debug("Data block %u of %u bytes\n", type, len); +- if (type == 2) { +- for (i = pos; i < pos + len; i++) { +- u8 idx = edid[pos + i] & 0x7f; +- svd[svd_n++] = idx; +- pr_debug("N%sative mode #%d\n", +- edid[pos + i] & 0x80 ? "" : "on-n", idx); +- } +- } else if (type == 3 && len >= 3) { +- /* Check Vendor Specific Data Block. For HDMI, +- it is always 00-0C-03 for HDMI Licensing, LLC. */ +- if (edid[pos + 1] == 3 && edid[pos + 2] == 0xc && +- edid[pos + 3] == 0) +- specs->misc |= FB_MISC_HDMI; +- } +- pos += len + 1; +- } +- +- block = edid + edid[2]; +- +- DPRINTK(" Extended Detailed Timings\n"); +- +- for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE; +- i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) +- if (PIXEL_CLOCK) +- edt[num++] = block - edid; +- +- /* Yikes, EDID data is totally useless */ +- if (!(num + svd_n)) +- return; +- +- m = kzalloc((specs->modedb_len + num + svd_n) * +- sizeof(struct fb_videomode), GFP_KERNEL); +- +- if (!m) +- return; +- +- memcpy(m, specs->modedb, specs->modedb_len * sizeof(struct fb_videomode)); +- +- for (i = specs->modedb_len; i < specs->modedb_len + num; i++) { +- get_detailed_timing(edid + edt[i - specs->modedb_len], &m[i]); +- if (i == specs->modedb_len) +- m[i].flag |= FB_MODE_IS_FIRST; +- pr_debug("Adding %ux%u@%u\n", m[i].xres, m[i].yres, m[i].refresh); +- } +- +- for (i = specs->modedb_len + num; i < specs->modedb_len + num + svd_n; i++) { +- int idx = svd[i - specs->modedb_len - num]; +- if (!idx || idx >= ARRAY_SIZE(cea_modes)) { +- pr_warning("Reserved SVD code %d\n", idx); +- } else if (!cea_modes[idx].xres) { +- pr_warning("Unimplemented SVD code %d\n", idx); +- } else { +- memcpy(&m[i], cea_modes + idx, sizeof(m[i])); +- pr_debug("Adding SVD #%d: %ux%u@%u\n", idx, +- m[i].xres, m[i].yres, m[i].refresh); +- } +- } +- +- kfree(specs->modedb); +- specs->modedb = m; +- specs->modedb_len = specs->modedb_len + num + svd_n; +-} +- + /* + * VESA Generalized Timing Formula (GTF) + */ +@@ -1497,9 +1406,6 @@ int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) + void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) + { + } +-void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) +-{ +-} + void fb_destroy_modedb(struct fb_videomode *modedb) + { + } +@@ -1607,7 +1513,6 @@ EXPORT_SYMBOL(fb_firmware_edid); + + EXPORT_SYMBOL(fb_parse_edid); + EXPORT_SYMBOL(fb_edid_to_monspecs); +-EXPORT_SYMBOL(fb_edid_add_monspecs); + EXPORT_SYMBOL(fb_get_mode); + EXPORT_SYMBOL(fb_validate_mode); + EXPORT_SYMBOL(fb_destroy_modedb); +diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c +index 455a15f70172..a9d76e1b4378 100644 +--- a/drivers/video/fbdev/core/modedb.c ++++ b/drivers/video/fbdev/core/modedb.c +@@ -289,63 +289,6 @@ static const struct fb_videomode modedb[] = { + }; + + #ifdef CONFIG_FB_MODE_HELPERS +-const struct fb_videomode cea_modes[65] = { +- /* #1: 640x480p@59.94/60Hz */ +- [1] = { +- NULL, 60, 640, 480, 39722, 48, 16, 33, 10, 96, 2, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #3: 720x480p@59.94/60Hz */ +- [3] = { +- NULL, 60, 720, 480, 37037, 60, 16, 30, 9, 62, 6, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #5: 1920x1080i@59.94/60Hz */ +- [5] = { +- NULL, 60, 1920, 1080, 13763, 148, 88, 15, 2, 44, 5, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_INTERLACED, 0, +- }, +- /* #7: 720(1440)x480iH@59.94/60Hz */ +- [7] = { +- NULL, 60, 1440, 480, 18554/*37108*/, 114, 38, 15, 4, 124, 3, 0, +- FB_VMODE_INTERLACED, 0, +- }, +- /* #9: 720(1440)x240pH@59.94/60Hz */ +- [9] = { +- NULL, 60, 1440, 240, 18554, 114, 38, 16, 4, 124, 3, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #18: 720x576pH@50Hz */ +- [18] = { +- NULL, 50, 720, 576, 37037, 68, 12, 39, 5, 64, 5, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #19: 1280x720p@50Hz */ +- [19] = { +- NULL, 50, 1280, 720, 13468, 220, 440, 20, 5, 40, 5, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #20: 1920x1080i@50Hz */ +- [20] = { +- NULL, 50, 1920, 1080, 13480, 148, 528, 15, 5, 528, 5, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_INTERLACED, 0, +- }, +- /* #32: 1920x1080p@23.98/24Hz */ +- [32] = { +- NULL, 24, 1920, 1080, 13468, 148, 638, 36, 4, 44, 5, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #35: (2880)x480p4x@59.94/60Hz */ +- [35] = { +- NULL, 60, 2880, 480, 9250, 240, 64, 30, 9, 248, 6, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +-}; +- + const struct fb_videomode vesa_modes[] = { + /* 0 640x350-85 VESA */ + { NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3, +diff --git a/drivers/video/fbdev/sbuslib.c b/drivers/video/fbdev/sbuslib.c +index 31c301d6be62..52e161dbd204 100644 +--- a/drivers/video/fbdev/sbuslib.c ++++ b/drivers/video/fbdev/sbuslib.c +@@ -105,11 +105,11 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, + struct fbtype __user *f = (struct fbtype __user *) arg; + + if (put_user(type, &f->fb_type) || +- __put_user(info->var.yres, &f->fb_height) || +- __put_user(info->var.xres, &f->fb_width) || +- __put_user(fb_depth, &f->fb_depth) || +- __put_user(0, &f->fb_cmsize) || +- __put_user(fb_size, &f->fb_cmsize)) ++ put_user(info->var.yres, &f->fb_height) || ++ put_user(info->var.xres, &f->fb_width) || ++ put_user(fb_depth, &f->fb_depth) || ++ put_user(0, &f->fb_cmsize) || ++ put_user(fb_size, &f->fb_cmsize)) + return -EFAULT; + return 0; + } +@@ -124,10 +124,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, + unsigned int index, count, i; + + if (get_user(index, &c->index) || +- __get_user(count, &c->count) || +- __get_user(ured, &c->red) || +- __get_user(ugreen, &c->green) || +- __get_user(ublue, &c->blue)) ++ get_user(count, &c->count) || ++ get_user(ured, &c->red) || ++ get_user(ugreen, &c->green) || ++ get_user(ublue, &c->blue)) + return -EFAULT; + + cmap.len = 1; +@@ -164,13 +164,13 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, + u8 red, green, blue; + + if (get_user(index, &c->index) || +- __get_user(count, &c->count) || +- __get_user(ured, &c->red) || +- __get_user(ugreen, &c->green) || +- __get_user(ublue, &c->blue)) ++ get_user(count, &c->count) || ++ get_user(ured, &c->red) || ++ get_user(ugreen, &c->green) || ++ get_user(ublue, &c->blue)) + return -EFAULT; + +- if (index + count > cmap->len) ++ if (index > cmap->len || count > cmap->len - index) + return -EINVAL; + + for (i = 0; i < count; i++) { +diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c +index 4b7da4409c60..5b832e83772a 100644 +--- a/fs/compat_ioctl.c ++++ b/fs/compat_ioctl.c +@@ -160,6 +160,7 @@ struct compat_video_event { + unsigned int frame_rate; + } u; + }; ++#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event) + + static int do_video_get_event(struct file *file, + unsigned int cmd, struct compat_video_event __user *up) +@@ -171,7 +172,7 @@ static int do_video_get_event(struct file *file, + if (kevent == NULL) + return -EFAULT; + +- err = do_ioctl(file, cmd, (unsigned long)kevent); ++ err = do_ioctl(file, VIDEO_GET_EVENT, (unsigned long)kevent); + if (!err) { + err = convert_in_user(&kevent->type, &up->type); + err |= convert_in_user(&kevent->timestamp, &up->timestamp); +@@ -190,6 +191,7 @@ struct compat_video_still_picture { + compat_uptr_t iFrame; + int32_t size; + }; ++#define VIDEO_STILLPICTURE32 _IOW('o', 30, struct compat_video_still_picture) + + static int do_video_stillpicture(struct file *file, + unsigned int cmd, struct compat_video_still_picture __user *up) +@@ -212,7 +214,7 @@ static int do_video_stillpicture(struct file *file, + if (err) + return -EFAULT; + +- err = do_ioctl(file, cmd, (unsigned long) up_native); ++ err = do_ioctl(file, VIDEO_STILLPICTURE, (unsigned long) up_native); + + return err; + } +@@ -1484,9 +1486,9 @@ static long do_ioctl_trans(unsigned int cmd, + return rtc_ioctl(file, cmd, argp); + + /* dvb */ +- case VIDEO_GET_EVENT: ++ case VIDEO_GET_EVENT32: + return do_video_get_event(file, cmd, argp); +- case VIDEO_STILLPICTURE: ++ case VIDEO_STILLPICTURE32: + return do_video_stillpicture(file, cmd, argp); + case VIDEO_SET_SPU_PALETTE: + return do_video_set_spu_palette(file, cmd, argp); +diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c +index 5c5ff9f6fe07..2a5e436ff8dd 100644 +--- a/fs/ecryptfs/inode.c ++++ b/fs/ecryptfs/inode.c +@@ -326,9 +326,9 @@ static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode) + static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry, + struct dentry *lower_dentry) + { +- struct inode *inode, *lower_inode = d_inode(lower_dentry); ++ struct path *path = ecryptfs_dentry_to_lower_path(dentry->d_parent); ++ struct inode *inode, *lower_inode; + struct ecryptfs_dentry_info *dentry_info; +- struct vfsmount *lower_mnt; + int rc = 0; + + dentry_info = kmem_cache_alloc(ecryptfs_dentry_info_cache, GFP_KERNEL); +@@ -340,16 +340,23 @@ static struct dentry *ecryptfs_lookup_interpose(struct dentry *dentry, + return ERR_PTR(-ENOMEM); + } + +- lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(dentry->d_parent)); + fsstack_copy_attr_atime(d_inode(dentry->d_parent), +- d_inode(lower_dentry->d_parent)); ++ d_inode(path->dentry)); + BUG_ON(!d_count(lower_dentry)); + + ecryptfs_set_dentry_private(dentry, dentry_info); +- dentry_info->lower_path.mnt = lower_mnt; ++ dentry_info->lower_path.mnt = mntget(path->mnt); + dentry_info->lower_path.dentry = lower_dentry; + +- if (d_really_is_negative(lower_dentry)) { ++ /* ++ * negative dentry can go positive under us here - its parent is not ++ * locked. That's OK and that could happen just as we return from ++ * ecryptfs_lookup() anyway. Just need to be careful and fetch ++ * ->d_inode only once - it's not stable here. ++ */ ++ lower_inode = READ_ONCE(lower_dentry->d_inode); ++ ++ if (!lower_inode) { + /* We want to add because we couldn't find in lower */ + d_add(dentry, NULL); + return NULL; +diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c +index 759056e776e5..b1d62003cda6 100644 +--- a/fs/f2fs/gc.c ++++ b/fs/f2fs/gc.c +@@ -985,7 +985,7 @@ stop: + + put_gc_inode(&gc_list); + +- if (sync) ++ if (sync && !ret) + ret = sec_freed ? 0 : -EAGAIN; + return ret; + } +diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c +index 9de1480a86bd..e87b7d7e80fc 100644 +--- a/fs/f2fs/recovery.c ++++ b/fs/f2fs/recovery.c +@@ -179,6 +179,8 @@ static void recover_inode(struct inode *inode, struct page *page) + char *name; + + inode->i_mode = le16_to_cpu(raw->i_mode); ++ i_uid_write(inode, le32_to_cpu(raw->i_uid)); ++ i_gid_write(inode, le32_to_cpu(raw->i_gid)); + f2fs_i_size_write(inode, le64_to_cpu(raw->i_size)); + inode->i_atime.tv_sec = le64_to_cpu(raw->i_mtime); + inode->i_ctime.tv_sec = le64_to_cpu(raw->i_ctime); +diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c +index 9eff18c1f3e4..e0ac676e0a35 100644 +--- a/fs/f2fs/super.c ++++ b/fs/f2fs/super.c +@@ -1650,8 +1650,12 @@ static int init_percpu_info(struct f2fs_sb_info *sbi) + if (err) + return err; + +- return percpu_counter_init(&sbi->total_valid_inode_count, 0, ++ err = percpu_counter_init(&sbi->total_valid_inode_count, 0, + GFP_KERNEL); ++ if (err) ++ percpu_counter_destroy(&sbi->alloc_valid_block_count); ++ ++ return err; + } + + /* +diff --git a/fs/fuse/control.c b/fs/fuse/control.c +index e25c40c10f4f..97ac2f5843fc 100644 +--- a/fs/fuse/control.c ++++ b/fs/fuse/control.c +@@ -107,7 +107,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file, + if (!fc) + return 0; + +- val = fc->max_background; ++ val = READ_ONCE(fc->max_background); + fuse_conn_put(fc); + + return fuse_conn_limit_read(file, buf, len, ppos, val); +@@ -144,7 +144,7 @@ static ssize_t fuse_conn_congestion_threshold_read(struct file *file, + if (!fc) + return 0; + +- val = fc->congestion_threshold; ++ val = READ_ONCE(fc->congestion_threshold); + fuse_conn_put(fc); + + return fuse_conn_limit_read(file, buf, len, ppos, val); +diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c +index 073126707270..f77a38755aea 100644 +--- a/fs/gfs2/rgrp.c ++++ b/fs/gfs2/rgrp.c +@@ -1211,7 +1211,7 @@ static int update_rgrp_lvb(struct gfs2_rgrpd *rgd) + rl_flags = be32_to_cpu(rgd->rd_rgl->rl_flags); + rl_flags &= ~GFS2_RDF_MASK; + rgd->rd_flags &= GFS2_RDF_MASK; +- rgd->rd_flags |= (rl_flags | GFS2_RDF_UPTODATE | GFS2_RDF_CHECK); ++ rgd->rd_flags |= (rl_flags | GFS2_RDF_CHECK); + if (rgd->rd_rgl->rl_unlinked == 0) + rgd->rd_flags &= ~GFS2_RDF_CHECK; + rgd->rd_free = be32_to_cpu(rgd->rd_rgl->rl_free); +diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c +index e3ee387a6dfe..37496d83661a 100644 +--- a/fs/gfs2/super.c ++++ b/fs/gfs2/super.c +@@ -844,10 +844,10 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp) + if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) + return error; + ++ flush_workqueue(gfs2_delete_workqueue); + kthread_stop(sdp->sd_quotad_process); + kthread_stop(sdp->sd_logd_process); + +- flush_workqueue(gfs2_delete_workqueue); + gfs2_quota_sync(sdp->sd_vfs, 0); + gfs2_statfs_sync(sdp->sd_vfs, 0); + +diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c +index 80317b04c84a..e431a850f2f2 100644 +--- a/fs/kernfs/symlink.c ++++ b/fs/kernfs/symlink.c +@@ -63,6 +63,9 @@ static int kernfs_get_target_path(struct kernfs_node *parent, + if (base == kn) + break; + ++ if ((s - path) + 3 >= PATH_MAX) ++ return -ENAMETOOLONG; ++ + strcpy(s, "../"); + s += 3; + base = base->parent; +@@ -79,7 +82,7 @@ static int kernfs_get_target_path(struct kernfs_node *parent, + if (len < 2) + return -EINVAL; + len--; +- if ((s - path) + len > PATH_MAX) ++ if ((s - path) + len >= PATH_MAX) + return -ENAMETOOLONG; + + /* reverse fillup of target string from target to base */ +diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c +index 46afd7cdcc37..9a8830a0f31f 100644 +--- a/fs/nfs/delegation.c ++++ b/fs/nfs/delegation.c +@@ -101,7 +101,7 @@ int nfs4_check_delegation(struct inode *inode, fmode_t flags) + return nfs4_do_check_delegation(inode, flags, false); + } + +-static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid) ++static int nfs_delegation_claim_locks(struct nfs4_state *state, const nfs4_stateid *stateid) + { + struct inode *inode = state->inode; + struct file_lock *fl; +@@ -116,7 +116,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_ + spin_lock(&flctx->flc_lock); + restart: + list_for_each_entry(fl, list, fl_list) { +- if (nfs_file_open_context(fl->fl_file) != ctx) ++ if (nfs_file_open_context(fl->fl_file)->state != state) + continue; + spin_unlock(&flctx->flc_lock); + status = nfs4_lock_delegation_recall(fl, state, stateid); +@@ -163,7 +163,7 @@ again: + seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); + err = nfs4_open_delegation_recall(ctx, state, stateid, type); + if (!err) +- err = nfs_delegation_claim_locks(ctx, state, stateid); ++ err = nfs_delegation_claim_locks(state, stateid); + if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) + err = -EAGAIN; + mutex_unlock(&sp->so_delegreturn_mutex); +diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c +index a799546a67f7..f6172c3f83ba 100644 +--- a/fs/orangefs/orangefs-sysfs.c ++++ b/fs/orangefs/orangefs-sysfs.c +@@ -315,7 +315,7 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj, + /* Can't do a service_operation if the client is not running... */ + rc = is_daemon_in_service(); + if (rc) { +- pr_info("%s: Client not running :%d:\n", ++ pr_info_ratelimited("%s: Client not running :%d:\n", + __func__, + is_daemon_in_service()); + goto out; +diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c +index 8ab782d8b33d..93d13f4010c1 100644 +--- a/fs/proc/vmcore.c ++++ b/fs/proc/vmcore.c +@@ -164,6 +164,16 @@ int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma, + return remap_pfn_range(vma, from, pfn, size, prot); + } + ++/* ++ * Architectures which support memory encryption override this. ++ */ ++ssize_t __weak ++copy_oldmem_page_encrypted(unsigned long pfn, char *buf, size_t csize, ++ unsigned long offset, int userbuf) ++{ ++ return copy_oldmem_page(pfn, buf, csize, offset, userbuf); ++} ++ + /* + * Copy to either kernel or user space + */ +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index bd738aafd432..7582a5712458 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -212,6 +212,11 @@ struct request { + (req)->cmd_flags |= flags; \ + } while (0) + ++static inline bool blk_rq_is_passthrough(struct request *rq) ++{ ++ return rq->cmd_type != REQ_TYPE_FS; ++} ++ + static inline unsigned short req_get_ioprio(struct request *req) + { + return req->ioprio; +@@ -663,7 +668,7 @@ static inline void blk_clear_rl_full(struct request_list *rl, bool sync) + + static inline bool rq_mergeable(struct request *rq) + { +- if (rq->cmd_type != REQ_TYPE_FS) ++ if (blk_rq_is_passthrough(rq)) + return false; + + if (req_op(rq) == REQ_OP_FLUSH) +@@ -910,7 +915,7 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq, + { + struct request_queue *q = rq->q; + +- if (unlikely(rq->cmd_type != REQ_TYPE_FS)) ++ if (blk_rq_is_passthrough(rq)) + return q->limits.max_hw_sectors; + + if (!q->limits.chunk_sectors || +diff --git a/include/linux/cpufeature.h b/include/linux/cpufeature.h +index 986c06c88d81..84d3c81b5978 100644 +--- a/include/linux/cpufeature.h ++++ b/include/linux/cpufeature.h +@@ -45,7 +45,7 @@ + * 'asm/cpufeature.h' of your favorite architecture. + */ + #define module_cpu_feature_match(x, __initfunc) \ +-static struct cpu_feature const cpu_feature_match_ ## x[] = \ ++static struct cpu_feature const __maybe_unused cpu_feature_match_ ## x[] = \ + { { .feature = cpu_feature(x) }, { } }; \ + MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \ + \ +diff --git a/include/linux/edac.h b/include/linux/edac.h +index 9e0d78966552..c6233227720c 100644 +--- a/include/linux/edac.h ++++ b/include/linux/edac.h +@@ -17,6 +17,7 @@ + #include <linux/completion.h> + #include <linux/workqueue.h> + #include <linux/debugfs.h> ++#include <linux/numa.h> + + struct device; + +@@ -778,6 +779,6 @@ struct mem_ctl_info { + /* + * Maximum number of memory controllers in the coherent fabric. + */ +-#define EDAC_MAX_MCS 16 ++#define EDAC_MAX_MCS 2 * MAX_NUMNODES + + #endif +diff --git a/include/linux/fb.h b/include/linux/fb.h +index a964d076b4dc..493d6d7794de 100644 +--- a/include/linux/fb.h ++++ b/include/linux/fb.h +@@ -732,8 +732,6 @@ extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); + extern const unsigned char *fb_firmware_edid(struct device *device); + extern void fb_edid_to_monspecs(unsigned char *edid, + struct fb_monspecs *specs); +-extern void fb_edid_add_monspecs(unsigned char *edid, +- struct fb_monspecs *specs); + extern void fb_destroy_modedb(struct fb_videomode *modedb); + extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); + extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter); +@@ -807,7 +805,6 @@ struct dmt_videomode { + + extern const char *fb_mode_option; + extern const struct fb_videomode vesa_modes[]; +-extern const struct fb_videomode cea_modes[65]; + extern const struct dmt_videomode dmt_modes[]; + + struct fb_modelist { +diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h +index e353f6600b0b..27dbab59f034 100644 +--- a/include/linux/intel-iommu.h ++++ b/include/linux/intel-iommu.h +@@ -295,7 +295,8 @@ enum { + #define QI_DEV_IOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32) + #define QI_DEV_IOTLB_QDEP(qdep) (((qdep) & 0x1f) << 16) + #define QI_DEV_IOTLB_ADDR(addr) ((u64)(addr) & VTD_PAGE_MASK) +-#define QI_DEV_IOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52)) ++#define QI_DEV_IOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \ ++ ((u64)((pfsid >> 4) & 0xfff) << 52)) + #define QI_DEV_IOTLB_SIZE 1 + #define QI_DEV_IOTLB_MAX_INVS 32 + +@@ -320,7 +321,8 @@ enum { + #define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32) + #define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16) + #define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4) +-#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52)) ++#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | \ ++ ((u64)((pfsid >> 4) & 0xfff) << 52)) + #define QI_DEV_EIOTLB_MAX_INVS 32 + + #define QI_PGRP_IDX(idx) (((u64)(idx)) << 55) +diff --git a/include/linux/libfdt_env.h b/include/linux/libfdt_env.h +index 2a663c6bb428..8850e243c940 100644 +--- a/include/linux/libfdt_env.h ++++ b/include/linux/libfdt_env.h +@@ -1,6 +1,7 @@ + #ifndef _LIBFDT_ENV_H + #define _LIBFDT_ENV_H + ++#include <linux/kernel.h> /* For INT_MAX */ + #include <linux/string.h> + + #include <asm/byteorder.h> +diff --git a/include/linux/platform_data/dma-ep93xx.h b/include/linux/platform_data/dma-ep93xx.h +index e82c642fa53c..5913be0793a2 100644 +--- a/include/linux/platform_data/dma-ep93xx.h ++++ b/include/linux/platform_data/dma-ep93xx.h +@@ -84,7 +84,7 @@ static inline enum dma_transfer_direction + ep93xx_dma_chan_direction(struct dma_chan *chan) + { + if (!ep93xx_dma_chan_is_m2p(chan)) +- return DMA_NONE; ++ return DMA_TRANS_NONE; + + /* even channels are for TX, odd for RX */ + return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; +diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h +index 7ba040c797ec..da2791b5fe87 100644 +--- a/include/linux/sunrpc/sched.h ++++ b/include/linux/sunrpc/sched.h +@@ -185,7 +185,6 @@ struct rpc_timer { + struct rpc_wait_queue { + spinlock_t lock; + struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */ +- pid_t owner; /* process id of last task serviced */ + unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */ + unsigned char priority; /* current priority */ + unsigned char nr; /* # tasks remaining for cookie */ +@@ -201,7 +200,6 @@ struct rpc_wait_queue { + * from a single cookie. The aim is to improve + * performance of NFS operations such as read/write. + */ +-#define RPC_BATCH_COUNT 16 + #define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0) + + /* +diff --git a/include/net/llc.h b/include/net/llc.h +index 82d989995d18..95e5ced4c133 100644 +--- a/include/net/llc.h ++++ b/include/net/llc.h +@@ -66,6 +66,7 @@ struct llc_sap { + int sk_count; + struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES]; + struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES]; ++ struct rcu_head rcu; + }; + + static inline +diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h +index 0638b8aeba34..1d9c701b1c7b 100644 +--- a/include/rdma/ib_verbs.h ++++ b/include/rdma/ib_verbs.h +@@ -1026,7 +1026,7 @@ struct ib_qp_init_attr { + struct ib_qp_cap cap; + enum ib_sig_type sq_sig_type; + enum ib_qp_type qp_type; +- enum ib_qp_create_flags create_flags; ++ u32 create_flags; + + /* + * Only needed for special QP types, or when using the RW API. +diff --git a/kernel/cpu.c b/kernel/cpu.c +index 0ed3e9deda30..c2573e858009 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -379,6 +379,7 @@ void __init cpu_smt_disable(bool force) + pr_info("SMT: Force disabled\n"); + cpu_smt_control = CPU_SMT_FORCE_DISABLED; + } else { ++ pr_info("SMT: disabled\n"); + cpu_smt_control = CPU_SMT_DISABLED; + } + } +diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c +index fbfab5722254..8ddd29476c0d 100644 +--- a/kernel/events/uprobes.c ++++ b/kernel/events/uprobes.c +@@ -1846,7 +1846,7 @@ static void handle_trampoline(struct pt_regs *regs) + + sigill: + uprobe_warn(current, "handle uretprobe, sending SIGILL."); +- force_sig_info(SIGILL, SEND_SIG_FORCED, current); ++ force_sig(SIGILL, current); + + } + +@@ -1962,7 +1962,7 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs) + + if (unlikely(err)) { + uprobe_warn(current, "execute the probed insn, sending SIGILL."); +- force_sig_info(SIGILL, SEND_SIG_FORCED, current); ++ force_sig(SIGILL, current); + } + } + +diff --git a/kernel/kprobes.c b/kernel/kprobes.c +index 11863e2b01c2..1b75fb8c7735 100644 +--- a/kernel/kprobes.c ++++ b/kernel/kprobes.c +@@ -514,8 +514,14 @@ static void do_free_cleaned_kprobes(void) + struct optimized_kprobe *op, *tmp; + + list_for_each_entry_safe(op, tmp, &freeing_list, list) { +- BUG_ON(!kprobe_unused(&op->kp)); + list_del_init(&op->list); ++ if (WARN_ON_ONCE(!kprobe_unused(&op->kp))) { ++ /* ++ * This must not happen, but if there is a kprobe ++ * still in use, keep it on kprobes hash list. ++ */ ++ continue; ++ } + free_aggr_kprobe(&op->kp); + } + } +diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c +index 6607d77afe55..a0339c458c14 100644 +--- a/kernel/printk/printk.c ++++ b/kernel/printk/printk.c +@@ -383,6 +383,7 @@ static u32 clear_idx; + /* record buffer */ + #define LOG_ALIGN __alignof__(struct printk_log) + #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) ++#define LOG_BUF_LEN_MAX (u32)(1 << 31) + static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); + static char *log_buf = __log_buf; + static u32 log_buf_len = __LOG_BUF_LEN; +@@ -983,18 +984,23 @@ void log_buf_kexec_setup(void) + static unsigned long __initdata new_log_buf_len; + + /* we practice scaling the ring buffer by powers of 2 */ +-static void __init log_buf_len_update(unsigned size) ++static void __init log_buf_len_update(u64 size) + { ++ if (size > (u64)LOG_BUF_LEN_MAX) { ++ size = (u64)LOG_BUF_LEN_MAX; ++ pr_err("log_buf over 2G is not supported.\n"); ++ } ++ + if (size) + size = roundup_pow_of_two(size); + if (size > log_buf_len) +- new_log_buf_len = size; ++ new_log_buf_len = (unsigned long)size; + } + + /* save requested log_buf_len since it's too early to process it */ + static int __init log_buf_len_setup(char *str) + { +- unsigned int size; ++ u64 size; + + if (!str) + return -EINVAL; +@@ -1064,7 +1070,7 @@ void __init setup_log_buf(int early) + } + + if (unlikely(!new_log_buf)) { +- pr_err("log_buf_len: %ld bytes not available\n", ++ pr_err("log_buf_len: %lu bytes not available\n", + new_log_buf_len); + return; + } +@@ -1077,8 +1083,8 @@ void __init setup_log_buf(int early) + memcpy(log_buf, __log_buf, __LOG_BUF_LEN); + raw_spin_unlock_irqrestore(&logbuf_lock, flags); + +- pr_info("log_buf_len: %d bytes\n", log_buf_len); +- pr_info("early log buf free: %d(%d%%)\n", ++ pr_info("log_buf_len: %u bytes\n", log_buf_len); ++ pr_info("early log buf free: %u(%u%%)\n", + free, (free * 100) / __LOG_BUF_LEN); + } + +diff --git a/kernel/signal.c b/kernel/signal.c +index 2bb1f9dc86c7..30914b3c76b2 100644 +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -71,6 +71,10 @@ static int sig_task_ignored(struct task_struct *t, int sig, bool force) + + handler = sig_handler(t, sig); + ++ /* SIGKILL and SIGSTOP may not be sent to the global init */ ++ if (unlikely(is_global_init(t) && sig_kernel_only(sig))) ++ return true; ++ + if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && + handler == SIG_DFL && !(force && sig_kernel_only(sig))) + return 1; +diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c +index eec1150125b9..e430e04997ee 100644 +--- a/mm/hugetlb_cgroup.c ++++ b/mm/hugetlb_cgroup.c +@@ -196,7 +196,7 @@ int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, + again: + rcu_read_lock(); + h_cg = hugetlb_cgroup_from_task(current); +- if (!css_tryget_online(&h_cg->css)) { ++ if (!css_tryget(&h_cg->css)) { + rcu_read_unlock(); + goto again; + } +diff --git a/mm/memcontrol.c b/mm/memcontrol.c +index 9ca63af4f37a..0f8422239dea 100644 +--- a/mm/memcontrol.c ++++ b/mm/memcontrol.c +@@ -741,7 +741,7 @@ static struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm) + if (unlikely(!memcg)) + memcg = root_mem_cgroup; + } +- } while (!css_tryget_online(&memcg->css)); ++ } while (!css_tryget(&memcg->css)); + rcu_read_unlock(); + return memcg; + } +diff --git a/mm/shmem.c b/mm/shmem.c +index ac8a5fedc245..6266a7d1ba00 100644 +--- a/mm/shmem.c ++++ b/mm/shmem.c +@@ -2464,7 +2464,7 @@ static void shmem_tag_pins(struct address_space *mapping) + + spin_lock_irq(&mapping->tree_lock); + radix_tree_for_each_slot(slot, &mapping->page_tree, &iter, start) { +- page = radix_tree_deref_slot(slot); ++ page = radix_tree_deref_slot_protected(slot, &mapping->tree_lock); + if (!page || radix_tree_exception(page)) { + if (radix_tree_deref_retry(page)) { + slot = radix_tree_iter_retry(&iter); +diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c +index 48d23abfe799..1306962a792a 100644 +--- a/net/bluetooth/l2cap_core.c ++++ b/net/bluetooth/l2cap_core.c +@@ -6811,6 +6811,16 @@ static int l2cap_le_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb) + chan->sdu_len = sdu_len; + chan->sdu_last_frag = skb; + ++ /* Detect if remote is not able to use the selected MPS */ ++ if (skb->len + L2CAP_SDULEN_SIZE < chan->mps) { ++ u16 mps_len = skb->len + L2CAP_SDULEN_SIZE; ++ ++ /* Adjust the number of credits */ ++ BT_DBG("chan->mps %u -> %u", chan->mps, mps_len); ++ chan->mps = mps_len; ++ l2cap_chan_le_send_credits(chan); ++ } ++ + return 0; + } + +diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c +index b798862b6be5..7efe740c06eb 100644 +--- a/net/ipv4/gre_demux.c ++++ b/net/ipv4/gre_demux.c +@@ -86,13 +86,14 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, + + options = (__be32 *)(greh + 1); + if (greh->flags & GRE_CSUM) { +- if (skb_checksum_simple_validate(skb)) { ++ if (!skb_checksum_simple_validate(skb)) { ++ skb_checksum_try_convert(skb, IPPROTO_GRE, 0, ++ null_compute_pseudo); ++ } else if (csum_err) { + *csum_err = true; + return -EINVAL; + } + +- skb_checksum_try_convert(skb, IPPROTO_GRE, 0, +- null_compute_pseudo); + options++; + } + +diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c +index 576f705d8180..9609ad71dd26 100644 +--- a/net/ipv4/ip_gre.c ++++ b/net/ipv4/ip_gre.c +@@ -224,13 +224,10 @@ static void gre_err(struct sk_buff *skb, u32 info) + const int type = icmp_hdr(skb)->type; + const int code = icmp_hdr(skb)->code; + struct tnl_ptk_info tpi; +- bool csum_err = false; + +- if (gre_parse_header(skb, &tpi, &csum_err, htons(ETH_P_IP), +- iph->ihl * 4) < 0) { +- if (!csum_err) /* ignore csum errors. */ +- return; +- } ++ if (gre_parse_header(skb, &tpi, NULL, htons(ETH_P_IP), ++ iph->ihl * 4) < 0) ++ return; + + if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { + ipv4_update_pmtu(skb, dev_net(skb->dev), info, +diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c +index e896a2c53b12..f1e442a39db8 100644 +--- a/net/llc/llc_core.c ++++ b/net/llc/llc_core.c +@@ -127,9 +127,7 @@ void llc_sap_close(struct llc_sap *sap) + list_del_rcu(&sap->node); + spin_unlock_bh(&llc_sap_list_lock); + +- synchronize_rcu(); +- +- kfree(sap); ++ kfree_rcu(sap, rcu); + } + + static struct packet_type llc_packet_type __read_mostly = { +diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c +index 30fbabf4bcbc..593184d14b3e 100644 +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -128,7 +128,7 @@ + + #define CCK_GROUP \ + [MINSTREL_CCK_GROUP] = { \ +- .streams = 0, \ ++ .streams = 1, \ + .flags = 0, \ + .duration = { \ + CCK_DURATION_LIST(false), \ +diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c +index e7da29021b38..c23392482580 100644 +--- a/net/openvswitch/vport-internal_dev.c ++++ b/net/openvswitch/vport-internal_dev.c +@@ -44,7 +44,8 @@ static struct internal_dev *internal_dev_priv(struct net_device *netdev) + } + + /* Called with rcu_read_lock_bh. */ +-static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) ++static netdev_tx_t ++internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) + { + int len, err; + +@@ -63,7 +64,7 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) + } else { + netdev->stats.tx_errors++; + } +- return 0; ++ return NETDEV_TX_OK; + } + + static int internal_dev_open(struct net_device *netdev) +diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c +index 600eacce653a..0ef65822fdd3 100644 +--- a/net/sunrpc/sched.c ++++ b/net/sunrpc/sched.c +@@ -99,64 +99,78 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task) + list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list); + } + +-static void rpc_rotate_queue_owner(struct rpc_wait_queue *queue) +-{ +- struct list_head *q = &queue->tasks[queue->priority]; +- struct rpc_task *task; +- +- if (!list_empty(q)) { +- task = list_first_entry(q, struct rpc_task, u.tk_wait.list); +- if (task->tk_owner == queue->owner) +- list_move_tail(&task->u.tk_wait.list, q); +- } +-} +- + static void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority) + { + if (queue->priority != priority) { +- /* Fairness: rotate the list when changing priority */ +- rpc_rotate_queue_owner(queue); + queue->priority = priority; ++ queue->nr = 1U << priority; + } + } + +-static void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid) +-{ +- queue->owner = pid; +- queue->nr = RPC_BATCH_COUNT; +-} +- + static void rpc_reset_waitqueue_priority(struct rpc_wait_queue *queue) + { + rpc_set_waitqueue_priority(queue, queue->maxpriority); +- rpc_set_waitqueue_owner(queue, 0); + } + + /* +- * Add new request to a priority queue. ++ * Add a request to a queue list + */ +-static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue, +- struct rpc_task *task, +- unsigned char queue_priority) ++static void ++__rpc_list_enqueue_task(struct list_head *q, struct rpc_task *task) + { +- struct list_head *q; + struct rpc_task *t; + +- INIT_LIST_HEAD(&task->u.tk_wait.links); +- if (unlikely(queue_priority > queue->maxpriority)) +- queue_priority = queue->maxpriority; +- if (queue_priority > queue->priority) +- rpc_set_waitqueue_priority(queue, queue_priority); +- q = &queue->tasks[queue_priority]; + list_for_each_entry(t, q, u.tk_wait.list) { + if (t->tk_owner == task->tk_owner) { +- list_add_tail(&task->u.tk_wait.list, &t->u.tk_wait.links); ++ list_add_tail(&task->u.tk_wait.links, ++ &t->u.tk_wait.links); ++ /* Cache the queue head in task->u.tk_wait.list */ ++ task->u.tk_wait.list.next = q; ++ task->u.tk_wait.list.prev = NULL; + return; + } + } ++ INIT_LIST_HEAD(&task->u.tk_wait.links); + list_add_tail(&task->u.tk_wait.list, q); + } + ++/* ++ * Remove request from a queue list ++ */ ++static void ++__rpc_list_dequeue_task(struct rpc_task *task) ++{ ++ struct list_head *q; ++ struct rpc_task *t; ++ ++ if (task->u.tk_wait.list.prev == NULL) { ++ list_del(&task->u.tk_wait.links); ++ return; ++ } ++ if (!list_empty(&task->u.tk_wait.links)) { ++ t = list_first_entry(&task->u.tk_wait.links, ++ struct rpc_task, ++ u.tk_wait.links); ++ /* Assume __rpc_list_enqueue_task() cached the queue head */ ++ q = t->u.tk_wait.list.next; ++ list_add_tail(&t->u.tk_wait.list, q); ++ list_del(&task->u.tk_wait.links); ++ } ++ list_del(&task->u.tk_wait.list); ++} ++ ++/* ++ * Add new request to a priority queue. ++ */ ++static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue, ++ struct rpc_task *task, ++ unsigned char queue_priority) ++{ ++ if (unlikely(queue_priority > queue->maxpriority)) ++ queue_priority = queue->maxpriority; ++ __rpc_list_enqueue_task(&queue->tasks[queue_priority], task); ++} ++ + /* + * Add new request to wait queue. + * +@@ -194,13 +208,7 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue, + */ + static void __rpc_remove_wait_queue_priority(struct rpc_task *task) + { +- struct rpc_task *t; +- +- if (!list_empty(&task->u.tk_wait.links)) { +- t = list_entry(task->u.tk_wait.links.next, struct rpc_task, u.tk_wait.list); +- list_move(&t->u.tk_wait.list, &task->u.tk_wait.list); +- list_splice_init(&task->u.tk_wait.links, &t->u.tk_wait.links); +- } ++ __rpc_list_dequeue_task(task); + } + + /* +@@ -212,7 +220,8 @@ static void __rpc_remove_wait_queue(struct rpc_wait_queue *queue, struct rpc_tas + __rpc_disable_timer(queue, task); + if (RPC_IS_PRIORITY(queue)) + __rpc_remove_wait_queue_priority(task); +- list_del(&task->u.tk_wait.list); ++ else ++ list_del(&task->u.tk_wait.list); + queue->qlen--; + dprintk("RPC: %5u removed from queue %p \"%s\"\n", + task->tk_pid, queue, rpc_qname(queue)); +@@ -481,17 +490,9 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q + * Service a batch of tasks from a single owner. + */ + q = &queue->tasks[queue->priority]; +- if (!list_empty(q)) { +- task = list_entry(q->next, struct rpc_task, u.tk_wait.list); +- if (queue->owner == task->tk_owner) { +- if (--queue->nr) +- goto out; +- list_move_tail(&task->u.tk_wait.list, q); +- } +- /* +- * Check if we need to switch queues. +- */ +- goto new_owner; ++ if (!list_empty(q) && --queue->nr) { ++ task = list_first_entry(q, struct rpc_task, u.tk_wait.list); ++ goto out; + } + + /* +@@ -503,7 +504,7 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q + else + q = q - 1; + if (!list_empty(q)) { +- task = list_entry(q->next, struct rpc_task, u.tk_wait.list); ++ task = list_first_entry(q, struct rpc_task, u.tk_wait.list); + goto new_queue; + } + } while (q != &queue->tasks[queue->priority]); +@@ -513,8 +514,6 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q + + new_queue: + rpc_set_waitqueue_priority(queue, (unsigned int)(q - &queue->tasks[0])); +-new_owner: +- rpc_set_waitqueue_owner(queue, task->tk_owner); + out: + return task; + } +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 060bc0cc8252..bb19be78aed7 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -3058,7 +3058,7 @@ static void get_key_callback(void *c, struct key_params *params) + params->cipher))) + goto nla_put_failure; + +- if (nla_put_u8(cookie->msg, NL80211_ATTR_KEY_IDX, cookie->idx)) ++ if (nla_put_u8(cookie->msg, NL80211_KEY_IDX, cookie->idx)) + goto nla_put_failure; + + nla_nest_end(cookie->msg, key); +diff --git a/net/wireless/reg.c b/net/wireless/reg.c +index 44befe9f9ff0..dde741f298de 100644 +--- a/net/wireless/reg.c ++++ b/net/wireless/reg.c +@@ -2616,8 +2616,54 @@ static void restore_regulatory_settings(bool reset_user) + schedule_work(®_work); + } + ++static bool is_wiphy_all_set_reg_flag(enum ieee80211_regulatory_flags flag) ++{ ++ struct cfg80211_registered_device *rdev; ++ struct wireless_dev *wdev; ++ ++ list_for_each_entry(rdev, &cfg80211_rdev_list, list) { ++ list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { ++ wdev_lock(wdev); ++ if (!(wdev->wiphy->regulatory_flags & flag)) { ++ wdev_unlock(wdev); ++ return false; ++ } ++ wdev_unlock(wdev); ++ } ++ } ++ ++ return true; ++} ++ + void regulatory_hint_disconnect(void) + { ++ /* Restore of regulatory settings is not required when wiphy(s) ++ * ignore IE from connected access point but clearance of beacon hints ++ * is required when wiphy(s) supports beacon hints. ++ */ ++ if (is_wiphy_all_set_reg_flag(REGULATORY_COUNTRY_IE_IGNORE)) { ++ struct reg_beacon *reg_beacon, *btmp; ++ ++ if (is_wiphy_all_set_reg_flag(REGULATORY_DISABLE_BEACON_HINTS)) ++ return; ++ ++ spin_lock_bh(®_pending_beacons_lock); ++ list_for_each_entry_safe(reg_beacon, btmp, ++ ®_pending_beacons, list) { ++ list_del(®_beacon->list); ++ kfree(reg_beacon); ++ } ++ spin_unlock_bh(®_pending_beacons_lock); ++ ++ list_for_each_entry_safe(reg_beacon, btmp, ++ ®_beacon_list, list) { ++ list_del(®_beacon->list); ++ kfree(reg_beacon); ++ } ++ ++ return; ++ } ++ + pr_debug("All devices are disconnected, going to restore regulatory settings\n"); + restore_regulatory_settings(false); + } +diff --git a/samples/mei/mei-amt-version.c b/samples/mei/mei-amt-version.c +index bb9988914a56..32234481ad7d 100644 +--- a/samples/mei/mei-amt-version.c ++++ b/samples/mei/mei-amt-version.c +@@ -370,7 +370,7 @@ static uint32_t amt_host_if_call(struct amt_host_if *acmd, + unsigned int expected_sz) + { + uint32_t in_buf_sz; +- uint32_t out_buf_sz; ++ ssize_t out_buf_sz; + ssize_t written; + uint32_t status; + struct amt_host_if_resp_header *msg_hdr; +diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c +index a84a1d3d23e5..c6888d76ca5e 100644 +--- a/sound/core/oss/pcm_plugin.c ++++ b/sound/core/oss/pcm_plugin.c +@@ -111,7 +111,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) + while (plugin->next) { + if (plugin->dst_frames) + frames = plugin->dst_frames(plugin, frames); +- if (snd_BUG_ON(frames <= 0)) ++ if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) + return -ENXIO; + plugin = plugin->next; + err = snd_pcm_plugin_alloc(plugin, frames); +@@ -123,7 +123,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) + while (plugin->prev) { + if (plugin->src_frames) + frames = plugin->src_frames(plugin, frames); +- if (snd_BUG_ON(frames <= 0)) ++ if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) + return -ENXIO; + plugin = plugin->prev; + err = snd_pcm_plugin_alloc(plugin, frames); +diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c +index 8ce1d0b40dce..ce1f1e4727ab 100644 +--- a/sound/core/seq/seq_system.c ++++ b/sound/core/seq/seq_system.c +@@ -123,6 +123,7 @@ int __init snd_seq_system_client_init(void) + { + struct snd_seq_port_callback pcallbacks; + struct snd_seq_port_info *port; ++ int err; + + port = kzalloc(sizeof(*port), GFP_KERNEL); + if (!port) +@@ -144,7 +145,10 @@ int __init snd_seq_system_client_init(void) + port->flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT; + port->addr.client = sysclient; + port->addr.port = SNDRV_SEQ_PORT_SYSTEM_TIMER; +- snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); ++ err = snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, ++ port); ++ if (err < 0) ++ goto error_port; + + /* register announcement port */ + strcpy(port->name, "Announce"); +@@ -154,16 +158,24 @@ int __init snd_seq_system_client_init(void) + port->flags = SNDRV_SEQ_PORT_FLG_GIVEN_PORT; + port->addr.client = sysclient; + port->addr.port = SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE; +- snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); ++ err = snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, ++ port); ++ if (err < 0) ++ goto error_port; + announce_port = port->addr.port; + + kfree(port); + return 0; ++ ++ error_port: ++ snd_seq_system_client_done(); ++ kfree(port); ++ return err; + } + + + /* unregister our internal client */ +-void __exit snd_seq_system_client_done(void) ++void snd_seq_system_client_done(void) + { + int oldsysclient = sysclient; + +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c +index 0abab7926dca..d1a6d20ace0d 100644 +--- a/sound/pci/hda/patch_sigmatel.c ++++ b/sound/pci/hda/patch_sigmatel.c +@@ -77,6 +77,7 @@ enum { + STAC_DELL_M6_BOTH, + STAC_DELL_EQ, + STAC_ALIENWARE_M17X, ++ STAC_ELO_VUPOINT_15MX, + STAC_92HD89XX_HP_FRONT_JACK, + STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, + STAC_92HD73XX_ASUS_MOBO, +@@ -1875,6 +1876,18 @@ static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec, + codec->no_jack_detect = 1; + } + ++ ++static void stac92hd73xx_disable_automute(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ struct sigmatel_spec *spec = codec->spec; ++ ++ if (action != HDA_FIXUP_ACT_PRE_PROBE) ++ return; ++ ++ spec->gen.suppress_auto_mute = 1; ++} ++ + static const struct hda_fixup stac92hd73xx_fixups[] = { + [STAC_92HD73XX_REF] = { + .type = HDA_FIXUP_FUNC, +@@ -1900,6 +1913,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = stac92hd73xx_fixup_alienware_m17x, + }, ++ [STAC_ELO_VUPOINT_15MX] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = stac92hd73xx_disable_automute, ++ }, + [STAC_92HD73XX_INTEL] = { + .type = HDA_FIXUP_PINS, + .v.pins = intel_dg45id_pin_configs, +@@ -1938,6 +1955,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { + { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, + { .id = STAC_DELL_EQ, .name = "dell-eq" }, + { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, ++ { .id = STAC_ELO_VUPOINT_15MX, .name = "elo-vupoint-15mx" }, + { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, + {} + }; +@@ -1987,6 +2005,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { + "Alienware M17x", STAC_ALIENWARE_M17X), + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, + "Alienware M17x R3", STAC_DELL_EQ), ++ SND_PCI_QUIRK(0x1059, 0x1011, ++ "ELO VuPoint 15MX", STAC_ELO_VUPOINT_15MX), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927, + "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, +diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c +index 1bc98c867133..2286dfd72ff7 100644 +--- a/sound/pci/intel8x0m.c ++++ b/sound/pci/intel8x0m.c +@@ -1171,16 +1171,6 @@ static int snd_intel8x0m_create(struct snd_card *card, + } + + port_inited: +- if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED, +- KBUILD_MODNAME, chip)) { +- dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); +- snd_intel8x0m_free(chip); +- return -EBUSY; +- } +- chip->irq = pci->irq; +- pci_set_master(pci); +- synchronize_irq(chip->irq); +- + /* initialize offsets */ + chip->bdbars_count = 2; + tbl = intel_regs; +@@ -1224,11 +1214,21 @@ static int snd_intel8x0m_create(struct snd_card *card, + chip->int_sta_reg = ICH_REG_GLOB_STA; + chip->int_sta_mask = int_sta_masks; + ++ pci_set_master(pci); ++ + if ((err = snd_intel8x0m_chip_init(chip, 1)) < 0) { + snd_intel8x0m_free(chip); + return err; + } + ++ if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED, ++ KBUILD_MODNAME, chip)) { ++ dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); ++ snd_intel8x0m_free(chip); ++ return -EBUSY; ++ } ++ chip->irq = pci->irq; ++ + if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { + snd_intel8x0m_free(chip); + return err; +diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c +index c602c4960924..88355d1719a3 100644 +--- a/sound/soc/codecs/hdac_hdmi.c ++++ b/sound/soc/codecs/hdac_hdmi.c +@@ -1267,6 +1267,12 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac, + if (ret) + return ret; + ++ /* Filter out 44.1, 88.2 and 176.4Khz */ ++ rates &= ~(SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_88200 | ++ SNDRV_PCM_RATE_176400); ++ if (!rates) ++ return -EINVAL; ++ + sprintf(dai_name, "intel-hdmi-hifi%d", i+1); + hdmi_dais[i].name = devm_kstrdup(&hdac->dev, + dai_name, GFP_KERNEL); +diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c +index 7406ea5c9a4f..39810b713d5f 100644 +--- a/sound/soc/codecs/sgtl5000.c ++++ b/sound/soc/codecs/sgtl5000.c +@@ -1217,7 +1217,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) + * Searching for a suitable index solving this formula: + * idx = 40 * log10(vag_val / lo_cagcntrl) + 15 + */ +- vol_quot = (vag * 100) / lo_vag; ++ vol_quot = lo_vag ? (vag * 100) / lo_vag : 0; + lo_vol = 0; + for (i = 0; i < ARRAY_SIZE(vol_quot_table); i++) { + if (vol_quot >= vol_quot_table[i]) +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c +index 1d00f6e894ef..d69559e45872 100644 +--- a/sound/soc/soc-pcm.c ++++ b/sound/soc/soc-pcm.c +@@ -1592,7 +1592,7 @@ static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime, + u64 formats) + { + runtime->hw.rate_min = stream->rate_min; +- runtime->hw.rate_max = stream->rate_max; ++ runtime->hw.rate_max = min_not_zero(stream->rate_max, UINT_MAX); + runtime->hw.channels_min = stream->channels_min; + runtime->hw.channels_max = stream->channels_max; + if (runtime->hw.formats) +diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c +index b8044c6034b3..30aa5f2df6da 100644 +--- a/sound/usb/endpoint.c ++++ b/sound/usb/endpoint.c +@@ -403,6 +403,9 @@ static void snd_complete_urb(struct urb *urb) + } + + prepare_outbound_urb(ep, ctx); ++ /* can be stopped during prepare callback */ ++ if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags))) ++ goto exit_clear; + } else { + retire_inbound_urb(ep, ctx); + /* can be stopped during retire callback */ +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c +index a02443717625..64fa1bbf0acb 100644 +--- a/sound/usb/mixer.c ++++ b/sound/usb/mixer.c +@@ -1046,7 +1046,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, + if (cval->min + cval->res < cval->max) { + int last_valid_res = cval->res; + int saved, test, check; +- get_cur_mix_raw(cval, minchn, &saved); ++ if (get_cur_mix_raw(cval, minchn, &saved) < 0) ++ goto no_res_check; + for (;;) { + test = saved; + if (test < cval->max) +@@ -1066,6 +1067,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, + snd_usb_set_cur_mix_value(cval, minchn, 0, saved); + } + ++no_res_check: + cval->initialized = 1; + } + |