aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/input/atmel,maxtouch.txt4
-rw-r--r--Documentation/devicetree/bindings/sound/rockchip-i2s.txt2
-rw-r--r--Documentation/devicetree/bindings/spi/spi-rockchip.txt8
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/arm64/mm/init.c3
-rw-r--r--arch/ia64/include/uapi/asm/unistd.h2
-rw-r--r--arch/ia64/pci/fixup.c24
-rw-r--r--arch/mips/Kconfig3
-rw-r--r--arch/mips/Makefile11
-rw-r--r--arch/mips/bcm63xx/irq.c4
-rw-r--r--arch/mips/boot/compressed/decompress.c1
-rw-r--r--arch/mips/include/asm/cop2.h18
-rw-r--r--arch/mips/include/asm/mach-ip28/spaces.h7
-rw-r--r--arch/mips/include/asm/page.h5
-rw-r--r--arch/mips/include/asm/smp.h5
-rw-r--r--arch/mips/include/asm/switch_to.h4
-rw-r--r--arch/mips/include/asm/topology.h8
-rw-r--r--arch/mips/include/uapi/asm/unistd.h18
-rw-r--r--arch/mips/kernel/machine_kexec.c8
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/net/bpf_jit.c5
-rw-r--r--arch/x86/boot/compressed/eboot.c18
-rw-r--r--arch/x86/boot/compressed/head_32.S54
-rw-r--r--arch/x86/boot/compressed/head_64.S56
-rw-r--r--arch/x86/include/asm/io_apic.h1
-rw-r--r--arch/x86/kernel/kprobes/opt.c4
-rw-r--r--arch/x86/mm/dump_pagetables.c4
-rw-r--r--arch/x86/mm/mmap.c2
-rw-r--r--arch/x86/pci/fixup.c24
-rw-r--r--crypto/drbg.c3
-rw-r--r--drivers/acpi/bus.c10
-rw-r--r--drivers/base/regmap/regmap-debugfs.c9
-rw-r--r--drivers/char/hw_random/virtio-rng.c7
-rw-r--r--drivers/firmware/efi/libstub/fdt.c10
-rw-r--r--drivers/gpu/drm/bochs/bochs_kms.c1
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_mode.c1
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c4
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c7
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c1
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c16
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_vga.c9
-rw-r--r--drivers/gpu/drm/radeon/cik_sdma.c7
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c28
-rw-r--r--drivers/gpu/drm/radeon/ni_dma.c6
-rw-r--r--drivers/gpu/drm/radeon/r100.c28
-rw-r--r--drivers/gpu/drm/radeon/r600_dma.c9
-rw-r--r--drivers/gpu/drm/radeon/r600d.h7
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c16
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/rs400.c4
-rw-r--r--drivers/gpu/drm/sti/sti_hdmi.c1
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c6
-rw-r--r--drivers/gpu/vga/vgaarb.c46
-rw-r--r--drivers/input/keyboard/atkbd.c8
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h15
-rw-r--r--drivers/input/serio/i8042.c2
-rw-r--r--drivers/pci/host/pci-imx6.c38
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c16
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c12
-rw-r--r--drivers/pci/hotplug/pcihp_slot.c6
-rw-r--r--drivers/regulator/88pm8607.c2
-rw-r--r--drivers/regulator/da9052-regulator.c4
-rw-r--r--drivers/regulator/max8907-regulator.c2
-rw-r--r--drivers/regulator/max8925-regulator.c2
-rw-r--r--drivers/regulator/max8997.c2
-rw-r--r--drivers/regulator/palmas-regulator.c1
-rw-r--r--drivers/regulator/tps65910-regulator.c2
-rw-r--r--drivers/scsi/libiscsi.c10
-rw-r--r--drivers/scsi/scsi_lib.c5
-rw-r--r--drivers/spi/spi-davinci.c39
-rw-r--r--drivers/spi/spi-dw.c12
-rw-r--r--drivers/spi/spi-fsl-espi.c15
-rw-r--r--drivers/spi/spi-fsl-spi.c10
-rw-r--r--drivers/spi/spi-pl022.c2
-rw-r--r--drivers/spi/spi-rockchip.c5
-rw-r--r--drivers/spi/spi-sirf.c5
-rw-r--r--fs/btrfs/btrfs_inode.h13
-rw-r--r--fs/btrfs/tree-log.c14
-rw-r--r--fs/btrfs/volumes.c13
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/connect.c19
-rw-r--r--fs/cifs/link.c12
-rw-r--r--fs/cifs/netmisc.c20
-rw-r--r--fs/cifs/sess.c17
-rw-r--r--fs/gfs2/bmap.c9
-rw-r--r--fs/gfs2/file.c15
-rw-r--r--fs/gfs2/incore.h7
-rw-r--r--fs/gfs2/inode.c9
-rw-r--r--fs/gfs2/super.c20
-rw-r--r--fs/namei.c39
-rw-r--r--fs/nfs/nfs4client.c38
-rw-r--r--fs/nfs/nfs4proc.c40
-rw-r--r--include/acpi/acpi_bus.h4
-rw-r--r--include/crypto/drbg.h13
-rw-r--r--include/linux/pci.h6
-rw-r--r--include/linux/vga_switcheroo.h2
-rw-r--r--include/linux/vgaarb.h2
-rw-r--r--include/scsi/scsi_tcq.h2
-rw-r--r--init/do_mounts.c12
-rw-r--r--kernel/events/core.c10
-rw-r--r--mm/dmapool.c2
-rw-r--r--sound/pci/hda/patch_sigmatel.c17
-rw-r--r--sound/soc/codecs/cs4265.c6
-rw-r--r--sound/soc/codecs/sta529.c4
-rw-r--r--sound/soc/codecs/tlv320aic31xx.c51
-rw-r--r--sound/soc/davinci/davinci-mcasp.c11
-rw-r--r--sound/soc/dwc/designware_i2s.c4
-rw-r--r--sound/soc/rockchip/rockchip_i2s.c13
-rw-r--r--sound/soc/samsung/i2s.c5
-rw-r--r--sound/soc/soc-compress.c6
-rw-r--r--sound/soc/soc-pcm.c6
-rw-r--r--sound/soc/spear/spear_pcm.c4
124 files changed, 778 insertions, 482 deletions
diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
index 0ac23f2ed104..1852906517ab 100644
--- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
@@ -11,10 +11,6 @@ Required properties:
11 11
12Optional properties for main touchpad device: 12Optional properties for main touchpad device:
13 13
14- linux,gpio-keymap: An array of up to 4 entries indicating the Linux
15 keycode generated by each GPIO. Linux keycodes are defined in
16 <dt-bindings/input/input.h>.
17
18- linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages 14- linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages
19 on GPIO bit changes. An array of up to 8 entries can be provided 15 on GPIO bit changes. An array of up to 8 entries can be provided
20 indicating the Linux keycode mapped to each bit of the status byte, 16 indicating the Linux keycode mapped to each bit of the status byte,
diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
index 6c55fcfe5e1d..9b82c20b306b 100644
--- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt
@@ -31,7 +31,7 @@ i2s@ff890000 {
31 #address-cells = <1>; 31 #address-cells = <1>;
32 #size-cells = <0>; 32 #size-cells = <0>;
33 dmas = <&pdma1 0>, <&pdma1 1>; 33 dmas = <&pdma1 0>, <&pdma1 1>;
34 dma-names = "rx", "tx"; 34 dma-names = "tx", "rx";
35 clock-names = "i2s_hclk", "i2s_clk"; 35 clock-names = "i2s_hclk", "i2s_clk";
36 clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; 36 clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
37}; 37};
diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.txt b/Documentation/devicetree/bindings/spi/spi-rockchip.txt
index 7bab35575817..467dec441c62 100644
--- a/Documentation/devicetree/bindings/spi/spi-rockchip.txt
+++ b/Documentation/devicetree/bindings/spi/spi-rockchip.txt
@@ -16,11 +16,15 @@ Required Properties:
16- clocks: Must contain an entry for each entry in clock-names. 16- clocks: Must contain an entry for each entry in clock-names.
17- clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for 17- clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for
18 the peripheral clock. 18 the peripheral clock.
19- #address-cells: should be 1.
20- #size-cells: should be 0.
21
22Optional Properties:
23
19- dmas: DMA specifiers for tx and rx dma. See the DMA client binding, 24- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
20 Documentation/devicetree/bindings/dma/dma.txt 25 Documentation/devicetree/bindings/dma/dma.txt
21- dma-names: DMA request names should include "tx" and "rx" if present. 26- dma-names: DMA request names should include "tx" and "rx" if present.
22- #address-cells: should be 1. 27
23- #size-cells: should be 0.
24 28
25Example: 29Example:
26 30
diff --git a/MAINTAINERS b/MAINTAINERS
index 809ecd680d88..670b3dcce2de 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6876,7 +6876,7 @@ F: arch/x86/kernel/quirks.c
6876 6876
6877PCI DRIVER FOR IMX6 6877PCI DRIVER FOR IMX6
6878M: Richard Zhu <r65037@freescale.com> 6878M: Richard Zhu <r65037@freescale.com>
6879M: Shawn Guo <shawn.guo@freescale.com> 6879M: Lucas Stach <l.stach@pengutronix.de>
6880L: linux-pci@vger.kernel.org 6880L: linux-pci@vger.kernel.org
6881L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6881L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
6882S: Maintained 6882S: Maintained
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 5472c2401876..a83061f37e43 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -149,8 +149,7 @@ void __init arm64_memblock_init(void)
149 memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start); 149 memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start);
150#endif 150#endif
151 151
152 if (!efi_enabled(EFI_MEMMAP)) 152 early_init_fdt_scan_reserved_mem();
153 early_init_fdt_scan_reserved_mem();
154 153
155 /* 4GB maximum for 32-bit only capable devices */ 154 /* 4GB maximum for 32-bit only capable devices */
156 if (IS_ENABLED(CONFIG_ZONE_DMA)) 155 if (IS_ENABLED(CONFIG_ZONE_DMA))
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index 6a65bb7d0657..18026b2eb582 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -329,6 +329,6 @@
329#define __NR_sched_getattr 1337 329#define __NR_sched_getattr 1337
330#define __NR_renameat2 1338 330#define __NR_renameat2 1338
331#define __NR_getrandom 1339 331#define __NR_getrandom 1339
332#define __NR_memfd_create 1339 332#define __NR_memfd_create 1340
333 333
334#endif /* _UAPI_ASM_IA64_UNISTD_H */ 334#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index ec73b2cf912a..fc505d58f078 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -38,27 +38,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
38 return; 38 return;
39 /* Maybe, this machine supports legacy memory map. */ 39 /* Maybe, this machine supports legacy memory map. */
40 40
41 if (!vga_default_device()) {
42 resource_size_t start, end;
43 int i;
44
45 /* Does firmware framebuffer belong to us? */
46 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
47 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
48 continue;
49
50 start = pci_resource_start(pdev, i);
51 end = pci_resource_end(pdev, i);
52
53 if (!start || !end)
54 continue;
55
56 if (screen_info.lfb_base >= start &&
57 (screen_info.lfb_base + screen_info.lfb_size) < end)
58 vga_set_default_device(pdev);
59 }
60 }
61
62 /* Is VGA routed to us? */ 41 /* Is VGA routed to us? */
63 bus = pdev->bus; 42 bus = pdev->bus;
64 while (bus) { 43 while (bus) {
@@ -83,8 +62,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
83 pci_read_config_word(pdev, PCI_COMMAND, &config); 62 pci_read_config_word(pdev, PCI_COMMAND, &config);
84 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 63 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
85 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 64 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
86 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 65 dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
87 vga_set_default_device(pdev);
88 } 66 }
89 } 67 }
90} 68}
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 900c7e5333b6..574c43000699 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -546,6 +546,7 @@ config SGI_IP28
546 # select SYS_HAS_EARLY_PRINTK 546 # select SYS_HAS_EARLY_PRINTK
547 select SYS_SUPPORTS_64BIT_KERNEL 547 select SYS_SUPPORTS_64BIT_KERNEL
548 select SYS_SUPPORTS_BIG_ENDIAN 548 select SYS_SUPPORTS_BIG_ENDIAN
549 select MIPS_L1_CACHE_SHIFT_7
549 help 550 help
550 This is the SGI Indigo2 with R10000 processor. To compile a Linux 551 This is the SGI Indigo2 with R10000 processor. To compile a Linux
551 kernel that runs on these, say Y here. 552 kernel that runs on these, say Y here.
@@ -2029,7 +2030,9 @@ config MIPS_CMP
2029 bool "MIPS CMP framework support (DEPRECATED)" 2030 bool "MIPS CMP framework support (DEPRECATED)"
2030 depends on SYS_SUPPORTS_MIPS_CMP 2031 depends on SYS_SUPPORTS_MIPS_CMP
2031 select MIPS_GIC_IPI 2032 select MIPS_GIC_IPI
2033 select SMP
2032 select SYNC_R4K 2034 select SYNC_R4K
2035 select SYS_SUPPORTS_SMP
2033 select WEAK_ORDERING 2036 select WEAK_ORDERING
2034 default n 2037 default n
2035 help 2038 help
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 9336509f47ad..bbac51e11179 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -113,7 +113,16 @@ predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
113cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) 113cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be))
114cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) 114cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
115 115
116cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) 116# For smartmips configurations, there are hundreds of warnings due to ISA overrides
117# in assembly and header files. smartmips is only supported for MIPS32r1 onwards
118# and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or
119# similar directives in the kernel will spam the build logs with the following warnings:
120# Warning: the `smartmips' extension requires MIPS32 revision 1 or greater
121# or
122# Warning: the 64-bit MIPS architecture does not support the `smartmips' extension
123# Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has
124# been fixed properly.
125cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) -Wa,--no-warn
117cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips) 126cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips)
118 127
119cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ 128cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index 37eb2d1fa69a..b94bf44d8d8e 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -434,7 +434,7 @@ static void bcm63xx_init_irq(void)
434 irq_stat_addr[0] += PERF_IRQSTAT_3368_REG; 434 irq_stat_addr[0] += PERF_IRQSTAT_3368_REG;
435 irq_mask_addr[0] += PERF_IRQMASK_3368_REG; 435 irq_mask_addr[0] += PERF_IRQMASK_3368_REG;
436 irq_stat_addr[1] = 0; 436 irq_stat_addr[1] = 0;
437 irq_stat_addr[1] = 0; 437 irq_mask_addr[1] = 0;
438 irq_bits = 32; 438 irq_bits = 32;
439 ext_irq_count = 4; 439 ext_irq_count = 4;
440 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; 440 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368;
@@ -443,7 +443,7 @@ static void bcm63xx_init_irq(void)
443 irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0); 443 irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0);
444 irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0); 444 irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0);
445 irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1); 445 irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1);
446 irq_stat_addr[1] += PERF_IRQMASK_6328_REG(1); 446 irq_mask_addr[1] += PERF_IRQMASK_6328_REG(1);
447 irq_bits = 64; 447 irq_bits = 64;
448 ext_irq_count = 4; 448 ext_irq_count = 4;
449 is_ext_irq_cascaded = 1; 449 is_ext_irq_cascaded = 1;
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index b49c7adbfa89..31903cf9709d 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/string.h>
16 17
17#include <asm/addrspace.h> 18#include <asm/addrspace.h>
18 19
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
index d0352983b94d..51f80bd36fcc 100644
--- a/arch/mips/include/asm/cop2.h
+++ b/arch/mips/include/asm/cop2.h
@@ -16,8 +16,8 @@
16extern void octeon_cop2_save(struct octeon_cop2_state *); 16extern void octeon_cop2_save(struct octeon_cop2_state *);
17extern void octeon_cop2_restore(struct octeon_cop2_state *); 17extern void octeon_cop2_restore(struct octeon_cop2_state *);
18 18
19#define cop2_save(r) octeon_cop2_save(r) 19#define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2)
20#define cop2_restore(r) octeon_cop2_restore(r) 20#define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2)
21 21
22#define cop2_present 1 22#define cop2_present 1
23#define cop2_lazy_restore 1 23#define cop2_lazy_restore 1
@@ -26,26 +26,26 @@ extern void octeon_cop2_restore(struct octeon_cop2_state *);
26 26
27extern void nlm_cop2_save(struct nlm_cop2_state *); 27extern void nlm_cop2_save(struct nlm_cop2_state *);
28extern void nlm_cop2_restore(struct nlm_cop2_state *); 28extern void nlm_cop2_restore(struct nlm_cop2_state *);
29#define cop2_save(r) nlm_cop2_save(r) 29
30#define cop2_restore(r) nlm_cop2_restore(r) 30#define cop2_save(r) nlm_cop2_save(&(r)->thread.cp2)
31#define cop2_restore(r) nlm_cop2_restore(&(r)->thread.cp2)
31 32
32#define cop2_present 1 33#define cop2_present 1
33#define cop2_lazy_restore 0 34#define cop2_lazy_restore 0
34 35
35#elif defined(CONFIG_CPU_LOONGSON3) 36#elif defined(CONFIG_CPU_LOONGSON3)
36 37
37#define cop2_save(r)
38#define cop2_restore(r)
39
40#define cop2_present 1 38#define cop2_present 1
41#define cop2_lazy_restore 1 39#define cop2_lazy_restore 1
40#define cop2_save(r) do { (r); } while (0)
41#define cop2_restore(r) do { (r); } while (0)
42 42
43#else 43#else
44 44
45#define cop2_present 0 45#define cop2_present 0
46#define cop2_lazy_restore 0 46#define cop2_lazy_restore 0
47#define cop2_save(r) 47#define cop2_save(r) do { (r); } while (0)
48#define cop2_restore(r) 48#define cop2_restore(r) do { (r); } while (0)
49#endif 49#endif
50 50
51enum cu2_ops { 51enum cu2_ops {
diff --git a/arch/mips/include/asm/mach-ip28/spaces.h b/arch/mips/include/asm/mach-ip28/spaces.h
index 5d6a76434d00..c4a912733b65 100644
--- a/arch/mips/include/asm/mach-ip28/spaces.h
+++ b/arch/mips/include/asm/mach-ip28/spaces.h
@@ -11,15 +11,8 @@
11#ifndef _ASM_MACH_IP28_SPACES_H 11#ifndef _ASM_MACH_IP28_SPACES_H
12#define _ASM_MACH_IP28_SPACES_H 12#define _ASM_MACH_IP28_SPACES_H
13 13
14#define CAC_BASE _AC(0xa800000000000000, UL)
15
16#define HIGHMEM_START (~0UL)
17
18#define PHYS_OFFSET _AC(0x20000000, UL) 14#define PHYS_OFFSET _AC(0x20000000, UL)
19 15
20#define UNCAC_BASE _AC(0xc0000000, UL) /* 0xa0000000 + PHYS_OFFSET */
21#define IO_BASE UNCAC_BASE
22
23#include <asm/mach-generic/spaces.h> 16#include <asm/mach-generic/spaces.h>
24 17
25#endif /* _ASM_MACH_IP28_SPACES_H */ 18#endif /* _ASM_MACH_IP28_SPACES_H */
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index 5699ec3a71af..3be81803595d 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -37,7 +37,7 @@
37 37
38/* 38/*
39 * This is used for calculating the real page sizes 39 * This is used for calculating the real page sizes
40 * for FTLB or VTLB + FTLB confugrations. 40 * for FTLB or VTLB + FTLB configurations.
41 */ 41 */
42static inline unsigned int page_size_ftlb(unsigned int mmuextdef) 42static inline unsigned int page_size_ftlb(unsigned int mmuextdef)
43{ 43{
@@ -223,7 +223,8 @@ static inline int pfn_valid(unsigned long pfn)
223 223
224#endif 224#endif
225 225
226#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr))) 226#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys((void *) \
227 (kaddr))))
227 228
228extern int __virt_addr_valid(const volatile void *kaddr); 229extern int __virt_addr_valid(const volatile void *kaddr);
229#define virt_addr_valid(kaddr) \ 230#define virt_addr_valid(kaddr) \
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 1e0f20a9cdda..eacf865d21c2 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -37,11 +37,6 @@ extern int __cpu_logical_map[NR_CPUS];
37 37
38#define NO_PROC_ID (-1) 38#define NO_PROC_ID (-1)
39 39
40#define topology_physical_package_id(cpu) (cpu_data[cpu].package)
41#define topology_core_id(cpu) (cpu_data[cpu].core)
42#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
43#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu])
44
45#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ 40#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
46#define SMP_CALL_FUNCTION 0x2 41#define SMP_CALL_FUNCTION 0x2
47/* Octeon - Tell another core to flush its icache */ 42/* Octeon - Tell another core to flush its icache */
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
index 495c1041a2cc..b928b6f898cd 100644
--- a/arch/mips/include/asm/switch_to.h
+++ b/arch/mips/include/asm/switch_to.h
@@ -92,7 +92,7 @@ do { \
92 KSTK_STATUS(prev) &= ~ST0_CU2; \ 92 KSTK_STATUS(prev) &= ~ST0_CU2; \
93 __c0_stat = read_c0_status(); \ 93 __c0_stat = read_c0_status(); \
94 write_c0_status(__c0_stat | ST0_CU2); \ 94 write_c0_status(__c0_stat | ST0_CU2); \
95 cop2_save(&prev->thread.cp2); \ 95 cop2_save(prev); \
96 write_c0_status(__c0_stat & ~ST0_CU2); \ 96 write_c0_status(__c0_stat & ~ST0_CU2); \
97 } \ 97 } \
98 __clear_software_ll_bit(); \ 98 __clear_software_ll_bit(); \
@@ -111,7 +111,7 @@ do { \
111 (KSTK_STATUS(current) & ST0_CU2)) { \ 111 (KSTK_STATUS(current) & ST0_CU2)) { \
112 __c0_stat = read_c0_status(); \ 112 __c0_stat = read_c0_status(); \
113 write_c0_status(__c0_stat | ST0_CU2); \ 113 write_c0_status(__c0_stat | ST0_CU2); \
114 cop2_restore(&current->thread.cp2); \ 114 cop2_restore(current); \
115 write_c0_status(__c0_stat & ~ST0_CU2); \ 115 write_c0_status(__c0_stat & ~ST0_CU2); \
116 } \ 116 } \
117 if (cpu_has_dsp) \ 117 if (cpu_has_dsp) \
diff --git a/arch/mips/include/asm/topology.h b/arch/mips/include/asm/topology.h
index 20ea4859c822..3e307ec2afba 100644
--- a/arch/mips/include/asm/topology.h
+++ b/arch/mips/include/asm/topology.h
@@ -9,5 +9,13 @@
9#define __ASM_TOPOLOGY_H 9#define __ASM_TOPOLOGY_H
10 10
11#include <topology.h> 11#include <topology.h>
12#include <linux/smp.h>
13
14#ifdef CONFIG_SMP
15#define topology_physical_package_id(cpu) (cpu_data[cpu].package)
16#define topology_core_id(cpu) (cpu_data[cpu].core)
17#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
18#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu])
19#endif
12 20
13#endif /* __ASM_TOPOLOGY_H */ 21#endif /* __ASM_TOPOLOGY_H */
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index 9bc13eaf9d67..fdb4923777d1 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -373,16 +373,18 @@
373#define __NR_sched_getattr (__NR_Linux + 350) 373#define __NR_sched_getattr (__NR_Linux + 350)
374#define __NR_renameat2 (__NR_Linux + 351) 374#define __NR_renameat2 (__NR_Linux + 351)
375#define __NR_seccomp (__NR_Linux + 352) 375#define __NR_seccomp (__NR_Linux + 352)
376#define __NR_getrandom (__NR_Linux + 353)
377#define __NR_memfd_create (__NR_Linux + 354)
376 378
377/* 379/*
378 * Offset of the last Linux o32 flavoured syscall 380 * Offset of the last Linux o32 flavoured syscall
379 */ 381 */
380#define __NR_Linux_syscalls 352 382#define __NR_Linux_syscalls 354
381 383
382#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 384#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
383 385
384#define __NR_O32_Linux 4000 386#define __NR_O32_Linux 4000
385#define __NR_O32_Linux_syscalls 352 387#define __NR_O32_Linux_syscalls 354
386 388
387#if _MIPS_SIM == _MIPS_SIM_ABI64 389#if _MIPS_SIM == _MIPS_SIM_ABI64
388 390
@@ -703,16 +705,18 @@
703#define __NR_sched_getattr (__NR_Linux + 310) 705#define __NR_sched_getattr (__NR_Linux + 310)
704#define __NR_renameat2 (__NR_Linux + 311) 706#define __NR_renameat2 (__NR_Linux + 311)
705#define __NR_seccomp (__NR_Linux + 312) 707#define __NR_seccomp (__NR_Linux + 312)
708#define __NR_getrandom (__NR_Linux + 313)
709#define __NR_memfd_create (__NR_Linux + 314)
706 710
707/* 711/*
708 * Offset of the last Linux 64-bit flavoured syscall 712 * Offset of the last Linux 64-bit flavoured syscall
709 */ 713 */
710#define __NR_Linux_syscalls 312 714#define __NR_Linux_syscalls 314
711 715
712#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 716#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
713 717
714#define __NR_64_Linux 5000 718#define __NR_64_Linux 5000
715#define __NR_64_Linux_syscalls 312 719#define __NR_64_Linux_syscalls 314
716 720
717#if _MIPS_SIM == _MIPS_SIM_NABI32 721#if _MIPS_SIM == _MIPS_SIM_NABI32
718 722
@@ -1037,15 +1041,17 @@
1037#define __NR_sched_getattr (__NR_Linux + 314) 1041#define __NR_sched_getattr (__NR_Linux + 314)
1038#define __NR_renameat2 (__NR_Linux + 315) 1042#define __NR_renameat2 (__NR_Linux + 315)
1039#define __NR_seccomp (__NR_Linux + 316) 1043#define __NR_seccomp (__NR_Linux + 316)
1044#define __NR_getrandom (__NR_Linux + 317)
1045#define __NR_memfd_create (__NR_Linux + 318)
1040 1046
1041/* 1047/*
1042 * Offset of the last N32 flavoured syscall 1048 * Offset of the last N32 flavoured syscall
1043 */ 1049 */
1044#define __NR_Linux_syscalls 316 1050#define __NR_Linux_syscalls 318
1045 1051
1046#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1052#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
1047 1053
1048#define __NR_N32_Linux 6000 1054#define __NR_N32_Linux 6000
1049#define __NR_N32_Linux_syscalls 316 1055#define __NR_N32_Linux_syscalls 318
1050 1056
1051#endif /* _UAPI_ASM_UNISTD_H */ 1057#endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c
index 992e18474da5..50980bf3983e 100644
--- a/arch/mips/kernel/machine_kexec.c
+++ b/arch/mips/kernel/machine_kexec.c
@@ -71,8 +71,12 @@ machine_kexec(struct kimage *image)
71 kexec_start_address = 71 kexec_start_address =
72 (unsigned long) phys_to_virt(image->start); 72 (unsigned long) phys_to_virt(image->start);
73 73
74 kexec_indirection_page = 74 if (image->type == KEXEC_TYPE_DEFAULT) {
75 (unsigned long) phys_to_virt(image->head & PAGE_MASK); 75 kexec_indirection_page =
76 (unsigned long) phys_to_virt(image->head & PAGE_MASK);
77 } else {
78 kexec_indirection_page = (unsigned long)&image->head;
79 }
76 80
77 memcpy((void*)reboot_code_buffer, relocate_new_kernel, 81 memcpy((void*)reboot_code_buffer, relocate_new_kernel,
78 relocate_new_kernel_size); 82 relocate_new_kernel_size);
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index f93b4cbec739..744cd10ba599 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -577,3 +577,5 @@ EXPORT(sys_call_table)
577 PTR sys_sched_getattr /* 4350 */ 577 PTR sys_sched_getattr /* 4350 */
578 PTR sys_renameat2 578 PTR sys_renameat2
579 PTR sys_seccomp 579 PTR sys_seccomp
580 PTR sys_getrandom
581 PTR sys_memfd_create
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 03ebd9979ad2..002b1bc09c38 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -432,4 +432,6 @@ EXPORT(sys_call_table)
432 PTR sys_sched_getattr /* 5310 */ 432 PTR sys_sched_getattr /* 5310 */
433 PTR sys_renameat2 433 PTR sys_renameat2
434 PTR sys_seccomp 434 PTR sys_seccomp
435 PTR sys_getrandom
436 PTR sys_memfd_create
435 .size sys_call_table,.-sys_call_table 437 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index ebc9228e2e15..ca6cbbe9805b 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -425,4 +425,6 @@ EXPORT(sysn32_call_table)
425 PTR sys_sched_getattr 425 PTR sys_sched_getattr
426 PTR sys_renameat2 /* 6315 */ 426 PTR sys_renameat2 /* 6315 */
427 PTR sys_seccomp 427 PTR sys_seccomp
428 PTR sys_getrandom
429 PTR sys_memfd_create
428 .size sysn32_call_table,.-sysn32_call_table 430 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 25bb8400156d..9e10d11fbb84 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -562,4 +562,6 @@ EXPORT(sys32_call_table)
562 PTR sys_sched_getattr /* 4350 */ 562 PTR sys_sched_getattr /* 4350 */
563 PTR sys_renameat2 563 PTR sys_renameat2
564 PTR sys_seccomp 564 PTR sys_seccomp
565 PTR sys_getrandom
566 PTR sys_memfd_create
565 .size sys32_call_table,.-sys32_call_table 567 .size sys32_call_table,.-sys32_call_table
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 05a56619ece2..9f7ecbda250c 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -793,6 +793,7 @@ static int build_body(struct jit_ctx *ctx)
793 const struct sock_filter *inst; 793 const struct sock_filter *inst;
794 unsigned int i, off, load_order, condt; 794 unsigned int i, off, load_order, condt;
795 u32 k, b_off __maybe_unused; 795 u32 k, b_off __maybe_unused;
796 int tmp;
796 797
797 for (i = 0; i < prog->len; i++) { 798 for (i = 0; i < prog->len; i++) {
798 u16 code; 799 u16 code;
@@ -1332,9 +1333,9 @@ jmp_cmp:
1332 case BPF_ANC | SKF_AD_PKTTYPE: 1333 case BPF_ANC | SKF_AD_PKTTYPE:
1333 ctx->flags |= SEEN_SKB; 1334 ctx->flags |= SEEN_SKB;
1334 1335
1335 off = pkt_type_offset(); 1336 tmp = off = pkt_type_offset();
1336 1337
1337 if (off < 0) 1338 if (tmp < 0)
1338 return -1; 1339 return -1;
1339 emit_load_byte(r_tmp, r_skb, off, ctx); 1340 emit_load_byte(r_tmp, r_skb, off, ctx);
1340 /* Keep only the last 3 bits */ 1341 /* Keep only the last 3 bits */
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index f277184e2ac1..dca9842d8f91 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -1032,7 +1032,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
1032 int i; 1032 int i;
1033 unsigned long ramdisk_addr; 1033 unsigned long ramdisk_addr;
1034 unsigned long ramdisk_size; 1034 unsigned long ramdisk_size;
1035 unsigned long initrd_addr_max;
1036 1035
1037 efi_early = c; 1036 efi_early = c;
1038 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; 1037 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table;
@@ -1095,15 +1094,20 @@ struct boot_params *make_boot_params(struct efi_config *c)
1095 1094
1096 memset(sdt, 0, sizeof(*sdt)); 1095 memset(sdt, 0, sizeof(*sdt));
1097 1096
1098 if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G)
1099 initrd_addr_max = -1UL;
1100 else
1101 initrd_addr_max = hdr->initrd_addr_max;
1102
1103 status = handle_cmdline_files(sys_table, image, 1097 status = handle_cmdline_files(sys_table, image,
1104 (char *)(unsigned long)hdr->cmd_line_ptr, 1098 (char *)(unsigned long)hdr->cmd_line_ptr,
1105 "initrd=", initrd_addr_max, 1099 "initrd=", hdr->initrd_addr_max,
1106 &ramdisk_addr, &ramdisk_size); 1100 &ramdisk_addr, &ramdisk_size);
1101
1102 if (status != EFI_SUCCESS &&
1103 hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) {
1104 efi_printk(sys_table, "Trying to load files to higher address\n");
1105 status = handle_cmdline_files(sys_table, image,
1106 (char *)(unsigned long)hdr->cmd_line_ptr,
1107 "initrd=", -1UL,
1108 &ramdisk_addr, &ramdisk_size);
1109 }
1110
1107 if (status != EFI_SUCCESS) 1111 if (status != EFI_SUCCESS)
1108 goto fail2; 1112 goto fail2;
1109 hdr->ramdisk_image = ramdisk_addr & 0xffffffff; 1113 hdr->ramdisk_image = ramdisk_addr & 0xffffffff;
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index cbed1407a5cd..d6b8aa4c986c 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -30,6 +30,33 @@
30#include <asm/boot.h> 30#include <asm/boot.h>
31#include <asm/asm-offsets.h> 31#include <asm/asm-offsets.h>
32 32
33/*
34 * Adjust our own GOT
35 *
36 * The relocation base must be in %ebx
37 *
38 * It is safe to call this macro more than once, because in some of the
39 * code paths multiple invocations are inevitable, e.g. via the efi*
40 * entry points.
41 *
42 * Relocation is only performed the first time.
43 */
44.macro FIXUP_GOT
45 cmpb $1, got_fixed(%ebx)
46 je 2f
47
48 leal _got(%ebx), %edx
49 leal _egot(%ebx), %ecx
501:
51 cmpl %ecx, %edx
52 jae 2f
53 addl %ebx, (%edx)
54 addl $4, %edx
55 jmp 1b
562:
57 movb $1, got_fixed(%ebx)
58.endm
59
33 __HEAD 60 __HEAD
34ENTRY(startup_32) 61ENTRY(startup_32)
35#ifdef CONFIG_EFI_STUB 62#ifdef CONFIG_EFI_STUB
@@ -56,6 +83,9 @@ ENTRY(efi_pe_entry)
56 add %esi, 88(%eax) 83 add %esi, 88(%eax)
57 pushl %eax 84 pushl %eax
58 85
86 movl %esi, %ebx
87 FIXUP_GOT
88
59 call make_boot_params 89 call make_boot_params
60 cmpl $0, %eax 90 cmpl $0, %eax
61 je fail 91 je fail
@@ -81,6 +111,10 @@ ENTRY(efi32_stub_entry)
81 leal efi32_config(%esi), %eax 111 leal efi32_config(%esi), %eax
82 add %esi, 88(%eax) 112 add %esi, 88(%eax)
83 pushl %eax 113 pushl %eax
114
115 movl %esi, %ebx
116 FIXUP_GOT
117
842: 1182:
85 call efi_main 119 call efi_main
86 cmpl $0, %eax 120 cmpl $0, %eax
@@ -190,19 +224,7 @@ relocated:
190 shrl $2, %ecx 224 shrl $2, %ecx
191 rep stosl 225 rep stosl
192 226
193/* 227 FIXUP_GOT
194 * Adjust our own GOT
195 */
196 leal _got(%ebx), %edx
197 leal _egot(%ebx), %ecx
1981:
199 cmpl %ecx, %edx
200 jae 2f
201 addl %ebx, (%edx)
202 addl $4, %edx
203 jmp 1b
2042:
205
206/* 228/*
207 * Do the decompression, and jump to the new kernel.. 229 * Do the decompression, and jump to the new kernel..
208 */ 230 */
@@ -225,8 +247,12 @@ relocated:
225 xorl %ebx, %ebx 247 xorl %ebx, %ebx
226 jmp *%eax 248 jmp *%eax
227 249
228#ifdef CONFIG_EFI_STUB
229 .data 250 .data
251/* Have we relocated the GOT? */
252got_fixed:
253 .byte 0
254
255#ifdef CONFIG_EFI_STUB
230efi32_config: 256efi32_config:
231 .fill 11,8,0 257 .fill 11,8,0
232 .long efi_call_phys 258 .long efi_call_phys
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 2884e0c3e8a5..50f69c7eaaf4 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -32,6 +32,33 @@
32#include <asm/processor-flags.h> 32#include <asm/processor-flags.h>
33#include <asm/asm-offsets.h> 33#include <asm/asm-offsets.h>
34 34
35/*
36 * Adjust our own GOT
37 *
38 * The relocation base must be in %rbx
39 *
40 * It is safe to call this macro more than once, because in some of the
41 * code paths multiple invocations are inevitable, e.g. via the efi*
42 * entry points.
43 *
44 * Relocation is only performed the first time.
45 */
46.macro FIXUP_GOT
47 cmpb $1, got_fixed(%rip)
48 je 2f
49
50 leaq _got(%rip), %rdx
51 leaq _egot(%rip), %rcx
521:
53 cmpq %rcx, %rdx
54 jae 2f
55 addq %rbx, (%rdx)
56 addq $8, %rdx
57 jmp 1b
582:
59 movb $1, got_fixed(%rip)
60.endm
61
35 __HEAD 62 __HEAD
36 .code32 63 .code32
37ENTRY(startup_32) 64ENTRY(startup_32)
@@ -252,10 +279,13 @@ ENTRY(efi_pe_entry)
252 subq $1b, %rbp 279 subq $1b, %rbp
253 280
254 /* 281 /*
255 * Relocate efi_config->call(). 282 * Relocate efi_config->call() and the GOT entries.
256 */ 283 */
257 addq %rbp, efi64_config+88(%rip) 284 addq %rbp, efi64_config+88(%rip)
258 285
286 movq %rbp, %rbx
287 FIXUP_GOT
288
259 movq %rax, %rdi 289 movq %rax, %rdi
260 call make_boot_params 290 call make_boot_params
261 cmpq $0,%rax 291 cmpq $0,%rax
@@ -271,10 +301,13 @@ handover_entry:
271 subq $1b, %rbp 301 subq $1b, %rbp
272 302
273 /* 303 /*
274 * Relocate efi_config->call(). 304 * Relocate efi_config->call() and the GOT entries.
275 */ 305 */
276 movq efi_config(%rip), %rax 306 movq efi_config(%rip), %rax
277 addq %rbp, 88(%rax) 307 addq %rbp, 88(%rax)
308
309 movq %rbp, %rbx
310 FIXUP_GOT
2782: 3112:
279 movq efi_config(%rip), %rdi 312 movq efi_config(%rip), %rdi
280 call efi_main 313 call efi_main
@@ -385,19 +418,8 @@ relocated:
385 shrq $3, %rcx 418 shrq $3, %rcx
386 rep stosq 419 rep stosq
387 420
388/* 421 FIXUP_GOT
389 * Adjust our own GOT 422
390 */
391 leaq _got(%rip), %rdx
392 leaq _egot(%rip), %rcx
3931:
394 cmpq %rcx, %rdx
395 jae 2f
396 addq %rbx, (%rdx)
397 addq $8, %rdx
398 jmp 1b
3992:
400
401/* 423/*
402 * Do the decompression, and jump to the new kernel.. 424 * Do the decompression, and jump to the new kernel..
403 */ 425 */
@@ -437,6 +459,10 @@ gdt:
437 .quad 0x0000000000000000 /* TS continued */ 459 .quad 0x0000000000000000 /* TS continued */
438gdt_end: 460gdt_end:
439 461
462/* Have we relocated the GOT? */
463got_fixed:
464 .byte 0
465
440#ifdef CONFIG_EFI_STUB 466#ifdef CONFIG_EFI_STUB
441efi_config: 467efi_config:
442 .quad 0 468 .quad 0
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 478c490f3654..1733ab49ac5e 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -239,6 +239,7 @@ static inline int mp_find_ioapic(u32 gsi) { return 0; }
239static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } 239static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; }
240static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } 240static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; }
241static inline void mp_unmap_irq(int irq) { } 241static inline void mp_unmap_irq(int irq) { }
242static inline bool mp_should_keep_irq(struct device *dev) { return 1; }
242 243
243static inline int save_ioapic_entries(void) 244static inline int save_ioapic_entries(void)
244{ 245{
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index f304773285ae..f1314d0bcf0a 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -338,8 +338,10 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
338 * a relative jump. 338 * a relative jump.
339 */ 339 */
340 rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE; 340 rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE;
341 if (abs(rel) > 0x7fffffff) 341 if (abs(rel) > 0x7fffffff) {
342 __arch_remove_optimized_kprobe(op, 0);
342 return -ERANGE; 343 return -ERANGE;
344 }
343 345
344 buf = (u8 *)op->optinsn.insn; 346 buf = (u8 *)op->optinsn.insn;
345 347
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 167ffcac16ed..95a427e57887 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -48,7 +48,9 @@ enum address_markers_idx {
48 LOW_KERNEL_NR, 48 LOW_KERNEL_NR,
49 VMALLOC_START_NR, 49 VMALLOC_START_NR,
50 VMEMMAP_START_NR, 50 VMEMMAP_START_NR,
51# ifdef CONFIG_X86_ESPFIX64
51 ESPFIX_START_NR, 52 ESPFIX_START_NR,
53# endif
52 HIGH_KERNEL_NR, 54 HIGH_KERNEL_NR,
53 MODULES_VADDR_NR, 55 MODULES_VADDR_NR,
54 MODULES_END_NR, 56 MODULES_END_NR,
@@ -71,7 +73,9 @@ static struct addr_marker address_markers[] = {
71 { PAGE_OFFSET, "Low Kernel Mapping" }, 73 { PAGE_OFFSET, "Low Kernel Mapping" },
72 { VMALLOC_START, "vmalloc() Area" }, 74 { VMALLOC_START, "vmalloc() Area" },
73 { VMEMMAP_START, "Vmemmap" }, 75 { VMEMMAP_START, "Vmemmap" },
76# ifdef CONFIG_X86_ESPFIX64
74 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, 77 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 },
78# endif
75 { __START_KERNEL_map, "High Kernel Mapping" }, 79 { __START_KERNEL_map, "High Kernel Mapping" },
76 { MODULES_VADDR, "Modules" }, 80 { MODULES_VADDR, "Modules" },
77 { MODULES_END, "End Modules" }, 81 { MODULES_END, "End Modules" },
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 25e7e1372bb2..919b91205cd4 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -31,7 +31,7 @@
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <asm/elf.h> 32#include <asm/elf.h>
33 33
34struct __read_mostly va_alignment va_align = { 34struct va_alignment __read_mostly va_align = {
35 .flags = -1, 35 .flags = -1,
36}; 36};
37 37
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index c61ea57d1ba1..9a2b7101ae8a 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -326,27 +326,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
326 struct pci_bus *bus; 326 struct pci_bus *bus;
327 u16 config; 327 u16 config;
328 328
329 if (!vga_default_device()) {
330 resource_size_t start, end;
331 int i;
332
333 /* Does firmware framebuffer belong to us? */
334 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
335 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
336 continue;
337
338 start = pci_resource_start(pdev, i);
339 end = pci_resource_end(pdev, i);
340
341 if (!start || !end)
342 continue;
343
344 if (screen_info.lfb_base >= start &&
345 (screen_info.lfb_base + screen_info.lfb_size) < end)
346 vga_set_default_device(pdev);
347 }
348 }
349
350 /* Is VGA routed to us? */ 329 /* Is VGA routed to us? */
351 bus = pdev->bus; 330 bus = pdev->bus;
352 while (bus) { 331 while (bus) {
@@ -371,8 +350,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
371 pci_read_config_word(pdev, PCI_COMMAND, &config); 350 pci_read_config_word(pdev, PCI_COMMAND, &config);
372 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 351 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
373 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 352 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
374 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 353 dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
375 vga_set_default_device(pdev);
376 } 354 }
377 } 355 }
378} 356}
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 7894db9ca90b..a53ee099e281 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1922,9 +1922,6 @@ static inline int __init drbg_healthcheck_sanity(void)
1922 /* overflow max addtllen with personalization string */ 1922 /* overflow max addtllen with personalization string */
1923 ret = drbg_instantiate(drbg, &addtl, coreref, pr); 1923 ret = drbg_instantiate(drbg, &addtl, coreref, pr);
1924 BUG_ON(0 == ret); 1924 BUG_ON(0 == ret);
1925 /* test uninstantated DRBG */
1926 len = drbg_generate(drbg, buf, (max_request_bytes + 1), NULL);
1927 BUG_ON(0 < len);
1928 /* all tests passed */ 1925 /* all tests passed */
1929 rc = 0; 1926 rc = 0;
1930 1927
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 8581f5b84f48..8b67bd0f6bb5 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -177,16 +177,6 @@ void acpi_bus_detach_private_data(acpi_handle handle)
177} 177}
178EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); 178EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data);
179 179
180void acpi_bus_no_hotplug(acpi_handle handle)
181{
182 struct acpi_device *adev = NULL;
183
184 acpi_bus_get_device(handle, &adev);
185 if (adev)
186 adev->flags.no_hotplug = true;
187}
188EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug);
189
190static void acpi_print_osc_error(acpi_handle handle, 180static void acpi_print_osc_error(acpi_handle handle,
191 struct acpi_osc_context *context, char *error) 181 struct acpi_osc_context *context, char *error)
192{ 182{
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 65ea7b256b3e..0c94b661c16f 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
512 map, &regmap_reg_ranges_fops); 512 map, &regmap_reg_ranges_fops);
513 513
514 if (map->max_register || regmap_readable(map, 0)) { 514 if (map->max_register || regmap_readable(map, 0)) {
515 debugfs_create_file("registers", 0400, map->debugfs, 515 umode_t registers_mode;
516
517 if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS))
518 registers_mode = 0600;
519 else
520 registers_mode = 0400;
521
522 debugfs_create_file("registers", registers_mode, map->debugfs,
516 map, &regmap_map_fops); 523 map, &regmap_map_fops);
517 debugfs_create_file("access", 0400, map->debugfs, 524 debugfs_create_file("access", 0400, map->debugfs,
518 map, &regmap_access_fops); 525 map, &regmap_access_fops);
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 2e3139eda93b..132c9ccfdc62 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -36,6 +36,7 @@ struct virtrng_info {
36 int index; 36 int index;
37 bool busy; 37 bool busy;
38 bool hwrng_register_done; 38 bool hwrng_register_done;
39 bool hwrng_removed;
39}; 40};
40 41
41 42
@@ -68,6 +69,9 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait)
68 int ret; 69 int ret;
69 struct virtrng_info *vi = (struct virtrng_info *)rng->priv; 70 struct virtrng_info *vi = (struct virtrng_info *)rng->priv;
70 71
72 if (vi->hwrng_removed)
73 return -ENODEV;
74
71 if (!vi->busy) { 75 if (!vi->busy) {
72 vi->busy = true; 76 vi->busy = true;
73 init_completion(&vi->have_data); 77 init_completion(&vi->have_data);
@@ -137,6 +141,9 @@ static void remove_common(struct virtio_device *vdev)
137{ 141{
138 struct virtrng_info *vi = vdev->priv; 142 struct virtrng_info *vi = vdev->priv;
139 143
144 vi->hwrng_removed = true;
145 vi->data_avail = 0;
146 complete(&vi->have_data);
140 vdev->config->reset(vdev); 147 vdev->config->reset(vdev);
141 vi->busy = false; 148 vi->busy = false;
142 if (vi->hwrng_register_done) 149 if (vi->hwrng_register_done)
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c
index a56bb3528755..c846a9608cbd 100644
--- a/drivers/firmware/efi/libstub/fdt.c
+++ b/drivers/firmware/efi/libstub/fdt.c
@@ -22,7 +22,7 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
22 unsigned long map_size, unsigned long desc_size, 22 unsigned long map_size, unsigned long desc_size,
23 u32 desc_ver) 23 u32 desc_ver)
24{ 24{
25 int node, prev; 25 int node, prev, num_rsv;
26 int status; 26 int status;
27 u32 fdt_val32; 27 u32 fdt_val32;
28 u64 fdt_val64; 28 u64 fdt_val64;
@@ -73,6 +73,14 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
73 prev = node; 73 prev = node;
74 } 74 }
75 75
76 /*
77 * Delete all memory reserve map entries. When booting via UEFI,
78 * kernel will use the UEFI memory map to find reserved regions.
79 */
80 num_rsv = fdt_num_mem_rsv(fdt);
81 while (num_rsv-- > 0)
82 fdt_del_mem_rsv(fdt, num_rsv);
83
76 node = fdt_subnode_offset(fdt, 0, "chosen"); 84 node = fdt_subnode_offset(fdt, 0, "chosen");
77 if (node < 0) { 85 if (node < 0) {
78 node = fdt_add_subnode(fdt, 0, "chosen"); 86 node = fdt_add_subnode(fdt, 0, "chosen");
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index 9d7346b92653..6b7efcf363d6 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -250,6 +250,7 @@ static void bochs_connector_init(struct drm_device *dev)
250 DRM_MODE_CONNECTOR_VIRTUAL); 250 DRM_MODE_CONNECTOR_VIRTUAL);
251 drm_connector_helper_add(connector, 251 drm_connector_helper_add(connector,
252 &bochs_connector_connector_helper_funcs); 252 &bochs_connector_connector_helper_funcs);
253 drm_connector_register(connector);
253} 254}
254 255
255 256
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index e1c5c3222129..c7c5a9d91fa0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -555,6 +555,7 @@ static struct drm_connector *cirrus_vga_init(struct drm_device *dev)
555 555
556 drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs); 556 drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs);
557 557
558 drm_connector_register(connector);
558 return connector; 559 return connector;
559} 560}
560 561
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 81d7681faa63..fdff1d420c14 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1631,6 +1631,10 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
1631 1631
1632 pipe_config->adjusted_mode.flags |= flags; 1632 pipe_config->adjusted_mode.flags |= flags;
1633 1633
1634 if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev) &&
1635 tmp & DP_COLOR_RANGE_16_235)
1636 pipe_config->limited_color_range = true;
1637
1634 pipe_config->has_dp_encoder = true; 1638 pipe_config->has_dp_encoder = true;
1635 1639
1636 intel_dp_get_m_n(crtc, pipe_config); 1640 intel_dp_get_m_n(crtc, pipe_config);
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index f9151f6641d9..ca34de7f6a7b 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -712,7 +712,8 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
712 struct intel_crtc_config *pipe_config) 712 struct intel_crtc_config *pipe_config)
713{ 713{
714 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); 714 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
715 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; 715 struct drm_device *dev = encoder->base.dev;
716 struct drm_i915_private *dev_priv = dev->dev_private;
716 u32 tmp, flags = 0; 717 u32 tmp, flags = 0;
717 int dotclock; 718 int dotclock;
718 719
@@ -734,6 +735,10 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
734 if (tmp & HDMI_MODE_SELECT_HDMI) 735 if (tmp & HDMI_MODE_SELECT_HDMI)
735 pipe_config->has_audio = true; 736 pipe_config->has_audio = true;
736 737
738 if (!HAS_PCH_SPLIT(dev) &&
739 tmp & HDMI_COLOR_RANGE_16_235)
740 pipe_config->limited_color_range = true;
741
737 pipe_config->adjusted_mode.flags |= flags; 742 pipe_config->adjusted_mode.flags |= flags;
738 743
739 if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) 744 if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2d068edd1adc..47a126a0493f 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1400,7 +1400,7 @@ i830_dispatch_execbuffer(struct intel_engine_cs *ring,
1400 */ 1400 */
1401 intel_ring_emit(ring, SRC_COPY_BLT_CMD | BLT_WRITE_RGBA); 1401 intel_ring_emit(ring, SRC_COPY_BLT_CMD | BLT_WRITE_RGBA);
1402 intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_SRC_COPY | 4096); 1402 intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_SRC_COPY | 4096);
1403 intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 1024); 1403 intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 4096);
1404 intel_ring_emit(ring, cs_offset); 1404 intel_ring_emit(ring, cs_offset);
1405 intel_ring_emit(ring, 4096); 1405 intel_ring_emit(ring, 4096);
1406 intel_ring_emit(ring, offset); 1406 intel_ring_emit(ring, offset);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
index 0a44459844e3..05a278bab247 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c
@@ -200,7 +200,6 @@ nvc0_bar_init(struct nouveau_object *object)
200 200
201 nv_mask(priv, 0x000200, 0x00000100, 0x00000000); 201 nv_mask(priv, 0x000200, 0x00000100, 0x00000000);
202 nv_mask(priv, 0x000200, 0x00000100, 0x00000100); 202 nv_mask(priv, 0x000200, 0x00000100, 0x00000100);
203 nv_mask(priv, 0x100c80, 0x00000001, 0x00000000);
204 203
205 nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12); 204 nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12);
206 if (priv->bar[0].mem) 205 if (priv->bar[0].mem)
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
index b19a2b3c1081..32f28dc73ef2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
@@ -60,6 +60,7 @@ nvc0_fb_init(struct nouveau_object *object)
60 60
61 if (priv->r100c10_page) 61 if (priv->r100c10_page)
62 nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); 62 nv_wr32(priv, 0x100c10, priv->r100c10 >> 8);
63 nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */
63 return 0; 64 return 0;
64} 65}
65 66
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
index b54b582e72c4..d5d65285efe5 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c
@@ -98,6 +98,7 @@ static int
98gf100_ltc_init(struct nouveau_object *object) 98gf100_ltc_init(struct nouveau_object *object)
99{ 99{
100 struct nvkm_ltc_priv *priv = (void *)object; 100 struct nvkm_ltc_priv *priv = (void *)object;
101 u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001);
101 int ret; 102 int ret;
102 103
103 ret = nvkm_ltc_init(priv); 104 ret = nvkm_ltc_init(priv);
@@ -107,6 +108,7 @@ gf100_ltc_init(struct nouveau_object *object)
107 nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ 108 nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */
108 nv_wr32(priv, 0x17e8d8, priv->ltc_nr); 109 nv_wr32(priv, 0x17e8d8, priv->ltc_nr);
109 nv_wr32(priv, 0x17e8d4, priv->tag_base); 110 nv_wr32(priv, 0x17e8d4, priv->tag_base);
111 nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000);
110 return 0; 112 return 0;
111} 113}
112 114
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c
index ea716569745d..b39b5d0eb8f9 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c
@@ -28,6 +28,7 @@ static int
28gk104_ltc_init(struct nouveau_object *object) 28gk104_ltc_init(struct nouveau_object *object)
29{ 29{
30 struct nvkm_ltc_priv *priv = (void *)object; 30 struct nvkm_ltc_priv *priv = (void *)object;
31 u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001);
31 int ret; 32 int ret;
32 33
33 ret = nvkm_ltc_init(priv); 34 ret = nvkm_ltc_init(priv);
@@ -37,6 +38,7 @@ gk104_ltc_init(struct nouveau_object *object)
37 nv_wr32(priv, 0x17e8d8, priv->ltc_nr); 38 nv_wr32(priv, 0x17e8d8, priv->ltc_nr);
38 nv_wr32(priv, 0x17e000, priv->ltc_nr); 39 nv_wr32(priv, 0x17e000, priv->ltc_nr);
39 nv_wr32(priv, 0x17e8d4, priv->tag_base); 40 nv_wr32(priv, 0x17e8d4, priv->tag_base);
41 nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000);
40 return 0; 42 return 0;
41} 43}
42 44
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
index 4761b2e9af00..a4de64289762 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c
@@ -98,6 +98,7 @@ static int
98gm107_ltc_init(struct nouveau_object *object) 98gm107_ltc_init(struct nouveau_object *object)
99{ 99{
100 struct nvkm_ltc_priv *priv = (void *)object; 100 struct nvkm_ltc_priv *priv = (void *)object;
101 u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001);
101 int ret; 102 int ret;
102 103
103 ret = nvkm_ltc_init(priv); 104 ret = nvkm_ltc_init(priv);
@@ -106,6 +107,7 @@ gm107_ltc_init(struct nouveau_object *object)
106 107
107 nv_wr32(priv, 0x17e27c, priv->ltc_nr); 108 nv_wr32(priv, 0x17e27c, priv->ltc_nr);
108 nv_wr32(priv, 0x17e278, priv->tag_base); 109 nv_wr32(priv, 0x17e278, priv->tag_base);
110 nv_mask(priv, 0x17e264, 0x00000002, lpg128 ? 0x00000002 : 0x00000000);
109 return 0; 111 return 0;
110} 112}
111 113
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 279206997e5c..622424692b3b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -46,7 +46,6 @@ static struct nouveau_dsm_priv {
46 bool dsm_detected; 46 bool dsm_detected;
47 bool optimus_detected; 47 bool optimus_detected;
48 acpi_handle dhandle; 48 acpi_handle dhandle;
49 acpi_handle other_handle;
50 acpi_handle rom_handle; 49 acpi_handle rom_handle;
51} nouveau_dsm_priv; 50} nouveau_dsm_priv;
52 51
@@ -222,10 +221,9 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
222 if (!dhandle) 221 if (!dhandle)
223 return false; 222 return false;
224 223
225 if (!acpi_has_method(dhandle, "_DSM")) { 224 if (!acpi_has_method(dhandle, "_DSM"))
226 nouveau_dsm_priv.other_handle = dhandle;
227 return false; 225 return false;
228 } 226
229 if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, 227 if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102,
230 1 << NOUVEAU_DSM_POWER)) 228 1 << NOUVEAU_DSM_POWER))
231 retval |= NOUVEAU_DSM_HAS_MUX; 229 retval |= NOUVEAU_DSM_HAS_MUX;
@@ -301,16 +299,6 @@ static bool nouveau_dsm_detect(void)
301 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", 299 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n",
302 acpi_method_name); 300 acpi_method_name);
303 nouveau_dsm_priv.dsm_detected = true; 301 nouveau_dsm_priv.dsm_detected = true;
304 /*
305 * On some systems hotplug events are generated for the device
306 * being switched off when _DSM is executed. They cause ACPI
307 * hotplug to trigger and attempt to remove the device from
308 * the system, which causes it to break down. Prevent that from
309 * happening by setting the no_hotplug flag for the involved
310 * ACPI device objects.
311 */
312 acpi_bus_no_hotplug(nouveau_dsm_priv.dhandle);
313 acpi_bus_no_hotplug(nouveau_dsm_priv.other_handle);
314 ret = true; 302 ret = true;
315 } 303 }
316 304
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 250a5e88c751..9c3af96a7153 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -627,6 +627,7 @@ int nouveau_pmops_suspend(struct device *dev)
627 627
628 pci_save_state(pdev); 628 pci_save_state(pdev);
629 pci_disable_device(pdev); 629 pci_disable_device(pdev);
630 pci_ignore_hotplug(pdev);
630 pci_set_power_state(pdev, PCI_D3hot); 631 pci_set_power_state(pdev, PCI_D3hot);
631 return 0; 632 return 0;
632} 633}
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
index 18d55d447248..c7592ec8ecb8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vga.c
+++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
@@ -108,7 +108,16 @@ void
108nouveau_vga_fini(struct nouveau_drm *drm) 108nouveau_vga_fini(struct nouveau_drm *drm)
109{ 109{
110 struct drm_device *dev = drm->dev; 110 struct drm_device *dev = drm->dev;
111 bool runtime = false;
112
113 if (nouveau_runtime_pm == 1)
114 runtime = true;
115 if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
116 runtime = true;
117
111 vga_switcheroo_unregister_client(dev->pdev); 118 vga_switcheroo_unregister_client(dev->pdev);
119 if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
120 vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
112 vga_client_register(dev->pdev, NULL, NULL, NULL); 121 vga_client_register(dev->pdev, NULL, NULL, NULL);
113} 122}
114 123
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c
index 192278bc993c..c4ffa54b1e3d 100644
--- a/drivers/gpu/drm/radeon/cik_sdma.c
+++ b/drivers/gpu/drm/radeon/cik_sdma.c
@@ -489,13 +489,6 @@ int cik_sdma_resume(struct radeon_device *rdev)
489{ 489{
490 int r; 490 int r;
491 491
492 /* Reset dma */
493 WREG32(SRBM_SOFT_RESET, SOFT_RESET_SDMA | SOFT_RESET_SDMA1);
494 RREG32(SRBM_SOFT_RESET);
495 udelay(50);
496 WREG32(SRBM_SOFT_RESET, 0);
497 RREG32(SRBM_SOFT_RESET);
498
499 r = cik_sdma_load_microcode(rdev); 492 r = cik_sdma_load_microcode(rdev);
500 if (r) 493 if (r)
501 return r; 494 return r;
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 8b58e11b64fa..67cb472d188c 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -33,6 +33,8 @@
33#define KV_MINIMUM_ENGINE_CLOCK 800 33#define KV_MINIMUM_ENGINE_CLOCK 800
34#define SMC_RAM_END 0x40000 34#define SMC_RAM_END 0x40000
35 35
36static int kv_enable_nb_dpm(struct radeon_device *rdev,
37 bool enable);
36static void kv_init_graphics_levels(struct radeon_device *rdev); 38static void kv_init_graphics_levels(struct radeon_device *rdev);
37static int kv_calculate_ds_divider(struct radeon_device *rdev); 39static int kv_calculate_ds_divider(struct radeon_device *rdev);
38static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); 40static int kv_calculate_nbps_level_settings(struct radeon_device *rdev);
@@ -1295,6 +1297,9 @@ void kv_dpm_disable(struct radeon_device *rdev)
1295{ 1297{
1296 kv_smc_bapm_enable(rdev, false); 1298 kv_smc_bapm_enable(rdev, false);
1297 1299
1300 if (rdev->family == CHIP_MULLINS)
1301 kv_enable_nb_dpm(rdev, false);
1302
1298 /* powerup blocks */ 1303 /* powerup blocks */
1299 kv_dpm_powergate_acp(rdev, false); 1304 kv_dpm_powergate_acp(rdev, false);
1300 kv_dpm_powergate_samu(rdev, false); 1305 kv_dpm_powergate_samu(rdev, false);
@@ -1769,15 +1774,24 @@ static int kv_update_dfs_bypass_settings(struct radeon_device *rdev,
1769 return ret; 1774 return ret;
1770} 1775}
1771 1776
1772static int kv_enable_nb_dpm(struct radeon_device *rdev) 1777static int kv_enable_nb_dpm(struct radeon_device *rdev,
1778 bool enable)
1773{ 1779{
1774 struct kv_power_info *pi = kv_get_pi(rdev); 1780 struct kv_power_info *pi = kv_get_pi(rdev);
1775 int ret = 0; 1781 int ret = 0;
1776 1782
1777 if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { 1783 if (enable) {
1778 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); 1784 if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) {
1779 if (ret == 0) 1785 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable);
1780 pi->nb_dpm_enabled = true; 1786 if (ret == 0)
1787 pi->nb_dpm_enabled = true;
1788 }
1789 } else {
1790 if (pi->enable_nb_dpm && pi->nb_dpm_enabled) {
1791 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Disable);
1792 if (ret == 0)
1793 pi->nb_dpm_enabled = false;
1794 }
1781 } 1795 }
1782 1796
1783 return ret; 1797 return ret;
@@ -1864,7 +1878,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev)
1864 } 1878 }
1865 kv_update_sclk_t(rdev); 1879 kv_update_sclk_t(rdev);
1866 if (rdev->family == CHIP_MULLINS) 1880 if (rdev->family == CHIP_MULLINS)
1867 kv_enable_nb_dpm(rdev); 1881 kv_enable_nb_dpm(rdev, true);
1868 } 1882 }
1869 } else { 1883 } else {
1870 if (pi->enable_dpm) { 1884 if (pi->enable_dpm) {
@@ -1889,7 +1903,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev)
1889 } 1903 }
1890 kv_update_acp_boot_level(rdev); 1904 kv_update_acp_boot_level(rdev);
1891 kv_update_sclk_t(rdev); 1905 kv_update_sclk_t(rdev);
1892 kv_enable_nb_dpm(rdev); 1906 kv_enable_nb_dpm(rdev, true);
1893 } 1907 }
1894 } 1908 }
1895 1909
diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c
index 8a3e6221cece..f26f0a9fb522 100644
--- a/drivers/gpu/drm/radeon/ni_dma.c
+++ b/drivers/gpu/drm/radeon/ni_dma.c
@@ -191,12 +191,6 @@ int cayman_dma_resume(struct radeon_device *rdev)
191 u32 reg_offset, wb_offset; 191 u32 reg_offset, wb_offset;
192 int i, r; 192 int i, r;
193 193
194 /* Reset dma */
195 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1);
196 RREG32(SRBM_SOFT_RESET);
197 udelay(50);
198 WREG32(SRBM_SOFT_RESET, 0);
199
200 for (i = 0; i < 2; i++) { 194 for (i = 0; i < 2; i++) {
201 if (i == 0) { 195 if (i == 0) {
202 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; 196 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX];
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 4c5ec44ff328..b0098e792e62 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -821,6 +821,20 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc)
821 return RREG32(RADEON_CRTC2_CRNT_FRAME); 821 return RREG32(RADEON_CRTC2_CRNT_FRAME);
822} 822}
823 823
824/**
825 * r100_ring_hdp_flush - flush Host Data Path via the ring buffer
826 * rdev: radeon device structure
827 * ring: ring buffer struct for emitting packets
828 */
829static void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring)
830{
831 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
832 radeon_ring_write(ring, rdev->config.r100.hdp_cntl |
833 RADEON_HDP_READ_BUFFER_INVALIDATE);
834 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
835 radeon_ring_write(ring, rdev->config.r100.hdp_cntl);
836}
837
824/* Who ever call radeon_fence_emit should call ring_lock and ask 838/* Who ever call radeon_fence_emit should call ring_lock and ask
825 * for enough space (today caller are ib schedule and buffer move) */ 839 * for enough space (today caller are ib schedule and buffer move) */
826void r100_fence_ring_emit(struct radeon_device *rdev, 840void r100_fence_ring_emit(struct radeon_device *rdev,
@@ -1056,20 +1070,6 @@ void r100_gfx_set_wptr(struct radeon_device *rdev,
1056 (void)RREG32(RADEON_CP_RB_WPTR); 1070 (void)RREG32(RADEON_CP_RB_WPTR);
1057} 1071}
1058 1072
1059/**
1060 * r100_ring_hdp_flush - flush Host Data Path via the ring buffer
1061 * rdev: radeon device structure
1062 * ring: ring buffer struct for emitting packets
1063 */
1064void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring)
1065{
1066 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
1067 radeon_ring_write(ring, rdev->config.r100.hdp_cntl |
1068 RADEON_HDP_READ_BUFFER_INVALIDATE);
1069 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
1070 radeon_ring_write(ring, rdev->config.r100.hdp_cntl);
1071}
1072
1073static void r100_cp_load_microcode(struct radeon_device *rdev) 1073static void r100_cp_load_microcode(struct radeon_device *rdev)
1074{ 1074{
1075 const __be32 *fw_data; 1075 const __be32 *fw_data;
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c
index 51fd98553eaf..a908daa006d2 100644
--- a/drivers/gpu/drm/radeon/r600_dma.c
+++ b/drivers/gpu/drm/radeon/r600_dma.c
@@ -124,15 +124,6 @@ int r600_dma_resume(struct radeon_device *rdev)
124 u32 rb_bufsz; 124 u32 rb_bufsz;
125 int r; 125 int r;
126 126
127 /* Reset dma */
128 if (rdev->family >= CHIP_RV770)
129 WREG32(SRBM_SOFT_RESET, RV770_SOFT_RESET_DMA);
130 else
131 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA);
132 RREG32(SRBM_SOFT_RESET);
133 udelay(50);
134 WREG32(SRBM_SOFT_RESET, 0);
135
136 WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); 127 WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0);
137 WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); 128 WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0);
138 129
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 0c4a7d8d93e0..31e1052ad3e3 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -44,13 +44,6 @@
44#define R6XX_MAX_PIPES 8 44#define R6XX_MAX_PIPES 8
45#define R6XX_MAX_PIPES_MASK 0xff 45#define R6XX_MAX_PIPES_MASK 0xff
46 46
47/* PTE flags */
48#define PTE_VALID (1 << 0)
49#define PTE_SYSTEM (1 << 1)
50#define PTE_SNOOPED (1 << 2)
51#define PTE_READABLE (1 << 5)
52#define PTE_WRITEABLE (1 << 6)
53
54/* tiling bits */ 47/* tiling bits */
55#define ARRAY_LINEAR_GENERAL 0x00000000 48#define ARRAY_LINEAR_GENERAL 0x00000000
56#define ARRAY_LINEAR_ALIGNED 0x00000001 49#define ARRAY_LINEAR_ALIGNED 0x00000001
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index eeeeabe09758..2dd5847f9b98 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -185,7 +185,6 @@ static struct radeon_asic_ring r100_gfx_ring = {
185 .get_rptr = &r100_gfx_get_rptr, 185 .get_rptr = &r100_gfx_get_rptr,
186 .get_wptr = &r100_gfx_get_wptr, 186 .get_wptr = &r100_gfx_get_wptr,
187 .set_wptr = &r100_gfx_set_wptr, 187 .set_wptr = &r100_gfx_set_wptr,
188 .hdp_flush = &r100_ring_hdp_flush,
189}; 188};
190 189
191static struct radeon_asic r100_asic = { 190static struct radeon_asic r100_asic = {
@@ -332,7 +331,6 @@ static struct radeon_asic_ring r300_gfx_ring = {
332 .get_rptr = &r100_gfx_get_rptr, 331 .get_rptr = &r100_gfx_get_rptr,
333 .get_wptr = &r100_gfx_get_wptr, 332 .get_wptr = &r100_gfx_get_wptr,
334 .set_wptr = &r100_gfx_set_wptr, 333 .set_wptr = &r100_gfx_set_wptr,
335 .hdp_flush = &r100_ring_hdp_flush,
336}; 334};
337 335
338static struct radeon_asic r300_asic = { 336static struct radeon_asic r300_asic = {
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 275a5dc01780..7756bc1e1cd3 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -148,8 +148,7 @@ u32 r100_gfx_get_wptr(struct radeon_device *rdev,
148 struct radeon_ring *ring); 148 struct radeon_ring *ring);
149void r100_gfx_set_wptr(struct radeon_device *rdev, 149void r100_gfx_set_wptr(struct radeon_device *rdev,
150 struct radeon_ring *ring); 150 struct radeon_ring *ring);
151void r100_ring_hdp_flush(struct radeon_device *rdev, 151
152 struct radeon_ring *ring);
153/* 152/*
154 * r200,rv250,rs300,rv280 153 * r200,rv250,rs300,rv280
155 */ 154 */
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index a9fb0d016d38..8bc7d0bbd3c8 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -33,7 +33,6 @@ static struct radeon_atpx_priv {
33 bool atpx_detected; 33 bool atpx_detected;
34 /* handle for device - and atpx */ 34 /* handle for device - and atpx */
35 acpi_handle dhandle; 35 acpi_handle dhandle;
36 acpi_handle other_handle;
37 struct radeon_atpx atpx; 36 struct radeon_atpx atpx;
38} radeon_atpx_priv; 37} radeon_atpx_priv;
39 38
@@ -453,10 +452,9 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
453 return false; 452 return false;
454 453
455 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); 454 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
456 if (ACPI_FAILURE(status)) { 455 if (ACPI_FAILURE(status))
457 radeon_atpx_priv.other_handle = dhandle;
458 return false; 456 return false;
459 } 457
460 radeon_atpx_priv.dhandle = dhandle; 458 radeon_atpx_priv.dhandle = dhandle;
461 radeon_atpx_priv.atpx.handle = atpx_handle; 459 radeon_atpx_priv.atpx.handle = atpx_handle;
462 return true; 460 return true;
@@ -540,16 +538,6 @@ static bool radeon_atpx_detect(void)
540 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", 538 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n",
541 acpi_method_name); 539 acpi_method_name);
542 radeon_atpx_priv.atpx_detected = true; 540 radeon_atpx_priv.atpx_detected = true;
543 /*
544 * On some systems hotplug events are generated for the device
545 * being switched off when ATPX is executed. They cause ACPI
546 * hotplug to trigger and attempt to remove the device from
547 * the system, which causes it to break down. Prevent that from
548 * happening by setting the no_hotplug flag for the involved
549 * ACPI device objects.
550 */
551 acpi_bus_no_hotplug(radeon_atpx_priv.dhandle);
552 acpi_bus_no_hotplug(radeon_atpx_priv.other_handle);
553 return true; 541 return true;
554 } 542 }
555 return false; 543 return false;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 6a219bcee66d..75223dd3a8a3 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1393,7 +1393,7 @@ int radeon_device_init(struct radeon_device *rdev,
1393 1393
1394 r = radeon_init(rdev); 1394 r = radeon_init(rdev);
1395 if (r) 1395 if (r)
1396 return r; 1396 goto failed;
1397 1397
1398 r = radeon_ib_ring_tests(rdev); 1398 r = radeon_ib_ring_tests(rdev);
1399 if (r) 1399 if (r)
@@ -1413,7 +1413,7 @@ int radeon_device_init(struct radeon_device *rdev,
1413 radeon_agp_disable(rdev); 1413 radeon_agp_disable(rdev);
1414 r = radeon_init(rdev); 1414 r = radeon_init(rdev);
1415 if (r) 1415 if (r)
1416 return r; 1416 goto failed;
1417 } 1417 }
1418 1418
1419 if ((radeon_testing & 1)) { 1419 if ((radeon_testing & 1)) {
@@ -1435,6 +1435,11 @@ int radeon_device_init(struct radeon_device *rdev,
1435 DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); 1435 DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n");
1436 } 1436 }
1437 return 0; 1437 return 0;
1438
1439failed:
1440 if (runtime)
1441 vga_switcheroo_fini_domain_pm_ops(rdev->dev);
1442 return r;
1438} 1443}
1439 1444
1440static void radeon_debugfs_remove_files(struct radeon_device *rdev); 1445static void radeon_debugfs_remove_files(struct radeon_device *rdev);
@@ -1455,6 +1460,8 @@ void radeon_device_fini(struct radeon_device *rdev)
1455 radeon_bo_evict_vram(rdev); 1460 radeon_bo_evict_vram(rdev);
1456 radeon_fini(rdev); 1461 radeon_fini(rdev);
1457 vga_switcheroo_unregister_client(rdev->pdev); 1462 vga_switcheroo_unregister_client(rdev->pdev);
1463 if (rdev->flags & RADEON_IS_PX)
1464 vga_switcheroo_fini_domain_pm_ops(rdev->dev);
1458 vga_client_register(rdev->pdev, NULL, NULL, NULL); 1465 vga_client_register(rdev->pdev, NULL, NULL, NULL);
1459 if (rdev->rio_mem) 1466 if (rdev->rio_mem)
1460 pci_iounmap(rdev->pdev, rdev->rio_mem); 1467 pci_iounmap(rdev->pdev, rdev->rio_mem);
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 8df888908833..4126fd0937a2 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -83,7 +83,7 @@
83 * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG 83 * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG
84 * 2.39.0 - Add INFO query for number of active CUs 84 * 2.39.0 - Add INFO query for number of active CUs
85 * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting 85 * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting
86 * CS to GPU 86 * CS to GPU on >= r600
87 */ 87 */
88#define KMS_DRIVER_MAJOR 2 88#define KMS_DRIVER_MAJOR 2
89#define KMS_DRIVER_MINOR 40 89#define KMS_DRIVER_MINOR 40
@@ -440,6 +440,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev)
440 ret = radeon_suspend_kms(drm_dev, false, false); 440 ret = radeon_suspend_kms(drm_dev, false, false);
441 pci_save_state(pdev); 441 pci_save_state(pdev);
442 pci_disable_device(pdev); 442 pci_disable_device(pdev);
443 pci_ignore_hotplug(pdev);
443 pci_set_power_state(pdev, PCI_D3cold); 444 pci_set_power_state(pdev, PCI_D3cold);
444 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; 445 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
445 446
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index 6c1fc339d228..c5799f16aa4b 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -221,9 +221,9 @@ void rs400_gart_set_page(struct radeon_device *rdev, unsigned i,
221 entry = (lower_32_bits(addr) & PAGE_MASK) | 221 entry = (lower_32_bits(addr) & PAGE_MASK) |
222 ((upper_32_bits(addr) & 0xff) << 4); 222 ((upper_32_bits(addr) & 0xff) << 4);
223 if (flags & RADEON_GART_PAGE_READ) 223 if (flags & RADEON_GART_PAGE_READ)
224 addr |= RS400_PTE_READABLE; 224 entry |= RS400_PTE_READABLE;
225 if (flags & RADEON_GART_PAGE_WRITE) 225 if (flags & RADEON_GART_PAGE_WRITE)
226 addr |= RS400_PTE_WRITEABLE; 226 entry |= RS400_PTE_WRITEABLE;
227 if (!(flags & RADEON_GART_PAGE_SNOOP)) 227 if (!(flags & RADEON_GART_PAGE_SNOOP))
228 entry |= RS400_PTE_UNSNOOPED; 228 entry |= RS400_PTE_UNSNOOPED;
229 entry = cpu_to_le32(entry); 229 entry = cpu_to_le32(entry);
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index ef93156a69c6..b22968c08d1f 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -298,7 +298,6 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
298 hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI)); 298 hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI));
299 299
300 val = frame[0xC]; 300 val = frame[0xC];
301 val |= frame[0xD] << 8;
302 hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI)); 301 hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI));
303 302
304 /* Enable transmission slot for AVI infoframe 303 /* Enable transmission slot for AVI infoframe
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 6866448083b2..37ac7b5dbd06 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -660,6 +660,12 @@ int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *
660} 660}
661EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); 661EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops);
662 662
663void vga_switcheroo_fini_domain_pm_ops(struct device *dev)
664{
665 dev->pm_domain = NULL;
666}
667EXPORT_SYMBOL(vga_switcheroo_fini_domain_pm_ops);
668
663static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) 669static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev)
664{ 670{
665 struct pci_dev *pdev = to_pci_dev(dev); 671 struct pci_dev *pdev = to_pci_dev(dev);
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index d2077f040f3e..77711623b973 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -41,6 +41,7 @@
41#include <linux/poll.h> 41#include <linux/poll.h>
42#include <linux/miscdevice.h> 42#include <linux/miscdevice.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/screen_info.h>
44 45
45#include <linux/uaccess.h> 46#include <linux/uaccess.h>
46 47
@@ -112,10 +113,8 @@ both:
112 return 1; 113 return 1;
113} 114}
114 115
115#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
116/* this is only used a cookie - it should not be dereferenced */ 116/* this is only used a cookie - it should not be dereferenced */
117static struct pci_dev *vga_default; 117static struct pci_dev *vga_default;
118#endif
119 118
120static void vga_arb_device_card_gone(struct pci_dev *pdev); 119static void vga_arb_device_card_gone(struct pci_dev *pdev);
121 120
@@ -131,7 +130,6 @@ static struct vga_device *vgadev_find(struct pci_dev *pdev)
131} 130}
132 131
133/* Returns the default VGA device (vgacon's babe) */ 132/* Returns the default VGA device (vgacon's babe) */
134#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
135struct pci_dev *vga_default_device(void) 133struct pci_dev *vga_default_device(void)
136{ 134{
137 return vga_default; 135 return vga_default;
@@ -147,7 +145,6 @@ void vga_set_default_device(struct pci_dev *pdev)
147 pci_dev_put(vga_default); 145 pci_dev_put(vga_default);
148 vga_default = pci_dev_get(pdev); 146 vga_default = pci_dev_get(pdev);
149} 147}
150#endif
151 148
152static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) 149static inline void vga_irq_set_state(struct vga_device *vgadev, bool state)
153{ 150{
@@ -583,11 +580,12 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)
583 /* Deal with VGA default device. Use first enabled one 580 /* Deal with VGA default device. Use first enabled one
584 * by default if arch doesn't have it's own hook 581 * by default if arch doesn't have it's own hook
585 */ 582 */
586#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
587 if (vga_default == NULL && 583 if (vga_default == NULL &&
588 ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) 584 ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) {
585 pr_info("vgaarb: setting as boot device: PCI:%s\n",
586 pci_name(pdev));
589 vga_set_default_device(pdev); 587 vga_set_default_device(pdev);
590#endif 588 }
591 589
592 vga_arbiter_check_bridge_sharing(vgadev); 590 vga_arbiter_check_bridge_sharing(vgadev);
593 591
@@ -621,10 +619,8 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev)
621 goto bail; 619 goto bail;
622 } 620 }
623 621
624#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
625 if (vga_default == pdev) 622 if (vga_default == pdev)
626 vga_set_default_device(NULL); 623 vga_set_default_device(NULL);
627#endif
628 624
629 if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) 625 if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM))
630 vga_decode_count--; 626 vga_decode_count--;
@@ -1320,6 +1316,38 @@ static int __init vga_arb_device_init(void)
1320 pr_info("vgaarb: loaded\n"); 1316 pr_info("vgaarb: loaded\n");
1321 1317
1322 list_for_each_entry(vgadev, &vga_list, list) { 1318 list_for_each_entry(vgadev, &vga_list, list) {
1319#if defined(CONFIG_X86) || defined(CONFIG_IA64)
1320 /* Override I/O based detection done by vga_arbiter_add_pci_device()
1321 * as it may take the wrong device (e.g. on Apple system under EFI).
1322 *
1323 * Select the device owning the boot framebuffer if there is one.
1324 */
1325 resource_size_t start, end;
1326 int i;
1327
1328 /* Does firmware framebuffer belong to us? */
1329 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
1330 if (!(pci_resource_flags(vgadev->pdev, i) & IORESOURCE_MEM))
1331 continue;
1332
1333 start = pci_resource_start(vgadev->pdev, i);
1334 end = pci_resource_end(vgadev->pdev, i);
1335
1336 if (!start || !end)
1337 continue;
1338
1339 if (screen_info.lfb_base < start ||
1340 (screen_info.lfb_base + screen_info.lfb_size) >= end)
1341 continue;
1342 if (!vga_default_device())
1343 pr_info("vgaarb: setting as boot device: PCI:%s\n",
1344 pci_name(vgadev->pdev));
1345 else if (vgadev->pdev != vga_default_device())
1346 pr_info("vgaarb: overriding boot device: PCI:%s\n",
1347 pci_name(vgadev->pdev));
1348 vga_set_default_device(vgadev->pdev);
1349 }
1350#endif
1323 if (vgadev->bridge_has_one_vga) 1351 if (vgadev->bridge_has_one_vga)
1324 pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); 1352 pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev));
1325 else 1353 else
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 2dd1d0dd4f7d..6f5d79569136 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -1791,14 +1791,6 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = {
1791 { 1791 {
1792 .matches = { 1792 .matches = {
1793 DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), 1793 DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
1794 DMI_MATCH(DMI_PRODUCT_NAME, "LW25-B7HV"),
1795 },
1796 .callback = atkbd_deactivate_fixup,
1797 },
1798 {
1799 .matches = {
1800 DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
1801 DMI_MATCH(DMI_PRODUCT_NAME, "P1-J273B"),
1802 }, 1794 },
1803 .callback = atkbd_deactivate_fixup, 1795 .callback = atkbd_deactivate_fixup,
1804 }, 1796 },
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 136b7b204f56..713e3ddb43bd 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -465,6 +465,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
465 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), 465 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
466 }, 466 },
467 }, 467 },
468 {
469 /* Avatar AVIU-145A6 */
470 .matches = {
471 DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
472 DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"),
473 },
474 },
468 { } 475 { }
469}; 476};
470 477
@@ -608,6 +615,14 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = {
608 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), 615 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"),
609 }, 616 },
610 }, 617 },
618 {
619 /* Fujitsu U574 laptop */
620 /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */
621 .matches = {
622 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
623 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"),
624 },
625 },
611 { } 626 { }
612}; 627};
613 628
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 3807c3e971cc..f5a98af3b325 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1254,6 +1254,8 @@ static int __init i8042_create_aux_port(int idx)
1254 } else { 1254 } else {
1255 snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); 1255 snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx);
1256 snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); 1256 snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1);
1257 strlcpy(serio->firmware_id, i8042_aux_firmware_id,
1258 sizeof(serio->firmware_id));
1257 } 1259 }
1258 1260
1259 port->serio = serio; 1261 port->serio = serio;
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index a568efaa331c..35fc73a8d0b3 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -49,6 +49,9 @@ struct imx6_pcie {
49 49
50/* PCIe Port Logic registers (memory-mapped) */ 50/* PCIe Port Logic registers (memory-mapped) */
51#define PL_OFFSET 0x700 51#define PL_OFFSET 0x700
52#define PCIE_PL_PFLR (PL_OFFSET + 0x08)
53#define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16)
54#define PCIE_PL_PFLR_FORCE_LINK (1 << 15)
52#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) 55#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
53#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) 56#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
54#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) 57#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29)
@@ -214,6 +217,32 @@ static int imx6q_pcie_abort_handler(unsigned long addr,
214static int imx6_pcie_assert_core_reset(struct pcie_port *pp) 217static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
215{ 218{
216 struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); 219 struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp);
220 u32 val, gpr1, gpr12;
221
222 /*
223 * If the bootloader already enabled the link we need some special
224 * handling to get the core back into a state where it is safe to
225 * touch it for configuration. As there is no dedicated reset signal
226 * wired up for MX6QDL, we need to manually force LTSSM into "detect"
227 * state before completely disabling LTSSM, which is a prerequisite
228 * for core configuration.
229 *
230 * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong
231 * indication that the bootloader activated the link.
232 */
233 regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, &gpr1);
234 regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, &gpr12);
235
236 if ((gpr1 & IMX6Q_GPR1_PCIE_REF_CLK_EN) &&
237 (gpr12 & IMX6Q_GPR12_PCIE_CTL_2)) {
238 val = readl(pp->dbi_base + PCIE_PL_PFLR);
239 val &= ~PCIE_PL_PFLR_LINK_STATE_MASK;
240 val |= PCIE_PL_PFLR_FORCE_LINK;
241 writel(val, pp->dbi_base + PCIE_PL_PFLR);
242
243 regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
244 IMX6Q_GPR12_PCIE_CTL_2, 0 << 10);
245 }
217 246
218 regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, 247 regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
219 IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); 248 IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18);
@@ -589,6 +618,14 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
589 return 0; 618 return 0;
590} 619}
591 620
621static void imx6_pcie_shutdown(struct platform_device *pdev)
622{
623 struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev);
624
625 /* bring down link, so bootloader gets clean state in case of reboot */
626 imx6_pcie_assert_core_reset(&imx6_pcie->pp);
627}
628
592static const struct of_device_id imx6_pcie_of_match[] = { 629static const struct of_device_id imx6_pcie_of_match[] = {
593 { .compatible = "fsl,imx6q-pcie", }, 630 { .compatible = "fsl,imx6q-pcie", },
594 {}, 631 {},
@@ -601,6 +638,7 @@ static struct platform_driver imx6_pcie_driver = {
601 .owner = THIS_MODULE, 638 .owner = THIS_MODULE,
602 .of_match_table = imx6_pcie_of_match, 639 .of_match_table = imx6_pcie_of_match,
603 }, 640 },
641 .shutdown = imx6_pcie_shutdown,
604}; 642};
605 643
606/* Freescale PCIe driver does not allow module unload */ 644/* Freescale PCIe driver does not allow module unload */
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 70741c8c46a0..6cd5160fc057 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -560,19 +560,15 @@ static void disable_slot(struct acpiphp_slot *slot)
560 slot->flags &= (~SLOT_ENABLED); 560 slot->flags &= (~SLOT_ENABLED);
561} 561}
562 562
563static bool acpiphp_no_hotplug(struct acpi_device *adev)
564{
565 return adev && adev->flags.no_hotplug;
566}
567
568static bool slot_no_hotplug(struct acpiphp_slot *slot) 563static bool slot_no_hotplug(struct acpiphp_slot *slot)
569{ 564{
570 struct acpiphp_func *func; 565 struct pci_bus *bus = slot->bus;
566 struct pci_dev *dev;
571 567
572 list_for_each_entry(func, &slot->funcs, sibling) 568 list_for_each_entry(dev, &bus->devices, bus_list) {
573 if (acpiphp_no_hotplug(func_to_acpi_device(func))) 569 if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug)
574 return true; 570 return true;
575 571 }
576 return false; 572 return false;
577} 573}
578 574
@@ -645,7 +641,7 @@ static void trim_stale_devices(struct pci_dev *dev)
645 641
646 status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); 642 status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
647 alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) 643 alive = (ACPI_SUCCESS(status) && device_status_valid(sta))
648 || acpiphp_no_hotplug(adev); 644 || dev->ignore_hotplug;
649 } 645 }
650 if (!alive) 646 if (!alive)
651 alive = pci_device_is_present(dev); 647 alive = pci_device_is_present(dev);
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 9da84b8b27d8..5e01ae39ec46 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -506,6 +506,8 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
506{ 506{
507 struct controller *ctrl = (struct controller *)dev_id; 507 struct controller *ctrl = (struct controller *)dev_id;
508 struct pci_dev *pdev = ctrl_dev(ctrl); 508 struct pci_dev *pdev = ctrl_dev(ctrl);
509 struct pci_bus *subordinate = pdev->subordinate;
510 struct pci_dev *dev;
509 struct slot *slot = ctrl->slot; 511 struct slot *slot = ctrl->slot;
510 u16 detected, intr_loc; 512 u16 detected, intr_loc;
511 513
@@ -539,6 +541,16 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
539 wake_up(&ctrl->queue); 541 wake_up(&ctrl->queue);
540 } 542 }
541 543
544 if (subordinate) {
545 list_for_each_entry(dev, &subordinate->devices, bus_list) {
546 if (dev->ignore_hotplug) {
547 ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n",
548 intr_loc, pci_name(dev));
549 return IRQ_HANDLED;
550 }
551 }
552 }
553
542 if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) 554 if (!(intr_loc & ~PCI_EXP_SLTSTA_CC))
543 return IRQ_HANDLED; 555 return IRQ_HANDLED;
544 556
diff --git a/drivers/pci/hotplug/pcihp_slot.c b/drivers/pci/hotplug/pcihp_slot.c
index e246a10a0d2c..3e36ec8d708a 100644
--- a/drivers/pci/hotplug/pcihp_slot.c
+++ b/drivers/pci/hotplug/pcihp_slot.c
@@ -46,7 +46,6 @@ static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp)
46 */ 46 */
47 if (pci_is_pcie(dev)) 47 if (pci_is_pcie(dev))
48 return; 48 return;
49 dev_info(&dev->dev, "using default PCI settings\n");
50 hpp = &pci_default_type0; 49 hpp = &pci_default_type0;
51 } 50 }
52 51
@@ -153,7 +152,6 @@ void pci_configure_slot(struct pci_dev *dev)
153{ 152{
154 struct pci_dev *cdev; 153 struct pci_dev *cdev;
155 struct hotplug_params hpp; 154 struct hotplug_params hpp;
156 int ret;
157 155
158 if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || 156 if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL ||
159 (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && 157 (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE &&
@@ -163,9 +161,7 @@ void pci_configure_slot(struct pci_dev *dev)
163 pcie_bus_configure_settings(dev->bus); 161 pcie_bus_configure_settings(dev->bus);
164 162
165 memset(&hpp, 0, sizeof(hpp)); 163 memset(&hpp, 0, sizeof(hpp));
166 ret = pci_get_hp_params(dev, &hpp); 164 pci_get_hp_params(dev, &hpp);
167 if (ret)
168 dev_warn(&dev->dev, "no hotplug settings from platform\n");
169 165
170 program_hpp_type2(dev, hpp.t2); 166 program_hpp_type2(dev, hpp.t2);
171 program_hpp_type1(dev, hpp.t1); 167 program_hpp_type1(dev, hpp.t1);
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 337634ad0562..6d77dcd7dcf6 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -319,7 +319,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev,
319 struct regulator_config *config) 319 struct regulator_config *config)
320{ 320{
321 struct device_node *nproot, *np; 321 struct device_node *nproot, *np;
322 nproot = of_node_get(pdev->dev.parent->of_node); 322 nproot = pdev->dev.parent->of_node;
323 if (!nproot) 323 if (!nproot)
324 return -ENODEV; 324 return -ENODEV;
325 nproot = of_get_child_by_name(nproot, "regulators"); 325 nproot = of_get_child_by_name(nproot, "regulators");
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
index fdb6ea8ae7e6..00033625a09c 100644
--- a/drivers/regulator/da9052-regulator.c
+++ b/drivers/regulator/da9052-regulator.c
@@ -422,9 +422,9 @@ static int da9052_regulator_probe(struct platform_device *pdev)
422 config.init_data = pdata->regulators[pdev->id]; 422 config.init_data = pdata->regulators[pdev->id];
423 } else { 423 } else {
424#ifdef CONFIG_OF 424#ifdef CONFIG_OF
425 struct device_node *nproot, *np; 425 struct device_node *nproot = da9052->dev->of_node;
426 struct device_node *np;
426 427
427 nproot = of_node_get(da9052->dev->of_node);
428 if (!nproot) 428 if (!nproot)
429 return -ENODEV; 429 return -ENODEV;
430 430
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
index 9623e9e290bf..3426be89c9f6 100644
--- a/drivers/regulator/max8907-regulator.c
+++ b/drivers/regulator/max8907-regulator.c
@@ -226,7 +226,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev)
226 struct device_node *np, *regulators; 226 struct device_node *np, *regulators;
227 int ret; 227 int ret;
228 228
229 np = of_node_get(pdev->dev.parent->of_node); 229 np = pdev->dev.parent->of_node;
230 if (!np) 230 if (!np)
231 return 0; 231 return 0;
232 232
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c
index dad2bcd14e96..7770777befc4 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -250,7 +250,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev,
250 struct device_node *nproot, *np; 250 struct device_node *nproot, *np;
251 int rcount; 251 int rcount;
252 252
253 nproot = of_node_get(pdev->dev.parent->of_node); 253 nproot = pdev->dev.parent->of_node;
254 if (!nproot) 254 if (!nproot)
255 return -ENODEV; 255 return -ENODEV;
256 np = of_get_child_by_name(nproot, "regulators"); 256 np = of_get_child_by_name(nproot, "regulators");
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index 90b4c530dee5..9c31e215a521 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -917,7 +917,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev,
917 struct max8997_regulator_data *rdata; 917 struct max8997_regulator_data *rdata;
918 unsigned int i, dvs_voltage_nr = 1, ret; 918 unsigned int i, dvs_voltage_nr = 1, ret;
919 919
920 pmic_np = of_node_get(iodev->dev->of_node); 920 pmic_np = iodev->dev->of_node;
921 if (!pmic_np) { 921 if (!pmic_np) {
922 dev_err(&pdev->dev, "could not find pmic sub-node\n"); 922 dev_err(&pdev->dev, "could not find pmic sub-node\n");
923 return -ENODEV; 923 return -ENODEV;
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index a7ce34d1b5f2..1878e5b567ef 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -1427,7 +1427,6 @@ static void palmas_dt_to_pdata(struct device *dev,
1427 u32 prop; 1427 u32 prop;
1428 int idx, ret; 1428 int idx, ret;
1429 1429
1430 node = of_node_get(node);
1431 regulators = of_get_child_by_name(node, "regulators"); 1430 regulators = of_get_child_by_name(node, "regulators");
1432 if (!regulators) { 1431 if (!regulators) {
1433 dev_info(dev, "regulator node not found\n"); 1432 dev_info(dev, "regulator node not found\n");
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index fa7db8847578..e584c998b55f 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1014,7 +1014,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data(
1014 if (!pmic_plat_data) 1014 if (!pmic_plat_data)
1015 return NULL; 1015 return NULL;
1016 1016
1017 np = of_node_get(pdev->dev.parent->of_node); 1017 np = pdev->dev.parent->of_node;
1018 regulators = of_get_child_by_name(np, "regulators"); 1018 regulators = of_get_child_by_name(np, "regulators");
1019 if (!regulators) { 1019 if (!regulators) {
1020 dev_err(&pdev->dev, "regulator node not found\n"); 1020 dev_err(&pdev->dev, "regulator node not found\n");
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index ea025e4806b6..191b59793519 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -717,11 +717,21 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
717 return NULL; 717 return NULL;
718 } 718 }
719 719
720 if (data_size > ISCSI_DEF_MAX_RECV_SEG_LEN) {
721 iscsi_conn_printk(KERN_ERR, conn, "Invalid buffer len of %u for login task. Max len is %u\n", data_size, ISCSI_DEF_MAX_RECV_SEG_LEN);
722 return NULL;
723 }
724
720 task = conn->login_task; 725 task = conn->login_task;
721 } else { 726 } else {
722 if (session->state != ISCSI_STATE_LOGGED_IN) 727 if (session->state != ISCSI_STATE_LOGGED_IN)
723 return NULL; 728 return NULL;
724 729
730 if (data_size != 0) {
731 iscsi_conn_printk(KERN_ERR, conn, "Can not send data buffer of len %u for op 0x%x\n", data_size, opcode);
732 return NULL;
733 }
734
725 BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); 735 BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE);
726 BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); 736 BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED);
727 737
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index d837dc180522..aaea4b98af16 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -733,12 +733,13 @@ static bool scsi_end_request(struct request *req, int error,
733 } else { 733 } else {
734 unsigned long flags; 734 unsigned long flags;
735 735
736 if (bidi_bytes)
737 scsi_release_bidi_buffers(cmd);
738
736 spin_lock_irqsave(q->queue_lock, flags); 739 spin_lock_irqsave(q->queue_lock, flags);
737 blk_finish_request(req, error); 740 blk_finish_request(req, error);
738 spin_unlock_irqrestore(q->queue_lock, flags); 741 spin_unlock_irqrestore(q->queue_lock, flags);
739 742
740 if (bidi_bytes)
741 scsi_release_bidi_buffers(cmd);
742 scsi_release_buffers(cmd); 743 scsi_release_buffers(cmd);
743 scsi_next_command(cmd); 744 scsi_next_command(cmd);
744 } 745 }
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 48f1d26e6ad9..134fb6eb7b19 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -397,24 +397,21 @@ static int davinci_spi_setup(struct spi_device *spi)
397 struct spi_master *master = spi->master; 397 struct spi_master *master = spi->master;
398 struct device_node *np = spi->dev.of_node; 398 struct device_node *np = spi->dev.of_node;
399 bool internal_cs = true; 399 bool internal_cs = true;
400 unsigned long flags = GPIOF_DIR_OUT;
401 400
402 dspi = spi_master_get_devdata(spi->master); 401 dspi = spi_master_get_devdata(spi->master);
403 pdata = &dspi->pdata; 402 pdata = &dspi->pdata;
404 403
405 flags |= (spi->mode & SPI_CS_HIGH) ? GPIOF_INIT_LOW : GPIOF_INIT_HIGH;
406
407 if (!(spi->mode & SPI_NO_CS)) { 404 if (!(spi->mode & SPI_NO_CS)) {
408 if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { 405 if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) {
409 retval = gpio_request_one(spi->cs_gpio, 406 retval = gpio_direction_output(
410 flags, dev_name(&spi->dev)); 407 spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
411 internal_cs = false; 408 internal_cs = false;
412 } else if (pdata->chip_sel && 409 } else if (pdata->chip_sel &&
413 spi->chip_select < pdata->num_chipselect && 410 spi->chip_select < pdata->num_chipselect &&
414 pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { 411 pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) {
415 spi->cs_gpio = pdata->chip_sel[spi->chip_select]; 412 spi->cs_gpio = pdata->chip_sel[spi->chip_select];
416 retval = gpio_request_one(spi->cs_gpio, 413 retval = gpio_direction_output(
417 flags, dev_name(&spi->dev)); 414 spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
418 internal_cs = false; 415 internal_cs = false;
419 } 416 }
420 417
@@ -439,12 +436,6 @@ static int davinci_spi_setup(struct spi_device *spi)
439 return retval; 436 return retval;
440} 437}
441 438
442static void davinci_spi_cleanup(struct spi_device *spi)
443{
444 if (spi->cs_gpio >= 0)
445 gpio_free(spi->cs_gpio);
446}
447
448static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) 439static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status)
449{ 440{
450 struct device *sdev = dspi->bitbang.master->dev.parent; 441 struct device *sdev = dspi->bitbang.master->dev.parent;
@@ -956,7 +947,6 @@ static int davinci_spi_probe(struct platform_device *pdev)
956 master->num_chipselect = pdata->num_chipselect; 947 master->num_chipselect = pdata->num_chipselect;
957 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); 948 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16);
958 master->setup = davinci_spi_setup; 949 master->setup = davinci_spi_setup;
959 master->cleanup = davinci_spi_cleanup;
960 950
961 dspi->bitbang.chipselect = davinci_spi_chipselect; 951 dspi->bitbang.chipselect = davinci_spi_chipselect;
962 dspi->bitbang.setup_transfer = davinci_spi_setup_transfer; 952 dspi->bitbang.setup_transfer = davinci_spi_setup_transfer;
@@ -967,6 +957,27 @@ static int davinci_spi_probe(struct platform_device *pdev)
967 if (dspi->version == SPI_VERSION_2) 957 if (dspi->version == SPI_VERSION_2)
968 dspi->bitbang.flags |= SPI_READY; 958 dspi->bitbang.flags |= SPI_READY;
969 959
960 if (pdev->dev.of_node) {
961 int i;
962
963 for (i = 0; i < pdata->num_chipselect; i++) {
964 int cs_gpio = of_get_named_gpio(pdev->dev.of_node,
965 "cs-gpios", i);
966
967 if (cs_gpio == -EPROBE_DEFER) {
968 ret = cs_gpio;
969 goto free_clk;
970 }
971
972 if (gpio_is_valid(cs_gpio)) {
973 ret = devm_gpio_request(&pdev->dev, cs_gpio,
974 dev_name(&pdev->dev));
975 if (ret)
976 goto free_clk;
977 }
978 }
979 }
980
970 r = platform_get_resource(pdev, IORESOURCE_DMA, 0); 981 r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
971 if (r) 982 if (r)
972 dma_rx_chan = r->start; 983 dma_rx_chan = r->start;
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 670f0627f3bf..0dd0623319b0 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -547,8 +547,7 @@ static int dw_spi_setup(struct spi_device *spi)
547 /* Only alloc on first setup */ 547 /* Only alloc on first setup */
548 chip = spi_get_ctldata(spi); 548 chip = spi_get_ctldata(spi);
549 if (!chip) { 549 if (!chip) {
550 chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data), 550 chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
551 GFP_KERNEL);
552 if (!chip) 551 if (!chip)
553 return -ENOMEM; 552 return -ENOMEM;
554 spi_set_ctldata(spi, chip); 553 spi_set_ctldata(spi, chip);
@@ -606,6 +605,14 @@ static int dw_spi_setup(struct spi_device *spi)
606 return 0; 605 return 0;
607} 606}
608 607
608static void dw_spi_cleanup(struct spi_device *spi)
609{
610 struct chip_data *chip = spi_get_ctldata(spi);
611
612 kfree(chip);
613 spi_set_ctldata(spi, NULL);
614}
615
609/* Restart the controller, disable all interrupts, clean rx fifo */ 616/* Restart the controller, disable all interrupts, clean rx fifo */
610static void spi_hw_init(struct dw_spi *dws) 617static void spi_hw_init(struct dw_spi *dws)
611{ 618{
@@ -661,6 +668,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
661 master->bus_num = dws->bus_num; 668 master->bus_num = dws->bus_num;
662 master->num_chipselect = dws->num_cs; 669 master->num_chipselect = dws->num_cs;
663 master->setup = dw_spi_setup; 670 master->setup = dw_spi_setup;
671 master->cleanup = dw_spi_cleanup;
664 master->transfer_one_message = dw_spi_transfer_one_message; 672 master->transfer_one_message = dw_spi_transfer_one_message;
665 master->max_speed_hz = dws->max_freq; 673 master->max_speed_hz = dws->max_freq;
666 674
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 8ebd724e4c59..429e11190265 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -452,16 +452,16 @@ static int fsl_espi_setup(struct spi_device *spi)
452 int retval; 452 int retval;
453 u32 hw_mode; 453 u32 hw_mode;
454 u32 loop_mode; 454 u32 loop_mode;
455 struct spi_mpc8xxx_cs *cs = spi->controller_state; 455 struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi);
456 456
457 if (!spi->max_speed_hz) 457 if (!spi->max_speed_hz)
458 return -EINVAL; 458 return -EINVAL;
459 459
460 if (!cs) { 460 if (!cs) {
461 cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); 461 cs = kzalloc(sizeof(*cs), GFP_KERNEL);
462 if (!cs) 462 if (!cs)
463 return -ENOMEM; 463 return -ENOMEM;
464 spi->controller_state = cs; 464 spi_set_ctldata(spi, cs);
465 } 465 }
466 466
467 mpc8xxx_spi = spi_master_get_devdata(spi->master); 467 mpc8xxx_spi = spi_master_get_devdata(spi->master);
@@ -496,6 +496,14 @@ static int fsl_espi_setup(struct spi_device *spi)
496 return 0; 496 return 0;
497} 497}
498 498
499static void fsl_espi_cleanup(struct spi_device *spi)
500{
501 struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi);
502
503 kfree(cs);
504 spi_set_ctldata(spi, NULL);
505}
506
499void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) 507void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events)
500{ 508{
501 struct fsl_espi_reg *reg_base = mspi->reg_base; 509 struct fsl_espi_reg *reg_base = mspi->reg_base;
@@ -605,6 +613,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev,
605 613
606 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); 614 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
607 master->setup = fsl_espi_setup; 615 master->setup = fsl_espi_setup;
616 master->cleanup = fsl_espi_cleanup;
608 617
609 mpc8xxx_spi = spi_master_get_devdata(master); 618 mpc8xxx_spi = spi_master_get_devdata(master);
610 mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg; 619 mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg;
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 9452f6740997..590f31bc0aba 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -425,16 +425,16 @@ static int fsl_spi_setup(struct spi_device *spi)
425 struct fsl_spi_reg *reg_base; 425 struct fsl_spi_reg *reg_base;
426 int retval; 426 int retval;
427 u32 hw_mode; 427 u32 hw_mode;
428 struct spi_mpc8xxx_cs *cs = spi->controller_state; 428 struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi);
429 429
430 if (!spi->max_speed_hz) 430 if (!spi->max_speed_hz)
431 return -EINVAL; 431 return -EINVAL;
432 432
433 if (!cs) { 433 if (!cs) {
434 cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); 434 cs = kzalloc(sizeof(*cs), GFP_KERNEL);
435 if (!cs) 435 if (!cs)
436 return -ENOMEM; 436 return -ENOMEM;
437 spi->controller_state = cs; 437 spi_set_ctldata(spi, cs);
438 } 438 }
439 mpc8xxx_spi = spi_master_get_devdata(spi->master); 439 mpc8xxx_spi = spi_master_get_devdata(spi->master);
440 440
@@ -496,9 +496,13 @@ static int fsl_spi_setup(struct spi_device *spi)
496static void fsl_spi_cleanup(struct spi_device *spi) 496static void fsl_spi_cleanup(struct spi_device *spi)
497{ 497{
498 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); 498 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
499 struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi);
499 500
500 if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) 501 if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio))
501 gpio_free(spi->cs_gpio); 502 gpio_free(spi->cs_gpio);
503
504 kfree(cs);
505 spi_set_ctldata(spi, NULL);
502} 506}
503 507
504static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) 508static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events)
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 1189cfd96477..f1f0a587e4fc 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -2136,7 +2136,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
2136 cs_gpio); 2136 cs_gpio);
2137 else if (gpio_direction_output(cs_gpio, 1)) 2137 else if (gpio_direction_output(cs_gpio, 1))
2138 dev_err(&adev->dev, 2138 dev_err(&adev->dev,
2139 "could set gpio %d as output\n", 2139 "could not set gpio %d as output\n",
2140 cs_gpio); 2140 cs_gpio);
2141 } 2141 }
2142 } 2142 }
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index cd0e08b0c9f6..3afc266b666d 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -220,7 +220,7 @@ static inline void wait_for_idle(struct rockchip_spi *rs)
220 do { 220 do {
221 if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) 221 if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY))
222 return; 222 return;
223 } while (time_before(jiffies, timeout)); 223 } while (!time_after(jiffies, timeout));
224 224
225 dev_warn(rs->dev, "spi controller is in busy state!\n"); 225 dev_warn(rs->dev, "spi controller is in busy state!\n");
226} 226}
@@ -529,7 +529,8 @@ static int rockchip_spi_transfer_one(
529 int ret = 0; 529 int ret = 0;
530 struct rockchip_spi *rs = spi_master_get_devdata(master); 530 struct rockchip_spi *rs = spi_master_get_devdata(master);
531 531
532 WARN_ON((readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); 532 WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) &&
533 (readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY));
533 534
534 if (!xfer->tx_buf && !xfer->rx_buf) { 535 if (!xfer->tx_buf && !xfer->rx_buf) {
535 dev_err(rs->dev, "No buffer for transfer\n"); 536 dev_err(rs->dev, "No buffer for transfer\n");
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index 95ac276eaafe..6f0602fd7401 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -312,6 +312,8 @@ static int spi_sirfsoc_cmd_transfer(struct spi_device *spi,
312 u32 cmd; 312 u32 cmd;
313 313
314 sspi = spi_master_get_devdata(spi->master); 314 sspi = spi_master_get_devdata(spi->master);
315 writel(SIRFSOC_SPI_FIFO_RESET, sspi->base + SIRFSOC_SPI_TXFIFO_OP);
316 writel(SIRFSOC_SPI_FIFO_START, sspi->base + SIRFSOC_SPI_TXFIFO_OP);
315 memcpy(&cmd, sspi->tx, t->len); 317 memcpy(&cmd, sspi->tx, t->len);
316 if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST)) 318 if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST))
317 cmd = cpu_to_be32(cmd) >> 319 cmd = cpu_to_be32(cmd) >>
@@ -438,7 +440,8 @@ static void spi_sirfsoc_pio_transfer(struct spi_device *spi,
438 sspi->tx_word(sspi); 440 sspi->tx_word(sspi);
439 writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN | 441 writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN |
440 SIRFSOC_SPI_TX_UFLOW_INT_EN | 442 SIRFSOC_SPI_TX_UFLOW_INT_EN |
441 SIRFSOC_SPI_RX_OFLOW_INT_EN, 443 SIRFSOC_SPI_RX_OFLOW_INT_EN |
444 SIRFSOC_SPI_RX_IO_DMA_INT_EN,
442 sspi->base + SIRFSOC_SPI_INT_EN); 445 sspi->base + SIRFSOC_SPI_INT_EN);
443 writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN, 446 writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN,
444 sspi->base + SIRFSOC_SPI_TX_RX_EN); 447 sspi->base + SIRFSOC_SPI_TX_RX_EN);
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 43527fd78825..56b8522d5767 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -234,8 +234,17 @@ static inline int btrfs_inode_in_log(struct inode *inode, u64 generation)
234 BTRFS_I(inode)->last_sub_trans <= 234 BTRFS_I(inode)->last_sub_trans <=
235 BTRFS_I(inode)->last_log_commit && 235 BTRFS_I(inode)->last_log_commit &&
236 BTRFS_I(inode)->last_sub_trans <= 236 BTRFS_I(inode)->last_sub_trans <=
237 BTRFS_I(inode)->root->last_log_commit) 237 BTRFS_I(inode)->root->last_log_commit) {
238 return 1; 238 /*
239 * After a ranged fsync we might have left some extent maps
240 * (that fall outside the fsync's range). So return false
241 * here if the list isn't empty, to make sure btrfs_log_inode()
242 * will be called and process those extent maps.
243 */
244 smp_mb();
245 if (list_empty(&BTRFS_I(inode)->extent_tree.modified_extents))
246 return 1;
247 }
239 return 0; 248 return 0;
240} 249}
241 250
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index d296efe2d3e7..1d1ba083ca6e 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4093,18 +4093,8 @@ log_extents:
4093 } 4093 }
4094 } 4094 }
4095 4095
4096 write_lock(&em_tree->lock); 4096 BTRFS_I(inode)->logged_trans = trans->transid;
4097 /* 4097 BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans;
4098 * If we're doing a ranged fsync and there are still modified extents
4099 * in the list, we must run on the next fsync call as it might cover
4100 * those extents (a full fsync or an fsync for other range).
4101 */
4102 if (list_empty(&em_tree->modified_extents)) {
4103 BTRFS_I(inode)->logged_trans = trans->transid;
4104 BTRFS_I(inode)->last_log_commit =
4105 BTRFS_I(inode)->last_sub_trans;
4106 }
4107 write_unlock(&em_tree->lock);
4108out_unlock: 4098out_unlock:
4109 if (unlikely(err)) 4099 if (unlikely(err))
4110 btrfs_put_logged_extents(&logged_list); 4100 btrfs_put_logged_extents(&logged_list);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 340a92d08e84..2c2d6d1d8eee 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -529,12 +529,12 @@ static noinline int device_list_add(const char *path,
529 */ 529 */
530 530
531 /* 531 /*
532 * As of now don't allow update to btrfs_fs_device through 532 * For now, we do allow update to btrfs_fs_device through the
533 * the btrfs dev scan cli, after FS has been mounted. 533 * btrfs dev scan cli after FS has been mounted. We're still
534 * tracking a problem where systems fail mount by subvolume id
535 * when we reject replacement on a mounted FS.
534 */ 536 */
535 if (fs_devices->opened) { 537 if (!fs_devices->opened && found_transid < device->generation) {
536 return -EBUSY;
537 } else {
538 /* 538 /*
539 * That is if the FS is _not_ mounted and if you 539 * That is if the FS is _not_ mounted and if you
540 * are here, that means there is more than one 540 * are here, that means there is more than one
@@ -542,8 +542,7 @@ static noinline int device_list_add(const char *path,
542 * with larger generation number or the last-in if 542 * with larger generation number or the last-in if
543 * generation are equal. 543 * generation are equal.
544 */ 544 */
545 if (found_transid < device->generation) 545 return -EEXIST;
546 return -EEXIST;
547 } 546 }
548 547
549 name = rcu_string_strdup(path, GFP_NOFS); 548 name = rcu_string_strdup(path, GFP_NOFS);
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index b0fafa499505..002e0c173939 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.04" 139#define CIFS_VERSION "2.05"
140#endif /* _CIFSFS_H */ 140#endif /* _CIFSFS_H */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 8a9fded7c135..36ca2045009b 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -837,6 +837,7 @@ cifs_demultiplex_thread(void *p)
837 struct TCP_Server_Info *server = p; 837 struct TCP_Server_Info *server = p;
838 unsigned int pdu_length; 838 unsigned int pdu_length;
839 char *buf = NULL; 839 char *buf = NULL;
840 struct task_struct *task_to_wake = NULL;
840 struct mid_q_entry *mid_entry; 841 struct mid_q_entry *mid_entry;
841 842
842 current->flags |= PF_MEMALLOC; 843 current->flags |= PF_MEMALLOC;
@@ -927,7 +928,19 @@ cifs_demultiplex_thread(void *p)
927 if (server->smallbuf) /* no sense logging a debug message if NULL */ 928 if (server->smallbuf) /* no sense logging a debug message if NULL */
928 cifs_small_buf_release(server->smallbuf); 929 cifs_small_buf_release(server->smallbuf);
929 930
931 task_to_wake = xchg(&server->tsk, NULL);
930 clean_demultiplex_info(server); 932 clean_demultiplex_info(server);
933
934 /* if server->tsk was NULL then wait for a signal before exiting */
935 if (!task_to_wake) {
936 set_current_state(TASK_INTERRUPTIBLE);
937 while (!signal_pending(current)) {
938 schedule();
939 set_current_state(TASK_INTERRUPTIBLE);
940 }
941 set_current_state(TASK_RUNNING);
942 }
943
931 module_put_and_exit(0); 944 module_put_and_exit(0);
932} 945}
933 946
@@ -2050,6 +2063,8 @@ cifs_find_tcp_session(struct smb_vol *vol)
2050static void 2063static void
2051cifs_put_tcp_session(struct TCP_Server_Info *server) 2064cifs_put_tcp_session(struct TCP_Server_Info *server)
2052{ 2065{
2066 struct task_struct *task;
2067
2053 spin_lock(&cifs_tcp_ses_lock); 2068 spin_lock(&cifs_tcp_ses_lock);
2054 if (--server->srv_count > 0) { 2069 if (--server->srv_count > 0) {
2055 spin_unlock(&cifs_tcp_ses_lock); 2070 spin_unlock(&cifs_tcp_ses_lock);
@@ -2073,6 +2088,10 @@ cifs_put_tcp_session(struct TCP_Server_Info *server)
2073 kfree(server->session_key.response); 2088 kfree(server->session_key.response);
2074 server->session_key.response = NULL; 2089 server->session_key.response = NULL;
2075 server->session_key.len = 0; 2090 server->session_key.len = 0;
2091
2092 task = xchg(&server->tsk, NULL);
2093 if (task)
2094 force_sig(SIGKILL, task);
2076} 2095}
2077 2096
2078static struct TCP_Server_Info * 2097static struct TCP_Server_Info *
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 68559fd557fb..5657416d3483 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -213,8 +213,12 @@ create_mf_symlink(const unsigned int xid, struct cifs_tcon *tcon,
213 if (rc) 213 if (rc)
214 goto out; 214 goto out;
215 215
216 rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, cifs_sb, 216 if (tcon->ses->server->ops->create_mf_symlink)
217 fromName, buf, &bytes_written); 217 rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon,
218 cifs_sb, fromName, buf, &bytes_written);
219 else
220 rc = -EOPNOTSUPP;
221
218 if (rc) 222 if (rc)
219 goto out; 223 goto out;
220 224
@@ -339,9 +343,11 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
339 if (rc) 343 if (rc)
340 return rc; 344 return rc;
341 345
342 if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) 346 if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) {
347 rc = -ENOENT;
343 /* it's not a symlink */ 348 /* it's not a symlink */
344 goto out; 349 goto out;
350 }
345 351
346 io_parms.netfid = fid.netfid; 352 io_parms.netfid = fid.netfid;
347 io_parms.pid = current->tgid; 353 io_parms.pid = current->tgid;
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 6834b9c3bec1..b333ff60781d 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -925,11 +925,23 @@ cifs_NTtimeToUnix(__le64 ntutc)
925 /* BB what about the timezone? BB */ 925 /* BB what about the timezone? BB */
926 926
927 /* Subtract the NTFS time offset, then convert to 1s intervals. */ 927 /* Subtract the NTFS time offset, then convert to 1s intervals. */
928 u64 t; 928 s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET;
929
930 /*
931 * Unfortunately can not use normal 64 bit division on 32 bit arch, but
932 * the alternative, do_div, does not work with negative numbers so have
933 * to special case them
934 */
935 if (t < 0) {
936 t = -t;
937 ts.tv_nsec = (long)(do_div(t, 10000000) * 100);
938 ts.tv_nsec = -ts.tv_nsec;
939 ts.tv_sec = -t;
940 } else {
941 ts.tv_nsec = (long)do_div(t, 10000000) * 100;
942 ts.tv_sec = t;
943 }
929 944
930 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET;
931 ts.tv_nsec = do_div(t, 10000000) * 100;
932 ts.tv_sec = t;
933 return ts; 945 return ts;
934} 946}
935 947
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 3a5e83317683..57db63ff88da 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -745,14 +745,6 @@ out:
745 sess_free_buffer(sess_data); 745 sess_free_buffer(sess_data);
746} 746}
747 747
748#else
749
750static void
751sess_auth_lanman(struct sess_data *sess_data)
752{
753 sess_data->result = -EOPNOTSUPP;
754 sess_data->func = NULL;
755}
756#endif 748#endif
757 749
758static void 750static void
@@ -1103,15 +1095,6 @@ out:
1103 ses->auth_key.response = NULL; 1095 ses->auth_key.response = NULL;
1104} 1096}
1105 1097
1106#else
1107
1108static void
1109sess_auth_kerberos(struct sess_data *sess_data)
1110{
1111 cifs_dbg(VFS, "Kerberos negotiated but upcall support disabled!\n");
1112 sess_data->result = -ENOSYS;
1113 sess_data->func = NULL;
1114}
1115#endif /* ! CONFIG_CIFS_UPCALL */ 1098#endif /* ! CONFIG_CIFS_UPCALL */
1116 1099
1117/* 1100/*
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index e6ee5b6e8d99..f0b945ab853e 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -359,7 +359,7 @@ static inline void release_metapath(struct metapath *mp)
359 * Returns: The length of the extent (minimum of one block) 359 * Returns: The length of the extent (minimum of one block)
360 */ 360 */
361 361
362static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob) 362static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, size_t limit, int *eob)
363{ 363{
364 const __be64 *end = (start + len); 364 const __be64 *end = (start + len);
365 const __be64 *first = ptr; 365 const __be64 *first = ptr;
@@ -449,7 +449,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
449 struct buffer_head *bh_map, struct metapath *mp, 449 struct buffer_head *bh_map, struct metapath *mp,
450 const unsigned int sheight, 450 const unsigned int sheight,
451 const unsigned int height, 451 const unsigned int height,
452 const unsigned int maxlen) 452 const size_t maxlen)
453{ 453{
454 struct gfs2_inode *ip = GFS2_I(inode); 454 struct gfs2_inode *ip = GFS2_I(inode);
455 struct gfs2_sbd *sdp = GFS2_SB(inode); 455 struct gfs2_sbd *sdp = GFS2_SB(inode);
@@ -483,7 +483,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
483 } else { 483 } else {
484 /* Need to allocate indirect blocks */ 484 /* Need to allocate indirect blocks */
485 ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; 485 ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs;
486 dblks = min(maxlen, ptrs_per_blk - mp->mp_list[end_of_metadata]); 486 dblks = min(maxlen, (size_t)(ptrs_per_blk -
487 mp->mp_list[end_of_metadata]));
487 if (height == ip->i_height) { 488 if (height == ip->i_height) {
488 /* Writing into existing tree, extend tree down */ 489 /* Writing into existing tree, extend tree down */
489 iblks = height - sheight; 490 iblks = height - sheight;
@@ -605,7 +606,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
605 struct gfs2_inode *ip = GFS2_I(inode); 606 struct gfs2_inode *ip = GFS2_I(inode);
606 struct gfs2_sbd *sdp = GFS2_SB(inode); 607 struct gfs2_sbd *sdp = GFS2_SB(inode);
607 unsigned int bsize = sdp->sd_sb.sb_bsize; 608 unsigned int bsize = sdp->sd_sb.sb_bsize;
608 const unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; 609 const size_t maxlen = bh_map->b_size >> inode->i_blkbits;
609 const u64 *arr = sdp->sd_heightsize; 610 const u64 *arr = sdp->sd_heightsize;
610 __be64 *ptr; 611 __be64 *ptr;
611 u64 size; 612 u64 size;
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 26b3f952e6b1..7f4ed3daa38c 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -26,6 +26,7 @@
26#include <linux/dlm.h> 26#include <linux/dlm.h>
27#include <linux/dlm_plock.h> 27#include <linux/dlm_plock.h>
28#include <linux/aio.h> 28#include <linux/aio.h>
29#include <linux/delay.h>
29 30
30#include "gfs2.h" 31#include "gfs2.h"
31#include "incore.h" 32#include "incore.h"
@@ -979,9 +980,10 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
979 unsigned int state; 980 unsigned int state;
980 int flags; 981 int flags;
981 int error = 0; 982 int error = 0;
983 int sleeptime;
982 984
983 state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; 985 state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
984 flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT; 986 flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY_1CB) | GL_EXACT;
985 987
986 mutex_lock(&fp->f_fl_mutex); 988 mutex_lock(&fp->f_fl_mutex);
987 989
@@ -1001,7 +1003,14 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
1001 gfs2_holder_init(gl, state, flags, fl_gh); 1003 gfs2_holder_init(gl, state, flags, fl_gh);
1002 gfs2_glock_put(gl); 1004 gfs2_glock_put(gl);
1003 } 1005 }
1004 error = gfs2_glock_nq(fl_gh); 1006 for (sleeptime = 1; sleeptime <= 4; sleeptime <<= 1) {
1007 error = gfs2_glock_nq(fl_gh);
1008 if (error != GLR_TRYFAILED)
1009 break;
1010 fl_gh->gh_flags = LM_FLAG_TRY | GL_EXACT;
1011 fl_gh->gh_error = 0;
1012 msleep(sleeptime);
1013 }
1005 if (error) { 1014 if (error) {
1006 gfs2_holder_uninit(fl_gh); 1015 gfs2_holder_uninit(fl_gh);
1007 if (error == GLR_TRYFAILED) 1016 if (error == GLR_TRYFAILED)
@@ -1024,7 +1033,7 @@ static void do_unflock(struct file *file, struct file_lock *fl)
1024 mutex_lock(&fp->f_fl_mutex); 1033 mutex_lock(&fp->f_fl_mutex);
1025 flock_lock_file_wait(file, fl); 1034 flock_lock_file_wait(file, fl);
1026 if (fl_gh->gh_gl) { 1035 if (fl_gh->gh_gl) {
1027 gfs2_glock_dq_wait(fl_gh); 1036 gfs2_glock_dq(fl_gh);
1028 gfs2_holder_uninit(fl_gh); 1037 gfs2_holder_uninit(fl_gh);
1029 } 1038 }
1030 mutex_unlock(&fp->f_fl_mutex); 1039 mutex_unlock(&fp->f_fl_mutex);
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 67d310c9ada3..39e7e9959b74 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -262,6 +262,9 @@ struct gfs2_holder {
262 unsigned long gh_ip; 262 unsigned long gh_ip;
263}; 263};
264 264
265/* Number of quota types we support */
266#define GFS2_MAXQUOTAS 2
267
265/* Resource group multi-block reservation, in order of appearance: 268/* Resource group multi-block reservation, in order of appearance:
266 269
267 Step 1. Function prepares to write, allocates a mb, sets the size hint. 270 Step 1. Function prepares to write, allocates a mb, sets the size hint.
@@ -282,8 +285,8 @@ struct gfs2_blkreserv {
282 u64 rs_inum; /* Inode number for reservation */ 285 u64 rs_inum; /* Inode number for reservation */
283 286
284 /* ancillary quota stuff */ 287 /* ancillary quota stuff */
285 struct gfs2_quota_data *rs_qa_qd[2 * MAXQUOTAS]; 288 struct gfs2_quota_data *rs_qa_qd[2 * GFS2_MAXQUOTAS];
286 struct gfs2_holder rs_qa_qd_ghs[2 * MAXQUOTAS]; 289 struct gfs2_holder rs_qa_qd_ghs[2 * GFS2_MAXQUOTAS];
287 unsigned int rs_qa_qd_num; 290 unsigned int rs_qa_qd_num;
288}; 291};
289 292
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index e62e59477884..fc8ac2ee0667 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -626,8 +626,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
626 if (!IS_ERR(inode)) { 626 if (!IS_ERR(inode)) {
627 d = d_splice_alias(inode, dentry); 627 d = d_splice_alias(inode, dentry);
628 error = PTR_ERR(d); 628 error = PTR_ERR(d);
629 if (IS_ERR(d)) 629 if (IS_ERR(d)) {
630 inode = ERR_CAST(d);
630 goto fail_gunlock; 631 goto fail_gunlock;
632 }
631 error = 0; 633 error = 0;
632 if (file) { 634 if (file) {
633 if (S_ISREG(inode->i_mode)) { 635 if (S_ISREG(inode->i_mode)) {
@@ -840,8 +842,10 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry,
840 int error; 842 int error;
841 843
842 inode = gfs2_lookupi(dir, &dentry->d_name, 0); 844 inode = gfs2_lookupi(dir, &dentry->d_name, 0);
843 if (!inode) 845 if (inode == NULL) {
846 d_add(dentry, NULL);
844 return NULL; 847 return NULL;
848 }
845 if (IS_ERR(inode)) 849 if (IS_ERR(inode))
846 return ERR_CAST(inode); 850 return ERR_CAST(inode);
847 851
@@ -854,7 +858,6 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry,
854 858
855 d = d_splice_alias(inode, dentry); 859 d = d_splice_alias(inode, dentry);
856 if (IS_ERR(d)) { 860 if (IS_ERR(d)) {
857 iput(inode);
858 gfs2_glock_dq_uninit(&gh); 861 gfs2_glock_dq_uninit(&gh);
859 return d; 862 return d;
860 } 863 }
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 2607ff13d486..a346f56c4c6d 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1294,7 +1294,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root)
1294 int val; 1294 int val;
1295 1295
1296 if (is_ancestor(root, sdp->sd_master_dir)) 1296 if (is_ancestor(root, sdp->sd_master_dir))
1297 seq_printf(s, ",meta"); 1297 seq_puts(s, ",meta");
1298 if (args->ar_lockproto[0]) 1298 if (args->ar_lockproto[0])
1299 seq_printf(s, ",lockproto=%s", args->ar_lockproto); 1299 seq_printf(s, ",lockproto=%s", args->ar_lockproto);
1300 if (args->ar_locktable[0]) 1300 if (args->ar_locktable[0])
@@ -1302,13 +1302,13 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root)
1302 if (args->ar_hostdata[0]) 1302 if (args->ar_hostdata[0])
1303 seq_printf(s, ",hostdata=%s", args->ar_hostdata); 1303 seq_printf(s, ",hostdata=%s", args->ar_hostdata);
1304 if (args->ar_spectator) 1304 if (args->ar_spectator)
1305 seq_printf(s, ",spectator"); 1305 seq_puts(s, ",spectator");
1306 if (args->ar_localflocks) 1306 if (args->ar_localflocks)
1307 seq_printf(s, ",localflocks"); 1307 seq_puts(s, ",localflocks");
1308 if (args->ar_debug) 1308 if (args->ar_debug)
1309 seq_printf(s, ",debug"); 1309 seq_puts(s, ",debug");
1310 if (args->ar_posix_acl) 1310 if (args->ar_posix_acl)
1311 seq_printf(s, ",acl"); 1311 seq_puts(s, ",acl");
1312 if (args->ar_quota != GFS2_QUOTA_DEFAULT) { 1312 if (args->ar_quota != GFS2_QUOTA_DEFAULT) {
1313 char *state; 1313 char *state;
1314 switch (args->ar_quota) { 1314 switch (args->ar_quota) {
@@ -1328,7 +1328,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root)
1328 seq_printf(s, ",quota=%s", state); 1328 seq_printf(s, ",quota=%s", state);
1329 } 1329 }
1330 if (args->ar_suiddir) 1330 if (args->ar_suiddir)
1331 seq_printf(s, ",suiddir"); 1331 seq_puts(s, ",suiddir");
1332 if (args->ar_data != GFS2_DATA_DEFAULT) { 1332 if (args->ar_data != GFS2_DATA_DEFAULT) {
1333 char *state; 1333 char *state;
1334 switch (args->ar_data) { 1334 switch (args->ar_data) {
@@ -1345,7 +1345,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root)
1345 seq_printf(s, ",data=%s", state); 1345 seq_printf(s, ",data=%s", state);
1346 } 1346 }
1347 if (args->ar_discard) 1347 if (args->ar_discard)
1348 seq_printf(s, ",discard"); 1348 seq_puts(s, ",discard");
1349 val = sdp->sd_tune.gt_logd_secs; 1349 val = sdp->sd_tune.gt_logd_secs;
1350 if (val != 30) 1350 if (val != 30)
1351 seq_printf(s, ",commit=%d", val); 1351 seq_printf(s, ",commit=%d", val);
@@ -1376,11 +1376,11 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root)
1376 seq_printf(s, ",errors=%s", state); 1376 seq_printf(s, ",errors=%s", state);
1377 } 1377 }
1378 if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) 1378 if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
1379 seq_printf(s, ",nobarrier"); 1379 seq_puts(s, ",nobarrier");
1380 if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) 1380 if (test_bit(SDF_DEMOTE, &sdp->sd_flags))
1381 seq_printf(s, ",demote_interface_used"); 1381 seq_puts(s, ",demote_interface_used");
1382 if (args->ar_rgrplvb) 1382 if (args->ar_rgrplvb)
1383 seq_printf(s, ",rgrplvb"); 1383 seq_puts(s, ",rgrplvb");
1384 return 0; 1384 return 0;
1385} 1385}
1386 1386
diff --git a/fs/namei.c b/fs/namei.c
index 215e44254c53..a7b05bf82d31 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1674,14 +1674,13 @@ EXPORT_SYMBOL(full_name_hash);
1674 1674
1675/* 1675/*
1676 * Calculate the length and hash of the path component, and 1676 * Calculate the length and hash of the path component, and
1677 * fill in the qstr. return the "len" as the result. 1677 * return the "hash_len" as the result.
1678 */ 1678 */
1679static inline unsigned long hash_name(const char *name, struct qstr *res) 1679static inline u64 hash_name(const char *name)
1680{ 1680{
1681 unsigned long a, b, adata, bdata, mask, hash, len; 1681 unsigned long a, b, adata, bdata, mask, hash, len;
1682 const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; 1682 const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
1683 1683
1684 res->name = name;
1685 hash = a = 0; 1684 hash = a = 0;
1686 len = -sizeof(unsigned long); 1685 len = -sizeof(unsigned long);
1687 do { 1686 do {
@@ -1698,9 +1697,7 @@ static inline unsigned long hash_name(const char *name, struct qstr *res)
1698 1697
1699 hash += a & zero_bytemask(mask); 1698 hash += a & zero_bytemask(mask);
1700 len += find_zero(mask); 1699 len += find_zero(mask);
1701 res->hash_len = hashlen_create(fold_hash(hash), len); 1700 return hashlen_create(fold_hash(hash), len);
1702
1703 return len;
1704} 1701}
1705 1702
1706#else 1703#else
@@ -1718,20 +1715,18 @@ EXPORT_SYMBOL(full_name_hash);
1718 * We know there's a real path component here of at least 1715 * We know there's a real path component here of at least
1719 * one character. 1716 * one character.
1720 */ 1717 */
1721static inline long hash_name(const char *name, struct qstr *res) 1718static inline u64 hash_name(const char *name)
1722{ 1719{
1723 unsigned long hash = init_name_hash(); 1720 unsigned long hash = init_name_hash();
1724 unsigned long len = 0, c; 1721 unsigned long len = 0, c;
1725 1722
1726 res->name = name;
1727 c = (unsigned char)*name; 1723 c = (unsigned char)*name;
1728 do { 1724 do {
1729 len++; 1725 len++;
1730 hash = partial_name_hash(c, hash); 1726 hash = partial_name_hash(c, hash);
1731 c = (unsigned char)name[len]; 1727 c = (unsigned char)name[len];
1732 } while (c && c != '/'); 1728 } while (c && c != '/');
1733 res->hash_len = hashlen_create(end_name_hash(hash), len); 1729 return hashlen_create(end_name_hash(hash), len);
1734 return len;
1735} 1730}
1736 1731
1737#endif 1732#endif
@@ -1756,18 +1751,17 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1756 1751
1757 /* At this point we know we have a real path component. */ 1752 /* At this point we know we have a real path component. */
1758 for(;;) { 1753 for(;;) {
1759 struct qstr this; 1754 u64 hash_len;
1760 long len;
1761 int type; 1755 int type;
1762 1756
1763 err = may_lookup(nd); 1757 err = may_lookup(nd);
1764 if (err) 1758 if (err)
1765 break; 1759 break;
1766 1760
1767 len = hash_name(name, &this); 1761 hash_len = hash_name(name);
1768 1762
1769 type = LAST_NORM; 1763 type = LAST_NORM;
1770 if (name[0] == '.') switch (len) { 1764 if (name[0] == '.') switch (hashlen_len(hash_len)) {
1771 case 2: 1765 case 2:
1772 if (name[1] == '.') { 1766 if (name[1] == '.') {
1773 type = LAST_DOTDOT; 1767 type = LAST_DOTDOT;
@@ -1781,29 +1775,32 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1781 struct dentry *parent = nd->path.dentry; 1775 struct dentry *parent = nd->path.dentry;
1782 nd->flags &= ~LOOKUP_JUMPED; 1776 nd->flags &= ~LOOKUP_JUMPED;
1783 if (unlikely(parent->d_flags & DCACHE_OP_HASH)) { 1777 if (unlikely(parent->d_flags & DCACHE_OP_HASH)) {
1778 struct qstr this = { { .hash_len = hash_len }, .name = name };
1784 err = parent->d_op->d_hash(parent, &this); 1779 err = parent->d_op->d_hash(parent, &this);
1785 if (err < 0) 1780 if (err < 0)
1786 break; 1781 break;
1782 hash_len = this.hash_len;
1783 name = this.name;
1787 } 1784 }
1788 } 1785 }
1789 1786
1790 nd->last = this; 1787 nd->last.hash_len = hash_len;
1788 nd->last.name = name;
1791 nd->last_type = type; 1789 nd->last_type = type;
1792 1790
1793 if (!name[len]) 1791 name += hashlen_len(hash_len);
1792 if (!*name)
1794 return 0; 1793 return 0;
1795 /* 1794 /*
1796 * If it wasn't NUL, we know it was '/'. Skip that 1795 * If it wasn't NUL, we know it was '/'. Skip that
1797 * slash, and continue until no more slashes. 1796 * slash, and continue until no more slashes.
1798 */ 1797 */
1799 do { 1798 do {
1800 len++; 1799 name++;
1801 } while (unlikely(name[len] == '/')); 1800 } while (unlikely(*name == '/'));
1802 if (!name[len]) 1801 if (!*name)
1803 return 0; 1802 return 0;
1804 1803
1805 name += len;
1806
1807 err = walk_component(nd, &next, LOOKUP_FOLLOW); 1804 err = walk_component(nd, &next, LOOKUP_FOLLOW);
1808 if (err < 0) 1805 if (err < 0)
1809 return err; 1806 return err;
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 53e435a95260..ffdb28d86cf8 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -482,6 +482,16 @@ int nfs40_walk_client_list(struct nfs_client *new,
482 482
483 spin_lock(&nn->nfs_client_lock); 483 spin_lock(&nn->nfs_client_lock);
484 list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { 484 list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
485
486 if (pos->rpc_ops != new->rpc_ops)
487 continue;
488
489 if (pos->cl_proto != new->cl_proto)
490 continue;
491
492 if (pos->cl_minorversion != new->cl_minorversion)
493 continue;
494
485 /* If "pos" isn't marked ready, we can't trust the 495 /* If "pos" isn't marked ready, we can't trust the
486 * remaining fields in "pos" */ 496 * remaining fields in "pos" */
487 if (pos->cl_cons_state > NFS_CS_READY) { 497 if (pos->cl_cons_state > NFS_CS_READY) {
@@ -501,15 +511,6 @@ int nfs40_walk_client_list(struct nfs_client *new,
501 if (pos->cl_cons_state != NFS_CS_READY) 511 if (pos->cl_cons_state != NFS_CS_READY)
502 continue; 512 continue;
503 513
504 if (pos->rpc_ops != new->rpc_ops)
505 continue;
506
507 if (pos->cl_proto != new->cl_proto)
508 continue;
509
510 if (pos->cl_minorversion != new->cl_minorversion)
511 continue;
512
513 if (pos->cl_clientid != new->cl_clientid) 514 if (pos->cl_clientid != new->cl_clientid)
514 continue; 515 continue;
515 516
@@ -622,6 +623,16 @@ int nfs41_walk_client_list(struct nfs_client *new,
622 623
623 spin_lock(&nn->nfs_client_lock); 624 spin_lock(&nn->nfs_client_lock);
624 list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { 625 list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
626
627 if (pos->rpc_ops != new->rpc_ops)
628 continue;
629
630 if (pos->cl_proto != new->cl_proto)
631 continue;
632
633 if (pos->cl_minorversion != new->cl_minorversion)
634 continue;
635
625 /* If "pos" isn't marked ready, we can't trust the 636 /* If "pos" isn't marked ready, we can't trust the
626 * remaining fields in "pos", especially the client 637 * remaining fields in "pos", especially the client
627 * ID and serverowner fields. Wait for CREATE_SESSION 638 * ID and serverowner fields. Wait for CREATE_SESSION
@@ -647,15 +658,6 @@ int nfs41_walk_client_list(struct nfs_client *new,
647 if (pos->cl_cons_state != NFS_CS_READY) 658 if (pos->cl_cons_state != NFS_CS_READY)
648 continue; 659 continue;
649 660
650 if (pos->rpc_ops != new->rpc_ops)
651 continue;
652
653 if (pos->cl_proto != new->cl_proto)
654 continue;
655
656 if (pos->cl_minorversion != new->cl_minorversion)
657 continue;
658
659 if (!nfs4_match_clientids(pos, new)) 661 if (!nfs4_match_clientids(pos, new))
660 continue; 662 continue;
661 663
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7dd8aca31c29..6ca0c8e7a945 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2226,9 +2226,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
2226 ret = _nfs4_proc_open(opendata); 2226 ret = _nfs4_proc_open(opendata);
2227 if (ret != 0) { 2227 if (ret != 0) {
2228 if (ret == -ENOENT) { 2228 if (ret == -ENOENT) {
2229 d_drop(opendata->dentry); 2229 dentry = opendata->dentry;
2230 d_add(opendata->dentry, NULL); 2230 if (dentry->d_inode)
2231 nfs_set_verifier(opendata->dentry, 2231 d_delete(dentry);
2232 else if (d_unhashed(dentry))
2233 d_add(dentry, NULL);
2234
2235 nfs_set_verifier(dentry,
2232 nfs_save_change_attribute(opendata->dir->d_inode)); 2236 nfs_save_change_attribute(opendata->dir->d_inode));
2233 } 2237 }
2234 goto out; 2238 goto out;
@@ -2614,23 +2618,23 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
2614 is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); 2618 is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags);
2615 is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); 2619 is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags);
2616 is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); 2620 is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags);
2617 /* Calculate the current open share mode */
2618 calldata->arg.fmode = 0;
2619 if (is_rdonly || is_rdwr)
2620 calldata->arg.fmode |= FMODE_READ;
2621 if (is_wronly || is_rdwr)
2622 calldata->arg.fmode |= FMODE_WRITE;
2623 /* Calculate the change in open mode */ 2621 /* Calculate the change in open mode */
2622 calldata->arg.fmode = 0;
2624 if (state->n_rdwr == 0) { 2623 if (state->n_rdwr == 0) {
2625 if (state->n_rdonly == 0) { 2624 if (state->n_rdonly == 0)
2626 call_close |= is_rdonly || is_rdwr; 2625 call_close |= is_rdonly;
2627 calldata->arg.fmode &= ~FMODE_READ; 2626 else if (is_rdonly)
2628 } 2627 calldata->arg.fmode |= FMODE_READ;
2629 if (state->n_wronly == 0) { 2628 if (state->n_wronly == 0)
2630 call_close |= is_wronly || is_rdwr; 2629 call_close |= is_wronly;
2631 calldata->arg.fmode &= ~FMODE_WRITE; 2630 else if (is_wronly)
2632 } 2631 calldata->arg.fmode |= FMODE_WRITE;
2633 } 2632 } else if (is_rdwr)
2633 calldata->arg.fmode |= FMODE_READ|FMODE_WRITE;
2634
2635 if (calldata->arg.fmode == 0)
2636 call_close |= is_rdwr;
2637
2634 if (!nfs4_valid_open_stateid(state)) 2638 if (!nfs4_valid_open_stateid(state))
2635 call_close = 0; 2639 call_close = 0;
2636 spin_unlock(&state->owner->so_lock); 2640 spin_unlock(&state->owner->so_lock);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c1c9de19edbe..d91e59b79f0d 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -204,10 +204,9 @@ struct acpi_device_flags {
204 u32 match_driver:1; 204 u32 match_driver:1;
205 u32 initialized:1; 205 u32 initialized:1;
206 u32 visited:1; 206 u32 visited:1;
207 u32 no_hotplug:1;
208 u32 hotplug_notify:1; 207 u32 hotplug_notify:1;
209 u32 is_dock_station:1; 208 u32 is_dock_station:1;
210 u32 reserved:22; 209 u32 reserved:23;
211}; 210};
212 211
213/* File System */ 212/* File System */
@@ -411,7 +410,6 @@ void acpi_bus_private_data_handler(acpi_handle, void *);
411int acpi_bus_get_private_data(acpi_handle, void **); 410int acpi_bus_get_private_data(acpi_handle, void **);
412int acpi_bus_attach_private_data(acpi_handle, void *); 411int acpi_bus_attach_private_data(acpi_handle, void *);
413void acpi_bus_detach_private_data(acpi_handle); 412void acpi_bus_detach_private_data(acpi_handle);
414void acpi_bus_no_hotplug(acpi_handle handle);
415extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 413extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
416extern int register_acpi_notifier(struct notifier_block *); 414extern int register_acpi_notifier(struct notifier_block *);
417extern int unregister_acpi_notifier(struct notifier_block *); 415extern int unregister_acpi_notifier(struct notifier_block *);
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
index 831d786976c5..882675e7c055 100644
--- a/include/crypto/drbg.h
+++ b/include/crypto/drbg.h
@@ -162,12 +162,25 @@ static inline size_t drbg_max_request_bytes(struct drbg_state *drbg)
162 162
163static inline size_t drbg_max_addtl(struct drbg_state *drbg) 163static inline size_t drbg_max_addtl(struct drbg_state *drbg)
164{ 164{
165#if (__BITS_PER_LONG == 32)
166 /*
167 * SP800-90A allows smaller maximum numbers to be returned -- we
168 * return SIZE_MAX - 1 to allow the verification of the enforcement
169 * of this value in drbg_healthcheck_sanity.
170 */
171 return (SIZE_MAX - 1);
172#else
165 return (1UL<<(drbg->core->max_addtllen)); 173 return (1UL<<(drbg->core->max_addtllen));
174#endif
166} 175}
167 176
168static inline size_t drbg_max_requests(struct drbg_state *drbg) 177static inline size_t drbg_max_requests(struct drbg_state *drbg)
169{ 178{
179#if (__BITS_PER_LONG == 32)
180 return SIZE_MAX;
181#else
170 return (1UL<<(drbg->core->max_req)); 182 return (1UL<<(drbg->core->max_req));
183#endif
171} 184}
172 185
173/* 186/*
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 61978a460841..96453f9bc8ba 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -303,6 +303,7 @@ struct pci_dev {
303 D3cold, not set for devices 303 D3cold, not set for devices
304 powered on/off by the 304 powered on/off by the
305 corresponding bridge */ 305 corresponding bridge */
306 unsigned int ignore_hotplug:1; /* Ignore hotplug events */
306 unsigned int d3_delay; /* D3->D0 transition time in ms */ 307 unsigned int d3_delay; /* D3->D0 transition time in ms */
307 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ 308 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
308 309
@@ -1021,6 +1022,11 @@ bool pci_dev_run_wake(struct pci_dev *dev);
1021bool pci_check_pme_status(struct pci_dev *dev); 1022bool pci_check_pme_status(struct pci_dev *dev);
1022void pci_pme_wakeup_bus(struct pci_bus *bus); 1023void pci_pme_wakeup_bus(struct pci_bus *bus);
1023 1024
1025static inline void pci_ignore_hotplug(struct pci_dev *dev)
1026{
1027 dev->ignore_hotplug = 1;
1028}
1029
1024static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 1030static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
1025 bool enable) 1031 bool enable)
1026{ 1032{
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 502073a53dd3..b483abd34493 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -64,6 +64,7 @@ int vga_switcheroo_get_client_state(struct pci_dev *dev);
64void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); 64void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic);
65 65
66int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); 66int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain);
67void vga_switcheroo_fini_domain_pm_ops(struct device *dev);
67int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); 68int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain);
68#else 69#else
69 70
@@ -82,6 +83,7 @@ static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return
82static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} 83static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {}
83 84
84static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } 85static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
86static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {}
85static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } 87static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
86 88
87#endif 89#endif
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2c02f3a8d2ba..c37bd4d06739 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -182,7 +182,6 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
182 * vga_get()... 182 * vga_get()...
183 */ 183 */
184 184
185#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
186#ifdef CONFIG_VGA_ARB 185#ifdef CONFIG_VGA_ARB
187extern struct pci_dev *vga_default_device(void); 186extern struct pci_dev *vga_default_device(void);
188extern void vga_set_default_device(struct pci_dev *pdev); 187extern void vga_set_default_device(struct pci_dev *pdev);
@@ -190,7 +189,6 @@ extern void vga_set_default_device(struct pci_dev *pdev);
190static inline struct pci_dev *vga_default_device(void) { return NULL; }; 189static inline struct pci_dev *vga_default_device(void) { return NULL; };
191static inline void vga_set_default_device(struct pci_dev *pdev) { }; 190static inline void vga_set_default_device(struct pci_dev *pdev) { };
192#endif 191#endif
193#endif
194 192
195/** 193/**
196 * vga_conflicts 194 * vga_conflicts
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index cdcc90b07ecb..e64583560701 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -68,7 +68,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
68 return; 68 return;
69 69
70 if (!shost_use_blk_mq(sdev->host) && 70 if (!shost_use_blk_mq(sdev->host) &&
71 blk_queue_tagged(sdev->request_queue)) 71 !blk_queue_tagged(sdev->request_queue))
72 blk_queue_init_tags(sdev->request_queue, depth, 72 blk_queue_init_tags(sdev->request_queue, depth,
73 sdev->host->bqt); 73 sdev->host->bqt);
74 74
diff --git a/init/do_mounts.c b/init/do_mounts.c
index b6237c31b0e2..82f22885c87e 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -539,6 +539,12 @@ void __init prepare_namespace(void)
539{ 539{
540 int is_floppy; 540 int is_floppy;
541 541
542 if (root_delay) {
543 printk(KERN_INFO "Waiting %d sec before mounting root device...\n",
544 root_delay);
545 ssleep(root_delay);
546 }
547
542 /* 548 /*
543 * wait for the known devices to complete their probing 549 * wait for the known devices to complete their probing
544 * 550 *
@@ -565,12 +571,6 @@ void __init prepare_namespace(void)
565 if (initrd_load()) 571 if (initrd_load())
566 goto out; 572 goto out;
567 573
568 if (root_delay) {
569 pr_info("Waiting %d sec before mounting root device...\n",
570 root_delay);
571 ssleep(root_delay);
572 }
573
574 /* wait for any asynchronous scanning to complete */ 574 /* wait for any asynchronous scanning to complete */
575 if ((ROOT_DEV == 0) && root_wait) { 575 if ((ROOT_DEV == 0) && root_wait) {
576 printk(KERN_INFO "Waiting for root device %s...\n", 576 printk(KERN_INFO "Waiting for root device %s...\n",
diff --git a/kernel/events/core.c b/kernel/events/core.c
index f9c1ed002dbc..d640a8b4dcbc 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1524,6 +1524,11 @@ retry:
1524 */ 1524 */
1525 if (ctx->is_active) { 1525 if (ctx->is_active) {
1526 raw_spin_unlock_irq(&ctx->lock); 1526 raw_spin_unlock_irq(&ctx->lock);
1527 /*
1528 * Reload the task pointer, it might have been changed by
1529 * a concurrent perf_event_context_sched_out().
1530 */
1531 task = ctx->task;
1527 goto retry; 1532 goto retry;
1528 } 1533 }
1529 1534
@@ -1967,6 +1972,11 @@ retry:
1967 */ 1972 */
1968 if (ctx->is_active) { 1973 if (ctx->is_active) {
1969 raw_spin_unlock_irq(&ctx->lock); 1974 raw_spin_unlock_irq(&ctx->lock);
1975 /*
1976 * Reload the task pointer, it might have been changed by
1977 * a concurrent perf_event_context_sched_out().
1978 */
1979 task = ctx->task;
1970 goto retry; 1980 goto retry;
1971 } 1981 }
1972 1982
diff --git a/mm/dmapool.c b/mm/dmapool.c
index 306baa594f95..ba8019b063e1 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -176,7 +176,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
176 if (list_empty(&dev->dma_pools) && 176 if (list_empty(&dev->dma_pools) &&
177 device_create_file(dev, &dev_attr_pools)) { 177 device_create_file(dev, &dev_attr_pools)) {
178 kfree(retval); 178 kfree(retval);
179 return NULL; 179 retval = NULL;
180 } else 180 } else
181 list_add(&retval->pools, &dev->dma_pools); 181 list_add(&retval->pools, &dev->dma_pools);
182 mutex_unlock(&pools_lock); 182 mutex_unlock(&pools_lock);
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index ea823e1100da..98cd1908c039 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -566,8 +566,8 @@ static void stac_init_power_map(struct hda_codec *codec)
566 if (snd_hda_jack_tbl_get(codec, nid)) 566 if (snd_hda_jack_tbl_get(codec, nid))
567 continue; 567 continue;
568 if (def_conf == AC_JACK_PORT_COMPLEX && 568 if (def_conf == AC_JACK_PORT_COMPLEX &&
569 !(spec->vref_mute_led_nid == nid || 569 spec->vref_mute_led_nid != nid &&
570 is_jack_detectable(codec, nid))) { 570 is_jack_detectable(codec, nid)) {
571 snd_hda_jack_detect_enable_callback(codec, nid, 571 snd_hda_jack_detect_enable_callback(codec, nid,
572 STAC_PWR_EVENT, 572 STAC_PWR_EVENT,
573 jack_update_power); 573 jack_update_power);
@@ -4276,11 +4276,18 @@ static int stac_parse_auto_config(struct hda_codec *codec)
4276 return err; 4276 return err;
4277 } 4277 }
4278 4278
4279 stac_init_power_map(codec);
4280
4281 return 0; 4279 return 0;
4282} 4280}
4283 4281
4282static int stac_build_controls(struct hda_codec *codec)
4283{
4284 int err = snd_hda_gen_build_controls(codec);
4285
4286 if (err < 0)
4287 return err;
4288 stac_init_power_map(codec);
4289 return 0;
4290}
4284 4291
4285static int stac_init(struct hda_codec *codec) 4292static int stac_init(struct hda_codec *codec)
4286{ 4293{
@@ -4392,7 +4399,7 @@ static int stac_suspend(struct hda_codec *codec)
4392#endif /* CONFIG_PM */ 4399#endif /* CONFIG_PM */
4393 4400
4394static const struct hda_codec_ops stac_patch_ops = { 4401static const struct hda_codec_ops stac_patch_ops = {
4395 .build_controls = snd_hda_gen_build_controls, 4402 .build_controls = stac_build_controls,
4396 .build_pcms = snd_hda_gen_build_pcms, 4403 .build_pcms = snd_hda_gen_build_pcms,
4397 .init = stac_init, 4404 .init = stac_init,
4398 .free = stac_free, 4405 .free = stac_free,
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
index 98523209f739..69a85164357c 100644
--- a/sound/soc/codecs/cs4265.c
+++ b/sound/soc/codecs/cs4265.c
@@ -458,12 +458,12 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
458 if (params_width(params) == 16) { 458 if (params_width(params) == 16) {
459 snd_soc_update_bits(codec, CS4265_DAC_CTL, 459 snd_soc_update_bits(codec, CS4265_DAC_CTL,
460 CS4265_DAC_CTL_DIF, (1 << 5)); 460 CS4265_DAC_CTL_DIF, (1 << 5));
461 snd_soc_update_bits(codec, CS4265_ADC_CTL, 461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
462 CS4265_SPDIF_CTL2_DIF, (1 << 7)); 462 CS4265_SPDIF_CTL2_DIF, (1 << 7));
463 } else { 463 } else {
464 snd_soc_update_bits(codec, CS4265_DAC_CTL, 464 snd_soc_update_bits(codec, CS4265_DAC_CTL,
465 CS4265_DAC_CTL_DIF, (3 << 5)); 465 CS4265_DAC_CTL_DIF, (3 << 5));
466 snd_soc_update_bits(codec, CS4265_ADC_CTL, 466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
467 CS4265_SPDIF_CTL2_DIF, (1 << 7)); 467 CS4265_SPDIF_CTL2_DIF, (1 << 7));
468 } 468 }
469 break; 469 break;
@@ -472,7 +472,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
472 CS4265_DAC_CTL_DIF, 0); 472 CS4265_DAC_CTL_DIF, 0);
473 snd_soc_update_bits(codec, CS4265_ADC_CTL, 473 snd_soc_update_bits(codec, CS4265_ADC_CTL,
474 CS4265_ADC_DIF, 0); 474 CS4265_ADC_DIF, 0);
475 snd_soc_update_bits(codec, CS4265_ADC_CTL, 475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
476 CS4265_SPDIF_CTL2_DIF, (1 << 6)); 476 CS4265_SPDIF_CTL2_DIF, (1 << 6));
477 477
478 break; 478 break;
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index 9aa1323fb2ab..89c748dd3d6e 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -4,7 +4,7 @@
4 * sound/soc/codecs/sta529.c -- spear ALSA Soc codec driver 4 * sound/soc/codecs/sta529.c -- spear ALSA Soc codec driver
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Rajeev Kumar <rajeev-dlh.kumar@st.com> 7 * Rajeev Kumar <rajeevkumar.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
@@ -426,5 +426,5 @@ static struct i2c_driver sta529_i2c_driver = {
426module_i2c_driver(sta529_i2c_driver); 426module_i2c_driver(sta529_i2c_driver);
427 427
428MODULE_DESCRIPTION("ASoC STA529 codec driver"); 428MODULE_DESCRIPTION("ASoC STA529 codec driver");
429MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); 429MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>");
430MODULE_LICENSE("GPL"); 430MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 0f64c7890eed..aea9e1ff9126 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -189,46 +189,57 @@ static const struct aic31xx_rate_divs aic31xx_divs[] = {
189 /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */ 189 /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */
190 /* 8k rate */ 190 /* 8k rate */
191 {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2}, 191 {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2},
192 {12000000, 8000, 1, 8, 1920, 128, 32, 3, 128, 32, 3},
192 {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2}, 193 {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2},
193 {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2}, 194 {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2},
194 /* 11.025k rate */ 195 /* 11.025k rate */
195 {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2}, 196 {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2},
197 {12000000, 11025, 1, 8, 4672, 128, 24, 3, 128, 24, 3},
196 {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2}, 198 {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2},
197 {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2}, 199 {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2},
198 /* 16k rate */ 200 /* 16k rate */
199 {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2}, 201 {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2},
202 {12000000, 16000, 1, 8, 1920, 128, 16, 3, 128, 16, 3},
200 {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2}, 203 {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2},
201 {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2}, 204 {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2},
202 /* 22.05k rate */ 205 /* 22.05k rate */
203 {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2}, 206 {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2},
207 {12000000, 22050, 1, 8, 4672, 128, 12, 3, 128, 12, 3},
204 {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2}, 208 {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2},
205 {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2}, 209 {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2},
206 /* 32k rate */ 210 /* 32k rate */
207 {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2}, 211 {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2},
212 {12000000, 32000, 1, 8, 1920, 128, 8, 3, 128, 8, 3},
208 {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2}, 213 {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2},
209 {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2}, 214 {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2},
210 /* 44.1k rate */ 215 /* 44.1k rate */
211 {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2}, 216 {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2},
217 {12000000, 44100, 1, 8, 4672, 128, 6, 3, 128, 6, 3},
212 {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2}, 218 {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2},
213 {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2}, 219 {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2},
214 /* 48k rate */ 220 /* 48k rate */
215 {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2}, 221 {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2},
222 {12000000, 48000, 1, 7, 6800, 96, 5, 4, 96, 5, 4},
216 {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2}, 223 {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2},
217 {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2}, 224 {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2},
218 /* 88.2k rate */ 225 /* 88.2k rate */
219 {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2}, 226 {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2},
227 {12000000, 88200, 1, 8, 4672, 64, 6, 3, 64, 6, 3},
220 {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2}, 228 {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2},
221 {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2}, 229 {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2},
222 /* 96k rate */ 230 /* 96k rate */
223 {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2}, 231 {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2},
232 {12000000, 96000, 1, 7, 6800, 48, 5, 4, 48, 5, 4},
224 {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2}, 233 {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2},
225 {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2}, 234 {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2},
226 /* 176.4k rate */ 235 /* 176.4k rate */
227 {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2}, 236 {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2},
237 {12000000, 176400, 1, 8, 4672, 32, 6, 3, 32, 6, 3},
228 {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2}, 238 {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2},
229 {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2}, 239 {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2},
230 /* 192k rate */ 240 /* 192k rate */
231 {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2}, 241 {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2},
242 {12000000, 192000, 1, 7, 6800, 24, 5, 4, 24, 5, 4},
232 {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2}, 243 {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2},
233 {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2}, 244 {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2},
234}; 245};
@@ -680,7 +691,9 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
680 struct snd_pcm_hw_params *params) 691 struct snd_pcm_hw_params *params)
681{ 692{
682 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); 693 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
694 int bclk_score = snd_soc_params_to_frame_size(params);
683 int bclk_n = 0; 695 int bclk_n = 0;
696 int match = -1;
684 int i; 697 int i;
685 698
686 /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */ 699 /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */
@@ -691,15 +704,37 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
691 704
692 for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) { 705 for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) {
693 if (aic31xx_divs[i].rate == params_rate(params) && 706 if (aic31xx_divs[i].rate == params_rate(params) &&
694 aic31xx_divs[i].mclk == aic31xx->sysclk) 707 aic31xx_divs[i].mclk == aic31xx->sysclk) {
695 break; 708 int s = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) %
709 snd_soc_params_to_frame_size(params);
710 int bn = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) /
711 snd_soc_params_to_frame_size(params);
712 if (s < bclk_score && bn > 0) {
713 match = i;
714 bclk_n = bn;
715 bclk_score = s;
716 }
717 }
696 } 718 }
697 719
698 if (i == ARRAY_SIZE(aic31xx_divs)) { 720 if (match == -1) {
699 dev_err(codec->dev, "%s: Sampling rate %u not supported\n", 721 dev_err(codec->dev,
722 "%s: Sample rate (%u) and format not supported\n",
700 __func__, params_rate(params)); 723 __func__, params_rate(params));
724 /* See bellow for details how fix this. */
701 return -EINVAL; 725 return -EINVAL;
702 } 726 }
727 if (bclk_score != 0) {
728 dev_warn(codec->dev, "Can not produce exact bitclock");
729 /* This is fine if using dsp format, but if using i2s
730 there may be trouble. To fix the issue edit the
731 aic31xx_divs table for your mclk and sample
732 rate. Details can be found from:
733 http://www.ti.com/lit/ds/symlink/tlv320aic3100.pdf
734 Section: 5.6 CLOCK Generation and PLL
735 */
736 }
737 i = match;
703 738
704 /* PLL configuration */ 739 /* PLL configuration */
705 snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK, 740 snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK,
@@ -729,14 +764,6 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
729 snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr); 764 snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr);
730 765
731 /* Bit clock divider configuration. */ 766 /* Bit clock divider configuration. */
732 bclk_n = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac)
733 / snd_soc_params_to_frame_size(params);
734 if (bclk_n == 0) {
735 dev_err(codec->dev, "%s: Not enough BLCK bandwidth\n",
736 __func__);
737 return -EINVAL;
738 }
739
740 snd_soc_update_bits(codec, AIC31XX_BCLKN, 767 snd_soc_update_bits(codec, AIC31XX_BCLKN,
741 AIC31XX_PLL_MASK, bclk_n); 768 AIC31XX_PLL_MASK, bclk_n);
742 769
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 6a6b2ff7d7d7..68347b55f6e1 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -467,8 +467,17 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
467{ 467{
468 u32 fmt; 468 u32 fmt;
469 u32 tx_rotate = (word_length / 4) & 0x7; 469 u32 tx_rotate = (word_length / 4) & 0x7;
470 u32 rx_rotate = (32 - word_length) / 4;
471 u32 mask = (1ULL << word_length) - 1; 470 u32 mask = (1ULL << word_length) - 1;
471 /*
472 * For captured data we should not rotate, inversion and masking is
473 * enoguh to get the data to the right position:
474 * Format data from bus after reverse (XRBUF)
475 * S16_LE: |LSB|MSB|xxx|xxx| |xxx|xxx|MSB|LSB|
476 * S24_3LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB|
477 * S24_LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB|
478 * S32_LE: |LSB|DAT|DAT|MSB| |MSB|DAT|DAT|LSB|
479 */
480 u32 rx_rotate = 0;
472 481
473 /* 482 /*
474 * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() 483 * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv()
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index 25c31f1655f6..e961388e6e9c 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -4,7 +4,7 @@
4 * sound/soc/dwc/designware_i2s.c 4 * sound/soc/dwc/designware_i2s.c
5 * 5 *
6 * Copyright (C) 2010 ST Microelectronics 6 * Copyright (C) 2010 ST Microelectronics
7 * Rajeev Kumar <rajeev-dlh.kumar@st.com> 7 * Rajeev Kumar <rajeevkumar.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
@@ -455,7 +455,7 @@ static struct platform_driver dw_i2s_driver = {
455 455
456module_platform_driver(dw_i2s_driver); 456module_platform_driver(dw_i2s_driver);
457 457
458MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); 458MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>");
459MODULE_DESCRIPTION("DESIGNWARE I2S SoC Interface"); 459MODULE_DESCRIPTION("DESIGNWARE I2S SoC Interface");
460MODULE_LICENSE("GPL"); 460MODULE_LICENSE("GPL");
461MODULE_ALIAS("platform:designware_i2s"); 461MODULE_ALIAS("platform:designware_i2s");
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 8d8e4b59049f..fb9e05c9f471 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -165,13 +165,14 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
165 struct rk_i2s_dev *i2s = to_info(cpu_dai); 165 struct rk_i2s_dev *i2s = to_info(cpu_dai);
166 unsigned int mask = 0, val = 0; 166 unsigned int mask = 0, val = 0;
167 167
168 mask = I2S_CKR_MSS_SLAVE; 168 mask = I2S_CKR_MSS_MASK;
169 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 169 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
170 case SND_SOC_DAIFMT_CBS_CFS: 170 case SND_SOC_DAIFMT_CBS_CFS:
171 val = I2S_CKR_MSS_SLAVE; 171 /* Set source clock in Master mode */
172 val = I2S_CKR_MSS_MASTER;
172 break; 173 break;
173 case SND_SOC_DAIFMT_CBM_CFM: 174 case SND_SOC_DAIFMT_CBM_CFM:
174 val = I2S_CKR_MSS_MASTER; 175 val = I2S_CKR_MSS_SLAVE;
175 break; 176 break;
176 default: 177 default:
177 return -EINVAL; 178 return -EINVAL;
@@ -361,6 +362,8 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg)
361 case I2S_XFER: 362 case I2S_XFER:
362 case I2S_CLR: 363 case I2S_CLR:
363 case I2S_RXDR: 364 case I2S_RXDR:
365 case I2S_FIFOLR:
366 case I2S_INTSR:
364 return true; 367 return true;
365 default: 368 default:
366 return false; 369 return false;
@@ -370,8 +373,8 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg)
370static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) 373static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg)
371{ 374{
372 switch (reg) { 375 switch (reg) {
373 case I2S_FIFOLR:
374 case I2S_INTSR: 376 case I2S_INTSR:
377 case I2S_CLR:
375 return true; 378 return true;
376 default: 379 default:
377 return false; 380 return false;
@@ -381,8 +384,6 @@ static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg)
381static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) 384static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg)
382{ 385{
383 switch (reg) { 386 switch (reg) {
384 case I2S_FIFOLR:
385 return true;
386 default: 387 default:
387 return false; 388 return false;
388 } 389 }
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 03eec22f0f46..9d513473b300 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -462,7 +462,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
462 if (dir == SND_SOC_CLOCK_IN) 462 if (dir == SND_SOC_CLOCK_IN)
463 rfs = 0; 463 rfs = 0;
464 464
465 if ((rfs && other->rfs && (other->rfs != rfs)) || 465 if ((rfs && other && other->rfs && (other->rfs != rfs)) ||
466 (any_active(i2s) && 466 (any_active(i2s) &&
467 (((dir == SND_SOC_CLOCK_IN) 467 (((dir == SND_SOC_CLOCK_IN)
468 && !(mod & MOD_CDCLKCON)) || 468 && !(mod & MOD_CDCLKCON)) ||
@@ -762,7 +762,8 @@ static void i2s_shutdown(struct snd_pcm_substream *substream,
762 } else { 762 } else {
763 u32 mod = readl(i2s->addr + I2SMOD); 763 u32 mod = readl(i2s->addr + I2SMOD);
764 i2s->cdclk_out = !(mod & MOD_CDCLKCON); 764 i2s->cdclk_out = !(mod & MOD_CDCLKCON);
765 other->cdclk_out = i2s->cdclk_out; 765 if (other)
766 other->cdclk_out = i2s->cdclk_out;
766 } 767 }
767 /* Reset any constraint on RFS and BFS */ 768 /* Reset any constraint on RFS and BFS */
768 i2s->rfs = 0; 769 i2s->rfs = 0;
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 27c06acce205..3092b58fede6 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -101,7 +101,11 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
101 101
102 fe->dpcm[stream].runtime = fe_substream->runtime; 102 fe->dpcm[stream].runtime = fe_substream->runtime;
103 103
104 if (dpcm_path_get(fe, stream, &list) <= 0) { 104 ret = dpcm_path_get(fe, stream, &list);
105 if (ret < 0) {
106 mutex_unlock(&fe->card->mutex);
107 goto fe_err;
108 } else if (ret == 0) {
105 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", 109 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
106 fe->dai_link->name, stream ? "capture" : "playback"); 110 fe->dai_link->name, stream ? "capture" : "playback");
107 } 111 }
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 731fdb5b5f9b..642c86240752 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2352,7 +2352,11 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
2352 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); 2352 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
2353 fe->dpcm[stream].runtime = fe_substream->runtime; 2353 fe->dpcm[stream].runtime = fe_substream->runtime;
2354 2354
2355 if (dpcm_path_get(fe, stream, &list) <= 0) { 2355 ret = dpcm_path_get(fe, stream, &list);
2356 if (ret < 0) {
2357 mutex_unlock(&fe->card->mutex);
2358 return ret;
2359 } else if (ret == 0) {
2356 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", 2360 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
2357 fe->dai_link->name, stream ? "capture" : "playback"); 2361 fe->dai_link->name, stream ? "capture" : "playback");
2358 } 2362 }
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c
index 0e5a8f35d0ad..a7dc3c56f44d 100644
--- a/sound/soc/spear/spear_pcm.c
+++ b/sound/soc/spear/spear_pcm.c
@@ -4,7 +4,7 @@
4 * sound/soc/spear/spear_pcm.c 4 * sound/soc/spear/spear_pcm.c
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com> 7 * Rajeev Kumar<rajeevkumar.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
@@ -50,6 +50,6 @@ int devm_spear_pcm_platform_register(struct device *dev,
50} 50}
51EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register); 51EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register);
52 52
53MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); 53MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>");
54MODULE_DESCRIPTION("SPEAr PCM DMA module"); 54MODULE_DESCRIPTION("SPEAr PCM DMA module");
55MODULE_LICENSE("GPL"); 55MODULE_LICENSE("GPL");