aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-12 13:29:36 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-12 13:29:36 -0400
commit4970c0cb6aa8996e39b1626887f5fb67a49f5ad1 (patch)
tree8e734bdf15768744a0ec03fbc715a6404a4f732b
parent3c0ed7d56d77b61f2177e8b72855ea32073c2091 (diff)
parent25cb62b76430a91cc6195f902e61c2cb84ade622 (diff)
Merge 4.3-rc5 into char-misc next
We want the fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--Documentation/device-mapper/snapshot.txt10
-rw-r--r--Documentation/devicetree/bindings/spi/sh-msiof.txt2
-rw-r--r--Documentation/devicetree/bindings/usb/renesas_usbhs.txt1
-rw-r--r--MAINTAINERS14
-rw-r--r--Makefile4
-rw-r--r--arch/alpha/include/asm/word-at-a-time.h2
-rw-r--r--arch/arm/boot/dts/Makefile2
-rw-r--r--arch/arm/boot/dts/exynos4412.dtsi1
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts1
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi2
-rw-r--r--arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi1
-rw-r--r--arch/arm/boot/dts/imx53-qsrb.dts2
-rw-r--r--arch/arm/boot/dts/imx53.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl-rex.dtsi2
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi1
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi1
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi2
-rw-r--r--arch/arm/mach-exynos/mcpm-exynos.c27
-rw-r--r--arch/arm/mach-exynos/regs-pmu.h6
-rw-r--r--arch/arm64/kernel/debug-monitors.c23
-rw-r--r--arch/arm64/kernel/insn.c6
-rw-r--r--arch/arm64/kernel/setup.c2
-rw-r--r--arch/arm64/mm/fault.c1
-rw-r--r--arch/h8300/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/io.h1
-rw-r--r--arch/mips/include/uapi/asm/swab.h19
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/word-at-a-time.h5
-rw-r--r--arch/s390/boot/compressed/Makefile2
-rw-r--r--arch/s390/configs/default_defconfig2
-rw-r--r--arch/s390/configs/gcov_defconfig2
-rw-r--r--arch/s390/configs/performance_defconfig2
-rw-r--r--arch/s390/include/asm/numa.h2
-rw-r--r--arch/s390/include/asm/topology.h2
-rw-r--r--arch/s390/kernel/asm-offsets.c1
-rw-r--r--arch/s390/kernel/entry.S30
-rw-r--r--arch/s390/kernel/vtime.c66
-rw-r--r--arch/s390/numa/mode_emu.c4
-rw-r--r--arch/s390/numa/numa.c4
-rw-r--r--arch/tile/include/asm/Kbuild1
-rw-r--r--arch/tile/include/asm/word-at-a-time.h8
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/include/asm/xen/hypercall.h4
-rw-r--r--arch/x86/xen/enlighten.c24
-rw-r--r--arch/x86/xen/p2m.c19
-rw-r--r--arch/x86/xen/setup.c4
-rw-r--r--drivers/base/regmap/regmap-debugfs.c5
-rw-r--r--drivers/bus/Kconfig1
-rw-r--r--drivers/clk/samsung/clk-cpu.c10
-rw-r--r--drivers/clk/ti/clk-3xxx.c2
-rw-r--r--drivers/clk/ti/clk-7xx.c18
-rw-r--r--drivers/clk/ti/clkt_dflt.c4
-rw-r--r--drivers/cpufreq/acpi-cpufreq.c3
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--drivers/devfreq/devfreq.c7
-rw-r--r--drivers/mcb/mcb-pci.c6
-rw-r--r--drivers/md/dm-cache-policy-cleaner.c2
-rw-r--r--drivers/md/dm-exception-store.c6
-rw-r--r--drivers/md/dm-exception-store.h5
-rw-r--r--drivers/md/dm-raid.c3
-rw-r--r--drivers/md/dm-snap-persistent.c17
-rw-r--r--drivers/md/dm-snap-transient.c3
-rw-r--r--drivers/md/dm-snap.c14
-rw-r--r--drivers/md/dm.c11
-rw-r--r--drivers/md/raid1.c4
-rw-r--r--drivers/md/raid10.c4
-rw-r--r--drivers/misc/mei/hbm.c2
-rw-r--r--drivers/mmc/host/omap_hsmmc.c14
-rw-r--r--drivers/mmc/host/sdhci-of-at91.c1
-rw-r--r--drivers/mmc/host/sdhci-pxav3.c6
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/mmc/host/sdhci.h5
-rw-r--r--drivers/mtd/nand/mxc_nand.c2
-rw-r--r--drivers/mtd/nand/sunxi_nand.c27
-rw-r--r--drivers/nvmem/core.c8
-rw-r--r--drivers/nvmem/sunxi_sid.c11
-rw-r--r--drivers/phy/phy-berlin-sata.c1
-rw-r--r--drivers/phy/phy-qcom-ufs.c11
-rw-r--r--drivers/phy/phy-rockchip-usb.c6
-rw-r--r--drivers/regulator/axp20x-regulator.c4
-rw-r--r--drivers/regulator/core.c4
-rw-r--r--drivers/scsi/3w-9xxx.c28
-rw-r--r--drivers/scsi/libiscsi.c17
-rw-r--r--drivers/scsi/scsi_dh.c2
-rw-r--r--drivers/spi/spi-davinci.c7
-rw-r--r--drivers/staging/speakup/fakekey.c1
-rw-r--r--drivers/tty/n_tty.c15
-rw-r--r--drivers/tty/serial/8250/8250_port.c8
-rw-r--r--drivers/tty/serial/atmel_serial.c2
-rw-r--r--drivers/tty/serial/imx.c20
-rw-r--r--drivers/tty/tty_buffer.c22
-rw-r--r--drivers/tty/tty_io.c40
-rw-r--r--drivers/usb/core/quirks.c13
-rw-r--r--drivers/usb/gadget/udc/bdc/bdc_ep.c4
-rw-r--r--drivers/usb/misc/chaoskey.c2
-rw-r--r--drivers/usb/renesas_usbhs/common.c7
-rw-r--r--drivers/video/fbdev/broadsheetfb.c8
-rw-r--r--drivers/video/fbdev/fsl-diu-fb.c9
-rw-r--r--drivers/video/fbdev/mb862xx/mb862xxfbdrv.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/connector-dvi.c2
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c1
-rw-r--r--drivers/video/fbdev/tridentfb.c12
-rw-r--r--drivers/video/of_display_timing.c1
-rw-r--r--fs/btrfs/disk-io.c4
-rw-r--r--fs/btrfs/export.c10
-rw-r--r--fs/btrfs/extent-tree.c9
-rw-r--r--fs/btrfs/extent_io.c19
-rw-r--r--fs/btrfs/send.c8
-rw-r--r--fs/btrfs/transaction.c1
-rw-r--r--fs/btrfs/transaction.h1
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/inode.c34
-rw-r--r--fs/cifs/smb2pdu.c2
-rw-r--r--fs/namei.c8
-rw-r--r--fs/nfs/nfs4proc.c15
-rw-r--r--fs/nfs/nfs4state.c3
-rw-r--r--fs/nfs/nfs4trace.h2
-rw-r--r--fs/nfs/write.c14
-rw-r--r--include/linux/irqdomain.h5
-rw-r--r--include/linux/usb/renesas_usbhs.h2
-rw-r--r--include/xen/interface/sched.h8
-rw-r--r--kernel/irq/handle.c2
-rw-r--r--kernel/sched/core.c10
-rw-r--r--kernel/sched/sched.h5
-rw-r--r--lib/string.c3
-rw-r--r--mm/filemap.c34
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_recvfrom.c6
-rw-r--r--net/sunrpc/xprtrdma/transport.c2
-rw-r--r--net/sunrpc/xprtrdma/verbs.c9
-rw-r--r--sound/pci/hda/patch_cirrus.c1
-rw-r--r--sound/pci/hda/patch_realtek.c1
-rw-r--r--sound/pci/hda/patch_sigmatel.c6
-rw-r--r--sound/soc/au1x/db1200.c4
-rw-r--r--sound/soc/codecs/rt5645.c6
-rw-r--r--sound/soc/codecs/rt5645.h16
-rw-r--r--sound/soc/codecs/sgtl5000.c6
-rw-r--r--sound/soc/codecs/tas2552.c2
-rw-r--r--sound/soc/codecs/tlv320aic3x.c19
-rw-r--r--sound/soc/codecs/wm8962.c5
-rw-r--r--sound/soc/dwc/designware_i2s.c19
-rw-r--r--sound/soc/fsl/imx-ssi.c19
-rw-r--r--sound/synth/emux/emux_oss.c3
-rw-r--r--tools/perf/util/Build2
-rw-r--r--tools/perf/util/perf_regs.c2
-rw-r--r--tools/perf/util/perf_regs.h1
145 files changed, 712 insertions, 392 deletions
diff --git a/Documentation/device-mapper/snapshot.txt b/Documentation/device-mapper/snapshot.txt
index 0d5bc46dc167..ad6949bff2e3 100644
--- a/Documentation/device-mapper/snapshot.txt
+++ b/Documentation/device-mapper/snapshot.txt
@@ -41,9 +41,13 @@ useless and be disabled, returning errors. So it is important to monitor
41the amount of free space and expand the <COW device> before it fills up. 41the amount of free space and expand the <COW device> before it fills up.
42 42
43<persistent?> is P (Persistent) or N (Not persistent - will not survive 43<persistent?> is P (Persistent) or N (Not persistent - will not survive
44after reboot). 44after reboot). O (Overflow) can be added as a persistent store option
45The difference is that for transient snapshots less metadata must be 45to allow userspace to advertise its support for seeing "Overflow" in the
46saved on disk - they can be kept in memory by the kernel. 46snapshot status. So supported store types are "P", "PO" and "N".
47
48The difference between persistent and transient is with transient
49snapshots less metadata must be saved on disk - they can be kept in
50memory by the kernel.
47 51
48 52
49* snapshot-merge <origin> <COW device> <persistent> <chunksize> 53* snapshot-merge <origin> <COW device> <persistent> <chunksize>
diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt b/Documentation/devicetree/bindings/spi/sh-msiof.txt
index 8f771441be60..705075da2f10 100644
--- a/Documentation/devicetree/bindings/spi/sh-msiof.txt
+++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt
@@ -51,7 +51,7 @@ Optional properties, deprecated for soctype-specific bindings:
51- renesas,tx-fifo-size : Overrides the default tx fifo size given in words 51- renesas,tx-fifo-size : Overrides the default tx fifo size given in words
52 (default is 64) 52 (default is 64)
53- renesas,rx-fifo-size : Overrides the default rx fifo size given in words 53- renesas,rx-fifo-size : Overrides the default rx fifo size given in words
54 (default is 64, or 256 on R-Car Gen2) 54 (default is 64)
55 55
56Pinctrl properties might be needed, too. See 56Pinctrl properties might be needed, too. See
57Documentation/devicetree/bindings/pinctrl/renesas,*. 57Documentation/devicetree/bindings/pinctrl/renesas,*.
diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
index 64a4ca6cf96f..7d48f63db44e 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
@@ -5,6 +5,7 @@ Required properties:
5 - "renesas,usbhs-r8a7790" 5 - "renesas,usbhs-r8a7790"
6 - "renesas,usbhs-r8a7791" 6 - "renesas,usbhs-r8a7791"
7 - "renesas,usbhs-r8a7794" 7 - "renesas,usbhs-r8a7794"
8 - "renesas,usbhs-r8a7795"
8 - reg: Base address and length of the register for the USBHS 9 - reg: Base address and length of the register for the USBHS
9 - interrupts: Interrupt specifier for the USBHS 10 - interrupts: Interrupt specifier for the USBHS
10 - clocks: A list of phandle + clock specifier pairs 11 - clocks: A list of phandle + clock specifier pairs
diff --git a/MAINTAINERS b/MAINTAINERS
index 847581b10238..fe5bbfebc74b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4003,7 +4003,7 @@ S: Maintained
4003F: sound/usb/misc/ua101.c 4003F: sound/usb/misc/ua101.c
4004 4004
4005EXTENSIBLE FIRMWARE INTERFACE (EFI) 4005EXTENSIBLE FIRMWARE INTERFACE (EFI)
4006M: Matt Fleming <matt.fleming@intel.com> 4006M: Matt Fleming <matt@codeblueprint.co.uk>
4007L: linux-efi@vger.kernel.org 4007L: linux-efi@vger.kernel.org
4008T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git 4008T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
4009S: Maintained 4009S: Maintained
@@ -4018,7 +4018,7 @@ F: include/linux/efi*.h
4018EFI VARIABLE FILESYSTEM 4018EFI VARIABLE FILESYSTEM
4019M: Matthew Garrett <matthew.garrett@nebula.com> 4019M: Matthew Garrett <matthew.garrett@nebula.com>
4020M: Jeremy Kerr <jk@ozlabs.org> 4020M: Jeremy Kerr <jk@ozlabs.org>
4021M: Matt Fleming <matt.fleming@intel.com> 4021M: Matt Fleming <matt@codeblueprint.co.uk>
4022T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git 4022T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git
4023L: linux-efi@vger.kernel.org 4023L: linux-efi@vger.kernel.org
4024S: Maintained 4024S: Maintained
@@ -9935,7 +9935,6 @@ S: Maintained
9935F: drivers/staging/lustre 9935F: drivers/staging/lustre
9936 9936
9937STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec) 9937STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec)
9938M: Julian Andres Klode <jak@jak-linux.org>
9939M: Marc Dietrich <marvin24@gmx.de> 9938M: Marc Dietrich <marvin24@gmx.de>
9940L: ac100@lists.launchpad.net (moderated for non-subscribers) 9939L: ac100@lists.launchpad.net (moderated for non-subscribers)
9941L: linux-tegra@vger.kernel.org 9940L: linux-tegra@vger.kernel.org
@@ -11399,15 +11398,6 @@ W: http://oops.ghostprotocols.net:81/blog
11399S: Maintained 11398S: Maintained
11400F: drivers/net/wireless/wl3501* 11399F: drivers/net/wireless/wl3501*
11401 11400
11402WM97XX TOUCHSCREEN DRIVERS
11403M: Mark Brown <broonie@kernel.org>
11404M: Liam Girdwood <lrg@slimlogic.co.uk>
11405L: linux-input@vger.kernel.org
11406W: https://github.com/CirrusLogic/linux-drivers/wiki
11407S: Supported
11408F: drivers/input/touchscreen/*wm97*
11409F: include/linux/wm97xx.h
11410
11411WOLFSON MICROELECTRONICS DRIVERS 11401WOLFSON MICROELECTRONICS DRIVERS
11412L: patches@opensource.wolfsonmicro.com 11402L: patches@opensource.wolfsonmicro.com
11413T: git https://github.com/CirrusLogic/linux-drivers.git 11403T: git https://github.com/CirrusLogic/linux-drivers.git
diff --git a/Makefile b/Makefile
index fd46821e428d..416660d05739 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 3 2PATCHLEVEL = 3
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc4 4EXTRAVERSION = -rc5
5NAME = Hurr durr I'ma sheep 5NAME = Blurry Fish Butt
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
diff --git a/arch/alpha/include/asm/word-at-a-time.h b/arch/alpha/include/asm/word-at-a-time.h
index 6b340d0f1521..902e6ab00a06 100644
--- a/arch/alpha/include/asm/word-at-a-time.h
+++ b/arch/alpha/include/asm/word-at-a-time.h
@@ -52,4 +52,6 @@ static inline unsigned long find_zero(unsigned long bits)
52#endif 52#endif
53} 53}
54 54
55#define zero_bytemask(mask) ((2ul << (find_zero(mask) * 8)) - 1)
56
55#endif /* _ASM_WORD_AT_A_TIME_H */ 57#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 233159d2eaab..bb8fa023d574 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -578,7 +578,7 @@ dtb-$(CONFIG_MACH_SUN4I) += \
578 sun4i-a10-hackberry.dtb \ 578 sun4i-a10-hackberry.dtb \
579 sun4i-a10-hyundai-a7hd.dtb \ 579 sun4i-a10-hyundai-a7hd.dtb \
580 sun4i-a10-inet97fv2.dtb \ 580 sun4i-a10-inet97fv2.dtb \
581 sun4i-a10-itead-iteaduino-plus.dts \ 581 sun4i-a10-itead-iteaduino-plus.dtb \
582 sun4i-a10-jesurun-q5.dtb \ 582 sun4i-a10-jesurun-q5.dtb \
583 sun4i-a10-marsboard.dtb \ 583 sun4i-a10-marsboard.dtb \
584 sun4i-a10-mini-xplus.dtb \ 584 sun4i-a10-mini-xplus.dtb \
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index ca0e3c15977f..294cfe40388d 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -98,6 +98,7 @@
98 opp-hz = /bits/ 64 <800000000>; 98 opp-hz = /bits/ 64 <800000000>;
99 opp-microvolt = <1000000>; 99 opp-microvolt = <1000000>;
100 clock-latency-ns = <200000>; 100 clock-latency-ns = <200000>;
101 opp-suspend;
101 }; 102 };
102 opp07 { 103 opp07 {
103 opp-hz = /bits/ 64 <900000000>; 104 opp-hz = /bits/ 64 <900000000>;
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 15aea760c1da..c625e71217aa 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -197,6 +197,7 @@
197 regulator-name = "P1.8V_LDO_OUT10"; 197 regulator-name = "P1.8V_LDO_OUT10";
198 regulator-min-microvolt = <1800000>; 198 regulator-min-microvolt = <1800000>;
199 regulator-max-microvolt = <1800000>; 199 regulator-max-microvolt = <1800000>;
200 regulator-always-on;
200 }; 201 };
201 202
202 ldo11_reg: LDO11 { 203 ldo11_reg: LDO11 {
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index df9aee92ecf4..1b3d6c769a3c 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -1117,7 +1117,7 @@
1117 interrupt-parent = <&combiner>; 1117 interrupt-parent = <&combiner>;
1118 interrupts = <3 0>; 1118 interrupts = <3 0>;
1119 clock-names = "sysmmu", "master"; 1119 clock-names = "sysmmu", "master";
1120 clocks = <&clock CLK_SMMU_FIMD1M0>, <&clock CLK_FIMD1>; 1120 clocks = <&clock CLK_SMMU_FIMD1M1>, <&clock CLK_FIMD1>;
1121 power-domains = <&disp_pd>; 1121 power-domains = <&disp_pd>;
1122 #iommu-cells = <0>; 1122 #iommu-cells = <0>;
1123 }; 1123 };
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
index 79ffdfe712aa..3b43e57845ae 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
@@ -472,7 +472,6 @@
472 */ 472 */
473 pinctrl-0 = <&pwm0_out &pwm1_out &pwm2_out &pwm3_out>; 473 pinctrl-0 = <&pwm0_out &pwm1_out &pwm2_out &pwm3_out>;
474 pinctrl-names = "default"; 474 pinctrl-names = "default";
475 samsung,pwm-outputs = <0>;
476 status = "okay"; 475 status = "okay";
477}; 476};
478 477
diff --git a/arch/arm/boot/dts/imx53-qsrb.dts b/arch/arm/boot/dts/imx53-qsrb.dts
index 66e47de5e826..96d7eede412e 100644
--- a/arch/arm/boot/dts/imx53-qsrb.dts
+++ b/arch/arm/boot/dts/imx53-qsrb.dts
@@ -36,7 +36,7 @@
36 pinctrl-0 = <&pinctrl_pmic>; 36 pinctrl-0 = <&pinctrl_pmic>;
37 reg = <0x08>; 37 reg = <0x08>;
38 interrupt-parent = <&gpio5>; 38 interrupt-parent = <&gpio5>;
39 interrupts = <23 0x8>; 39 interrupts = <23 IRQ_TYPE_LEVEL_HIGH>;
40 regulators { 40 regulators {
41 sw1_reg: sw1a { 41 sw1_reg: sw1a {
42 regulator-name = "SW1"; 42 regulator-name = "SW1";
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index c3e3ca9362fb..cd170376eaca 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -15,6 +15,7 @@
15#include <dt-bindings/clock/imx5-clock.h> 15#include <dt-bindings/clock/imx5-clock.h>
16#include <dt-bindings/gpio/gpio.h> 16#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/input/input.h> 17#include <dt-bindings/input/input.h>
18#include <dt-bindings/interrupt-controller/irq.h>
18 19
19/ { 20/ {
20 aliases { 21 aliases {
diff --git a/arch/arm/boot/dts/imx6qdl-rex.dtsi b/arch/arm/boot/dts/imx6qdl-rex.dtsi
index 3373fd958e95..a50356243888 100644
--- a/arch/arm/boot/dts/imx6qdl-rex.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-rex.dtsi
@@ -35,7 +35,6 @@
35 compatible = "regulator-fixed"; 35 compatible = "regulator-fixed";
36 reg = <1>; 36 reg = <1>;
37 pinctrl-names = "default"; 37 pinctrl-names = "default";
38 pinctrl-0 = <&pinctrl_usbh1>;
39 regulator-name = "usbh1_vbus"; 38 regulator-name = "usbh1_vbus";
40 regulator-min-microvolt = <5000000>; 39 regulator-min-microvolt = <5000000>;
41 regulator-max-microvolt = <5000000>; 40 regulator-max-microvolt = <5000000>;
@@ -47,7 +46,6 @@
47 compatible = "regulator-fixed"; 46 compatible = "regulator-fixed";
48 reg = <2>; 47 reg = <2>;
49 pinctrl-names = "default"; 48 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_usbotg>;
51 regulator-name = "usb_otg_vbus"; 49 regulator-name = "usb_otg_vbus";
52 regulator-min-microvolt = <5000000>; 50 regulator-min-microvolt = <5000000>;
53 regulator-max-microvolt = <5000000>; 51 regulator-max-microvolt = <5000000>;
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index a0b2a79cbfbd..4624d0f2a754 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1627,6 +1627,7 @@
1627 "mix.0", "mix.1", 1627 "mix.0", "mix.1",
1628 "dvc.0", "dvc.1", 1628 "dvc.0", "dvc.1",
1629 "clk_a", "clk_b", "clk_c", "clk_i"; 1629 "clk_a", "clk_b", "clk_c", "clk_i";
1630 power-domains = <&cpg_clocks>;
1630 1631
1631 status = "disabled"; 1632 status = "disabled";
1632 1633
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 831525dd39a6..1666c8a6b143 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -1677,6 +1677,7 @@
1677 "mix.0", "mix.1", 1677 "mix.0", "mix.1",
1678 "dvc.0", "dvc.1", 1678 "dvc.0", "dvc.1",
1679 "clk_a", "clk_b", "clk_c", "clk_i"; 1679 "clk_a", "clk_b", "clk_c", "clk_i";
1680 power-domains = <&cpg_clocks>;
1680 1681
1681 status = "disabled"; 1682 status = "disabled";
1682 1683
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 2bebaa286f9a..391230c3dc93 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -107,7 +107,7 @@
107 720000 1200000 107 720000 1200000
108 528000 1100000 108 528000 1100000
109 312000 1000000 109 312000 1000000
110 144000 900000 110 144000 1000000
111 >; 111 >;
112 #cooling-cells = <2>; 112 #cooling-cells = <2>;
113 cooling-min-level = <0>; 113 cooling-min-level = <0>;
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index 9bdf54795f05..56978199c479 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -20,6 +20,7 @@
20#include <asm/cputype.h> 20#include <asm/cputype.h>
21#include <asm/cp15.h> 21#include <asm/cp15.h>
22#include <asm/mcpm.h> 22#include <asm/mcpm.h>
23#include <asm/smp_plat.h>
23 24
24#include "regs-pmu.h" 25#include "regs-pmu.h"
25#include "common.h" 26#include "common.h"
@@ -70,7 +71,31 @@ static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
70 cluster >= EXYNOS5420_NR_CLUSTERS) 71 cluster >= EXYNOS5420_NR_CLUSTERS)
71 return -EINVAL; 72 return -EINVAL;
72 73
73 exynos_cpu_power_up(cpunr); 74 if (!exynos_cpu_power_state(cpunr)) {
75 exynos_cpu_power_up(cpunr);
76
77 /*
78 * This assumes the cluster number of the big cores(Cortex A15)
79 * is 0 and the Little cores(Cortex A7) is 1.
80 * When the system was booted from the Little core,
81 * they should be reset during power up cpu.
82 */
83 if (cluster &&
84 cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1)) {
85 /*
86 * Before we reset the Little cores, we should wait
87 * the SPARE2 register is set to 1 because the init
88 * codes of the iROM will set the register after
89 * initialization.
90 */
91 while (!pmu_raw_readl(S5P_PMU_SPARE2))
92 udelay(10);
93
94 pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
95 EXYNOS_SWRESET);
96 }
97 }
98
74 return 0; 99 return 0;
75} 100}
76 101
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index b7614333d296..fba9068ed260 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -513,6 +513,12 @@ static inline unsigned int exynos_pmu_cpunr(unsigned int mpidr)
513#define SPREAD_ENABLE 0xF 513#define SPREAD_ENABLE 0xF
514#define SPREAD_USE_STANDWFI 0xF 514#define SPREAD_USE_STANDWFI 0xF
515 515
516#define EXYNOS5420_KFC_CORE_RESET0 BIT(8)
517#define EXYNOS5420_KFC_ETM_RESET0 BIT(20)
518
519#define EXYNOS5420_KFC_CORE_RESET(_nr) \
520 ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) << (_nr))
521
516#define EXYNOS5420_BB_CON1 0x0784 522#define EXYNOS5420_BB_CON1 0x0784
517#define EXYNOS5420_BB_SEL_EN BIT(31) 523#define EXYNOS5420_BB_SEL_EN BIT(31)
518#define EXYNOS5420_BB_PMOS_EN BIT(7) 524#define EXYNOS5420_BB_PMOS_EN BIT(7)
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index cebf78661a55..253021ef2769 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -201,7 +201,7 @@ void unregister_step_hook(struct step_hook *hook)
201} 201}
202 202
203/* 203/*
204 * Call registered single step handers 204 * Call registered single step handlers
205 * There is no Syndrome info to check for determining the handler. 205 * There is no Syndrome info to check for determining the handler.
206 * So we call all the registered handlers, until the right handler is 206 * So we call all the registered handlers, until the right handler is
207 * found which returns zero. 207 * found which returns zero.
@@ -271,20 +271,21 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
271 * Use reader/writer locks instead of plain spinlock. 271 * Use reader/writer locks instead of plain spinlock.
272 */ 272 */
273static LIST_HEAD(break_hook); 273static LIST_HEAD(break_hook);
274static DEFINE_RWLOCK(break_hook_lock); 274static DEFINE_SPINLOCK(break_hook_lock);
275 275
276void register_break_hook(struct break_hook *hook) 276void register_break_hook(struct break_hook *hook)
277{ 277{
278 write_lock(&break_hook_lock); 278 spin_lock(&break_hook_lock);
279 list_add(&hook->node, &break_hook); 279 list_add_rcu(&hook->node, &break_hook);
280 write_unlock(&break_hook_lock); 280 spin_unlock(&break_hook_lock);
281} 281}
282 282
283void unregister_break_hook(struct break_hook *hook) 283void unregister_break_hook(struct break_hook *hook)
284{ 284{
285 write_lock(&break_hook_lock); 285 spin_lock(&break_hook_lock);
286 list_del(&hook->node); 286 list_del_rcu(&hook->node);
287 write_unlock(&break_hook_lock); 287 spin_unlock(&break_hook_lock);
288 synchronize_rcu();
288} 289}
289 290
290static int call_break_hook(struct pt_regs *regs, unsigned int esr) 291static int call_break_hook(struct pt_regs *regs, unsigned int esr)
@@ -292,11 +293,11 @@ static int call_break_hook(struct pt_regs *regs, unsigned int esr)
292 struct break_hook *hook; 293 struct break_hook *hook;
293 int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL; 294 int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL;
294 295
295 read_lock(&break_hook_lock); 296 rcu_read_lock();
296 list_for_each_entry(hook, &break_hook, node) 297 list_for_each_entry_rcu(hook, &break_hook, node)
297 if ((esr & hook->esr_mask) == hook->esr_val) 298 if ((esr & hook->esr_mask) == hook->esr_val)
298 fn = hook->fn; 299 fn = hook->fn;
299 read_unlock(&break_hook_lock); 300 rcu_read_unlock();
300 301
301 return fn ? fn(regs, esr) : DBG_HOOK_ERROR; 302 return fn ? fn(regs, esr) : DBG_HOOK_ERROR;
302} 303}
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c
index f341866aa810..c08b9ad6f429 100644
--- a/arch/arm64/kernel/insn.c
+++ b/arch/arm64/kernel/insn.c
@@ -85,7 +85,7 @@ bool aarch64_insn_is_branch_imm(u32 insn)
85 aarch64_insn_is_bcond(insn)); 85 aarch64_insn_is_bcond(insn));
86} 86}
87 87
88static DEFINE_SPINLOCK(patch_lock); 88static DEFINE_RAW_SPINLOCK(patch_lock);
89 89
90static void __kprobes *patch_map(void *addr, int fixmap) 90static void __kprobes *patch_map(void *addr, int fixmap)
91{ 91{
@@ -131,13 +131,13 @@ static int __kprobes __aarch64_insn_write(void *addr, u32 insn)
131 unsigned long flags = 0; 131 unsigned long flags = 0;
132 int ret; 132 int ret;
133 133
134 spin_lock_irqsave(&patch_lock, flags); 134 raw_spin_lock_irqsave(&patch_lock, flags);
135 waddr = patch_map(addr, FIX_TEXT_POKE0); 135 waddr = patch_map(addr, FIX_TEXT_POKE0);
136 136
137 ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE); 137 ret = probe_kernel_write(waddr, &insn, AARCH64_INSN_SIZE);
138 138
139 patch_unmap(FIX_TEXT_POKE0); 139 patch_unmap(FIX_TEXT_POKE0);
140 spin_unlock_irqrestore(&patch_lock, flags); 140 raw_spin_unlock_irqrestore(&patch_lock, flags);
141 141
142 return ret; 142 return ret;
143} 143}
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 6bab21f84a9f..232247945b1c 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -364,6 +364,8 @@ static void __init relocate_initrd(void)
364 to_free = ram_end - orig_start; 364 to_free = ram_end - orig_start;
365 365
366 size = orig_end - orig_start; 366 size = orig_end - orig_start;
367 if (!size)
368 return;
367 369
368 /* initrd needs to be relocated completely inside linear mapping */ 370 /* initrd needs to be relocated completely inside linear mapping */
369 new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn), 371 new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn),
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index aba9ead1384c..9fadf6d7039b 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -287,6 +287,7 @@ retry:
287 * starvation. 287 * starvation.
288 */ 288 */
289 mm_flags &= ~FAULT_FLAG_ALLOW_RETRY; 289 mm_flags &= ~FAULT_FLAG_ALLOW_RETRY;
290 mm_flags |= FAULT_FLAG_TRIED;
290 goto retry; 291 goto retry;
291 } 292 }
292 } 293 }
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index 70e6ae1e7006..373cb23301e3 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -73,4 +73,5 @@ generic-y += uaccess.h
73generic-y += ucontext.h 73generic-y += ucontext.h
74generic-y += unaligned.h 74generic-y += unaligned.h
75generic-y += vga.h 75generic-y += vga.h
76generic-y += word-at-a-time.h
76generic-y += xor.h 77generic-y += xor.h
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 9e777cd42b67..d10fd80dbb7e 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -256,6 +256,7 @@ static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long si
256 */ 256 */
257#define ioremap_nocache(offset, size) \ 257#define ioremap_nocache(offset, size) \
258 __ioremap_mode((offset), (size), _CACHE_UNCACHED) 258 __ioremap_mode((offset), (size), _CACHE_UNCACHED)
259#define ioremap_uc ioremap_nocache
259 260
260/* 261/*
261 * ioremap_cachable - map bus memory into CPU space 262 * ioremap_cachable - map bus memory into CPU space
diff --git a/arch/mips/include/uapi/asm/swab.h b/arch/mips/include/uapi/asm/swab.h
index c4ddc4f0d2dc..23cd9b118c9e 100644
--- a/arch/mips/include/uapi/asm/swab.h
+++ b/arch/mips/include/uapi/asm/swab.h
@@ -13,16 +13,15 @@
13 13
14#define __SWAB_64_THRU_32__ 14#define __SWAB_64_THRU_32__
15 15
16#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \ 16#if !defined(__mips16) && \
17 defined(_MIPS_ARCH_LOONGSON3A) 17 ((defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \
18 defined(_MIPS_ARCH_LOONGSON3A))
18 19
19static inline __attribute__((nomips16)) __attribute_const__ 20static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
20 __u16 __arch_swab16(__u16 x)
21{ 21{
22 __asm__( 22 __asm__(
23 " .set push \n" 23 " .set push \n"
24 " .set arch=mips32r2 \n" 24 " .set arch=mips32r2 \n"
25 " .set nomips16 \n"
26 " wsbh %0, %1 \n" 25 " wsbh %0, %1 \n"
27 " .set pop \n" 26 " .set pop \n"
28 : "=r" (x) 27 : "=r" (x)
@@ -32,13 +31,11 @@ static inline __attribute__((nomips16)) __attribute_const__
32} 31}
33#define __arch_swab16 __arch_swab16 32#define __arch_swab16 __arch_swab16
34 33
35static inline __attribute__((nomips16)) __attribute_const__ 34static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
36 __u32 __arch_swab32(__u32 x)
37{ 35{
38 __asm__( 36 __asm__(
39 " .set push \n" 37 " .set push \n"
40 " .set arch=mips32r2 \n" 38 " .set arch=mips32r2 \n"
41 " .set nomips16 \n"
42 " wsbh %0, %1 \n" 39 " wsbh %0, %1 \n"
43 " rotr %0, %0, 16 \n" 40 " rotr %0, %0, 16 \n"
44 " .set pop \n" 41 " .set pop \n"
@@ -54,13 +51,11 @@ static inline __attribute__((nomips16)) __attribute_const__
54 * 64-bit kernel on r2 CPUs. 51 * 64-bit kernel on r2 CPUs.
55 */ 52 */
56#ifdef __mips64 53#ifdef __mips64
57static inline __attribute__((nomips16)) __attribute_const__ 54static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
58 __u64 __arch_swab64(__u64 x)
59{ 55{
60 __asm__( 56 __asm__(
61 " .set push \n" 57 " .set push \n"
62 " .set arch=mips64r2 \n" 58 " .set arch=mips64r2 \n"
63 " .set nomips16 \n"
64 " dsbh %0, %1 \n" 59 " dsbh %0, %1 \n"
65 " dshd %0, %0 \n" 60 " dshd %0, %0 \n"
66 " .set pop \n" 61 " .set pop \n"
@@ -71,5 +66,5 @@ static inline __attribute__((nomips16)) __attribute_const__
71} 66}
72#define __arch_swab64 __arch_swab64 67#define __arch_swab64 __arch_swab64
73#endif /* __mips64 */ 68#endif /* __mips64 */
74#endif /* MIPS R2 or newer or Loongson 3A */ 69#endif /* (not __mips16) and (MIPS R2 or newer or Loongson 3A) */
75#endif /* _ASM_SWAB_H */ 70#endif /* _ASM_SWAB_H */
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index ac1662956e0c..ab9f4e0ed4cf 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -7,4 +7,3 @@ generic-y += mcs_spinlock.h
7generic-y += preempt.h 7generic-y += preempt.h
8generic-y += rwsem.h 8generic-y += rwsem.h
9generic-y += vtime.h 9generic-y += vtime.h
10generic-y += word-at-a-time.h
diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h
index 5b3a903adae6..e4396a7d0f7c 100644
--- a/arch/powerpc/include/asm/word-at-a-time.h
+++ b/arch/powerpc/include/asm/word-at-a-time.h
@@ -40,6 +40,11 @@ static inline bool has_zero(unsigned long val, unsigned long *data, const struct
40 return (val + c->high_bits) & ~rhs; 40 return (val + c->high_bits) & ~rhs;
41} 41}
42 42
43static inline unsigned long zero_bytemask(unsigned long mask)
44{
45 return ~1ul << __fls(mask);
46}
47
43#else 48#else
44 49
45#ifdef CONFIG_64BIT 50#ifdef CONFIG_64BIT
diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile
index d4788111c161..fac6ac9790fa 100644
--- a/arch/s390/boot/compressed/Makefile
+++ b/arch/s390/boot/compressed/Makefile
@@ -10,7 +10,7 @@ targets += misc.o piggy.o sizes.h head.o
10 10
11KBUILD_CFLAGS := -m64 -D__KERNEL__ $(LINUX_INCLUDE) -O2 11KBUILD_CFLAGS := -m64 -D__KERNEL__ $(LINUX_INCLUDE) -O2
12KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 12KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
13KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks 13KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -msoft-float
14KBUILD_CFLAGS += $(call cc-option,-mpacked-stack) 14KBUILD_CFLAGS += $(call cc-option,-mpacked-stack)
15KBUILD_CFLAGS += $(call cc-option,-ffreestanding) 15KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
16 16
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index 0c98f1508542..ed7da281df66 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -381,7 +381,7 @@ CONFIG_ISCSI_TCP=m
381CONFIG_SCSI_DEBUG=m 381CONFIG_SCSI_DEBUG=m
382CONFIG_ZFCP=y 382CONFIG_ZFCP=y
383CONFIG_SCSI_VIRTIO=m 383CONFIG_SCSI_VIRTIO=m
384CONFIG_SCSI_DH=m 384CONFIG_SCSI_DH=y
385CONFIG_SCSI_DH_RDAC=m 385CONFIG_SCSI_DH_RDAC=m
386CONFIG_SCSI_DH_HP_SW=m 386CONFIG_SCSI_DH_HP_SW=m
387CONFIG_SCSI_DH_EMC=m 387CONFIG_SCSI_DH_EMC=m
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index 82083e1fbdc4..9858b14cde1e 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -377,7 +377,7 @@ CONFIG_ISCSI_TCP=m
377CONFIG_SCSI_DEBUG=m 377CONFIG_SCSI_DEBUG=m
378CONFIG_ZFCP=y 378CONFIG_ZFCP=y
379CONFIG_SCSI_VIRTIO=m 379CONFIG_SCSI_VIRTIO=m
380CONFIG_SCSI_DH=m 380CONFIG_SCSI_DH=y
381CONFIG_SCSI_DH_RDAC=m 381CONFIG_SCSI_DH_RDAC=m
382CONFIG_SCSI_DH_HP_SW=m 382CONFIG_SCSI_DH_HP_SW=m
383CONFIG_SCSI_DH_EMC=m 383CONFIG_SCSI_DH_EMC=m
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index c05c9e0821e3..7f14f80717d4 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -377,7 +377,7 @@ CONFIG_ISCSI_TCP=m
377CONFIG_SCSI_DEBUG=m 377CONFIG_SCSI_DEBUG=m
378CONFIG_ZFCP=y 378CONFIG_ZFCP=y
379CONFIG_SCSI_VIRTIO=m 379CONFIG_SCSI_VIRTIO=m
380CONFIG_SCSI_DH=m 380CONFIG_SCSI_DH=y
381CONFIG_SCSI_DH_RDAC=m 381CONFIG_SCSI_DH_RDAC=m
382CONFIG_SCSI_DH_HP_SW=m 382CONFIG_SCSI_DH_HP_SW=m
383CONFIG_SCSI_DH_EMC=m 383CONFIG_SCSI_DH_EMC=m
diff --git a/arch/s390/include/asm/numa.h b/arch/s390/include/asm/numa.h
index 2a0efc63b9e5..dc19ee0c92aa 100644
--- a/arch/s390/include/asm/numa.h
+++ b/arch/s390/include/asm/numa.h
@@ -19,7 +19,7 @@ int numa_pfn_to_nid(unsigned long pfn);
19int __node_distance(int a, int b); 19int __node_distance(int a, int b);
20void numa_update_cpu_topology(void); 20void numa_update_cpu_topology(void);
21 21
22extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; 22extern cpumask_t node_to_cpumask_map[MAX_NUMNODES];
23extern int numa_debug_enabled; 23extern int numa_debug_enabled;
24 24
25#else 25#else
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index 27ebde643933..94fc55fc72ce 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -68,7 +68,7 @@ static inline int cpu_to_node(int cpu)
68#define cpumask_of_node cpumask_of_node 68#define cpumask_of_node cpumask_of_node
69static inline const struct cpumask *cpumask_of_node(int node) 69static inline const struct cpumask *cpumask_of_node(int node)
70{ 70{
71 return node_to_cpumask_map[node]; 71 return &node_to_cpumask_map[node];
72} 72}
73 73
74/* 74/*
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 48c9af7a7683..3aeeb1b562c0 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -176,6 +176,7 @@ int main(void)
176 DEFINE(__LC_PASTE, offsetof(struct _lowcore, paste)); 176 DEFINE(__LC_PASTE, offsetof(struct _lowcore, paste));
177 DEFINE(__LC_FP_CREG_SAVE_AREA, offsetof(struct _lowcore, fpt_creg_save_area)); 177 DEFINE(__LC_FP_CREG_SAVE_AREA, offsetof(struct _lowcore, fpt_creg_save_area));
178 DEFINE(__LC_LAST_BREAK, offsetof(struct _lowcore, breaking_event_addr)); 178 DEFINE(__LC_LAST_BREAK, offsetof(struct _lowcore, breaking_event_addr));
179 DEFINE(__LC_PERCPU_OFFSET, offsetof(struct _lowcore, percpu_offset));
179 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data)); 180 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
180 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap)); 181 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap));
181 DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb)); 182 DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb));
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 09b039d7983d..582fe44ab07c 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -733,6 +733,14 @@ ENTRY(psw_idle)
733 stg %r3,__SF_EMPTY(%r15) 733 stg %r3,__SF_EMPTY(%r15)
734 larl %r1,.Lpsw_idle_lpsw+4 734 larl %r1,.Lpsw_idle_lpsw+4
735 stg %r1,__SF_EMPTY+8(%r15) 735 stg %r1,__SF_EMPTY+8(%r15)
736#ifdef CONFIG_SMP
737 larl %r1,smp_cpu_mtid
738 llgf %r1,0(%r1)
739 ltgr %r1,%r1
740 jz .Lpsw_idle_stcctm
741 .insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+16(%r15)
742.Lpsw_idle_stcctm:
743#endif
736 STCK __CLOCK_IDLE_ENTER(%r2) 744 STCK __CLOCK_IDLE_ENTER(%r2)
737 stpt __TIMER_IDLE_ENTER(%r2) 745 stpt __TIMER_IDLE_ENTER(%r2)
738.Lpsw_idle_lpsw: 746.Lpsw_idle_lpsw:
@@ -1159,7 +1167,27 @@ cleanup_critical:
1159 jhe 1f 1167 jhe 1f
1160 mvc __CLOCK_IDLE_ENTER(8,%r2),__CLOCK_IDLE_EXIT(%r2) 1168 mvc __CLOCK_IDLE_ENTER(8,%r2),__CLOCK_IDLE_EXIT(%r2)
1161 mvc __TIMER_IDLE_ENTER(8,%r2),__TIMER_IDLE_EXIT(%r2) 1169 mvc __TIMER_IDLE_ENTER(8,%r2),__TIMER_IDLE_EXIT(%r2)
11621: # account system time going idle 11701: # calculate idle cycles
1171#ifdef CONFIG_SMP
1172 clg %r9,BASED(.Lcleanup_idle_insn)
1173 jl 3f
1174 larl %r1,smp_cpu_mtid
1175 llgf %r1,0(%r1)
1176 ltgr %r1,%r1
1177 jz 3f
1178 .insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+80(%r15)
1179 larl %r3,mt_cycles
1180 ag %r3,__LC_PERCPU_OFFSET
1181 la %r4,__SF_EMPTY+16(%r15)
11822: lg %r0,0(%r3)
1183 slg %r0,0(%r4)
1184 alg %r0,64(%r4)
1185 stg %r0,0(%r3)
1186 la %r3,8(%r3)
1187 la %r4,8(%r4)
1188 brct %r1,2b
1189#endif
11903: # account system time going idle
1163 lg %r9,__LC_STEAL_TIMER 1191 lg %r9,__LC_STEAL_TIMER
1164 alg %r9,__CLOCK_IDLE_ENTER(%r2) 1192 alg %r9,__CLOCK_IDLE_ENTER(%r2)
1165 slg %r9,__LC_LAST_UPDATE_CLOCK 1193 slg %r9,__LC_LAST_UPDATE_CLOCK
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index c8653435c70d..dafc44f519c3 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -25,7 +25,7 @@ static DEFINE_SPINLOCK(virt_timer_lock);
25static atomic64_t virt_timer_current; 25static atomic64_t virt_timer_current;
26static atomic64_t virt_timer_elapsed; 26static atomic64_t virt_timer_elapsed;
27 27
28static DEFINE_PER_CPU(u64, mt_cycles[32]); 28DEFINE_PER_CPU(u64, mt_cycles[8]);
29static DEFINE_PER_CPU(u64, mt_scaling_mult) = { 1 }; 29static DEFINE_PER_CPU(u64, mt_scaling_mult) = { 1 };
30static DEFINE_PER_CPU(u64, mt_scaling_div) = { 1 }; 30static DEFINE_PER_CPU(u64, mt_scaling_div) = { 1 };
31static DEFINE_PER_CPU(u64, mt_scaling_jiffies); 31static DEFINE_PER_CPU(u64, mt_scaling_jiffies);
@@ -60,6 +60,34 @@ static inline int virt_timer_forward(u64 elapsed)
60 return elapsed >= atomic64_read(&virt_timer_current); 60 return elapsed >= atomic64_read(&virt_timer_current);
61} 61}
62 62
63static void update_mt_scaling(void)
64{
65 u64 cycles_new[8], *cycles_old;
66 u64 delta, fac, mult, div;
67 int i;
68
69 stcctm5(smp_cpu_mtid + 1, cycles_new);
70 cycles_old = this_cpu_ptr(mt_cycles);
71 fac = 1;
72 mult = div = 0;
73 for (i = 0; i <= smp_cpu_mtid; i++) {
74 delta = cycles_new[i] - cycles_old[i];
75 div += delta;
76 mult *= i + 1;
77 mult += delta * fac;
78 fac *= i + 1;
79 }
80 div *= fac;
81 if (div > 0) {
82 /* Update scaling factor */
83 __this_cpu_write(mt_scaling_mult, mult);
84 __this_cpu_write(mt_scaling_div, div);
85 memcpy(cycles_old, cycles_new,
86 sizeof(u64) * (smp_cpu_mtid + 1));
87 }
88 __this_cpu_write(mt_scaling_jiffies, jiffies_64);
89}
90
63/* 91/*
64 * Update process times based on virtual cpu times stored by entry.S 92 * Update process times based on virtual cpu times stored by entry.S
65 * to the lowcore fields user_timer, system_timer & steal_clock. 93 * to the lowcore fields user_timer, system_timer & steal_clock.
@@ -69,7 +97,6 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
69 struct thread_info *ti = task_thread_info(tsk); 97 struct thread_info *ti = task_thread_info(tsk);
70 u64 timer, clock, user, system, steal; 98 u64 timer, clock, user, system, steal;
71 u64 user_scaled, system_scaled; 99 u64 user_scaled, system_scaled;
72 int i;
73 100
74 timer = S390_lowcore.last_update_timer; 101 timer = S390_lowcore.last_update_timer;
75 clock = S390_lowcore.last_update_clock; 102 clock = S390_lowcore.last_update_clock;
@@ -85,34 +112,10 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
85 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 112 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
86 S390_lowcore.steal_timer += S390_lowcore.last_update_clock - clock; 113 S390_lowcore.steal_timer += S390_lowcore.last_update_clock - clock;
87 114
88 /* Do MT utilization calculation */ 115 /* Update MT utilization calculation */
89 if (smp_cpu_mtid && 116 if (smp_cpu_mtid &&
90 time_after64(jiffies_64, __this_cpu_read(mt_scaling_jiffies))) { 117 time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
91 u64 cycles_new[32], *cycles_old; 118 update_mt_scaling();
92 u64 delta, fac, mult, div;
93
94 cycles_old = this_cpu_ptr(mt_cycles);
95 if (stcctm5(smp_cpu_mtid + 1, cycles_new) < 2) {
96 fac = 1;
97 mult = div = 0;
98 for (i = 0; i <= smp_cpu_mtid; i++) {
99 delta = cycles_new[i] - cycles_old[i];
100 div += delta;
101 mult *= i + 1;
102 mult += delta * fac;
103 fac *= i + 1;
104 }
105 div *= fac;
106 if (div > 0) {
107 /* Update scaling factor */
108 __this_cpu_write(mt_scaling_mult, mult);
109 __this_cpu_write(mt_scaling_div, div);
110 memcpy(cycles_old, cycles_new,
111 sizeof(u64) * (smp_cpu_mtid + 1));
112 }
113 }
114 __this_cpu_write(mt_scaling_jiffies, jiffies_64);
115 }
116 119
117 user = S390_lowcore.user_timer - ti->user_timer; 120 user = S390_lowcore.user_timer - ti->user_timer;
118 S390_lowcore.steal_timer -= user; 121 S390_lowcore.steal_timer -= user;
@@ -181,6 +184,11 @@ void vtime_account_irq_enter(struct task_struct *tsk)
181 S390_lowcore.last_update_timer = get_vtimer(); 184 S390_lowcore.last_update_timer = get_vtimer();
182 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 185 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
183 186
187 /* Update MT utilization calculation */
188 if (smp_cpu_mtid &&
189 time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
190 update_mt_scaling();
191
184 system = S390_lowcore.system_timer - ti->system_timer; 192 system = S390_lowcore.system_timer - ti->system_timer;
185 S390_lowcore.steal_timer -= system; 193 S390_lowcore.steal_timer -= system;
186 ti->system_timer = S390_lowcore.system_timer; 194 ti->system_timer = S390_lowcore.system_timer;
diff --git a/arch/s390/numa/mode_emu.c b/arch/s390/numa/mode_emu.c
index 7de4e2f780d7..30b2698a28e2 100644
--- a/arch/s390/numa/mode_emu.c
+++ b/arch/s390/numa/mode_emu.c
@@ -368,7 +368,7 @@ static void topology_add_core(struct toptree *core)
368 cpumask_copy(&top->thread_mask, &core->mask); 368 cpumask_copy(&top->thread_mask, &core->mask);
369 cpumask_copy(&top->core_mask, &core_mc(core)->mask); 369 cpumask_copy(&top->core_mask, &core_mc(core)->mask);
370 cpumask_copy(&top->book_mask, &core_book(core)->mask); 370 cpumask_copy(&top->book_mask, &core_book(core)->mask);
371 cpumask_set_cpu(cpu, node_to_cpumask_map[core_node(core)->id]); 371 cpumask_set_cpu(cpu, &node_to_cpumask_map[core_node(core)->id]);
372 top->node_id = core_node(core)->id; 372 top->node_id = core_node(core)->id;
373 } 373 }
374} 374}
@@ -383,7 +383,7 @@ static void toptree_to_topology(struct toptree *numa)
383 383
384 /* Clear all node masks */ 384 /* Clear all node masks */
385 for (i = 0; i < MAX_NUMNODES; i++) 385 for (i = 0; i < MAX_NUMNODES; i++)
386 cpumask_clear(node_to_cpumask_map[i]); 386 cpumask_clear(&node_to_cpumask_map[i]);
387 387
388 /* Rebuild all masks */ 388 /* Rebuild all masks */
389 toptree_for_each(core, numa, CORE) 389 toptree_for_each(core, numa, CORE)
diff --git a/arch/s390/numa/numa.c b/arch/s390/numa/numa.c
index 09b1d2355bd9..43f32ce60aa3 100644
--- a/arch/s390/numa/numa.c
+++ b/arch/s390/numa/numa.c
@@ -23,7 +23,7 @@
23pg_data_t *node_data[MAX_NUMNODES]; 23pg_data_t *node_data[MAX_NUMNODES];
24EXPORT_SYMBOL(node_data); 24EXPORT_SYMBOL(node_data);
25 25
26cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; 26cpumask_t node_to_cpumask_map[MAX_NUMNODES];
27EXPORT_SYMBOL(node_to_cpumask_map); 27EXPORT_SYMBOL(node_to_cpumask_map);
28 28
29const struct numa_mode numa_mode_plain = { 29const struct numa_mode numa_mode_plain = {
@@ -144,7 +144,7 @@ void __init numa_setup(void)
144static int __init numa_init_early(void) 144static int __init numa_init_early(void)
145{ 145{
146 /* Attach all possible CPUs to node 0 for now. */ 146 /* Attach all possible CPUs to node 0 for now. */
147 cpumask_copy(node_to_cpumask_map[0], cpu_possible_mask); 147 cpumask_copy(&node_to_cpumask_map[0], cpu_possible_mask);
148 return 0; 148 return 0;
149} 149}
150early_initcall(numa_init_early); 150early_initcall(numa_init_early);
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 0b6cacaad933..ba35c41c71ff 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -40,5 +40,4 @@ generic-y += termbits.h
40generic-y += termios.h 40generic-y += termios.h
41generic-y += trace_clock.h 41generic-y += trace_clock.h
42generic-y += types.h 42generic-y += types.h
43generic-y += word-at-a-time.h
44generic-y += xor.h 43generic-y += xor.h
diff --git a/arch/tile/include/asm/word-at-a-time.h b/arch/tile/include/asm/word-at-a-time.h
index 9e5ce0d7b292..b66a693c2c34 100644
--- a/arch/tile/include/asm/word-at-a-time.h
+++ b/arch/tile/include/asm/word-at-a-time.h
@@ -6,7 +6,7 @@
6struct word_at_a_time { /* unused */ }; 6struct word_at_a_time { /* unused */ };
7#define WORD_AT_A_TIME_CONSTANTS {} 7#define WORD_AT_A_TIME_CONSTANTS {}
8 8
9/* Generate 0x01 byte values for non-zero bytes using a SIMD instruction. */ 9/* Generate 0x01 byte values for zero bytes using a SIMD instruction. */
10static inline unsigned long has_zero(unsigned long val, unsigned long *data, 10static inline unsigned long has_zero(unsigned long val, unsigned long *data,
11 const struct word_at_a_time *c) 11 const struct word_at_a_time *c)
12{ 12{
@@ -33,4 +33,10 @@ static inline long find_zero(unsigned long mask)
33#endif 33#endif
34} 34}
35 35
36#ifdef __BIG_ENDIAN
37#define zero_bytemask(mask) (~1ul << (63 - __builtin_clzl(mask)))
38#else
39#define zero_bytemask(mask) ((2ul << __builtin_ctzl(mask)) - 1)
40#endif
41
36#endif /* _ASM_WORD_AT_A_TIME_H */ 42#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 328c8352480c..96d058a87100 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1308,6 +1308,7 @@ config HIGHMEM
1308config X86_PAE 1308config X86_PAE
1309 bool "PAE (Physical Address Extension) Support" 1309 bool "PAE (Physical Address Extension) Support"
1310 depends on X86_32 && !HIGHMEM4G 1310 depends on X86_32 && !HIGHMEM4G
1311 select SWIOTLB
1311 ---help--- 1312 ---help---
1312 PAE is required for NX support, and furthermore enables 1313 PAE is required for NX support, and furthermore enables
1313 larger swapspace support for non-overcommit purposes. It 1314 larger swapspace support for non-overcommit purposes. It
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 83aea8055119..4c20dd333412 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -336,10 +336,10 @@ HYPERVISOR_update_descriptor(u64 ma, u64 desc)
336 return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32); 336 return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
337} 337}
338 338
339static inline int 339static inline long
340HYPERVISOR_memory_op(unsigned int cmd, void *arg) 340HYPERVISOR_memory_op(unsigned int cmd, void *arg)
341{ 341{
342 return _hypercall2(int, memory_op, cmd, arg); 342 return _hypercall2(long, memory_op, cmd, arg);
343} 343}
344 344
345static inline int 345static inline int
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 30d12afe52ed..993b7a71386d 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -33,6 +33,10 @@
33#include <linux/memblock.h> 33#include <linux/memblock.h>
34#include <linux/edd.h> 34#include <linux/edd.h>
35 35
36#ifdef CONFIG_KEXEC_CORE
37#include <linux/kexec.h>
38#endif
39
36#include <xen/xen.h> 40#include <xen/xen.h>
37#include <xen/events.h> 41#include <xen/events.h>
38#include <xen/interface/xen.h> 42#include <xen/interface/xen.h>
@@ -1077,6 +1081,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
1077 /* Fast syscall setup is all done in hypercalls, so 1081 /* Fast syscall setup is all done in hypercalls, so
1078 these are all ignored. Stub them out here to stop 1082 these are all ignored. Stub them out here to stop
1079 Xen console noise. */ 1083 Xen console noise. */
1084 break;
1080 1085
1081 default: 1086 default:
1082 if (!pmu_msr_write(msr, low, high, &ret)) 1087 if (!pmu_msr_write(msr, low, high, &ret))
@@ -1807,6 +1812,21 @@ static struct notifier_block xen_hvm_cpu_notifier = {
1807 .notifier_call = xen_hvm_cpu_notify, 1812 .notifier_call = xen_hvm_cpu_notify,
1808}; 1813};
1809 1814
1815#ifdef CONFIG_KEXEC_CORE
1816static void xen_hvm_shutdown(void)
1817{
1818 native_machine_shutdown();
1819 if (kexec_in_progress)
1820 xen_reboot(SHUTDOWN_soft_reset);
1821}
1822
1823static void xen_hvm_crash_shutdown(struct pt_regs *regs)
1824{
1825 native_machine_crash_shutdown(regs);
1826 xen_reboot(SHUTDOWN_soft_reset);
1827}
1828#endif
1829
1810static void __init xen_hvm_guest_init(void) 1830static void __init xen_hvm_guest_init(void)
1811{ 1831{
1812 if (xen_pv_domain()) 1832 if (xen_pv_domain())
@@ -1826,6 +1846,10 @@ static void __init xen_hvm_guest_init(void)
1826 x86_init.irqs.intr_init = xen_init_IRQ; 1846 x86_init.irqs.intr_init = xen_init_IRQ;
1827 xen_hvm_init_time_ops(); 1847 xen_hvm_init_time_ops();
1828 xen_hvm_init_mmu_ops(); 1848 xen_hvm_init_mmu_ops();
1849#ifdef CONFIG_KEXEC_CORE
1850 machine_ops.shutdown = xen_hvm_shutdown;
1851 machine_ops.crash_shutdown = xen_hvm_crash_shutdown;
1852#endif
1829} 1853}
1830#endif 1854#endif
1831 1855
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index bfc08b13044b..660b3cfef234 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -112,6 +112,15 @@ static unsigned long *p2m_identity;
112static pte_t *p2m_missing_pte; 112static pte_t *p2m_missing_pte;
113static pte_t *p2m_identity_pte; 113static pte_t *p2m_identity_pte;
114 114
115/*
116 * Hint at last populated PFN.
117 *
118 * Used to set HYPERVISOR_shared_info->arch.max_pfn so the toolstack
119 * can avoid scanning the whole P2M (which may be sized to account for
120 * hotplugged memory).
121 */
122static unsigned long xen_p2m_last_pfn;
123
115static inline unsigned p2m_top_index(unsigned long pfn) 124static inline unsigned p2m_top_index(unsigned long pfn)
116{ 125{
117 BUG_ON(pfn >= MAX_P2M_PFN); 126 BUG_ON(pfn >= MAX_P2M_PFN);
@@ -270,7 +279,7 @@ void xen_setup_mfn_list_list(void)
270 else 279 else
271 HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = 280 HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
272 virt_to_mfn(p2m_top_mfn); 281 virt_to_mfn(p2m_top_mfn);
273 HYPERVISOR_shared_info->arch.max_pfn = xen_max_p2m_pfn; 282 HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn;
274 HYPERVISOR_shared_info->arch.p2m_generation = 0; 283 HYPERVISOR_shared_info->arch.p2m_generation = 0;
275 HYPERVISOR_shared_info->arch.p2m_vaddr = (unsigned long)xen_p2m_addr; 284 HYPERVISOR_shared_info->arch.p2m_vaddr = (unsigned long)xen_p2m_addr;
276 HYPERVISOR_shared_info->arch.p2m_cr3 = 285 HYPERVISOR_shared_info->arch.p2m_cr3 =
@@ -406,6 +415,8 @@ void __init xen_vmalloc_p2m_tree(void)
406 static struct vm_struct vm; 415 static struct vm_struct vm;
407 unsigned long p2m_limit; 416 unsigned long p2m_limit;
408 417
418 xen_p2m_last_pfn = xen_max_p2m_pfn;
419
409 p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE; 420 p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE;
410 vm.flags = VM_ALLOC; 421 vm.flags = VM_ALLOC;
411 vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit), 422 vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit),
@@ -608,6 +619,12 @@ static bool alloc_p2m(unsigned long pfn)
608 free_p2m_page(p2m); 619 free_p2m_page(p2m);
609 } 620 }
610 621
622 /* Expanded the p2m? */
623 if (pfn > xen_p2m_last_pfn) {
624 xen_p2m_last_pfn = pfn;
625 HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn;
626 }
627
611 return true; 628 return true;
612} 629}
613 630
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index f5ef6746d47a..1c30e4ab1022 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -548,7 +548,7 @@ static unsigned long __init xen_get_max_pages(void)
548{ 548{
549 unsigned long max_pages, limit; 549 unsigned long max_pages, limit;
550 domid_t domid = DOMID_SELF; 550 domid_t domid = DOMID_SELF;
551 int ret; 551 long ret;
552 552
553 limit = xen_get_pages_limit(); 553 limit = xen_get_pages_limit();
554 max_pages = limit; 554 max_pages = limit;
@@ -798,7 +798,7 @@ char * __init xen_memory_setup(void)
798 xen_ignore_unusable(); 798 xen_ignore_unusable();
799 799
800 /* Make sure the Xen-supplied memory map is well-ordered. */ 800 /* Make sure the Xen-supplied memory map is well-ordered. */
801 sanitize_e820_map(xen_e820_map, xen_e820_map_entries, 801 sanitize_e820_map(xen_e820_map, ARRAY_SIZE(xen_e820_map),
802 &xen_e820_map_entries); 802 &xen_e820_map_entries);
803 803
804 max_pages = xen_get_max_pages(); 804 max_pages = xen_get_max_pages();
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index f42f2bac6466..4c55cfbad19e 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -32,8 +32,7 @@ static DEFINE_MUTEX(regmap_debugfs_early_lock);
32/* Calculate the length of a fixed format */ 32/* Calculate the length of a fixed format */
33static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size) 33static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size)
34{ 34{
35 snprintf(buf, buf_size, "%x", max_val); 35 return snprintf(NULL, 0, "%x", max_val);
36 return strlen(buf);
37} 36}
38 37
39static ssize_t regmap_name_read_file(struct file *file, 38static ssize_t regmap_name_read_file(struct file *file,
@@ -432,7 +431,7 @@ static ssize_t regmap_access_read_file(struct file *file,
432 /* If we're in the region the user is trying to read */ 431 /* If we're in the region the user is trying to read */
433 if (p >= *ppos) { 432 if (p >= *ppos) {
434 /* ...but not beyond it */ 433 /* ...but not beyond it */
435 if (buf_pos >= count - 1 - tot_len) 434 if (buf_pos + tot_len + 1 >= count)
436 break; 435 break;
437 436
438 /* Format the register */ 437 /* Format the register */
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index 1a82f3a17681..0ebca8ba7bc4 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -36,7 +36,6 @@ config ARM_CCI400_PORT_CTRL
36 36
37config ARM_CCI500_PMU 37config ARM_CCI500_PMU
38 bool "ARM CCI500 PMU support" 38 bool "ARM CCI500 PMU support"
39 default y
40 depends on (ARM && CPU_V7) || ARM64 39 depends on (ARM && CPU_V7) || ARM64
41 depends on PERF_EVENTS 40 depends on PERF_EVENTS
42 select ARM_CCI_PMU 41 select ARM_CCI_PMU
diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c
index 7c1e1f58e2da..2fe37f708dc7 100644
--- a/drivers/clk/samsung/clk-cpu.c
+++ b/drivers/clk/samsung/clk-cpu.c
@@ -164,7 +164,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
164 * the values for DIV_COPY and DIV_HPM dividers need not be set. 164 * the values for DIV_COPY and DIV_HPM dividers need not be set.
165 */ 165 */
166 div0 = cfg_data->div0; 166 div0 = cfg_data->div0;
167 if (test_bit(CLK_CPU_HAS_DIV1, &cpuclk->flags)) { 167 if (cpuclk->flags & CLK_CPU_HAS_DIV1) {
168 div1 = cfg_data->div1; 168 div1 = cfg_data->div1;
169 if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK) 169 if (readl(base + E4210_SRC_CPU) & E4210_MUX_HPM_MASK)
170 div1 = readl(base + E4210_DIV_CPU1) & 170 div1 = readl(base + E4210_DIV_CPU1) &
@@ -185,7 +185,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
185 alt_div = DIV_ROUND_UP(alt_prate, tmp_rate) - 1; 185 alt_div = DIV_ROUND_UP(alt_prate, tmp_rate) - 1;
186 WARN_ON(alt_div >= MAX_DIV); 186 WARN_ON(alt_div >= MAX_DIV);
187 187
188 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 188 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
189 /* 189 /*
190 * In Exynos4210, ATB clock parent is also mout_core. So 190 * In Exynos4210, ATB clock parent is also mout_core. So
191 * ATB clock also needs to be mantained at safe speed. 191 * ATB clock also needs to be mantained at safe speed.
@@ -206,7 +206,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata,
206 writel(div0, base + E4210_DIV_CPU0); 206 writel(div0, base + E4210_DIV_CPU0);
207 wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL); 207 wait_until_divider_stable(base + E4210_DIV_STAT_CPU0, DIV_MASK_ALL);
208 208
209 if (test_bit(CLK_CPU_HAS_DIV1, &cpuclk->flags)) { 209 if (cpuclk->flags & CLK_CPU_HAS_DIV1) {
210 writel(div1, base + E4210_DIV_CPU1); 210 writel(div1, base + E4210_DIV_CPU1);
211 wait_until_divider_stable(base + E4210_DIV_STAT_CPU1, 211 wait_until_divider_stable(base + E4210_DIV_STAT_CPU1,
212 DIV_MASK_ALL); 212 DIV_MASK_ALL);
@@ -225,7 +225,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata,
225 unsigned long mux_reg; 225 unsigned long mux_reg;
226 226
227 /* find out the divider values to use for clock data */ 227 /* find out the divider values to use for clock data */
228 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 228 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
229 while ((cfg_data->prate * 1000) != ndata->new_rate) { 229 while ((cfg_data->prate * 1000) != ndata->new_rate) {
230 if (cfg_data->prate == 0) 230 if (cfg_data->prate == 0)
231 return -EINVAL; 231 return -EINVAL;
@@ -240,7 +240,7 @@ static int exynos_cpuclk_post_rate_change(struct clk_notifier_data *ndata,
240 writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU); 240 writel(mux_reg & ~(1 << 16), base + E4210_SRC_CPU);
241 wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1); 241 wait_until_mux_stable(base + E4210_STAT_CPU, 16, 1);
242 242
243 if (test_bit(CLK_CPU_NEEDS_DEBUG_ALT_DIV, &cpuclk->flags)) { 243 if (cpuclk->flags & CLK_CPU_NEEDS_DEBUG_ALT_DIV) {
244 div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK); 244 div |= (cfg_data->div0 & E4210_DIV0_ATB_MASK);
245 div_mask |= E4210_DIV0_ATB_MASK; 245 div_mask |= E4210_DIV0_ATB_MASK;
246 } 246 }
diff --git a/drivers/clk/ti/clk-3xxx.c b/drivers/clk/ti/clk-3xxx.c
index 676ee8f6d813..8831e1a05367 100644
--- a/drivers/clk/ti/clk-3xxx.c
+++ b/drivers/clk/ti/clk-3xxx.c
@@ -374,7 +374,6 @@ static struct ti_dt_clk omap3xxx_clks[] = {
374 DT_CLK(NULL, "gpio2_ick", "gpio2_ick"), 374 DT_CLK(NULL, "gpio2_ick", "gpio2_ick"),
375 DT_CLK(NULL, "wdt3_ick", "wdt3_ick"), 375 DT_CLK(NULL, "wdt3_ick", "wdt3_ick"),
376 DT_CLK(NULL, "uart3_ick", "uart3_ick"), 376 DT_CLK(NULL, "uart3_ick", "uart3_ick"),
377 DT_CLK(NULL, "uart4_ick", "uart4_ick"),
378 DT_CLK(NULL, "gpt9_ick", "gpt9_ick"), 377 DT_CLK(NULL, "gpt9_ick", "gpt9_ick"),
379 DT_CLK(NULL, "gpt8_ick", "gpt8_ick"), 378 DT_CLK(NULL, "gpt8_ick", "gpt8_ick"),
380 DT_CLK(NULL, "gpt7_ick", "gpt7_ick"), 379 DT_CLK(NULL, "gpt7_ick", "gpt7_ick"),
@@ -519,6 +518,7 @@ static struct ti_dt_clk am35xx_clks[] = {
519static struct ti_dt_clk omap36xx_clks[] = { 518static struct ti_dt_clk omap36xx_clks[] = {
520 DT_CLK(NULL, "omap_192m_alwon_fck", "omap_192m_alwon_fck"), 519 DT_CLK(NULL, "omap_192m_alwon_fck", "omap_192m_alwon_fck"),
521 DT_CLK(NULL, "uart4_fck", "uart4_fck"), 520 DT_CLK(NULL, "uart4_fck", "uart4_fck"),
521 DT_CLK(NULL, "uart4_ick", "uart4_ick"),
522 { .node_name = NULL }, 522 { .node_name = NULL },
523}; 523};
524 524
diff --git a/drivers/clk/ti/clk-7xx.c b/drivers/clk/ti/clk-7xx.c
index 9b5b289e6334..a911d7de3377 100644
--- a/drivers/clk/ti/clk-7xx.c
+++ b/drivers/clk/ti/clk-7xx.c
@@ -18,7 +18,6 @@
18 18
19#include "clock.h" 19#include "clock.h"
20 20
21#define DRA7_DPLL_ABE_DEFFREQ 180633600
22#define DRA7_DPLL_GMAC_DEFFREQ 1000000000 21#define DRA7_DPLL_GMAC_DEFFREQ 1000000000
23#define DRA7_DPLL_USB_DEFFREQ 960000000 22#define DRA7_DPLL_USB_DEFFREQ 960000000
24 23
@@ -313,27 +312,12 @@ static struct ti_dt_clk dra7xx_clks[] = {
313int __init dra7xx_dt_clk_init(void) 312int __init dra7xx_dt_clk_init(void)
314{ 313{
315 int rc; 314 int rc;
316 struct clk *abe_dpll_mux, *sys_clkin2, *dpll_ck, *hdcp_ck; 315 struct clk *dpll_ck, *hdcp_ck;
317 316
318 ti_dt_clocks_register(dra7xx_clks); 317 ti_dt_clocks_register(dra7xx_clks);
319 318
320 omap2_clk_disable_autoidle_all(); 319 omap2_clk_disable_autoidle_all();
321 320
322 abe_dpll_mux = clk_get_sys(NULL, "abe_dpll_sys_clk_mux");
323 sys_clkin2 = clk_get_sys(NULL, "sys_clkin2");
324 dpll_ck = clk_get_sys(NULL, "dpll_abe_ck");
325
326 rc = clk_set_parent(abe_dpll_mux, sys_clkin2);
327 if (!rc)
328 rc = clk_set_rate(dpll_ck, DRA7_DPLL_ABE_DEFFREQ);
329 if (rc)
330 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
331
332 dpll_ck = clk_get_sys(NULL, "dpll_abe_m2x2_ck");
333 rc = clk_set_rate(dpll_ck, DRA7_DPLL_ABE_DEFFREQ * 2);
334 if (rc)
335 pr_err("%s: failed to configure ABE DPLL m2x2!\n", __func__);
336
337 dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck"); 321 dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck");
338 rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ); 322 rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ);
339 if (rc) 323 if (rc)
diff --git a/drivers/clk/ti/clkt_dflt.c b/drivers/clk/ti/clkt_dflt.c
index 90d7d8a21c49..1ddc288fce4e 100644
--- a/drivers/clk/ti/clkt_dflt.c
+++ b/drivers/clk/ti/clkt_dflt.c
@@ -222,7 +222,7 @@ int omap2_dflt_clk_enable(struct clk_hw *hw)
222 } 222 }
223 } 223 }
224 224
225 if (unlikely(!clk->enable_reg)) { 225 if (unlikely(IS_ERR(clk->enable_reg))) {
226 pr_err("%s: %s missing enable_reg\n", __func__, 226 pr_err("%s: %s missing enable_reg\n", __func__,
227 clk_hw_get_name(hw)); 227 clk_hw_get_name(hw));
228 ret = -EINVAL; 228 ret = -EINVAL;
@@ -264,7 +264,7 @@ void omap2_dflt_clk_disable(struct clk_hw *hw)
264 u32 v; 264 u32 v;
265 265
266 clk = to_clk_hw_omap(hw); 266 clk = to_clk_hw_omap(hw);
267 if (!clk->enable_reg) { 267 if (IS_ERR(clk->enable_reg)) {
268 /* 268 /*
269 * 'independent' here refers to a clock which is not 269 * 'independent' here refers to a clock which is not
270 * controlled by its parent. 270 * controlled by its parent.
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 798277227de7..cec1ee2d2f74 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -149,6 +149,9 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf)
149{ 149{
150 struct acpi_cpufreq_data *data = policy->driver_data; 150 struct acpi_cpufreq_data *data = policy->driver_data;
151 151
152 if (unlikely(!data))
153 return -ENODEV;
154
152 return cpufreq_show_cpus(data->freqdomain_cpus, buf); 155 return cpufreq_show_cpus(data->freqdomain_cpus, buf);
153} 156}
154 157
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index ef5ed9470de9..25c4c15103a0 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1436,8 +1436,10 @@ static void cpufreq_offline_finish(unsigned int cpu)
1436 * since this is a core component, and is essential for the 1436 * since this is a core component, and is essential for the
1437 * subsequent light-weight ->init() to succeed. 1437 * subsequent light-weight ->init() to succeed.
1438 */ 1438 */
1439 if (cpufreq_driver->exit) 1439 if (cpufreq_driver->exit) {
1440 cpufreq_driver->exit(policy); 1440 cpufreq_driver->exit(policy);
1441 policy->freq_table = NULL;
1442 }
1441} 1443}
1442 1444
1443/** 1445/**
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 3927ed9fdbd5..ca848cc6a8fd 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -492,7 +492,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
492 if (err) { 492 if (err) {
493 put_device(&devfreq->dev); 493 put_device(&devfreq->dev);
494 mutex_unlock(&devfreq->lock); 494 mutex_unlock(&devfreq->lock);
495 goto err_dev; 495 goto err_out;
496 } 496 }
497 497
498 mutex_unlock(&devfreq->lock); 498 mutex_unlock(&devfreq->lock);
@@ -518,7 +518,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
518err_init: 518err_init:
519 list_del(&devfreq->node); 519 list_del(&devfreq->node);
520 device_unregister(&devfreq->dev); 520 device_unregister(&devfreq->dev);
521err_dev:
522 kfree(devfreq); 521 kfree(devfreq);
523err_out: 522err_out:
524 return ERR_PTR(err); 523 return ERR_PTR(err);
@@ -795,8 +794,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
795 ret = PTR_ERR(governor); 794 ret = PTR_ERR(governor);
796 goto out; 795 goto out;
797 } 796 }
798 if (df->governor == governor) 797 if (df->governor == governor) {
798 ret = 0;
799 goto out; 799 goto out;
800 }
800 801
801 if (df->governor) { 802 if (df->governor) {
802 ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL); 803 ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);
diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c
index de36237d7c6b..051645498b53 100644
--- a/drivers/mcb/mcb-pci.c
+++ b/drivers/mcb/mcb-pci.c
@@ -74,7 +74,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
74 ret = -ENOTSUPP; 74 ret = -ENOTSUPP;
75 dev_err(&pdev->dev, 75 dev_err(&pdev->dev,
76 "IO mapped PCI devices are not supported\n"); 76 "IO mapped PCI devices are not supported\n");
77 goto out_release; 77 goto out_iounmap;
78 } 78 }
79 79
80 pci_set_drvdata(pdev, priv); 80 pci_set_drvdata(pdev, priv);
@@ -89,7 +89,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
89 89
90 ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base); 90 ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base);
91 if (ret < 0) 91 if (ret < 0)
92 goto out_iounmap; 92 goto out_mcb_bus;
93 num_cells = ret; 93 num_cells = ret;
94 94
95 dev_dbg(&pdev->dev, "Found %d cells\n", num_cells); 95 dev_dbg(&pdev->dev, "Found %d cells\n", num_cells);
@@ -98,6 +98,8 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
98 98
99 return 0; 99 return 0;
100 100
101out_mcb_bus:
102 mcb_release_bus(priv->bus);
101out_iounmap: 103out_iounmap:
102 iounmap(priv->base); 104 iounmap(priv->base);
103out_release: 105out_release:
diff --git a/drivers/md/dm-cache-policy-cleaner.c b/drivers/md/dm-cache-policy-cleaner.c
index 240c9f0e85e7..8a096456579b 100644
--- a/drivers/md/dm-cache-policy-cleaner.c
+++ b/drivers/md/dm-cache-policy-cleaner.c
@@ -436,7 +436,7 @@ static struct dm_cache_policy *wb_create(dm_cblock_t cache_size,
436static struct dm_cache_policy_type wb_policy_type = { 436static struct dm_cache_policy_type wb_policy_type = {
437 .name = "cleaner", 437 .name = "cleaner",
438 .version = {1, 0, 0}, 438 .version = {1, 0, 0},
439 .hint_size = 0, 439 .hint_size = 4,
440 .owner = THIS_MODULE, 440 .owner = THIS_MODULE,
441 .create = wb_create 441 .create = wb_create
442}; 442};
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index ebaa4f803eec..192bb8beeb6b 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -203,7 +203,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
203 return -EINVAL; 203 return -EINVAL;
204 } 204 }
205 205
206 tmp_store = kmalloc(sizeof(*tmp_store), GFP_KERNEL); 206 tmp_store = kzalloc(sizeof(*tmp_store), GFP_KERNEL);
207 if (!tmp_store) { 207 if (!tmp_store) {
208 ti->error = "Exception store allocation failed"; 208 ti->error = "Exception store allocation failed";
209 return -ENOMEM; 209 return -ENOMEM;
@@ -215,7 +215,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
215 else if (persistent == 'N') 215 else if (persistent == 'N')
216 type = get_type("N"); 216 type = get_type("N");
217 else { 217 else {
218 ti->error = "Persistent flag is not P or N"; 218 ti->error = "Exception store type is not P or N";
219 r = -EINVAL; 219 r = -EINVAL;
220 goto bad_type; 220 goto bad_type;
221 } 221 }
@@ -233,7 +233,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
233 if (r) 233 if (r)
234 goto bad; 234 goto bad;
235 235
236 r = type->ctr(tmp_store, 0, NULL); 236 r = type->ctr(tmp_store, (strlen(argv[0]) > 1 ? &argv[0][1] : NULL));
237 if (r) { 237 if (r) {
238 ti->error = "Exception store type constructor failed"; 238 ti->error = "Exception store type constructor failed";
239 goto bad; 239 goto bad;
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
index 0b2536247cf5..fae34e7a0b1e 100644
--- a/drivers/md/dm-exception-store.h
+++ b/drivers/md/dm-exception-store.h
@@ -42,8 +42,7 @@ struct dm_exception_store_type {
42 const char *name; 42 const char *name;
43 struct module *module; 43 struct module *module;
44 44
45 int (*ctr) (struct dm_exception_store *store, 45 int (*ctr) (struct dm_exception_store *store, char *options);
46 unsigned argc, char **argv);
47 46
48 /* 47 /*
49 * Destroys this object when you've finished with it. 48 * Destroys this object when you've finished with it.
@@ -123,6 +122,8 @@ struct dm_exception_store {
123 unsigned chunk_shift; 122 unsigned chunk_shift;
124 123
125 void *context; 124 void *context;
125
126 bool userspace_supports_overflow;
126}; 127};
127 128
128/* 129/*
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 97e165183e79..a0901214aef5 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -329,8 +329,7 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size)
329 */ 329 */
330 if (min_region_size > (1 << 13)) { 330 if (min_region_size > (1 << 13)) {
331 /* If not a power of 2, make it the next power of 2 */ 331 /* If not a power of 2, make it the next power of 2 */
332 if (min_region_size & (min_region_size - 1)) 332 region_size = roundup_pow_of_two(min_region_size);
333 region_size = 1 << fls(region_size);
334 DMINFO("Choosing default region size of %lu sectors", 333 DMINFO("Choosing default region size of %lu sectors",
335 region_size); 334 region_size);
336 } else { 335 } else {
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index bf71583296f7..aeacad9be51d 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -7,6 +7,7 @@
7 7
8#include "dm-exception-store.h" 8#include "dm-exception-store.h"
9 9
10#include <linux/ctype.h>
10#include <linux/mm.h> 11#include <linux/mm.h>
11#include <linux/pagemap.h> 12#include <linux/pagemap.h>
12#include <linux/vmalloc.h> 13#include <linux/vmalloc.h>
@@ -843,8 +844,7 @@ static void persistent_drop_snapshot(struct dm_exception_store *store)
843 DMWARN("write header failed"); 844 DMWARN("write header failed");
844} 845}
845 846
846static int persistent_ctr(struct dm_exception_store *store, 847static int persistent_ctr(struct dm_exception_store *store, char *options)
847 unsigned argc, char **argv)
848{ 848{
849 struct pstore *ps; 849 struct pstore *ps;
850 850
@@ -873,6 +873,16 @@ static int persistent_ctr(struct dm_exception_store *store,
873 return -ENOMEM; 873 return -ENOMEM;
874 } 874 }
875 875
876 if (options) {
877 char overflow = toupper(options[0]);
878 if (overflow == 'O')
879 store->userspace_supports_overflow = true;
880 else {
881 DMERR("Unsupported persistent store option: %s", options);
882 return -EINVAL;
883 }
884 }
885
876 store->context = ps; 886 store->context = ps;
877 887
878 return 0; 888 return 0;
@@ -888,7 +898,8 @@ static unsigned persistent_status(struct dm_exception_store *store,
888 case STATUSTYPE_INFO: 898 case STATUSTYPE_INFO:
889 break; 899 break;
890 case STATUSTYPE_TABLE: 900 case STATUSTYPE_TABLE:
891 DMEMIT(" P %llu", (unsigned long long)store->chunk_size); 901 DMEMIT(" %s %llu", store->userspace_supports_overflow ? "PO" : "P",
902 (unsigned long long)store->chunk_size);
892 } 903 }
893 904
894 return sz; 905 return sz;
diff --git a/drivers/md/dm-snap-transient.c b/drivers/md/dm-snap-transient.c
index 1ce9a2586e41..9b7c8c8049d6 100644
--- a/drivers/md/dm-snap-transient.c
+++ b/drivers/md/dm-snap-transient.c
@@ -70,8 +70,7 @@ static void transient_usage(struct dm_exception_store *store,
70 *metadata_sectors = 0; 70 *metadata_sectors = 0;
71} 71}
72 72
73static int transient_ctr(struct dm_exception_store *store, 73static int transient_ctr(struct dm_exception_store *store, char *options)
74 unsigned argc, char **argv)
75{ 74{
76 struct transient_c *tc; 75 struct transient_c *tc;
77 76
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index c0bcd6516dfe..c06b74e91cd6 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1098,7 +1098,7 @@ static void stop_merge(struct dm_snapshot *s)
1098} 1098}
1099 1099
1100/* 1100/*
1101 * Construct a snapshot mapping: <origin_dev> <COW-dev> <p/n> <chunk-size> 1101 * Construct a snapshot mapping: <origin_dev> <COW-dev> <p|po|n> <chunk-size>
1102 */ 1102 */
1103static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) 1103static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1104{ 1104{
@@ -1302,6 +1302,7 @@ static void __handover_exceptions(struct dm_snapshot *snap_src,
1302 1302
1303 u.store_swap = snap_dest->store; 1303 u.store_swap = snap_dest->store;
1304 snap_dest->store = snap_src->store; 1304 snap_dest->store = snap_src->store;
1305 snap_dest->store->userspace_supports_overflow = u.store_swap->userspace_supports_overflow;
1305 snap_src->store = u.store_swap; 1306 snap_src->store = u.store_swap;
1306 1307
1307 snap_dest->store->snap = snap_dest; 1308 snap_dest->store->snap = snap_dest;
@@ -1739,8 +1740,11 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio)
1739 1740
1740 pe = __find_pending_exception(s, pe, chunk); 1741 pe = __find_pending_exception(s, pe, chunk);
1741 if (!pe) { 1742 if (!pe) {
1742 s->snapshot_overflowed = 1; 1743 if (s->store->userspace_supports_overflow) {
1743 DMERR("Snapshot overflowed: Unable to allocate exception."); 1744 s->snapshot_overflowed = 1;
1745 DMERR("Snapshot overflowed: Unable to allocate exception.");
1746 } else
1747 __invalidate_snapshot(s, -ENOMEM);
1744 r = -EIO; 1748 r = -EIO;
1745 goto out_unlock; 1749 goto out_unlock;
1746 } 1750 }
@@ -2365,7 +2369,7 @@ static struct target_type origin_target = {
2365 2369
2366static struct target_type snapshot_target = { 2370static struct target_type snapshot_target = {
2367 .name = "snapshot", 2371 .name = "snapshot",
2368 .version = {1, 14, 0}, 2372 .version = {1, 15, 0},
2369 .module = THIS_MODULE, 2373 .module = THIS_MODULE,
2370 .ctr = snapshot_ctr, 2374 .ctr = snapshot_ctr,
2371 .dtr = snapshot_dtr, 2375 .dtr = snapshot_dtr,
@@ -2379,7 +2383,7 @@ static struct target_type snapshot_target = {
2379 2383
2380static struct target_type merge_target = { 2384static struct target_type merge_target = {
2381 .name = dm_snapshot_merge_target_name, 2385 .name = dm_snapshot_merge_target_name,
2382 .version = {1, 3, 0}, 2386 .version = {1, 4, 0},
2383 .module = THIS_MODULE, 2387 .module = THIS_MODULE,
2384 .ctr = snapshot_ctr, 2388 .ctr = snapshot_ctr,
2385 .dtr = snapshot_dtr, 2389 .dtr = snapshot_dtr,
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 6264781dc69a..1b5c6047e4f1 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1001,6 +1001,7 @@ static void end_clone_bio(struct bio *clone)
1001 struct dm_rq_target_io *tio = info->tio; 1001 struct dm_rq_target_io *tio = info->tio;
1002 struct bio *bio = info->orig; 1002 struct bio *bio = info->orig;
1003 unsigned int nr_bytes = info->orig->bi_iter.bi_size; 1003 unsigned int nr_bytes = info->orig->bi_iter.bi_size;
1004 int error = clone->bi_error;
1004 1005
1005 bio_put(clone); 1006 bio_put(clone);
1006 1007
@@ -1011,13 +1012,13 @@ static void end_clone_bio(struct bio *clone)
1011 * the remainder. 1012 * the remainder.
1012 */ 1013 */
1013 return; 1014 return;
1014 else if (bio->bi_error) { 1015 else if (error) {
1015 /* 1016 /*
1016 * Don't notice the error to the upper layer yet. 1017 * Don't notice the error to the upper layer yet.
1017 * The error handling decision is made by the target driver, 1018 * The error handling decision is made by the target driver,
1018 * when the request is completed. 1019 * when the request is completed.
1019 */ 1020 */
1020 tio->error = bio->bi_error; 1021 tio->error = error;
1021 return; 1022 return;
1022 } 1023 }
1023 1024
@@ -2837,8 +2838,6 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
2837 2838
2838 might_sleep(); 2839 might_sleep();
2839 2840
2840 map = dm_get_live_table(md, &srcu_idx);
2841
2842 spin_lock(&_minor_lock); 2841 spin_lock(&_minor_lock);
2843 idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md)))); 2842 idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md))));
2844 set_bit(DMF_FREEING, &md->flags); 2843 set_bit(DMF_FREEING, &md->flags);
@@ -2852,14 +2851,14 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
2852 * do not race with internal suspend. 2851 * do not race with internal suspend.
2853 */ 2852 */
2854 mutex_lock(&md->suspend_lock); 2853 mutex_lock(&md->suspend_lock);
2854 map = dm_get_live_table(md, &srcu_idx);
2855 if (!dm_suspended_md(md)) { 2855 if (!dm_suspended_md(md)) {
2856 dm_table_presuspend_targets(map); 2856 dm_table_presuspend_targets(map);
2857 dm_table_postsuspend_targets(map); 2857 dm_table_postsuspend_targets(map);
2858 } 2858 }
2859 mutex_unlock(&md->suspend_lock);
2860
2861 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ 2859 /* dm_put_live_table must be before msleep, otherwise deadlock is possible */
2862 dm_put_live_table(md, srcu_idx); 2860 dm_put_live_table(md, srcu_idx);
2861 mutex_unlock(&md->suspend_lock);
2863 2862
2864 /* 2863 /*
2865 * Rare, but there may be I/O requests still going to complete, 2864 * Rare, but there may be I/O requests still going to complete,
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 049df6c4a8cc..ddd8a5f572aa 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2382,8 +2382,8 @@ static void raid1d(struct md_thread *thread)
2382 } 2382 }
2383 spin_unlock_irqrestore(&conf->device_lock, flags); 2383 spin_unlock_irqrestore(&conf->device_lock, flags);
2384 while (!list_empty(&tmp)) { 2384 while (!list_empty(&tmp)) {
2385 r1_bio = list_first_entry(&conf->bio_end_io_list, 2385 r1_bio = list_first_entry(&tmp, struct r1bio,
2386 struct r1bio, retry_list); 2386 retry_list);
2387 list_del(&r1_bio->retry_list); 2387 list_del(&r1_bio->retry_list);
2388 raid_end_bio_io(r1_bio); 2388 raid_end_bio_io(r1_bio);
2389 } 2389 }
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 7c99a4037715..9f69dc526f8c 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2688,8 +2688,8 @@ static void raid10d(struct md_thread *thread)
2688 } 2688 }
2689 spin_unlock_irqrestore(&conf->device_lock, flags); 2689 spin_unlock_irqrestore(&conf->device_lock, flags);
2690 while (!list_empty(&tmp)) { 2690 while (!list_empty(&tmp)) {
2691 r10_bio = list_first_entry(&conf->bio_end_io_list, 2691 r10_bio = list_first_entry(&tmp, struct r10bio,
2692 struct r10bio, retry_list); 2692 retry_list);
2693 list_del(&r10_bio->retry_list); 2693 list_del(&r10_bio->retry_list);
2694 raid_end_bio_io(r10_bio); 2694 raid_end_bio_io(r10_bio);
2695 } 2695 }
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index 8eec887c8f70..6d7c188fb65c 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -1209,7 +1209,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
1209 * after the host receives the enum_resp 1209 * after the host receives the enum_resp
1210 * message clients may be added or removed 1210 * message clients may be added or removed
1211 */ 1211 */
1212 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS && 1212 if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS ||
1213 dev->hbm_state >= MEI_HBM_STOPPED) { 1213 dev->hbm_state >= MEI_HBM_STOPPED) {
1214 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n", 1214 dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n",
1215 dev->dev_state, dev->hbm_state); 1215 dev->dev_state, dev->hbm_state);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 781e4db31767..7fb0753abe30 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -182,6 +182,7 @@ struct omap_hsmmc_host {
182 struct clk *fclk; 182 struct clk *fclk;
183 struct clk *dbclk; 183 struct clk *dbclk;
184 struct regulator *pbias; 184 struct regulator *pbias;
185 bool pbias_enabled;
185 void __iomem *base; 186 void __iomem *base;
186 int vqmmc_enabled; 187 int vqmmc_enabled;
187 resource_size_t mapbase; 188 resource_size_t mapbase;
@@ -328,20 +329,22 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
328 return ret; 329 return ret;
329 } 330 }
330 331
331 if (!regulator_is_enabled(host->pbias)) { 332 if (host->pbias_enabled == 0) {
332 ret = regulator_enable(host->pbias); 333 ret = regulator_enable(host->pbias);
333 if (ret) { 334 if (ret) {
334 dev_err(host->dev, "pbias reg enable fail\n"); 335 dev_err(host->dev, "pbias reg enable fail\n");
335 return ret; 336 return ret;
336 } 337 }
338 host->pbias_enabled = 1;
337 } 339 }
338 } else { 340 } else {
339 if (regulator_is_enabled(host->pbias)) { 341 if (host->pbias_enabled == 1) {
340 ret = regulator_disable(host->pbias); 342 ret = regulator_disable(host->pbias);
341 if (ret) { 343 if (ret) {
342 dev_err(host->dev, "pbias reg disable fail\n"); 344 dev_err(host->dev, "pbias reg disable fail\n");
343 return ret; 345 return ret;
344 } 346 }
347 host->pbias_enabled = 0;
345 } 348 }
346 } 349 }
347 350
@@ -475,7 +478,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
475 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc"); 478 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc");
476 if (IS_ERR(mmc->supply.vmmc)) { 479 if (IS_ERR(mmc->supply.vmmc)) {
477 ret = PTR_ERR(mmc->supply.vmmc); 480 ret = PTR_ERR(mmc->supply.vmmc);
478 if (ret != -ENODEV) 481 if ((ret != -ENODEV) && host->dev->of_node)
479 return ret; 482 return ret;
480 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n", 483 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
481 PTR_ERR(mmc->supply.vmmc)); 484 PTR_ERR(mmc->supply.vmmc));
@@ -490,7 +493,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
490 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux"); 493 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux");
491 if (IS_ERR(mmc->supply.vqmmc)) { 494 if (IS_ERR(mmc->supply.vqmmc)) {
492 ret = PTR_ERR(mmc->supply.vqmmc); 495 ret = PTR_ERR(mmc->supply.vqmmc);
493 if (ret != -ENODEV) 496 if ((ret != -ENODEV) && host->dev->of_node)
494 return ret; 497 return ret;
495 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", 498 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n",
496 PTR_ERR(mmc->supply.vqmmc)); 499 PTR_ERR(mmc->supply.vqmmc));
@@ -500,7 +503,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
500 host->pbias = devm_regulator_get_optional(host->dev, "pbias"); 503 host->pbias = devm_regulator_get_optional(host->dev, "pbias");
501 if (IS_ERR(host->pbias)) { 504 if (IS_ERR(host->pbias)) {
502 ret = PTR_ERR(host->pbias); 505 ret = PTR_ERR(host->pbias);
503 if (ret != -ENODEV) 506 if ((ret != -ENODEV) && host->dev->of_node)
504 return ret; 507 return ret;
505 dev_dbg(host->dev, "unable to get pbias regulator %ld\n", 508 dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
506 PTR_ERR(host->pbias)); 509 PTR_ERR(host->pbias));
@@ -2053,6 +2056,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
2053 host->base = base + pdata->reg_offset; 2056 host->base = base + pdata->reg_offset;
2054 host->power_mode = MMC_POWER_OFF; 2057 host->power_mode = MMC_POWER_OFF;
2055 host->next_data.cookie = 1; 2058 host->next_data.cookie = 1;
2059 host->pbias_enabled = 0;
2056 host->vqmmc_enabled = 0; 2060 host->vqmmc_enabled = 0;
2057 2061
2058 ret = omap_hsmmc_gpio_init(mmc, host, pdata); 2062 ret = omap_hsmmc_gpio_init(mmc, host, pdata);
diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index d1556643a41d..a0f05de5409f 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -43,6 +43,7 @@ static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
43 43
44static const struct sdhci_pltfm_data soc_data_sama5d2 = { 44static const struct sdhci_pltfm_data soc_data_sama5d2 = {
45 .ops = &sdhci_at91_sama5d2_ops, 45 .ops = &sdhci_at91_sama5d2_ops,
46 .quirks2 = SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST,
46}; 47};
47 48
48static const struct of_device_id sdhci_at91_dt_match[] = { 49static const struct of_device_id sdhci_at91_dt_match[] = {
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 946d37f94a31..f5edf9d3a18a 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -135,6 +135,7 @@ static int armada_38x_quirks(struct platform_device *pdev,
135 struct sdhci_pxa *pxa = pltfm_host->priv; 135 struct sdhci_pxa *pxa = pltfm_host->priv;
136 struct resource *res; 136 struct resource *res;
137 137
138 host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
138 host->quirks |= SDHCI_QUIRK_MISSING_CAPS; 139 host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
139 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 140 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
140 "conf-sdio3"); 141 "conf-sdio3");
@@ -290,6 +291,9 @@ static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
290 uhs == MMC_TIMING_UHS_DDR50) { 291 uhs == MMC_TIMING_UHS_DDR50) {
291 reg_val &= ~SDIO3_CONF_CLK_INV; 292 reg_val &= ~SDIO3_CONF_CLK_INV;
292 reg_val |= SDIO3_CONF_SD_FB_CLK; 293 reg_val |= SDIO3_CONF_SD_FB_CLK;
294 } else if (uhs == MMC_TIMING_MMC_HS) {
295 reg_val &= ~SDIO3_CONF_CLK_INV;
296 reg_val &= ~SDIO3_CONF_SD_FB_CLK;
293 } else { 297 } else {
294 reg_val |= SDIO3_CONF_CLK_INV; 298 reg_val |= SDIO3_CONF_CLK_INV;
295 reg_val &= ~SDIO3_CONF_SD_FB_CLK; 299 reg_val &= ~SDIO3_CONF_SD_FB_CLK;
@@ -398,7 +402,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
398 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { 402 if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
399 ret = armada_38x_quirks(pdev, host); 403 ret = armada_38x_quirks(pdev, host);
400 if (ret < 0) 404 if (ret < 0)
401 goto err_clk_get; 405 goto err_mbus_win;
402 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); 406 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
403 if (ret < 0) 407 if (ret < 0)
404 goto err_mbus_win; 408 goto err_mbus_win;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 64b7fdbd1a9c..fbc7efdddcb5 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1160,6 +1160,8 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
1160 host->mmc->actual_clock = 0; 1160 host->mmc->actual_clock = 0;
1161 1161
1162 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); 1162 sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
1163 if (host->quirks2 & SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST)
1164 mdelay(1);
1163 1165
1164 if (clock == 0) 1166 if (clock == 0)
1165 return; 1167 return;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 7c02ff46c8ac..9d4aa31b683a 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -412,6 +412,11 @@ struct sdhci_host {
412#define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14) 412#define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14)
413/* Broken Clock divider zero in controller */ 413/* Broken Clock divider zero in controller */
414#define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15) 414#define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15)
415/*
416 * When internal clock is disabled, a delay is needed before modifying the
417 * SD clock frequency or enabling back the internal clock.
418 */
419#define SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST (1<<16)
415 420
416 int irq; /* Device IRQ */ 421 int irq; /* Device IRQ */
417 void __iomem *ioaddr; /* Mapped address */ 422 void __iomem *ioaddr; /* Mapped address */
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 2426db88db36..f04445b992f5 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -879,7 +879,7 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom)
879 oob_chunk_size); 879 oob_chunk_size);
880 880
881 /* the last chunk */ 881 /* the last chunk */
882 memcpy16_toio(&s[oob_chunk_size * sparebuf_size], 882 memcpy16_toio(&s[i * sparebuf_size],
883 &d[i * oob_chunk_size], 883 &d[i * oob_chunk_size],
884 host->used_oobsize - i * oob_chunk_size); 884 host->used_oobsize - i * oob_chunk_size);
885 } 885 }
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index f97a58d6aae1..e7d333c162be 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -147,6 +147,10 @@
147#define NFC_ECC_MODE GENMASK(15, 12) 147#define NFC_ECC_MODE GENMASK(15, 12)
148#define NFC_RANDOM_SEED GENMASK(30, 16) 148#define NFC_RANDOM_SEED GENMASK(30, 16)
149 149
150/* NFC_USER_DATA helper macros */
151#define NFC_BUF_TO_USER_DATA(buf) ((buf)[0] | ((buf)[1] << 8) | \
152 ((buf)[2] << 16) | ((buf)[3] << 24))
153
150#define NFC_DEFAULT_TIMEOUT_MS 1000 154#define NFC_DEFAULT_TIMEOUT_MS 1000
151 155
152#define NFC_SRAM_SIZE 1024 156#define NFC_SRAM_SIZE 1024
@@ -646,15 +650,9 @@ static int sunxi_nfc_hw_ecc_write_page(struct mtd_info *mtd,
646 offset = layout->eccpos[i * ecc->bytes] - 4 + mtd->writesize; 650 offset = layout->eccpos[i * ecc->bytes] - 4 + mtd->writesize;
647 651
648 /* Fill OOB data in */ 652 /* Fill OOB data in */
649 if (oob_required) { 653 writel(NFC_BUF_TO_USER_DATA(chip->oob_poi +
650 tmp = 0xffffffff; 654 layout->oobfree[i].offset),
651 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, &tmp, 655 nfc->regs + NFC_REG_USER_DATA_BASE);
652 4);
653 } else {
654 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE,
655 chip->oob_poi + offset - mtd->writesize,
656 4);
657 }
658 656
659 chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1); 657 chip->cmdfunc(mtd, NAND_CMD_RNDIN, offset, -1);
660 658
@@ -784,14 +782,8 @@ static int sunxi_nfc_hw_syndrome_ecc_write_page(struct mtd_info *mtd,
784 offset += ecc->size; 782 offset += ecc->size;
785 783
786 /* Fill OOB data in */ 784 /* Fill OOB data in */
787 if (oob_required) { 785 writel(NFC_BUF_TO_USER_DATA(oob),
788 tmp = 0xffffffff; 786 nfc->regs + NFC_REG_USER_DATA_BASE);
789 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, &tmp,
790 4);
791 } else {
792 memcpy_toio(nfc->regs + NFC_REG_USER_DATA_BASE, oob,
793 4);
794 }
795 787
796 tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ACCESS_DIR | 788 tmp = NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD | NFC_ACCESS_DIR |
797 (1 << 30); 789 (1 << 30);
@@ -1389,6 +1381,7 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
1389 node); 1381 node);
1390 nand_release(&chip->mtd); 1382 nand_release(&chip->mtd);
1391 sunxi_nand_ecc_cleanup(&chip->nand.ecc); 1383 sunxi_nand_ecc_cleanup(&chip->nand.ecc);
1384 list_del(&chip->node);
1392 } 1385 }
1393} 1386}
1394 1387
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index d3c6676b3c0c..6fd4e5a5ef4a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -67,7 +67,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj,
67 int rc; 67 int rc;
68 68
69 /* Stop the user from reading */ 69 /* Stop the user from reading */
70 if (pos > nvmem->size) 70 if (pos >= nvmem->size)
71 return 0; 71 return 0;
72 72
73 if (pos + count > nvmem->size) 73 if (pos + count > nvmem->size)
@@ -92,7 +92,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
92 int rc; 92 int rc;
93 93
94 /* Stop the user from writing */ 94 /* Stop the user from writing */
95 if (pos > nvmem->size) 95 if (pos >= nvmem->size)
96 return 0; 96 return 0;
97 97
98 if (pos + count > nvmem->size) 98 if (pos + count > nvmem->size)
@@ -825,7 +825,7 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
825 return rc; 825 return rc;
826 826
827 /* shift bits in-place */ 827 /* shift bits in-place */
828 if (cell->bit_offset || cell->bit_offset) 828 if (cell->bit_offset || cell->nbits)
829 nvmem_shift_read_buffer_in_place(cell, buf); 829 nvmem_shift_read_buffer_in_place(cell, buf);
830 830
831 *len = cell->bytes; 831 *len = cell->bytes;
@@ -938,7 +938,7 @@ int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len)
938 rc = regmap_raw_write(nvmem->regmap, cell->offset, buf, cell->bytes); 938 rc = regmap_raw_write(nvmem->regmap, cell->offset, buf, cell->bytes);
939 939
940 /* free the tmp buffer */ 940 /* free the tmp buffer */
941 if (cell->bit_offset) 941 if (cell->bit_offset || cell->nbits)
942 kfree(buf); 942 kfree(buf);
943 943
944 if (IS_ERR_VALUE(rc)) 944 if (IS_ERR_VALUE(rc))
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 14777dd5212d..cfa3b85064dd 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -103,7 +103,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
103 struct nvmem_device *nvmem; 103 struct nvmem_device *nvmem;
104 struct regmap *regmap; 104 struct regmap *regmap;
105 struct sunxi_sid *sid; 105 struct sunxi_sid *sid;
106 int i, size; 106 int ret, i, size;
107 char *randomness; 107 char *randomness;
108 108
109 sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL); 109 sid = devm_kzalloc(dev, sizeof(*sid), GFP_KERNEL);
@@ -131,6 +131,11 @@ static int sunxi_sid_probe(struct platform_device *pdev)
131 return PTR_ERR(nvmem); 131 return PTR_ERR(nvmem);
132 132
133 randomness = kzalloc(sizeof(u8) * size, GFP_KERNEL); 133 randomness = kzalloc(sizeof(u8) * size, GFP_KERNEL);
134 if (!randomness) {
135 ret = -EINVAL;
136 goto err_unreg_nvmem;
137 }
138
134 for (i = 0; i < size; i++) 139 for (i = 0; i < size; i++)
135 randomness[i] = sunxi_sid_read_byte(sid, i); 140 randomness[i] = sunxi_sid_read_byte(sid, i);
136 141
@@ -140,6 +145,10 @@ static int sunxi_sid_probe(struct platform_device *pdev)
140 platform_set_drvdata(pdev, nvmem); 145 platform_set_drvdata(pdev, nvmem);
141 146
142 return 0; 147 return 0;
148
149err_unreg_nvmem:
150 nvmem_unregister(nvmem);
151 return ret;
143} 152}
144 153
145static int sunxi_sid_remove(struct platform_device *pdev) 154static int sunxi_sid_remove(struct platform_device *pdev)
diff --git a/drivers/phy/phy-berlin-sata.c b/drivers/phy/phy-berlin-sata.c
index 0062027afb1e..77a2e054fdea 100644
--- a/drivers/phy/phy-berlin-sata.c
+++ b/drivers/phy/phy-berlin-sata.c
@@ -276,6 +276,7 @@ static const struct of_device_id phy_berlin_sata_of_match[] = {
276 { .compatible = "marvell,berlin2q-sata-phy" }, 276 { .compatible = "marvell,berlin2q-sata-phy" },
277 { }, 277 { },
278}; 278};
279MODULE_DEVICE_TABLE(of, phy_berlin_sata_of_match);
279 280
280static struct platform_driver phy_berlin_sata_driver = { 281static struct platform_driver phy_berlin_sata_driver = {
281 .probe = phy_berlin_sata_probe, 282 .probe = phy_berlin_sata_probe,
diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index 49a1ed0cef56..107cb57c3513 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -432,6 +432,7 @@ out_disable_src:
432out: 432out:
433 return ret; 433 return ret;
434} 434}
435EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_ref_clk);
435 436
436static 437static
437int ufs_qcom_phy_disable_vreg(struct phy *phy, 438int ufs_qcom_phy_disable_vreg(struct phy *phy,
@@ -474,6 +475,7 @@ void ufs_qcom_phy_disable_ref_clk(struct phy *generic_phy)
474 phy->is_ref_clk_enabled = false; 475 phy->is_ref_clk_enabled = false;
475 } 476 }
476} 477}
478EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_ref_clk);
477 479
478#define UFS_REF_CLK_EN (1 << 5) 480#define UFS_REF_CLK_EN (1 << 5)
479 481
@@ -517,11 +519,13 @@ void ufs_qcom_phy_enable_dev_ref_clk(struct phy *generic_phy)
517{ 519{
518 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true); 520 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true);
519} 521}
522EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_dev_ref_clk);
520 523
521void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy) 524void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy)
522{ 525{
523 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false); 526 ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false);
524} 527}
528EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_dev_ref_clk);
525 529
526/* Turn ON M-PHY RMMI interface clocks */ 530/* Turn ON M-PHY RMMI interface clocks */
527int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy) 531int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
@@ -550,6 +554,7 @@ int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
550out: 554out:
551 return ret; 555 return ret;
552} 556}
557EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_iface_clk);
553 558
554/* Turn OFF M-PHY RMMI interface clocks */ 559/* Turn OFF M-PHY RMMI interface clocks */
555void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy) 560void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
@@ -562,6 +567,7 @@ void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
562 phy->is_iface_clk_enabled = false; 567 phy->is_iface_clk_enabled = false;
563 } 568 }
564} 569}
570EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_iface_clk);
565 571
566int ufs_qcom_phy_start_serdes(struct phy *generic_phy) 572int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
567{ 573{
@@ -578,6 +584,7 @@ int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
578 584
579 return ret; 585 return ret;
580} 586}
587EXPORT_SYMBOL_GPL(ufs_qcom_phy_start_serdes);
581 588
582int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes) 589int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
583{ 590{
@@ -595,6 +602,7 @@ int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
595 602
596 return ret; 603 return ret;
597} 604}
605EXPORT_SYMBOL_GPL(ufs_qcom_phy_set_tx_lane_enable);
598 606
599void ufs_qcom_phy_save_controller_version(struct phy *generic_phy, 607void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
600 u8 major, u16 minor, u16 step) 608 u8 major, u16 minor, u16 step)
@@ -605,6 +613,7 @@ void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
605 ufs_qcom_phy->host_ctrl_rev_minor = minor; 613 ufs_qcom_phy->host_ctrl_rev_minor = minor;
606 ufs_qcom_phy->host_ctrl_rev_step = step; 614 ufs_qcom_phy->host_ctrl_rev_step = step;
607} 615}
616EXPORT_SYMBOL_GPL(ufs_qcom_phy_save_controller_version);
608 617
609int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B) 618int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
610{ 619{
@@ -625,6 +634,7 @@ int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
625 634
626 return ret; 635 return ret;
627} 636}
637EXPORT_SYMBOL_GPL(ufs_qcom_phy_calibrate_phy);
628 638
629int ufs_qcom_phy_remove(struct phy *generic_phy, 639int ufs_qcom_phy_remove(struct phy *generic_phy,
630 struct ufs_qcom_phy *ufs_qcom_phy) 640 struct ufs_qcom_phy *ufs_qcom_phy)
@@ -662,6 +672,7 @@ int ufs_qcom_phy_is_pcs_ready(struct phy *generic_phy)
662 return ufs_qcom_phy->phy_spec_ops-> 672 return ufs_qcom_phy->phy_spec_ops->
663 is_physical_coding_sublayer_ready(ufs_qcom_phy); 673 is_physical_coding_sublayer_ready(ufs_qcom_phy);
664} 674}
675EXPORT_SYMBOL_GPL(ufs_qcom_phy_is_pcs_ready);
665 676
666int ufs_qcom_phy_power_on(struct phy *generic_phy) 677int ufs_qcom_phy_power_on(struct phy *generic_phy)
667{ 678{
diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
index 5a5c073e72fe..91d6f342c565 100644
--- a/drivers/phy/phy-rockchip-usb.c
+++ b/drivers/phy/phy-rockchip-usb.c
@@ -98,6 +98,7 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
98 struct device_node *child; 98 struct device_node *child;
99 struct regmap *grf; 99 struct regmap *grf;
100 unsigned int reg_offset; 100 unsigned int reg_offset;
101 int err;
101 102
102 grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); 103 grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
103 if (IS_ERR(grf)) { 104 if (IS_ERR(grf)) {
@@ -129,6 +130,11 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
129 return PTR_ERR(rk_phy->phy); 130 return PTR_ERR(rk_phy->phy);
130 } 131 }
131 phy_set_drvdata(rk_phy->phy, rk_phy); 132 phy_set_drvdata(rk_phy->phy, rk_phy);
133
134 /* only power up usb phy when it use, so disable it when init*/
135 err = rockchip_usb_phy_power(rk_phy, 1);
136 if (err)
137 return err;
132 } 138 }
133 139
134 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 140 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 01bf3476a791..a9567af7cec0 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -192,9 +192,9 @@ static const struct regulator_desc axp22x_regulators[] = {
192 AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20, 192 AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
193 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), 193 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
194 AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20, 194 AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20,
195 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), 195 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(4)),
196 AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, 196 AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
197 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(4)), 197 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)),
198 /* secondary switchable output of DCDC1 */ 198 /* secondary switchable output of DCDC1 */
199 AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100, 199 AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100,
200 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)), 200 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)),
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7849187d91ae..8a34f6acc801 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1403,6 +1403,10 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
1403 return 0; 1403 return 0;
1404 } 1404 }
1405 1405
1406 /* Did the lookup explicitly defer for us? */
1407 if (ret == -EPROBE_DEFER)
1408 return ret;
1409
1406 if (have_full_constraints()) { 1410 if (have_full_constraints()) {
1407 r = dummy_regulator_rdev; 1411 r = dummy_regulator_rdev;
1408 } else { 1412 } else {
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index add419d6ff34..a56a7b243e91 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -212,6 +212,17 @@ static const struct file_operations twa_fops = {
212 .llseek = noop_llseek, 212 .llseek = noop_llseek,
213}; 213};
214 214
215/*
216 * The controllers use an inline buffer instead of a mapped SGL for small,
217 * single entry buffers. Note that we treat a zero-length transfer like
218 * a mapped SGL.
219 */
220static bool twa_command_mapped(struct scsi_cmnd *cmd)
221{
222 return scsi_sg_count(cmd) != 1 ||
223 scsi_bufflen(cmd) >= TW_MIN_SGL_LENGTH;
224}
225
215/* This function will complete an aen request from the isr */ 226/* This function will complete an aen request from the isr */
216static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) 227static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id)
217{ 228{
@@ -1339,7 +1350,8 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
1339 } 1350 }
1340 1351
1341 /* Now complete the io */ 1352 /* Now complete the io */
1342 scsi_dma_unmap(cmd); 1353 if (twa_command_mapped(cmd))
1354 scsi_dma_unmap(cmd);
1343 cmd->scsi_done(cmd); 1355 cmd->scsi_done(cmd);
1344 tw_dev->state[request_id] = TW_S_COMPLETED; 1356 tw_dev->state[request_id] = TW_S_COMPLETED;
1345 twa_free_request_id(tw_dev, request_id); 1357 twa_free_request_id(tw_dev, request_id);
@@ -1582,7 +1594,8 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
1582 struct scsi_cmnd *cmd = tw_dev->srb[i]; 1594 struct scsi_cmnd *cmd = tw_dev->srb[i];
1583 1595
1584 cmd->result = (DID_RESET << 16); 1596 cmd->result = (DID_RESET << 16);
1585 scsi_dma_unmap(cmd); 1597 if (twa_command_mapped(cmd))
1598 scsi_dma_unmap(cmd);
1586 cmd->scsi_done(cmd); 1599 cmd->scsi_done(cmd);
1587 } 1600 }
1588 } 1601 }
@@ -1765,12 +1778,14 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
1765 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); 1778 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL);
1766 switch (retval) { 1779 switch (retval) {
1767 case SCSI_MLQUEUE_HOST_BUSY: 1780 case SCSI_MLQUEUE_HOST_BUSY:
1768 scsi_dma_unmap(SCpnt); 1781 if (twa_command_mapped(SCpnt))
1782 scsi_dma_unmap(SCpnt);
1769 twa_free_request_id(tw_dev, request_id); 1783 twa_free_request_id(tw_dev, request_id);
1770 break; 1784 break;
1771 case 1: 1785 case 1:
1772 SCpnt->result = (DID_ERROR << 16); 1786 SCpnt->result = (DID_ERROR << 16);
1773 scsi_dma_unmap(SCpnt); 1787 if (twa_command_mapped(SCpnt))
1788 scsi_dma_unmap(SCpnt);
1774 done(SCpnt); 1789 done(SCpnt);
1775 tw_dev->state[request_id] = TW_S_COMPLETED; 1790 tw_dev->state[request_id] = TW_S_COMPLETED;
1776 twa_free_request_id(tw_dev, request_id); 1791 twa_free_request_id(tw_dev, request_id);
@@ -1831,8 +1846,7 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
1831 /* Map sglist from scsi layer to cmd packet */ 1846 /* Map sglist from scsi layer to cmd packet */
1832 1847
1833 if (scsi_sg_count(srb)) { 1848 if (scsi_sg_count(srb)) {
1834 if ((scsi_sg_count(srb) == 1) && 1849 if (!twa_command_mapped(srb)) {
1835 (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) {
1836 if (srb->sc_data_direction == DMA_TO_DEVICE || 1850 if (srb->sc_data_direction == DMA_TO_DEVICE ||
1837 srb->sc_data_direction == DMA_BIDIRECTIONAL) 1851 srb->sc_data_direction == DMA_BIDIRECTIONAL)
1838 scsi_sg_copy_to_buffer(srb, 1852 scsi_sg_copy_to_buffer(srb,
@@ -1905,7 +1919,7 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re
1905{ 1919{
1906 struct scsi_cmnd *cmd = tw_dev->srb[request_id]; 1920 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1907 1921
1908 if (scsi_bufflen(cmd) < TW_MIN_SGL_LENGTH && 1922 if (!twa_command_mapped(cmd) &&
1909 (cmd->sc_data_direction == DMA_FROM_DEVICE || 1923 (cmd->sc_data_direction == DMA_FROM_DEVICE ||
1910 cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { 1924 cmd->sc_data_direction == DMA_BIDIRECTIONAL)) {
1911 if (scsi_sg_count(cmd) == 1) { 1925 if (scsi_sg_count(cmd) == 1) {
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 33c74d3436c9..6bffd91b973a 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -976,13 +976,13 @@ static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
976 wake_up(&conn->ehwait); 976 wake_up(&conn->ehwait);
977} 977}
978 978
979static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) 979static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
980{ 980{
981 struct iscsi_nopout hdr; 981 struct iscsi_nopout hdr;
982 struct iscsi_task *task; 982 struct iscsi_task *task;
983 983
984 if (!rhdr && conn->ping_task) 984 if (!rhdr && conn->ping_task)
985 return; 985 return -EINVAL;
986 986
987 memset(&hdr, 0, sizeof(struct iscsi_nopout)); 987 memset(&hdr, 0, sizeof(struct iscsi_nopout));
988 hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE; 988 hdr.opcode = ISCSI_OP_NOOP_OUT | ISCSI_OP_IMMEDIATE;
@@ -996,13 +996,16 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
996 hdr.ttt = RESERVED_ITT; 996 hdr.ttt = RESERVED_ITT;
997 997
998 task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); 998 task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0);
999 if (!task) 999 if (!task) {
1000 iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); 1000 iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n");
1001 else if (!rhdr) { 1001 return -EIO;
1002 } else if (!rhdr) {
1002 /* only track our nops */ 1003 /* only track our nops */
1003 conn->ping_task = task; 1004 conn->ping_task = task;
1004 conn->last_ping = jiffies; 1005 conn->last_ping = jiffies;
1005 } 1006 }
1007
1008 return 0;
1006} 1009}
1007 1010
1008static int iscsi_nop_out_rsp(struct iscsi_task *task, 1011static int iscsi_nop_out_rsp(struct iscsi_task *task,
@@ -2092,8 +2095,10 @@ static void iscsi_check_transport_timeouts(unsigned long data)
2092 if (time_before_eq(last_recv + recv_timeout, jiffies)) { 2095 if (time_before_eq(last_recv + recv_timeout, jiffies)) {
2093 /* send a ping to try to provoke some traffic */ 2096 /* send a ping to try to provoke some traffic */
2094 ISCSI_DBG_CONN(conn, "Sending nopout as ping\n"); 2097 ISCSI_DBG_CONN(conn, "Sending nopout as ping\n");
2095 iscsi_send_nopout(conn, NULL); 2098 if (iscsi_send_nopout(conn, NULL))
2096 next_timeout = conn->last_ping + (conn->ping_timeout * HZ); 2099 next_timeout = jiffies + (1 * HZ);
2100 else
2101 next_timeout = conn->last_ping + (conn->ping_timeout * HZ);
2097 } else 2102 } else
2098 next_timeout = last_recv + recv_timeout; 2103 next_timeout = last_recv + recv_timeout;
2099 2104
diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
index edb044a7b56d..0a2168e69bbc 100644
--- a/drivers/scsi/scsi_dh.c
+++ b/drivers/scsi/scsi_dh.c
@@ -111,7 +111,7 @@ static struct scsi_device_handler *scsi_dh_lookup(const char *name)
111 111
112 dh = __scsi_dh_lookup(name); 112 dh = __scsi_dh_lookup(name);
113 if (!dh) { 113 if (!dh) {
114 request_module(name); 114 request_module("scsi_dh_%s", name);
115 dh = __scsi_dh_lookup(name); 115 dh = __scsi_dh_lookup(name);
116 } 116 }
117 117
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 3cf9faa6cc3f..a85d863d4a44 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -992,11 +992,12 @@ static int davinci_spi_probe(struct platform_device *pdev)
992 goto free_master; 992 goto free_master;
993 } 993 }
994 994
995 dspi->irq = platform_get_irq(pdev, 0); 995 ret = platform_get_irq(pdev, 0);
996 if (dspi->irq <= 0) { 996 if (ret == 0)
997 ret = -EINVAL; 997 ret = -EINVAL;
998 if (ret < 0)
998 goto free_master; 999 goto free_master;
999 } 1000 dspi->irq = ret;
1000 1001
1001 ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq, 1002 ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq,
1002 dummy_thread_fn, 0, dev_name(&pdev->dev), dspi); 1003 dummy_thread_fn, 0, dev_name(&pdev->dev), dspi);
diff --git a/drivers/staging/speakup/fakekey.c b/drivers/staging/speakup/fakekey.c
index 4299cf45f947..5e1f16c36b49 100644
--- a/drivers/staging/speakup/fakekey.c
+++ b/drivers/staging/speakup/fakekey.c
@@ -81,6 +81,7 @@ void speakup_fake_down_arrow(void)
81 __this_cpu_write(reporting_keystroke, true); 81 __this_cpu_write(reporting_keystroke, true);
82 input_report_key(virt_keyboard, KEY_DOWN, PRESSED); 82 input_report_key(virt_keyboard, KEY_DOWN, PRESSED);
83 input_report_key(virt_keyboard, KEY_DOWN, RELEASED); 83 input_report_key(virt_keyboard, KEY_DOWN, RELEASED);
84 input_sync(virt_keyboard);
84 __this_cpu_write(reporting_keystroke, false); 85 __this_cpu_write(reporting_keystroke, false);
85 86
86 /* reenable preemption */ 87 /* reenable preemption */
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 20932cc9c8f7..b09023b07169 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -343,8 +343,7 @@ static void n_tty_packet_mode_flush(struct tty_struct *tty)
343 spin_lock_irqsave(&tty->ctrl_lock, flags); 343 spin_lock_irqsave(&tty->ctrl_lock, flags);
344 tty->ctrl_status |= TIOCPKT_FLUSHREAD; 344 tty->ctrl_status |= TIOCPKT_FLUSHREAD;
345 spin_unlock_irqrestore(&tty->ctrl_lock, flags); 345 spin_unlock_irqrestore(&tty->ctrl_lock, flags);
346 if (waitqueue_active(&tty->link->read_wait)) 346 wake_up_interruptible(&tty->link->read_wait);
347 wake_up_interruptible(&tty->link->read_wait);
348 } 347 }
349} 348}
350 349
@@ -1382,8 +1381,7 @@ handle_newline:
1382 put_tty_queue(c, ldata); 1381 put_tty_queue(c, ldata);
1383 smp_store_release(&ldata->canon_head, ldata->read_head); 1382 smp_store_release(&ldata->canon_head, ldata->read_head);
1384 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1383 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1385 if (waitqueue_active(&tty->read_wait)) 1384 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1386 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1387 return 0; 1385 return 0;
1388 } 1386 }
1389 } 1387 }
@@ -1667,8 +1665,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
1667 1665
1668 if ((read_cnt(ldata) >= ldata->minimum_to_wake) || L_EXTPROC(tty)) { 1666 if ((read_cnt(ldata) >= ldata->minimum_to_wake) || L_EXTPROC(tty)) {
1669 kill_fasync(&tty->fasync, SIGIO, POLL_IN); 1667 kill_fasync(&tty->fasync, SIGIO, POLL_IN);
1670 if (waitqueue_active(&tty->read_wait)) 1668 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1671 wake_up_interruptible_poll(&tty->read_wait, POLLIN);
1672 } 1669 }
1673} 1670}
1674 1671
@@ -1887,10 +1884,8 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
1887 } 1884 }
1888 1885
1889 /* The termios change make the tty ready for I/O */ 1886 /* The termios change make the tty ready for I/O */
1890 if (waitqueue_active(&tty->write_wait)) 1887 wake_up_interruptible(&tty->write_wait);
1891 wake_up_interruptible(&tty->write_wait); 1888 wake_up_interruptible(&tty->read_wait);
1892 if (waitqueue_active(&tty->read_wait))
1893 wake_up_interruptible(&tty->read_wait);
1894} 1889}
1895 1890
1896/** 1891/**
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index b1e0ba3e525b..0bbf34035d6a 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -261,6 +261,14 @@ configured less than Maximum supported fifo bytes */
261 UART_FCR7_64BYTE, 261 UART_FCR7_64BYTE,
262 .flags = UART_CAP_FIFO, 262 .flags = UART_CAP_FIFO,
263 }, 263 },
264 [PORT_RT2880] = {
265 .name = "Palmchip BK-3103",
266 .fifo_size = 16,
267 .tx_loadsz = 16,
268 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
269 .rxtrig_bytes = {1, 4, 8, 14},
270 .flags = UART_CAP_FIFO,
271 },
264}; 272};
265 273
266/* Uart divisor latch read */ 274/* Uart divisor latch read */
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 5ca5cf3e9359..538ea03bc101 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2786,7 +2786,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
2786 ret = atmel_init_gpios(port, &pdev->dev); 2786 ret = atmel_init_gpios(port, &pdev->dev);
2787 if (ret < 0) { 2787 if (ret < 0) {
2788 dev_err(&pdev->dev, "Failed to initialize GPIOs."); 2788 dev_err(&pdev->dev, "Failed to initialize GPIOs.");
2789 goto err; 2789 goto err_clear_bit;
2790 } 2790 }
2791 2791
2792 ret = atmel_init_port(port, pdev); 2792 ret = atmel_init_port(port, pdev);
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index fe3d41cc8416..d0388a071ba1 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1631,12 +1631,12 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1631 int locked = 1; 1631 int locked = 1;
1632 int retval; 1632 int retval;
1633 1633
1634 retval = clk_prepare_enable(sport->clk_per); 1634 retval = clk_enable(sport->clk_per);
1635 if (retval) 1635 if (retval)
1636 return; 1636 return;
1637 retval = clk_prepare_enable(sport->clk_ipg); 1637 retval = clk_enable(sport->clk_ipg);
1638 if (retval) { 1638 if (retval) {
1639 clk_disable_unprepare(sport->clk_per); 1639 clk_disable(sport->clk_per);
1640 return; 1640 return;
1641 } 1641 }
1642 1642
@@ -1675,8 +1675,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
1675 if (locked) 1675 if (locked)
1676 spin_unlock_irqrestore(&sport->port.lock, flags); 1676 spin_unlock_irqrestore(&sport->port.lock, flags);
1677 1677
1678 clk_disable_unprepare(sport->clk_ipg); 1678 clk_disable(sport->clk_ipg);
1679 clk_disable_unprepare(sport->clk_per); 1679 clk_disable(sport->clk_per);
1680} 1680}
1681 1681
1682/* 1682/*
@@ -1777,7 +1777,15 @@ imx_console_setup(struct console *co, char *options)
1777 1777
1778 retval = uart_set_options(&sport->port, co, baud, parity, bits, flow); 1778 retval = uart_set_options(&sport->port, co, baud, parity, bits, flow);
1779 1779
1780 clk_disable_unprepare(sport->clk_ipg); 1780 clk_disable(sport->clk_ipg);
1781 if (retval) {
1782 clk_unprepare(sport->clk_ipg);
1783 goto error_console;
1784 }
1785
1786 retval = clk_prepare(sport->clk_per);
1787 if (retval)
1788 clk_disable_unprepare(sport->clk_ipg);
1781 1789
1782error_console: 1790error_console:
1783 return retval; 1791 return retval;
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 5a3fa8913880..a660ab181cca 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -242,7 +242,10 @@ void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld)
242 atomic_inc(&buf->priority); 242 atomic_inc(&buf->priority);
243 243
244 mutex_lock(&buf->lock); 244 mutex_lock(&buf->lock);
245 while ((next = buf->head->next) != NULL) { 245 /* paired w/ release in __tty_buffer_request_room; ensures there are
246 * no pending memory accesses to the freed buffer
247 */
248 while ((next = smp_load_acquire(&buf->head->next)) != NULL) {
246 tty_buffer_free(port, buf->head); 249 tty_buffer_free(port, buf->head);
247 buf->head = next; 250 buf->head = next;
248 } 251 }
@@ -290,7 +293,10 @@ static int __tty_buffer_request_room(struct tty_port *port, size_t size,
290 if (n != NULL) { 293 if (n != NULL) {
291 n->flags = flags; 294 n->flags = flags;
292 buf->tail = n; 295 buf->tail = n;
293 b->commit = b->used; 296 /* paired w/ acquire in flush_to_ldisc(); ensures
297 * flush_to_ldisc() sees buffer data.
298 */
299 smp_store_release(&b->commit, b->used);
294 /* paired w/ acquire in flush_to_ldisc(); ensures the 300 /* paired w/ acquire in flush_to_ldisc(); ensures the
295 * latest commit value can be read before the head is 301 * latest commit value can be read before the head is
296 * advanced to the next buffer 302 * advanced to the next buffer
@@ -393,7 +399,10 @@ void tty_schedule_flip(struct tty_port *port)
393{ 399{
394 struct tty_bufhead *buf = &port->buf; 400 struct tty_bufhead *buf = &port->buf;
395 401
396 buf->tail->commit = buf->tail->used; 402 /* paired w/ acquire in flush_to_ldisc(); ensures
403 * flush_to_ldisc() sees buffer data.
404 */
405 smp_store_release(&buf->tail->commit, buf->tail->used);
397 schedule_work(&buf->work); 406 schedule_work(&buf->work);
398} 407}
399EXPORT_SYMBOL(tty_schedule_flip); 408EXPORT_SYMBOL(tty_schedule_flip);
@@ -467,7 +476,7 @@ static void flush_to_ldisc(struct work_struct *work)
467 struct tty_struct *tty; 476 struct tty_struct *tty;
468 struct tty_ldisc *disc; 477 struct tty_ldisc *disc;
469 478
470 tty = port->itty; 479 tty = READ_ONCE(port->itty);
471 if (tty == NULL) 480 if (tty == NULL)
472 return; 481 return;
473 482
@@ -491,7 +500,10 @@ static void flush_to_ldisc(struct work_struct *work)
491 * is advancing to the next buffer 500 * is advancing to the next buffer
492 */ 501 */
493 next = smp_load_acquire(&head->next); 502 next = smp_load_acquire(&head->next);
494 count = head->commit - head->read; 503 /* paired w/ release in __tty_buffer_request_room() or in
504 * tty_buffer_flush(); ensures we see the committed buffer data
505 */
506 count = smp_load_acquire(&head->commit) - head->read;
495 if (!count) { 507 if (!count) {
496 if (next == NULL) { 508 if (next == NULL) {
497 check_other_closed(tty); 509 check_other_closed(tty);
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 02785d844354..2eefaa6e3e3a 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2128,8 +2128,24 @@ retry_open:
2128 if (!noctty && 2128 if (!noctty &&
2129 current->signal->leader && 2129 current->signal->leader &&
2130 !current->signal->tty && 2130 !current->signal->tty &&
2131 tty->session == NULL) 2131 tty->session == NULL) {
2132 __proc_set_tty(tty); 2132 /*
2133 * Don't let a process that only has write access to the tty
2134 * obtain the privileges associated with having a tty as
2135 * controlling terminal (being able to reopen it with full
2136 * access through /dev/tty, being able to perform pushback).
2137 * Many distributions set the group of all ttys to "tty" and
2138 * grant write-only access to all terminals for setgid tty
2139 * binaries, which should not imply full privileges on all ttys.
2140 *
2141 * This could theoretically break old code that performs open()
2142 * on a write-only file descriptor. In that case, it might be
2143 * necessary to also permit this if
2144 * inode_permission(inode, MAY_READ) == 0.
2145 */
2146 if (filp->f_mode & FMODE_READ)
2147 __proc_set_tty(tty);
2148 }
2133 spin_unlock_irq(&current->sighand->siglock); 2149 spin_unlock_irq(&current->sighand->siglock);
2134 read_unlock(&tasklist_lock); 2150 read_unlock(&tasklist_lock);
2135 tty_unlock(tty); 2151 tty_unlock(tty);
@@ -2418,7 +2434,7 @@ static int fionbio(struct file *file, int __user *p)
2418 * Takes ->siglock() when updating signal->tty 2434 * Takes ->siglock() when updating signal->tty
2419 */ 2435 */
2420 2436
2421static int tiocsctty(struct tty_struct *tty, int arg) 2437static int tiocsctty(struct tty_struct *tty, struct file *file, int arg)
2422{ 2438{
2423 int ret = 0; 2439 int ret = 0;
2424 2440
@@ -2452,6 +2468,13 @@ static int tiocsctty(struct tty_struct *tty, int arg)
2452 goto unlock; 2468 goto unlock;
2453 } 2469 }
2454 } 2470 }
2471
2472 /* See the comment in tty_open(). */
2473 if ((file->f_mode & FMODE_READ) == 0 && !capable(CAP_SYS_ADMIN)) {
2474 ret = -EPERM;
2475 goto unlock;
2476 }
2477
2455 proc_set_tty(tty); 2478 proc_set_tty(tty);
2456unlock: 2479unlock:
2457 read_unlock(&tasklist_lock); 2480 read_unlock(&tasklist_lock);
@@ -2844,7 +2867,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2844 no_tty(); 2867 no_tty();
2845 return 0; 2868 return 0;
2846 case TIOCSCTTY: 2869 case TIOCSCTTY:
2847 return tiocsctty(tty, arg); 2870 return tiocsctty(tty, file, arg);
2848 case TIOCGPGRP: 2871 case TIOCGPGRP:
2849 return tiocgpgrp(tty, real_tty, p); 2872 return tiocgpgrp(tty, real_tty, p);
2850 case TIOCSPGRP: 2873 case TIOCSPGRP:
@@ -3151,13 +3174,18 @@ struct class *tty_class;
3151static int tty_cdev_add(struct tty_driver *driver, dev_t dev, 3174static int tty_cdev_add(struct tty_driver *driver, dev_t dev,
3152 unsigned int index, unsigned int count) 3175 unsigned int index, unsigned int count)
3153{ 3176{
3177 int err;
3178
3154 /* init here, since reused cdevs cause crashes */ 3179 /* init here, since reused cdevs cause crashes */
3155 driver->cdevs[index] = cdev_alloc(); 3180 driver->cdevs[index] = cdev_alloc();
3156 if (!driver->cdevs[index]) 3181 if (!driver->cdevs[index])
3157 return -ENOMEM; 3182 return -ENOMEM;
3158 cdev_init(driver->cdevs[index], &tty_fops); 3183 driver->cdevs[index]->ops = &tty_fops;
3159 driver->cdevs[index]->owner = driver->owner; 3184 driver->cdevs[index]->owner = driver->owner;
3160 return cdev_add(driver->cdevs[index], dev, count); 3185 err = cdev_add(driver->cdevs[index], dev, count);
3186 if (err)
3187 kobject_put(&driver->cdevs[index]->kobj);
3188 return err;
3161} 3189}
3162 3190
3163/** 3191/**
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index d85abfed84cc..f5a381945db2 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -54,6 +54,13 @@ static const struct usb_device_id usb_quirk_list[] = {
54 { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, 54 { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
55 { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, 55 { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
56 56
57 /* Logitech ConferenceCam CC3000e */
58 { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
59 { USB_DEVICE(0x046d, 0x0848), .driver_info = USB_QUIRK_DELAY_INIT },
60
61 /* Logitech PTZ Pro Camera */
62 { USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT },
63
57 /* Logitech Quickcam Fusion */ 64 /* Logitech Quickcam Fusion */
58 { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, 65 { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
59 66
@@ -78,6 +85,12 @@ static const struct usb_device_id usb_quirk_list[] = {
78 /* Philips PSC805 audio device */ 85 /* Philips PSC805 audio device */
79 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, 86 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
80 87
88 /* Plantronic Audio 655 DSP */
89 { USB_DEVICE(0x047f, 0xc008), .driver_info = USB_QUIRK_RESET_RESUME },
90
91 /* Plantronic Audio 648 USB */
92 { USB_DEVICE(0x047f, 0xc013), .driver_info = USB_QUIRK_RESET_RESUME },
93
81 /* Artisman Watchdog Dongle */ 94 /* Artisman Watchdog Dongle */
82 { USB_DEVICE(0x04b4, 0x0526), .driver_info = 95 { USB_DEVICE(0x04b4, 0x0526), .driver_info =
83 USB_QUIRK_CONFIG_INTF_STRINGS }, 96 USB_QUIRK_CONFIG_INTF_STRINGS },
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index d1b81539d632..d6199507f861 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -159,8 +159,10 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
159 bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool, 159 bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool,
160 GFP_ATOMIC, 160 GFP_ATOMIC,
161 &dma); 161 &dma);
162 if (!bd_table->start_bd) 162 if (!bd_table->start_bd) {
163 kfree(bd_table);
163 goto fail; 164 goto fail;
165 }
164 166
165 bd_table->dma = dma; 167 bd_table->dma = dma;
166 168
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index 3ad5d19e4d04..23c794813e6a 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -472,7 +472,7 @@ static int chaoskey_rng_read(struct hwrng *rng, void *data,
472 if (this_time > max) 472 if (this_time > max)
473 this_time = max; 473 this_time = max;
474 474
475 memcpy(data, dev->buf, this_time); 475 memcpy(data, dev->buf + dev->used, this_time);
476 476
477 dev->used += this_time; 477 dev->used += this_time;
478 478
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 7b98e1d9194c..d82fa36c3465 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -476,6 +476,11 @@ static const struct of_device_id usbhs_of_match[] = {
476 .compatible = "renesas,usbhs-r8a7794", 476 .compatible = "renesas,usbhs-r8a7794",
477 .data = (void *)USBHS_TYPE_RCAR_GEN2, 477 .data = (void *)USBHS_TYPE_RCAR_GEN2,
478 }, 478 },
479 {
480 /* Gen3 is compatible with Gen2 */
481 .compatible = "renesas,usbhs-r8a7795",
482 .data = (void *)USBHS_TYPE_RCAR_GEN2,
483 },
479 { }, 484 { },
480}; 485};
481MODULE_DEVICE_TABLE(of, usbhs_of_match); 486MODULE_DEVICE_TABLE(of, usbhs_of_match);
@@ -493,7 +498,7 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
493 return NULL; 498 return NULL;
494 499
495 dparam = &info->driver_param; 500 dparam = &info->driver_param;
496 dparam->type = of_id ? (u32)of_id->data : 0; 501 dparam->type = of_id ? (uintptr_t)of_id->data : 0;
497 if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp)) 502 if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp))
498 dparam->buswait_bwait = tmp; 503 dparam->buswait_bwait = tmp;
499 gpio = of_get_named_gpio_flags(dev->of_node, "renesas,enable-gpio", 0, 504 gpio = of_get_named_gpio_flags(dev->of_node, "renesas,enable-gpio", 0,
diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c
index 0e5fde1d3ffb..9f9a7bef1ff6 100644
--- a/drivers/video/fbdev/broadsheetfb.c
+++ b/drivers/video/fbdev/broadsheetfb.c
@@ -752,7 +752,7 @@ static ssize_t broadsheet_loadstore_waveform(struct device *dev,
752 if ((fw_entry->size < 8*1024) || (fw_entry->size > 64*1024)) { 752 if ((fw_entry->size < 8*1024) || (fw_entry->size > 64*1024)) {
753 dev_err(dev, "Invalid waveform\n"); 753 dev_err(dev, "Invalid waveform\n");
754 err = -EINVAL; 754 err = -EINVAL;
755 goto err_failed; 755 goto err_fw;
756 } 756 }
757 757
758 mutex_lock(&(par->io_lock)); 758 mutex_lock(&(par->io_lock));
@@ -762,13 +762,15 @@ static ssize_t broadsheet_loadstore_waveform(struct device *dev,
762 mutex_unlock(&(par->io_lock)); 762 mutex_unlock(&(par->io_lock));
763 if (err < 0) { 763 if (err < 0) {
764 dev_err(dev, "Failed to store broadsheet waveform\n"); 764 dev_err(dev, "Failed to store broadsheet waveform\n");
765 goto err_failed; 765 goto err_fw;
766 } 766 }
767 767
768 dev_info(dev, "Stored broadsheet waveform, size %zd\n", fw_entry->size); 768 dev_info(dev, "Stored broadsheet waveform, size %zd\n", fw_entry->size);
769 769
770 return len; 770 err = len;
771 771
772err_fw:
773 release_firmware(fw_entry);
772err_failed: 774err_failed:
773 return err; 775 return err;
774} 776}
diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index 7fa2e6f9e322..b335c1ae8625 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -1628,9 +1628,16 @@ static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state)
1628static int fsl_diu_resume(struct platform_device *ofdev) 1628static int fsl_diu_resume(struct platform_device *ofdev)
1629{ 1629{
1630 struct fsl_diu_data *data; 1630 struct fsl_diu_data *data;
1631 unsigned int i;
1631 1632
1632 data = dev_get_drvdata(&ofdev->dev); 1633 data = dev_get_drvdata(&ofdev->dev);
1633 enable_lcdc(data->fsl_diu_info); 1634
1635 fsl_diu_enable_interrupts(data);
1636 update_lcdc(data->fsl_diu_info);
1637 for (i = 0; i < NUM_AOIS; i++) {
1638 if (data->mfb[i].count)
1639 fsl_diu_enable_panel(&data->fsl_diu_info[i]);
1640 }
1634 1641
1635 return 0; 1642 return 0;
1636} 1643}
diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
index 9b8bebdf8f86..f9ec5c0484fa 100644
--- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
@@ -831,6 +831,7 @@ static struct of_device_id of_platform_mb862xx_tbl[] = {
831 { .compatible = "fujitsu,coral", }, 831 { .compatible = "fujitsu,coral", },
832 { /* end */ } 832 { /* end */ }
833}; 833};
834MODULE_DEVICE_TABLE(of, of_platform_mb862xx_tbl);
834 835
835static struct platform_driver of_platform_mb862xxfb_driver = { 836static struct platform_driver of_platform_mb862xxfb_driver = {
836 .driver = { 837 .driver = {
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
index a8ce920fa797..d811e6dcaef7 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c
@@ -294,7 +294,7 @@ static int dvic_probe_of(struct platform_device *pdev)
294 294
295 adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); 295 adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0);
296 if (adapter_node) { 296 if (adapter_node) {
297 adapter = of_find_i2c_adapter_by_node(adapter_node); 297 adapter = of_get_i2c_adapter_by_node(adapter_node);
298 if (adapter == NULL) { 298 if (adapter == NULL) {
299 dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n"); 299 dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n");
300 omap_dss_put_device(ddata->in); 300 omap_dss_put_device(ddata->in);
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
index 90cbc4c3406c..c581231c74a5 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
@@ -898,6 +898,7 @@ static const struct of_device_id acx565akm_of_match[] = {
898 { .compatible = "omapdss,sony,acx565akm", }, 898 { .compatible = "omapdss,sony,acx565akm", },
899 {}, 899 {},
900}; 900};
901MODULE_DEVICE_TABLE(of, acx565akm_of_match);
901 902
902static struct spi_driver acx565akm_driver = { 903static struct spi_driver acx565akm_driver = {
903 .driver = { 904 .driver = {
diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 7ed9a227f5ea..01b43e9ce941 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -226,7 +226,7 @@ static void blade_image_blit(struct tridentfb_par *par, const char *data,
226 writemmr(par, DST1, point(x, y)); 226 writemmr(par, DST1, point(x, y));
227 writemmr(par, DST2, point(x + w - 1, y + h - 1)); 227 writemmr(par, DST2, point(x + w - 1, y + h - 1));
228 228
229 memcpy(par->io_virt + 0x10000, data, 4 * size); 229 iowrite32_rep(par->io_virt + 0x10000, data, size);
230} 230}
231 231
232static void blade_copy_rect(struct tridentfb_par *par, 232static void blade_copy_rect(struct tridentfb_par *par,
@@ -673,8 +673,14 @@ static int get_nativex(struct tridentfb_par *par)
673static inline void set_lwidth(struct tridentfb_par *par, int width) 673static inline void set_lwidth(struct tridentfb_par *par, int width)
674{ 674{
675 write3X4(par, VGA_CRTC_OFFSET, width & 0xFF); 675 write3X4(par, VGA_CRTC_OFFSET, width & 0xFF);
676 write3X4(par, AddColReg, 676 /* chips older than TGUI9660 have only 1 width bit in AddColReg */
677 (read3X4(par, AddColReg) & 0xCF) | ((width & 0x300) >> 4)); 677 /* touching the other one breaks I2C/DDC */
678 if (par->chip_id == TGUI9440 || par->chip_id == CYBER9320)
679 write3X4(par, AddColReg,
680 (read3X4(par, AddColReg) & 0xEF) | ((width & 0x100) >> 4));
681 else
682 write3X4(par, AddColReg,
683 (read3X4(par, AddColReg) & 0xCF) | ((width & 0x300) >> 4));
678} 684}
679 685
680/* For resolutions smaller than FP resolution stretch */ 686/* For resolutions smaller than FP resolution stretch */
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index 32d8275e4c88..8a1076beecd3 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -210,6 +210,7 @@ struct display_timings *of_get_display_timings(struct device_node *np)
210 */ 210 */
211 pr_err("%s: error in timing %d\n", 211 pr_err("%s: error in timing %d\n",
212 of_node_full_name(np), disp->num_timings + 1); 212 of_node_full_name(np), disp->num_timings + 1);
213 kfree(dt);
213 goto timingfail; 214 goto timingfail;
214 } 215 }
215 216
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 295795aebe0b..1e60d00d4ea7 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2847,6 +2847,8 @@ int open_ctree(struct super_block *sb,
2847 !extent_buffer_uptodate(chunk_root->node)) { 2847 !extent_buffer_uptodate(chunk_root->node)) {
2848 printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n", 2848 printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n",
2849 sb->s_id); 2849 sb->s_id);
2850 if (!IS_ERR(chunk_root->node))
2851 free_extent_buffer(chunk_root->node);
2850 chunk_root->node = NULL; 2852 chunk_root->node = NULL;
2851 goto fail_tree_roots; 2853 goto fail_tree_roots;
2852 } 2854 }
@@ -2885,6 +2887,8 @@ retry_root_backup:
2885 !extent_buffer_uptodate(tree_root->node)) { 2887 !extent_buffer_uptodate(tree_root->node)) {
2886 printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n", 2888 printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n",
2887 sb->s_id); 2889 sb->s_id);
2890 if (!IS_ERR(tree_root->node))
2891 free_extent_buffer(tree_root->node);
2888 tree_root->node = NULL; 2892 tree_root->node = NULL;
2889 goto recovery_tree_root; 2893 goto recovery_tree_root;
2890 } 2894 }
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 8d052209f473..2513a7f53334 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -112,11 +112,11 @@ static struct dentry *btrfs_fh_to_parent(struct super_block *sb, struct fid *fh,
112 u32 generation; 112 u32 generation;
113 113
114 if (fh_type == FILEID_BTRFS_WITH_PARENT) { 114 if (fh_type == FILEID_BTRFS_WITH_PARENT) {
115 if (fh_len != BTRFS_FID_SIZE_CONNECTABLE) 115 if (fh_len < BTRFS_FID_SIZE_CONNECTABLE)
116 return NULL; 116 return NULL;
117 root_objectid = fid->root_objectid; 117 root_objectid = fid->root_objectid;
118 } else if (fh_type == FILEID_BTRFS_WITH_PARENT_ROOT) { 118 } else if (fh_type == FILEID_BTRFS_WITH_PARENT_ROOT) {
119 if (fh_len != BTRFS_FID_SIZE_CONNECTABLE_ROOT) 119 if (fh_len < BTRFS_FID_SIZE_CONNECTABLE_ROOT)
120 return NULL; 120 return NULL;
121 root_objectid = fid->parent_root_objectid; 121 root_objectid = fid->parent_root_objectid;
122 } else 122 } else
@@ -136,11 +136,11 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
136 u32 generation; 136 u32 generation;
137 137
138 if ((fh_type != FILEID_BTRFS_WITH_PARENT || 138 if ((fh_type != FILEID_BTRFS_WITH_PARENT ||
139 fh_len != BTRFS_FID_SIZE_CONNECTABLE) && 139 fh_len < BTRFS_FID_SIZE_CONNECTABLE) &&
140 (fh_type != FILEID_BTRFS_WITH_PARENT_ROOT || 140 (fh_type != FILEID_BTRFS_WITH_PARENT_ROOT ||
141 fh_len != BTRFS_FID_SIZE_CONNECTABLE_ROOT) && 141 fh_len < BTRFS_FID_SIZE_CONNECTABLE_ROOT) &&
142 (fh_type != FILEID_BTRFS_WITHOUT_PARENT || 142 (fh_type != FILEID_BTRFS_WITHOUT_PARENT ||
143 fh_len != BTRFS_FID_SIZE_NON_CONNECTABLE)) 143 fh_len < BTRFS_FID_SIZE_NON_CONNECTABLE))
144 return NULL; 144 return NULL;
145 145
146 objectid = fid->objectid; 146 objectid = fid->objectid;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9f9604201333..601d7d45d164 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2828,6 +2828,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
2828 struct btrfs_delayed_ref_head *head; 2828 struct btrfs_delayed_ref_head *head;
2829 int ret; 2829 int ret;
2830 int run_all = count == (unsigned long)-1; 2830 int run_all = count == (unsigned long)-1;
2831 bool can_flush_pending_bgs = trans->can_flush_pending_bgs;
2831 2832
2832 /* We'll clean this up in btrfs_cleanup_transaction */ 2833 /* We'll clean this up in btrfs_cleanup_transaction */
2833 if (trans->aborted) 2834 if (trans->aborted)
@@ -2844,6 +2845,7 @@ again:
2844#ifdef SCRAMBLE_DELAYED_REFS 2845#ifdef SCRAMBLE_DELAYED_REFS
2845 delayed_refs->run_delayed_start = find_middle(&delayed_refs->root); 2846 delayed_refs->run_delayed_start = find_middle(&delayed_refs->root);
2846#endif 2847#endif
2848 trans->can_flush_pending_bgs = false;
2847 ret = __btrfs_run_delayed_refs(trans, root, count); 2849 ret = __btrfs_run_delayed_refs(trans, root, count);
2848 if (ret < 0) { 2850 if (ret < 0) {
2849 btrfs_abort_transaction(trans, root, ret); 2851 btrfs_abort_transaction(trans, root, ret);
@@ -2893,6 +2895,7 @@ again:
2893 } 2895 }
2894out: 2896out:
2895 assert_qgroups_uptodate(trans); 2897 assert_qgroups_uptodate(trans);
2898 trans->can_flush_pending_bgs = can_flush_pending_bgs;
2896 return 0; 2899 return 0;
2897} 2900}
2898 2901
@@ -4306,7 +4309,8 @@ out:
4306 * the block groups that were made dirty during the lifetime of the 4309 * the block groups that were made dirty during the lifetime of the
4307 * transaction. 4310 * transaction.
4308 */ 4311 */
4309 if (trans->chunk_bytes_reserved >= (2 * 1024 * 1024ull)) { 4312 if (trans->can_flush_pending_bgs &&
4313 trans->chunk_bytes_reserved >= (2 * 1024 * 1024ull)) {
4310 btrfs_create_pending_block_groups(trans, trans->root); 4314 btrfs_create_pending_block_groups(trans, trans->root);
4311 btrfs_trans_release_chunk_metadata(trans); 4315 btrfs_trans_release_chunk_metadata(trans);
4312 } 4316 }
@@ -9560,7 +9564,9 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans,
9560 struct btrfs_block_group_item item; 9564 struct btrfs_block_group_item item;
9561 struct btrfs_key key; 9565 struct btrfs_key key;
9562 int ret = 0; 9566 int ret = 0;
9567 bool can_flush_pending_bgs = trans->can_flush_pending_bgs;
9563 9568
9569 trans->can_flush_pending_bgs = false;
9564 list_for_each_entry_safe(block_group, tmp, &trans->new_bgs, bg_list) { 9570 list_for_each_entry_safe(block_group, tmp, &trans->new_bgs, bg_list) {
9565 if (ret) 9571 if (ret)
9566 goto next; 9572 goto next;
@@ -9581,6 +9587,7 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans,
9581next: 9587next:
9582 list_del_init(&block_group->bg_list); 9588 list_del_init(&block_group->bg_list);
9583 } 9589 }
9590 trans->can_flush_pending_bgs = can_flush_pending_bgs;
9584} 9591}
9585 9592
9586int btrfs_make_block_group(struct btrfs_trans_handle *trans, 9593int btrfs_make_block_group(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index e2357e31609a..3915c9473e94 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3132,12 +3132,12 @@ static inline void __do_contiguous_readpages(struct extent_io_tree *tree,
3132 get_extent_t *get_extent, 3132 get_extent_t *get_extent,
3133 struct extent_map **em_cached, 3133 struct extent_map **em_cached,
3134 struct bio **bio, int mirror_num, 3134 struct bio **bio, int mirror_num,
3135 unsigned long *bio_flags, int rw) 3135 unsigned long *bio_flags, int rw,
3136 u64 *prev_em_start)
3136{ 3137{
3137 struct inode *inode; 3138 struct inode *inode;
3138 struct btrfs_ordered_extent *ordered; 3139 struct btrfs_ordered_extent *ordered;
3139 int index; 3140 int index;
3140 u64 prev_em_start = (u64)-1;
3141 3141
3142 inode = pages[0]->mapping->host; 3142 inode = pages[0]->mapping->host;
3143 while (1) { 3143 while (1) {
@@ -3153,7 +3153,7 @@ static inline void __do_contiguous_readpages(struct extent_io_tree *tree,
3153 3153
3154 for (index = 0; index < nr_pages; index++) { 3154 for (index = 0; index < nr_pages; index++) {
3155 __do_readpage(tree, pages[index], get_extent, em_cached, bio, 3155 __do_readpage(tree, pages[index], get_extent, em_cached, bio,
3156 mirror_num, bio_flags, rw, &prev_em_start); 3156 mirror_num, bio_flags, rw, prev_em_start);
3157 page_cache_release(pages[index]); 3157 page_cache_release(pages[index]);
3158 } 3158 }
3159} 3159}
@@ -3163,7 +3163,8 @@ static void __extent_readpages(struct extent_io_tree *tree,
3163 int nr_pages, get_extent_t *get_extent, 3163 int nr_pages, get_extent_t *get_extent,
3164 struct extent_map **em_cached, 3164 struct extent_map **em_cached,
3165 struct bio **bio, int mirror_num, 3165 struct bio **bio, int mirror_num,
3166 unsigned long *bio_flags, int rw) 3166 unsigned long *bio_flags, int rw,
3167 u64 *prev_em_start)
3167{ 3168{
3168 u64 start = 0; 3169 u64 start = 0;
3169 u64 end = 0; 3170 u64 end = 0;
@@ -3184,7 +3185,7 @@ static void __extent_readpages(struct extent_io_tree *tree,
3184 index - first_index, start, 3185 index - first_index, start,
3185 end, get_extent, em_cached, 3186 end, get_extent, em_cached,
3186 bio, mirror_num, bio_flags, 3187 bio, mirror_num, bio_flags,
3187 rw); 3188 rw, prev_em_start);
3188 start = page_start; 3189 start = page_start;
3189 end = start + PAGE_CACHE_SIZE - 1; 3190 end = start + PAGE_CACHE_SIZE - 1;
3190 first_index = index; 3191 first_index = index;
@@ -3195,7 +3196,8 @@ static void __extent_readpages(struct extent_io_tree *tree,
3195 __do_contiguous_readpages(tree, &pages[first_index], 3196 __do_contiguous_readpages(tree, &pages[first_index],
3196 index - first_index, start, 3197 index - first_index, start,
3197 end, get_extent, em_cached, bio, 3198 end, get_extent, em_cached, bio,
3198 mirror_num, bio_flags, rw); 3199 mirror_num, bio_flags, rw,
3200 prev_em_start);
3199} 3201}
3200 3202
3201static int __extent_read_full_page(struct extent_io_tree *tree, 3203static int __extent_read_full_page(struct extent_io_tree *tree,
@@ -4207,6 +4209,7 @@ int extent_readpages(struct extent_io_tree *tree,
4207 struct page *page; 4209 struct page *page;
4208 struct extent_map *em_cached = NULL; 4210 struct extent_map *em_cached = NULL;
4209 int nr = 0; 4211 int nr = 0;
4212 u64 prev_em_start = (u64)-1;
4210 4213
4211 for (page_idx = 0; page_idx < nr_pages; page_idx++) { 4214 for (page_idx = 0; page_idx < nr_pages; page_idx++) {
4212 page = list_entry(pages->prev, struct page, lru); 4215 page = list_entry(pages->prev, struct page, lru);
@@ -4223,12 +4226,12 @@ int extent_readpages(struct extent_io_tree *tree,
4223 if (nr < ARRAY_SIZE(pagepool)) 4226 if (nr < ARRAY_SIZE(pagepool))
4224 continue; 4227 continue;
4225 __extent_readpages(tree, pagepool, nr, get_extent, &em_cached, 4228 __extent_readpages(tree, pagepool, nr, get_extent, &em_cached,
4226 &bio, 0, &bio_flags, READ); 4229 &bio, 0, &bio_flags, READ, &prev_em_start);
4227 nr = 0; 4230 nr = 0;
4228 } 4231 }
4229 if (nr) 4232 if (nr)
4230 __extent_readpages(tree, pagepool, nr, get_extent, &em_cached, 4233 __extent_readpages(tree, pagepool, nr, get_extent, &em_cached,
4231 &bio, 0, &bio_flags, READ); 4234 &bio, 0, &bio_flags, READ, &prev_em_start);
4232 4235
4233 if (em_cached) 4236 if (em_cached)
4234 free_extent_map(em_cached); 4237 free_extent_map(em_cached);
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index aa72bfd28f7d..a739b825bdd3 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1920,10 +1920,12 @@ static int did_overwrite_ref(struct send_ctx *sctx,
1920 /* 1920 /*
1921 * We know that it is or will be overwritten. Check this now. 1921 * We know that it is or will be overwritten. Check this now.
1922 * The current inode being processed might have been the one that caused 1922 * The current inode being processed might have been the one that caused
1923 * inode 'ino' to be orphanized, therefore ow_inode can actually be the 1923 * inode 'ino' to be orphanized, therefore check if ow_inode matches
1924 * same as sctx->send_progress. 1924 * the current inode being processed.
1925 */ 1925 */
1926 if (ow_inode <= sctx->send_progress) 1926 if ((ow_inode < sctx->send_progress) ||
1927 (ino != sctx->cur_ino && ow_inode == sctx->cur_ino &&
1928 gen == sctx->cur_inode_gen))
1927 ret = 1; 1929 ret = 1;
1928 else 1930 else
1929 ret = 0; 1931 ret = 0;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 74bc3338418b..a5b06442f0bf 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -557,6 +557,7 @@ again:
557 h->delayed_ref_elem.seq = 0; 557 h->delayed_ref_elem.seq = 0;
558 h->type = type; 558 h->type = type;
559 h->allocating_chunk = false; 559 h->allocating_chunk = false;
560 h->can_flush_pending_bgs = true;
560 h->reloc_reserved = false; 561 h->reloc_reserved = false;
561 h->sync = false; 562 h->sync = false;
562 INIT_LIST_HEAD(&h->qgroup_ref_list); 563 INIT_LIST_HEAD(&h->qgroup_ref_list);
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 87964bf8892d..a994bb097ee5 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -118,6 +118,7 @@ struct btrfs_trans_handle {
118 short aborted; 118 short aborted;
119 short adding_csums; 119 short adding_csums;
120 bool allocating_chunk; 120 bool allocating_chunk;
121 bool can_flush_pending_bgs;
121 bool reloc_reserved; 122 bool reloc_reserved;
122 bool sync; 123 bool sync;
123 unsigned int type; 124 unsigned int type;
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 27aea110e923..c3cc1609025f 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -136,5 +136,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
136extern const struct export_operations cifs_export_ops; 136extern const struct export_operations cifs_export_ops;
137#endif /* CONFIG_CIFS_NFSD_EXPORT */ 137#endif /* CONFIG_CIFS_NFSD_EXPORT */
138 138
139#define CIFS_VERSION "2.07" 139#define CIFS_VERSION "2.08"
140#endif /* _CIFSFS_H */ 140#endif /* _CIFSFS_H */
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index f621b44cb800..6b66dd5d1540 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -2034,7 +2034,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
2034 struct tcon_link *tlink = NULL; 2034 struct tcon_link *tlink = NULL;
2035 struct cifs_tcon *tcon = NULL; 2035 struct cifs_tcon *tcon = NULL;
2036 struct TCP_Server_Info *server; 2036 struct TCP_Server_Info *server;
2037 struct cifs_io_parms io_parms;
2038 2037
2039 /* 2038 /*
2040 * To avoid spurious oplock breaks from server, in the case of 2039 * To avoid spurious oplock breaks from server, in the case of
@@ -2056,18 +2055,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
2056 rc = -ENOSYS; 2055 rc = -ENOSYS;
2057 cifsFileInfo_put(open_file); 2056 cifsFileInfo_put(open_file);
2058 cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc); 2057 cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc);
2059 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
2060 unsigned int bytes_written;
2061
2062 io_parms.netfid = open_file->fid.netfid;
2063 io_parms.pid = open_file->pid;
2064 io_parms.tcon = tcon;
2065 io_parms.offset = 0;
2066 io_parms.length = attrs->ia_size;
2067 rc = CIFSSMBWrite(xid, &io_parms, &bytes_written,
2068 NULL, NULL, 1);
2069 cifs_dbg(FYI, "Wrt seteof rc %d\n", rc);
2070 }
2071 } else 2058 } else
2072 rc = -EINVAL; 2059 rc = -EINVAL;
2073 2060
@@ -2093,28 +2080,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
2093 else 2080 else
2094 rc = -ENOSYS; 2081 rc = -ENOSYS;
2095 cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc); 2082 cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc);
2096 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
2097 __u16 netfid;
2098 int oplock = 0;
2099 2083
2100 rc = SMBLegacyOpen(xid, tcon, full_path, FILE_OPEN,
2101 GENERIC_WRITE, CREATE_NOT_DIR, &netfid,
2102 &oplock, NULL, cifs_sb->local_nls,
2103 cifs_remap(cifs_sb));
2104 if (rc == 0) {
2105 unsigned int bytes_written;
2106
2107 io_parms.netfid = netfid;
2108 io_parms.pid = current->tgid;
2109 io_parms.tcon = tcon;
2110 io_parms.offset = 0;
2111 io_parms.length = attrs->ia_size;
2112 rc = CIFSSMBWrite(xid, &io_parms, &bytes_written, NULL,
2113 NULL, 1);
2114 cifs_dbg(FYI, "wrt seteof rc %d\n", rc);
2115 CIFSSMBClose(xid, tcon, netfid);
2116 }
2117 }
2118 if (tlink) 2084 if (tlink)
2119 cifs_put_tlink(tlink); 2085 cifs_put_tlink(tlink);
2120 2086
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index ce83e2edbe0a..597a417ba94d 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -922,7 +922,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
922 if (tcon && tcon->bad_network_name) 922 if (tcon && tcon->bad_network_name)
923 return -ENOENT; 923 return -ENOENT;
924 924
925 if ((tcon->seal) && 925 if ((tcon && tcon->seal) &&
926 ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) { 926 ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) {
927 cifs_dbg(VFS, "encryption requested but no server support"); 927 cifs_dbg(VFS, "encryption requested but no server support");
928 return -EOPNOTSUPP; 928 return -EOPNOTSUPP;
diff --git a/fs/namei.c b/fs/namei.c
index 726d211db484..33e9495a3129 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1558,8 +1558,6 @@ static int lookup_fast(struct nameidata *nd,
1558 negative = d_is_negative(dentry); 1558 negative = d_is_negative(dentry);
1559 if (read_seqcount_retry(&dentry->d_seq, seq)) 1559 if (read_seqcount_retry(&dentry->d_seq, seq))
1560 return -ECHILD; 1560 return -ECHILD;
1561 if (negative)
1562 return -ENOENT;
1563 1561
1564 /* 1562 /*
1565 * This sequence count validates that the parent had no 1563 * This sequence count validates that the parent had no
@@ -1580,6 +1578,12 @@ static int lookup_fast(struct nameidata *nd,
1580 goto unlazy; 1578 goto unlazy;
1581 } 1579 }
1582 } 1580 }
1581 /*
1582 * Note: do negative dentry check after revalidation in
1583 * case that drops it.
1584 */
1585 if (negative)
1586 return -ENOENT;
1583 path->mnt = mnt; 1587 path->mnt = mnt;
1584 path->dentry = dentry; 1588 path->dentry = dentry;
1585 if (likely(__follow_mount_rcu(nd, path, inode, seqp))) 1589 if (likely(__follow_mount_rcu(nd, path, inode, seqp)))
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f93b9cdb4934..5133bb18830e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1458,12 +1458,18 @@ nfs4_opendata_check_deleg(struct nfs4_opendata *data, struct nfs4_state *state)
1458 if (delegation) 1458 if (delegation)
1459 delegation_flags = delegation->flags; 1459 delegation_flags = delegation->flags;
1460 rcu_read_unlock(); 1460 rcu_read_unlock();
1461 if (data->o_arg.claim == NFS4_OPEN_CLAIM_DELEGATE_CUR) { 1461 switch (data->o_arg.claim) {
1462 default:
1463 break;
1464 case NFS4_OPEN_CLAIM_DELEGATE_CUR:
1465 case NFS4_OPEN_CLAIM_DELEG_CUR_FH:
1462 pr_err_ratelimited("NFS: Broken NFSv4 server %s is " 1466 pr_err_ratelimited("NFS: Broken NFSv4 server %s is "
1463 "returning a delegation for " 1467 "returning a delegation for "
1464 "OPEN(CLAIM_DELEGATE_CUR)\n", 1468 "OPEN(CLAIM_DELEGATE_CUR)\n",
1465 clp->cl_hostname); 1469 clp->cl_hostname);
1466 } else if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0) 1470 return;
1471 }
1472 if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0)
1467 nfs_inode_set_delegation(state->inode, 1473 nfs_inode_set_delegation(state->inode,
1468 data->owner->so_cred, 1474 data->owner->so_cred,
1469 &data->o_res); 1475 &data->o_res);
@@ -1771,6 +1777,9 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx,
1771 if (IS_ERR(opendata)) 1777 if (IS_ERR(opendata))
1772 return PTR_ERR(opendata); 1778 return PTR_ERR(opendata);
1773 nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid); 1779 nfs4_stateid_copy(&opendata->o_arg.u.delegation, stateid);
1780 write_seqlock(&state->seqlock);
1781 nfs4_stateid_copy(&state->stateid, &state->open_stateid);
1782 write_sequnlock(&state->seqlock);
1774 clear_bit(NFS_DELEGATED_STATE, &state->flags); 1783 clear_bit(NFS_DELEGATED_STATE, &state->flags);
1775 switch (type & (FMODE_READ|FMODE_WRITE)) { 1784 switch (type & (FMODE_READ|FMODE_WRITE)) {
1776 case FMODE_READ|FMODE_WRITE: 1785 case FMODE_READ|FMODE_WRITE:
@@ -1863,6 +1872,8 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
1863 data->rpc_done = 0; 1872 data->rpc_done = 0;
1864 data->rpc_status = 0; 1873 data->rpc_status = 0;
1865 data->timestamp = jiffies; 1874 data->timestamp = jiffies;
1875 if (data->is_recover)
1876 nfs4_set_sequence_privileged(&data->c_arg.seq_args);
1866 task = rpc_run_task(&task_setup_data); 1877 task = rpc_run_task(&task_setup_data);
1867 if (IS_ERR(task)) 1878 if (IS_ERR(task))
1868 return PTR_ERR(task); 1879 return PTR_ERR(task);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 5db324635e92..d854693a15b0 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1725,7 +1725,8 @@ restart:
1725 if (!test_and_clear_bit(ops->owner_flag_bit, 1725 if (!test_and_clear_bit(ops->owner_flag_bit,
1726 &sp->so_flags)) 1726 &sp->so_flags))
1727 continue; 1727 continue;
1728 atomic_inc(&sp->so_count); 1728 if (!atomic_inc_not_zero(&sp->so_count))
1729 continue;
1729 spin_unlock(&clp->cl_lock); 1730 spin_unlock(&clp->cl_lock);
1730 rcu_read_unlock(); 1731 rcu_read_unlock();
1731 1732
diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
index 28df12e525ba..671cf68fe56b 100644
--- a/fs/nfs/nfs4trace.h
+++ b/fs/nfs/nfs4trace.h
@@ -409,7 +409,7 @@ DECLARE_EVENT_CLASS(nfs4_open_event,
409 __entry->flags = flags; 409 __entry->flags = flags;
410 __entry->fmode = (__force unsigned int)ctx->mode; 410 __entry->fmode = (__force unsigned int)ctx->mode;
411 __entry->dev = ctx->dentry->d_sb->s_dev; 411 __entry->dev = ctx->dentry->d_sb->s_dev;
412 if (!IS_ERR(state)) 412 if (!IS_ERR_OR_NULL(state))
413 inode = state->inode; 413 inode = state->inode;
414 if (inode != NULL) { 414 if (inode != NULL) {
415 __entry->fileid = NFS_FILEID(inode); 415 __entry->fileid = NFS_FILEID(inode);
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 72624dc4a623..75ab7622e0cc 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -569,19 +569,17 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
569 if (!nfs_pageio_add_request(pgio, req)) { 569 if (!nfs_pageio_add_request(pgio, req)) {
570 nfs_redirty_request(req); 570 nfs_redirty_request(req);
571 ret = pgio->pg_error; 571 ret = pgio->pg_error;
572 } 572 } else
573 nfs_add_stats(page_file_mapping(page)->host,
574 NFSIOS_WRITEPAGES, 1);
573out: 575out:
574 return ret; 576 return ret;
575} 577}
576 578
577static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio) 579static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio)
578{ 580{
579 struct inode *inode = page_file_mapping(page)->host;
580 int ret; 581 int ret;
581 582
582 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
583 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
584
585 nfs_pageio_cond_complete(pgio, page_file_index(page)); 583 nfs_pageio_cond_complete(pgio, page_file_index(page));
586 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE); 584 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE);
587 if (ret == -EAGAIN) { 585 if (ret == -EAGAIN) {
@@ -597,9 +595,11 @@ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, st
597static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc) 595static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc)
598{ 596{
599 struct nfs_pageio_descriptor pgio; 597 struct nfs_pageio_descriptor pgio;
598 struct inode *inode = page_file_mapping(page)->host;
600 int err; 599 int err;
601 600
602 nfs_pageio_init_write(&pgio, page->mapping->host, wb_priority(wbc), 601 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
602 nfs_pageio_init_write(&pgio, inode, wb_priority(wbc),
603 false, &nfs_async_write_completion_ops); 603 false, &nfs_async_write_completion_ops);
604 err = nfs_do_writepage(page, wbc, &pgio); 604 err = nfs_do_writepage(page, wbc, &pgio);
605 nfs_pageio_complete(&pgio); 605 nfs_pageio_complete(&pgio);
@@ -1223,7 +1223,7 @@ static int nfs_can_extend_write(struct file *file, struct page *page, struct ino
1223 return 1; 1223 return 1;
1224 if (!flctx || (list_empty_careful(&flctx->flc_flock) && 1224 if (!flctx || (list_empty_careful(&flctx->flc_flock) &&
1225 list_empty_careful(&flctx->flc_posix))) 1225 list_empty_careful(&flctx->flc_posix)))
1226 return 0; 1226 return 1;
1227 1227
1228 /* Check to see if there are whole file write locks */ 1228 /* Check to see if there are whole file write locks */
1229 ret = 0; 1229 ret = 0;
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index d3ca79236fb0..f644fdb06dd6 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -161,6 +161,11 @@ enum {
161 IRQ_DOMAIN_FLAG_NONCORE = (1 << 16), 161 IRQ_DOMAIN_FLAG_NONCORE = (1 << 16),
162}; 162};
163 163
164static inline struct device_node *irq_domain_get_of_node(struct irq_domain *d)
165{
166 return d->of_node;
167}
168
164#ifdef CONFIG_IRQ_DOMAIN 169#ifdef CONFIG_IRQ_DOMAIN
165struct irq_domain *__irq_domain_add(struct device_node *of_node, int size, 170struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
166 irq_hw_number_t hwirq_max, int direct_max, 171 irq_hw_number_t hwirq_max, int direct_max,
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 3dd5a781da99..bfb74723f151 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -157,7 +157,7 @@ struct renesas_usbhs_driver_param {
157 */ 157 */
158 int pio_dma_border; /* default is 64byte */ 158 int pio_dma_border; /* default is 64byte */
159 159
160 u32 type; 160 uintptr_t type;
161 u32 enable_gpio; 161 u32 enable_gpio;
162 162
163 /* 163 /*
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index 9ce083960a25..f18490985fc8 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -107,5 +107,13 @@ struct sched_watchdog {
107#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ 107#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
108#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ 108#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
109#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */ 109#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */
110/*
111 * Domain asked to perform 'soft reset' for it. The expected behavior is to
112 * reset internal Xen state for the domain returning it to the point where it
113 * was created but leaving the domain's memory contents and vCPU contexts
114 * intact. This will allow the domain to start over and set up all Xen specific
115 * interfaces again.
116 */
117#define SHUTDOWN_soft_reset 5
110 118
111#endif /* __XEN_PUBLIC_SCHED_H__ */ 119#endif /* __XEN_PUBLIC_SCHED_H__ */
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index de41a68fc038..e25a83b67cce 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -22,7 +22,6 @@
22 22
23/** 23/**
24 * handle_bad_irq - handle spurious and unhandled irqs 24 * handle_bad_irq - handle spurious and unhandled irqs
25 * @irq: the interrupt number
26 * @desc: description of the interrupt 25 * @desc: description of the interrupt
27 * 26 *
28 * Handles spurious and unhandled IRQ's. It also prints a debugmessage. 27 * Handles spurious and unhandled IRQ's. It also prints a debugmessage.
@@ -35,6 +34,7 @@ void handle_bad_irq(struct irq_desc *desc)
35 kstat_incr_irqs_this_cpu(desc); 34 kstat_incr_irqs_this_cpu(desc);
36 ack_bad_irq(irq); 35 ack_bad_irq(irq);
37} 36}
37EXPORT_SYMBOL_GPL(handle_bad_irq);
38 38
39/* 39/*
40 * Special, empty irq handler: 40 * Special, empty irq handler:
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 615953141951..10a8faa1b0d4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2517,11 +2517,11 @@ static struct rq *finish_task_switch(struct task_struct *prev)
2517 * If a task dies, then it sets TASK_DEAD in tsk->state and calls 2517 * If a task dies, then it sets TASK_DEAD in tsk->state and calls
2518 * schedule one last time. The schedule call will never return, and 2518 * schedule one last time. The schedule call will never return, and
2519 * the scheduled task must drop that reference. 2519 * the scheduled task must drop that reference.
2520 * The test for TASK_DEAD must occur while the runqueue locks are 2520 *
2521 * still held, otherwise prev could be scheduled on another cpu, die 2521 * We must observe prev->state before clearing prev->on_cpu (in
2522 * there before we look at prev->state, and then the reference would 2522 * finish_lock_switch), otherwise a concurrent wakeup can get prev
2523 * be dropped twice. 2523 * running on another CPU and we could rave with its RUNNING -> DEAD
2524 * Manfred Spraul <manfred@colorfullife.com> 2524 * transition, resulting in a double drop.
2525 */ 2525 */
2526 prev_state = prev->state; 2526 prev_state = prev->state;
2527 vtime_task_switch(prev); 2527 vtime_task_switch(prev);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 68cda117574c..6d2a119c7ad9 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1078,9 +1078,10 @@ static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
1078 * After ->on_cpu is cleared, the task can be moved to a different CPU. 1078 * After ->on_cpu is cleared, the task can be moved to a different CPU.
1079 * We must ensure this doesn't happen until the switch is completely 1079 * We must ensure this doesn't happen until the switch is completely
1080 * finished. 1080 * finished.
1081 *
1082 * Pairs with the control dependency and rmb in try_to_wake_up().
1081 */ 1083 */
1082 smp_wmb(); 1084 smp_store_release(&prev->on_cpu, 0);
1083 prev->on_cpu = 0;
1084#endif 1085#endif
1085#ifdef CONFIG_DEBUG_SPINLOCK 1086#ifdef CONFIG_DEBUG_SPINLOCK
1086 /* this is a valid case when another task releases the spinlock */ 1087 /* this is a valid case when another task releases the spinlock */
diff --git a/lib/string.c b/lib/string.c
index 8dbb7b1eab50..84775ba873b9 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -203,12 +203,13 @@ ssize_t strscpy(char *dest, const char *src, size_t count)
203 unsigned long c, data; 203 unsigned long c, data;
204 204
205 c = *(unsigned long *)(src+res); 205 c = *(unsigned long *)(src+res);
206 *(unsigned long *)(dest+res) = c;
207 if (has_zero(c, &data, &constants)) { 206 if (has_zero(c, &data, &constants)) {
208 data = prep_zero_mask(c, data, &constants); 207 data = prep_zero_mask(c, data, &constants);
209 data = create_zero_mask(data); 208 data = create_zero_mask(data);
209 *(unsigned long *)(dest+res) = c & zero_bytemask(data);
210 return res + find_zero(data); 210 return res + find_zero(data);
211 } 211 }
212 *(unsigned long *)(dest+res) = c;
212 res += sizeof(unsigned long); 213 res += sizeof(unsigned long);
213 count -= sizeof(unsigned long); 214 count -= sizeof(unsigned long);
214 max -= sizeof(unsigned long); 215 max -= sizeof(unsigned long);
diff --git a/mm/filemap.c b/mm/filemap.c
index 72940fb38666..1cc5467cf36c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2473,6 +2473,21 @@ ssize_t generic_perform_write(struct file *file,
2473 iov_iter_count(i)); 2473 iov_iter_count(i));
2474 2474
2475again: 2475again:
2476 /*
2477 * Bring in the user page that we will copy from _first_.
2478 * Otherwise there's a nasty deadlock on copying from the
2479 * same page as we're writing to, without it being marked
2480 * up-to-date.
2481 *
2482 * Not only is this an optimisation, but it is also required
2483 * to check that the address is actually valid, when atomic
2484 * usercopies are used, below.
2485 */
2486 if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
2487 status = -EFAULT;
2488 break;
2489 }
2490
2476 status = a_ops->write_begin(file, mapping, pos, bytes, flags, 2491 status = a_ops->write_begin(file, mapping, pos, bytes, flags,
2477 &page, &fsdata); 2492 &page, &fsdata);
2478 if (unlikely(status < 0)) 2493 if (unlikely(status < 0))
@@ -2480,17 +2495,8 @@ again:
2480 2495
2481 if (mapping_writably_mapped(mapping)) 2496 if (mapping_writably_mapped(mapping))
2482 flush_dcache_page(page); 2497 flush_dcache_page(page);
2483 /* 2498
2484 * 'page' is now locked. If we are trying to copy from a
2485 * mapping of 'page' in userspace, the copy might fault and
2486 * would need PageUptodate() to complete. But, page can not be
2487 * made Uptodate without acquiring the page lock, which we hold.
2488 * Deadlock. Avoid with pagefault_disable(). Fix up below with
2489 * iov_iter_fault_in_readable().
2490 */
2491 pagefault_disable();
2492 copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes); 2499 copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
2493 pagefault_enable();
2494 flush_dcache_page(page); 2500 flush_dcache_page(page);
2495 2501
2496 status = a_ops->write_end(file, mapping, pos, bytes, copied, 2502 status = a_ops->write_end(file, mapping, pos, bytes, copied,
@@ -2513,14 +2519,6 @@ again:
2513 */ 2519 */
2514 bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset, 2520 bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
2515 iov_iter_single_seg_count(i)); 2521 iov_iter_single_seg_count(i));
2516 /*
2517 * This is the fallback to recover if the copy from
2518 * userspace above faults.
2519 */
2520 if (unlikely(iov_iter_fault_in_readable(i, bytes))) {
2521 status = -EFAULT;
2522 break;
2523 }
2524 goto again; 2522 goto again;
2525 } 2523 }
2526 pos += copied; 2524 pos += copied;
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index cb5174284074..5f6ca47092b0 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -136,7 +136,8 @@ int rdma_read_chunk_lcl(struct svcxprt_rdma *xprt,
136 ctxt->direction = DMA_FROM_DEVICE; 136 ctxt->direction = DMA_FROM_DEVICE;
137 ctxt->read_hdr = head; 137 ctxt->read_hdr = head;
138 pages_needed = min_t(int, pages_needed, xprt->sc_max_sge_rd); 138 pages_needed = min_t(int, pages_needed, xprt->sc_max_sge_rd);
139 read = min_t(int, pages_needed << PAGE_SHIFT, rs_length); 139 read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset,
140 rs_length);
140 141
141 for (pno = 0; pno < pages_needed; pno++) { 142 for (pno = 0; pno < pages_needed; pno++) {
142 int len = min_t(int, rs_length, PAGE_SIZE - pg_off); 143 int len = min_t(int, rs_length, PAGE_SIZE - pg_off);
@@ -235,7 +236,8 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt,
235 ctxt->direction = DMA_FROM_DEVICE; 236 ctxt->direction = DMA_FROM_DEVICE;
236 ctxt->frmr = frmr; 237 ctxt->frmr = frmr;
237 pages_needed = min_t(int, pages_needed, xprt->sc_frmr_pg_list_len); 238 pages_needed = min_t(int, pages_needed, xprt->sc_frmr_pg_list_len);
238 read = min_t(int, pages_needed << PAGE_SHIFT, rs_length); 239 read = min_t(int, (pages_needed << PAGE_SHIFT) - *page_offset,
240 rs_length);
239 241
240 frmr->kva = page_address(rqstp->rq_arg.pages[pg_no]); 242 frmr->kva = page_address(rqstp->rq_arg.pages[pg_no]);
241 frmr->direction = DMA_FROM_DEVICE; 243 frmr->direction = DMA_FROM_DEVICE;
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 64443eb754ad..41e452bc580c 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -270,8 +270,8 @@ xprt_rdma_destroy(struct rpc_xprt *xprt)
270 270
271 xprt_clear_connected(xprt); 271 xprt_clear_connected(xprt);
272 272
273 rpcrdma_buffer_destroy(&r_xprt->rx_buf);
274 rpcrdma_ep_destroy(&r_xprt->rx_ep, &r_xprt->rx_ia); 273 rpcrdma_ep_destroy(&r_xprt->rx_ep, &r_xprt->rx_ia);
274 rpcrdma_buffer_destroy(&r_xprt->rx_buf);
275 rpcrdma_ia_close(&r_xprt->rx_ia); 275 rpcrdma_ia_close(&r_xprt->rx_ia);
276 276
277 xprt_rdma_free_addresses(xprt); 277 xprt_rdma_free_addresses(xprt);
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index eb081ad05e33..8a477e27bad7 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -755,19 +755,22 @@ rpcrdma_ep_destroy(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
755 755
756 cancel_delayed_work_sync(&ep->rep_connect_worker); 756 cancel_delayed_work_sync(&ep->rep_connect_worker);
757 757
758 if (ia->ri_id->qp) { 758 if (ia->ri_id->qp)
759 rpcrdma_ep_disconnect(ep, ia); 759 rpcrdma_ep_disconnect(ep, ia);
760
761 rpcrdma_clean_cq(ep->rep_attr.recv_cq);
762 rpcrdma_clean_cq(ep->rep_attr.send_cq);
763
764 if (ia->ri_id->qp) {
760 rdma_destroy_qp(ia->ri_id); 765 rdma_destroy_qp(ia->ri_id);
761 ia->ri_id->qp = NULL; 766 ia->ri_id->qp = NULL;
762 } 767 }
763 768
764 rpcrdma_clean_cq(ep->rep_attr.recv_cq);
765 rc = ib_destroy_cq(ep->rep_attr.recv_cq); 769 rc = ib_destroy_cq(ep->rep_attr.recv_cq);
766 if (rc) 770 if (rc)
767 dprintk("RPC: %s: ib_destroy_cq returned %i\n", 771 dprintk("RPC: %s: ib_destroy_cq returned %i\n",
768 __func__, rc); 772 __func__, rc);
769 773
770 rpcrdma_clean_cq(ep->rep_attr.send_cq);
771 rc = ib_destroy_cq(ep->rep_attr.send_cq); 774 rc = ib_destroy_cq(ep->rep_attr.send_cq);
772 if (rc) 775 if (rc)
773 dprintk("RPC: %s: ib_destroy_cq returned %i\n", 776 dprintk("RPC: %s: ib_destroy_cq returned %i\n",
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 584a0343ab0c..85813de26da8 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -633,6 +633,7 @@ static const struct snd_pci_quirk cs4208_mac_fixup_tbl[] = {
633 SND_PCI_QUIRK(0x106b, 0x5e00, "MacBookPro 11,2", CS4208_MBP11), 633 SND_PCI_QUIRK(0x106b, 0x5e00, "MacBookPro 11,2", CS4208_MBP11),
634 SND_PCI_QUIRK(0x106b, 0x7100, "MacBookAir 6,1", CS4208_MBA6), 634 SND_PCI_QUIRK(0x106b, 0x7100, "MacBookAir 6,1", CS4208_MBA6),
635 SND_PCI_QUIRK(0x106b, 0x7200, "MacBookAir 6,2", CS4208_MBA6), 635 SND_PCI_QUIRK(0x106b, 0x7200, "MacBookAir 6,2", CS4208_MBA6),
636 SND_PCI_QUIRK(0x106b, 0x7b00, "MacBookPro 12,1", CS4208_MBP11),
636 {} /* terminator */ 637 {} /* terminator */
637}; 638};
638 639
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index afec6dc9f91f..16b8dcba5c12 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5306,6 +5306,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5306 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), 5306 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
5307 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK), 5307 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
5308 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 5308 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
5309 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
5309 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK), 5310 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
5310 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), 5311 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
5311 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), 5312 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9d947aef2c8b..def5cc8dff02 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4520,7 +4520,11 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
4520 return err; 4520 return err;
4521 4521
4522 spec = codec->spec; 4522 spec = codec->spec;
4523 codec->power_save_node = 1; 4523 /* enable power_save_node only for new 92HD89xx chips, as it causes
4524 * click noises on old 92HD73xx chips.
4525 */
4526 if ((codec->core.vendor_id & 0xfffffff0) != 0x111d7670)
4527 codec->power_save_node = 1;
4524 spec->linear_tone_beep = 0; 4528 spec->linear_tone_beep = 0;
4525 spec->gen.mixer_nid = 0x1d; 4529 spec->gen.mixer_nid = 0x1d;
4526 spec->have_spdif_mux = 1; 4530 spec->have_spdif_mux = 1;
diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c
index 58c3164802b8..8c907ebea189 100644
--- a/sound/soc/au1x/db1200.c
+++ b/sound/soc/au1x/db1200.c
@@ -129,6 +129,8 @@ static struct snd_soc_dai_link db1300_i2s_dai = {
129 .cpu_dai_name = "au1xpsc_i2s.2", 129 .cpu_dai_name = "au1xpsc_i2s.2",
130 .platform_name = "au1xpsc-pcm.2", 130 .platform_name = "au1xpsc-pcm.2",
131 .codec_name = "wm8731.0-001b", 131 .codec_name = "wm8731.0-001b",
132 .dai_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF |
133 SND_SOC_DAIFMT_CBM_CFM,
132 .ops = &db1200_i2s_wm8731_ops, 134 .ops = &db1200_i2s_wm8731_ops,
133}; 135};
134 136
@@ -146,6 +148,8 @@ static struct snd_soc_dai_link db1550_i2s_dai = {
146 .cpu_dai_name = "au1xpsc_i2s.3", 148 .cpu_dai_name = "au1xpsc_i2s.3",
147 .platform_name = "au1xpsc-pcm.3", 149 .platform_name = "au1xpsc-pcm.3",
148 .codec_name = "wm8731.0-001b", 150 .codec_name = "wm8731.0-001b",
151 .dai_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF |
152 SND_SOC_DAIFMT_CBM_CFM,
149 .ops = &db1200_i2s_wm8731_ops, 153 .ops = &db1200_i2s_wm8731_ops,
150}; 154};
151 155
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 268a28bd1df4..5c101af0ac63 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -519,11 +519,11 @@ static const struct snd_kcontrol_new rt5645_snd_controls[] = {
519 RT5645_L_VOL_SFT + 1, RT5645_R_VOL_SFT + 1, 63, 0, adc_vol_tlv), 519 RT5645_L_VOL_SFT + 1, RT5645_R_VOL_SFT + 1, 63, 0, adc_vol_tlv),
520 520
521 /* ADC Boost Volume Control */ 521 /* ADC Boost Volume Control */
522 SOC_DOUBLE_TLV("STO1 ADC Boost Gain", RT5645_ADC_BST_VOL1, 522 SOC_DOUBLE_TLV("ADC Boost Capture Volume", RT5645_ADC_BST_VOL1,
523 RT5645_STO1_ADC_L_BST_SFT, RT5645_STO1_ADC_R_BST_SFT, 3, 0, 523 RT5645_STO1_ADC_L_BST_SFT, RT5645_STO1_ADC_R_BST_SFT, 3, 0,
524 adc_bst_tlv), 524 adc_bst_tlv),
525 SOC_DOUBLE_TLV("STO2 ADC Boost Gain", RT5645_ADC_BST_VOL1, 525 SOC_DOUBLE_TLV("Mono ADC Boost Capture Volume", RT5645_ADC_BST_VOL2,
526 RT5645_STO2_ADC_L_BST_SFT, RT5645_STO2_ADC_R_BST_SFT, 3, 0, 526 RT5645_MONO_ADC_L_BST_SFT, RT5645_MONO_ADC_R_BST_SFT, 3, 0,
527 adc_bst_tlv), 527 adc_bst_tlv),
528 528
529 /* I2S2 function select */ 529 /* I2S2 function select */
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h
index 0e4cfc6ac649..8c964cfb120d 100644
--- a/sound/soc/codecs/rt5645.h
+++ b/sound/soc/codecs/rt5645.h
@@ -39,8 +39,8 @@
39#define RT5645_STO1_ADC_DIG_VOL 0x1c 39#define RT5645_STO1_ADC_DIG_VOL 0x1c
40#define RT5645_MONO_ADC_DIG_VOL 0x1d 40#define RT5645_MONO_ADC_DIG_VOL 0x1d
41#define RT5645_ADC_BST_VOL1 0x1e 41#define RT5645_ADC_BST_VOL1 0x1e
42/* Mixer - D-D */
43#define RT5645_ADC_BST_VOL2 0x20 42#define RT5645_ADC_BST_VOL2 0x20
43/* Mixer - D-D */
44#define RT5645_STO1_ADC_MIXER 0x27 44#define RT5645_STO1_ADC_MIXER 0x27
45#define RT5645_MONO_ADC_MIXER 0x28 45#define RT5645_MONO_ADC_MIXER 0x28
46#define RT5645_AD_DA_MIXER 0x29 46#define RT5645_AD_DA_MIXER 0x29
@@ -315,12 +315,14 @@
315#define RT5645_STO1_ADC_R_BST_SFT 12 315#define RT5645_STO1_ADC_R_BST_SFT 12
316#define RT5645_STO1_ADC_COMP_MASK (0x3 << 10) 316#define RT5645_STO1_ADC_COMP_MASK (0x3 << 10)
317#define RT5645_STO1_ADC_COMP_SFT 10 317#define RT5645_STO1_ADC_COMP_SFT 10
318#define RT5645_STO2_ADC_L_BST_MASK (0x3 << 8) 318
319#define RT5645_STO2_ADC_L_BST_SFT 8 319/* ADC Boost Volume Control (0x20) */
320#define RT5645_STO2_ADC_R_BST_MASK (0x3 << 6) 320#define RT5645_MONO_ADC_L_BST_MASK (0x3 << 14)
321#define RT5645_STO2_ADC_R_BST_SFT 6 321#define RT5645_MONO_ADC_L_BST_SFT 14
322#define RT5645_STO2_ADC_COMP_MASK (0x3 << 4) 322#define RT5645_MONO_ADC_R_BST_MASK (0x3 << 12)
323#define RT5645_STO2_ADC_COMP_SFT 4 323#define RT5645_MONO_ADC_R_BST_SFT 12
324#define RT5645_MONO_ADC_COMP_MASK (0x3 << 10)
325#define RT5645_MONO_ADC_COMP_SFT 10
324 326
325/* Stereo2 ADC Mixer Control (0x26) */ 327/* Stereo2 ADC Mixer Control (0x26) */
326#define RT5645_STO2_ADC_SRC_MASK (0x1 << 15) 328#define RT5645_STO2_ADC_SRC_MASK (0x1 << 15)
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index bfda25ef0dd4..f540f82b1f27 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1376,8 +1376,8 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1376 sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT); 1376 sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT);
1377 1377
1378 snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL, 1378 snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL,
1379 SGTL5000_BIAS_R_MASK, 1379 SGTL5000_BIAS_VOLT_MASK,
1380 sgtl5000->micbias_voltage << SGTL5000_BIAS_R_SHIFT); 1380 sgtl5000->micbias_voltage << SGTL5000_BIAS_VOLT_SHIFT);
1381 /* 1381 /*
1382 * disable DAP 1382 * disable DAP
1383 * TODO: 1383 * TODO:
@@ -1549,7 +1549,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1549 else { 1549 else {
1550 sgtl5000->micbias_voltage = 0; 1550 sgtl5000->micbias_voltage = 0;
1551 dev_err(&client->dev, 1551 dev_err(&client->dev,
1552 "Unsuitable MicBias resistor\n"); 1552 "Unsuitable MicBias voltage\n");
1553 } 1553 }
1554 } else { 1554 } else {
1555 sgtl5000->micbias_voltage = 0; 1555 sgtl5000->micbias_voltage = 0;
diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
index e3a0bca28bcf..cc1d3981fa4b 100644
--- a/sound/soc/codecs/tas2552.c
+++ b/sound/soc/codecs/tas2552.c
@@ -549,7 +549,7 @@ static struct snd_soc_dai_driver tas2552_dai[] = {
549/* 549/*
550 * DAC digital volumes. From -7 to 24 dB in 1 dB steps 550 * DAC digital volumes. From -7 to 24 dB in 1 dB steps
551 */ 551 */
552static DECLARE_TLV_DB_SCALE(dac_tlv, -7, 100, 0); 552static DECLARE_TLV_DB_SCALE(dac_tlv, -700, 100, 0);
553 553
554static const char * const tas2552_din_source_select[] = { 554static const char * const tas2552_din_source_select[] = {
555 "Muted", 555 "Muted",
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 1a82b19b2644..8739126a1f6f 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1509,14 +1509,17 @@ static int aic3x_init(struct snd_soc_codec *codec)
1509 snd_soc_write(codec, PGAL_2_LLOPM_VOL, DEFAULT_VOL); 1509 snd_soc_write(codec, PGAL_2_LLOPM_VOL, DEFAULT_VOL);
1510 snd_soc_write(codec, PGAR_2_RLOPM_VOL, DEFAULT_VOL); 1510 snd_soc_write(codec, PGAR_2_RLOPM_VOL, DEFAULT_VOL);
1511 1511
1512 /* Line2 to HP Bypass default volume, disconnect from Output Mixer */ 1512 /* On tlv320aic3104, these registers are reserved and must not be written */
1513 snd_soc_write(codec, LINE2L_2_HPLOUT_VOL, DEFAULT_VOL); 1513 if (aic3x->model != AIC3X_MODEL_3104) {
1514 snd_soc_write(codec, LINE2R_2_HPROUT_VOL, DEFAULT_VOL); 1514 /* Line2 to HP Bypass default volume, disconnect from Output Mixer */
1515 snd_soc_write(codec, LINE2L_2_HPLCOM_VOL, DEFAULT_VOL); 1515 snd_soc_write(codec, LINE2L_2_HPLOUT_VOL, DEFAULT_VOL);
1516 snd_soc_write(codec, LINE2R_2_HPRCOM_VOL, DEFAULT_VOL); 1516 snd_soc_write(codec, LINE2R_2_HPROUT_VOL, DEFAULT_VOL);
1517 /* Line2 Line Out default volume, disconnect from Output Mixer */ 1517 snd_soc_write(codec, LINE2L_2_HPLCOM_VOL, DEFAULT_VOL);
1518 snd_soc_write(codec, LINE2L_2_LLOPM_VOL, DEFAULT_VOL); 1518 snd_soc_write(codec, LINE2R_2_HPRCOM_VOL, DEFAULT_VOL);
1519 snd_soc_write(codec, LINE2R_2_RLOPM_VOL, DEFAULT_VOL); 1519 /* Line2 Line Out default volume, disconnect from Output Mixer */
1520 snd_soc_write(codec, LINE2L_2_LLOPM_VOL, DEFAULT_VOL);
1521 snd_soc_write(codec, LINE2R_2_RLOPM_VOL, DEFAULT_VOL);
1522 }
1520 1523
1521 switch (aic3x->model) { 1524 switch (aic3x->model) {
1522 case AIC3X_MODEL_3X: 1525 case AIC3X_MODEL_3X:
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 293e47a6ff59..2fbc6ef8cbdb 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3760,7 +3760,7 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
3760 ret = snd_soc_register_codec(&i2c->dev, 3760 ret = snd_soc_register_codec(&i2c->dev,
3761 &soc_codec_dev_wm8962, &wm8962_dai, 1); 3761 &soc_codec_dev_wm8962, &wm8962_dai, 1);
3762 if (ret < 0) 3762 if (ret < 0)
3763 goto err_enable; 3763 goto err_pm_runtime;
3764 3764
3765 regcache_cache_only(wm8962->regmap, true); 3765 regcache_cache_only(wm8962->regmap, true);
3766 3766
@@ -3769,6 +3769,8 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
3769 3769
3770 return 0; 3770 return 0;
3771 3771
3772err_pm_runtime:
3773 pm_runtime_disable(&i2c->dev);
3772err_enable: 3774err_enable:
3773 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); 3775 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
3774err: 3776err:
@@ -3778,6 +3780,7 @@ err:
3778static int wm8962_i2c_remove(struct i2c_client *client) 3780static int wm8962_i2c_remove(struct i2c_client *client)
3779{ 3781{
3780 snd_soc_unregister_codec(&client->dev); 3782 snd_soc_unregister_codec(&client->dev);
3783 pm_runtime_disable(&client->dev);
3781 return 0; 3784 return 0;
3782} 3785}
3783 3786
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index a3e97b46b64e..ba34252b7bba 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -131,23 +131,32 @@ static inline void i2s_clear_irqs(struct dw_i2s_dev *dev, u32 stream)
131 131
132 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 132 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
133 for (i = 0; i < 4; i++) 133 for (i = 0; i < 4; i++)
134 i2s_write_reg(dev->i2s_base, TOR(i), 0); 134 i2s_read_reg(dev->i2s_base, TOR(i));
135 } else { 135 } else {
136 for (i = 0; i < 4; i++) 136 for (i = 0; i < 4; i++)
137 i2s_write_reg(dev->i2s_base, ROR(i), 0); 137 i2s_read_reg(dev->i2s_base, ROR(i));
138 } 138 }
139} 139}
140 140
141static void i2s_start(struct dw_i2s_dev *dev, 141static void i2s_start(struct dw_i2s_dev *dev,
142 struct snd_pcm_substream *substream) 142 struct snd_pcm_substream *substream)
143{ 143{
144 144 u32 i, irq;
145 i2s_write_reg(dev->i2s_base, IER, 1); 145 i2s_write_reg(dev->i2s_base, IER, 1);
146 146
147 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 147 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
148 for (i = 0; i < 4; i++) {
149 irq = i2s_read_reg(dev->i2s_base, IMR(i));
150 i2s_write_reg(dev->i2s_base, IMR(i), irq & ~0x30);
151 }
148 i2s_write_reg(dev->i2s_base, ITER, 1); 152 i2s_write_reg(dev->i2s_base, ITER, 1);
149 else 153 } else {
154 for (i = 0; i < 4; i++) {
155 irq = i2s_read_reg(dev->i2s_base, IMR(i));
156 i2s_write_reg(dev->i2s_base, IMR(i), irq & ~0x03);
157 }
150 i2s_write_reg(dev->i2s_base, IRER, 1); 158 i2s_write_reg(dev->i2s_base, IRER, 1);
159 }
151 160
152 i2s_write_reg(dev->i2s_base, CER, 1); 161 i2s_write_reg(dev->i2s_base, CER, 1);
153} 162}
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 48b2d24dd1f0..b95132e2f9dc 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -95,7 +95,8 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
95 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 95 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
96 case SND_SOC_DAIFMT_I2S: 96 case SND_SOC_DAIFMT_I2S:
97 /* data on rising edge of bclk, frame low 1clk before data */ 97 /* data on rising edge of bclk, frame low 1clk before data */
98 strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0; 98 strcr |= SSI_STCR_TXBIT0 | SSI_STCR_TSCKP | SSI_STCR_TFSI |
99 SSI_STCR_TEFS;
99 scr |= SSI_SCR_NET; 100 scr |= SSI_SCR_NET;
100 if (ssi->flags & IMX_SSI_USE_I2S_SLAVE) { 101 if (ssi->flags & IMX_SSI_USE_I2S_SLAVE) {
101 scr &= ~SSI_I2S_MODE_MASK; 102 scr &= ~SSI_I2S_MODE_MASK;
@@ -104,33 +105,31 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
104 break; 105 break;
105 case SND_SOC_DAIFMT_LEFT_J: 106 case SND_SOC_DAIFMT_LEFT_J:
106 /* data on rising edge of bclk, frame high with data */ 107 /* data on rising edge of bclk, frame high with data */
107 strcr |= SSI_STCR_TXBIT0; 108 strcr |= SSI_STCR_TXBIT0 | SSI_STCR_TSCKP;
108 break; 109 break;
109 case SND_SOC_DAIFMT_DSP_B: 110 case SND_SOC_DAIFMT_DSP_B:
110 /* data on rising edge of bclk, frame high with data */ 111 /* data on rising edge of bclk, frame high with data */
111 strcr |= SSI_STCR_TFSL | SSI_STCR_TXBIT0; 112 strcr |= SSI_STCR_TXBIT0 | SSI_STCR_TSCKP | SSI_STCR_TFSL;
112 break; 113 break;
113 case SND_SOC_DAIFMT_DSP_A: 114 case SND_SOC_DAIFMT_DSP_A:
114 /* data on rising edge of bclk, frame high 1clk before data */ 115 /* data on rising edge of bclk, frame high 1clk before data */
115 strcr |= SSI_STCR_TFSL | SSI_STCR_TXBIT0 | SSI_STCR_TEFS; 116 strcr |= SSI_STCR_TXBIT0 | SSI_STCR_TSCKP | SSI_STCR_TFSL |
117 SSI_STCR_TEFS;
116 break; 118 break;
117 } 119 }
118 120
119 /* DAI clock inversion */ 121 /* DAI clock inversion */
120 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 122 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
121 case SND_SOC_DAIFMT_IB_IF: 123 case SND_SOC_DAIFMT_IB_IF:
122 strcr |= SSI_STCR_TFSI; 124 strcr ^= SSI_STCR_TSCKP | SSI_STCR_TFSI;
123 strcr &= ~SSI_STCR_TSCKP;
124 break; 125 break;
125 case SND_SOC_DAIFMT_IB_NF: 126 case SND_SOC_DAIFMT_IB_NF:
126 strcr &= ~(SSI_STCR_TSCKP | SSI_STCR_TFSI); 127 strcr ^= SSI_STCR_TSCKP;
127 break; 128 break;
128 case SND_SOC_DAIFMT_NB_IF: 129 case SND_SOC_DAIFMT_NB_IF:
129 strcr |= SSI_STCR_TFSI | SSI_STCR_TSCKP; 130 strcr ^= SSI_STCR_TFSI;
130 break; 131 break;
131 case SND_SOC_DAIFMT_NB_NF: 132 case SND_SOC_DAIFMT_NB_NF:
132 strcr &= ~SSI_STCR_TFSI;
133 strcr |= SSI_STCR_TSCKP;
134 break; 133 break;
135 } 134 }
136 135
diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c
index 82e350e9501c..ac75816ada7c 100644
--- a/sound/synth/emux/emux_oss.c
+++ b/sound/synth/emux/emux_oss.c
@@ -69,7 +69,8 @@ snd_emux_init_seq_oss(struct snd_emux *emu)
69 struct snd_seq_oss_reg *arg; 69 struct snd_seq_oss_reg *arg;
70 struct snd_seq_device *dev; 70 struct snd_seq_device *dev;
71 71
72 if (snd_seq_device_new(emu->card, 0, SNDRV_SEQ_DEV_ID_OSS, 72 /* using device#1 here for avoiding conflicts with OPL3 */
73 if (snd_seq_device_new(emu->card, 1, SNDRV_SEQ_DEV_ID_OSS,
73 sizeof(struct snd_seq_oss_reg), &dev) < 0) 74 sizeof(struct snd_seq_oss_reg), &dev) < 0)
74 return; 75 return;
75 76
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 349bc96ca1fe..e5f18a288b74 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -17,6 +17,7 @@ libperf-y += levenshtein.o
17libperf-y += llvm-utils.o 17libperf-y += llvm-utils.o
18libperf-y += parse-options.o 18libperf-y += parse-options.o
19libperf-y += parse-events.o 19libperf-y += parse-events.o
20libperf-y += perf_regs.o
20libperf-y += path.o 21libperf-y += path.o
21libperf-y += rbtree.o 22libperf-y += rbtree.o
22libperf-y += bitmap.o 23libperf-y += bitmap.o
@@ -103,7 +104,6 @@ libperf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o
103 104
104libperf-y += scripting-engines/ 105libperf-y += scripting-engines/
105 106
106libperf-$(CONFIG_PERF_REGS) += perf_regs.o
107libperf-$(CONFIG_ZLIB) += zlib.o 107libperf-$(CONFIG_ZLIB) += zlib.o
108libperf-$(CONFIG_LZMA) += lzma.o 108libperf-$(CONFIG_LZMA) += lzma.o
109 109
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 885e8ac83997..6b8eb13e14e4 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -6,6 +6,7 @@ const struct sample_reg __weak sample_reg_masks[] = {
6 SMPL_REG_END 6 SMPL_REG_END
7}; 7};
8 8
9#ifdef HAVE_PERF_REGS_SUPPORT
9int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) 10int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
10{ 11{
11 int i, idx = 0; 12 int i, idx = 0;
@@ -29,3 +30,4 @@ out:
29 *valp = regs->cache_regs[id]; 30 *valp = regs->cache_regs[id];
30 return 0; 31 return 0;
31} 32}
33#endif
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 2984dcc54d67..679d6e493962 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -2,6 +2,7 @@
2#define __PERF_REGS_H 2#define __PERF_REGS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h>
5 6
6struct regs_dump; 7struct regs_dump;
7 8