aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt1
-rw-r--r--arch/arc/kernel/ptrace.c2
-rw-r--r--arch/arm/Makefile9
-rw-r--r--arch/arm/boot/Makefile16
-rw-r--r--arch/arm/boot/install.sh14
-rw-r--r--arch/arm/include/asm/jump_label.h2
-rw-r--r--arch/mips/include/asm/jump_label.h2
-rw-r--r--arch/mips/kernel/octeon_switch.S2
-rw-r--r--arch/mips/kernel/r2300_switch.S2
-rw-r--r--arch/mips/kernel/r4k_switch.S2
-rw-r--r--arch/powerpc/include/asm/jump_label.h2
-rw-r--r--arch/powerpc/kernel/irq.c5
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S2
-rw-r--r--arch/powerpc/kvm/e500_mmu_host.c18
-rw-r--r--arch/s390/include/asm/jump_label.h2
-rw-r--r--arch/s390/kernel/crash_dump.c42
-rw-r--r--arch/s390/kernel/entry.S1
-rw-r--r--arch/s390/kernel/entry64.S1
-rw-r--r--arch/s390/kernel/kprobes.c6
-rw-r--r--arch/sparc/include/asm/jump_label.h2
-rw-r--r--arch/tile/include/asm/atomic.h5
-rw-r--r--arch/tile/include/asm/atomic_32.h27
-rw-r--r--arch/tile/include/asm/cmpxchg.h28
-rw-r--r--arch/tile/include/asm/percpu.h34
-rw-r--r--arch/tile/kernel/hardwall.c6
-rw-r--r--arch/tile/kernel/intvec_32.S3
-rw-r--r--arch/tile/kernel/intvec_64.S3
-rw-r--r--arch/tile/kernel/stack.c12
-rw-r--r--arch/tile/lib/atomic_32.c8
-rw-r--r--arch/x86/Kconfig6
-rw-r--r--arch/x86/include/asm/cpufeature.h6
-rw-r--r--arch/x86/include/asm/jump_label.h2
-rw-r--r--arch/x86/include/asm/mutex_64.h4
-rw-r--r--arch/x86/kernel/cpu/perf_event.c11
-rw-r--r--arch/x86/kernel/reboot.c8
-rw-r--r--arch/x86/kvm/vmx.c24
-rw-r--r--drivers/char/random.c11
-rw-r--r--drivers/gpu/drm/drm_edid.c2
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c8
-rw-r--r--drivers/gpu/drm/gma500/gtt.c1
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c15
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h6
-rw-r--r--drivers/gpu/drm/i915/intel_display.c38
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c2
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h1
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/mc/base.c2
-rw-r--r--drivers/gpu/drm/radeon/btc_dpm.c6
-rw-r--r--drivers/gpu/drm/radeon/cik.c6
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c2
-rw-r--r--drivers/gpu/drm/radeon/evergreen_hdmi.c3
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h4
-rw-r--r--drivers/gpu/drm/radeon/r600_hdmi.c21
-rw-r--r--drivers/gpu/drm/radeon/r600d.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_test.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_uvd.c3
-rw-r--r--drivers/gpu/drm/radeon/si.c10
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c6
-rw-r--r--drivers/gpu/drm/radeon/sid.h4
-rw-r--r--drivers/gpu/drm/radeon/trinity_dpm.c2
-rw-r--r--drivers/hid/Kconfig1
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-holtek-mouse.c4
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-roccat-kone.c2
-rw-r--r--drivers/hid/hid-roccat-koneplus.c4
-rw-r--r--drivers/hid/hid-roccat-kovaplus.c4
-rw-r--r--drivers/hid/hid-roccat-pyra.c4
-rw-r--r--drivers/hid/hid-wiimote-modules.c40
-rw-r--r--drivers/hid/hid-wiimote.h4
-rw-r--r--drivers/hid/hidraw.c21
-rw-r--r--drivers/hid/uhid.c3
-rw-r--r--drivers/hwmon/applesmc.c13
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c5
-rw-r--r--drivers/i2c/busses/i2c-imx.c11
-rw-r--r--drivers/i2c/busses/i2c-mxs.c3
-rw-r--r--drivers/i2c/busses/i2c-omap.c3
-rw-r--r--drivers/i2c/busses/i2c-stu300.c11
-rw-r--r--drivers/i2c/i2c-core.c3
-rw-r--r--drivers/i2c/muxes/i2c-arb-gpio-challenge.c2
-rw-r--r--drivers/i2c/muxes/i2c-mux-gpio.c14
-rw-r--r--drivers/i2c/muxes/i2c-mux-pinctrl.c4
-rw-r--r--drivers/iommu/Kconfig2
-rw-r--r--drivers/md/bcache/request.c3
-rw-r--r--drivers/mtd/devices/m25p80.c17
-rw-r--r--drivers/mtd/nand/nand_base.c8
-rw-r--r--drivers/s390/char/sclp_cmd.c8
-rw-r--r--drivers/s390/char/tty3270.c2
-rw-r--r--drivers/spi/spi-atmel.c3
-rw-r--r--drivers/spi/spi-clps711x.c3
-rw-r--r--drivers/spi/spi-fsl-dspi.c10
-rw-r--r--drivers/spi/spi-mpc512x-psc.c4
-rw-r--r--drivers/spi/spi-pxa2xx.c11
-rw-r--r--drivers/spi/spi-s3c64xx.c4
-rw-r--r--drivers/spi/spi-sh-hspi.c4
-rw-r--r--drivers/watchdog/hpwdt.c6
-rw-r--r--fs/btrfs/disk-io.c9
-rw-r--r--fs/btrfs/disk-io.h13
-rw-r--r--fs/btrfs/extent_io.c12
-rw-r--r--fs/btrfs/inode.c2
-rw-r--r--fs/btrfs/relocation.c2
-rw-r--r--fs/btrfs/root-tree.c8
-rw-r--r--fs/ext4/inode.c2
-rw-r--r--fs/ext4/xattr.c2
-rw-r--r--fs/statfs.c2
-rw-r--r--include/linux/compiler-gcc4.h15
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/perf_event.h24
-rw-r--r--include/linux/random.h1
-rw-r--r--include/linux/timex.h14
-rw-r--r--include/linux/vgaarb.h7
-rw-r--r--init/main.c2
-rw-r--r--kernel/events/core.c6
-rw-r--r--lib/kobject.c2
-rw-r--r--sound/pci/hda/patch_hdmi.c18
-rw-r--r--sound/pci/hda/patch_realtek.c54
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c22
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c7
-rw-r--r--tools/perf/Makefile1
-rw-r--r--tools/perf/builtin-stat.c1
-rw-r--r--tools/perf/config/feature-tests.mak2
-rw-r--r--tools/perf/util/dwarf-aux.c25
-rw-r--r--tools/perf/util/dwarf-aux.h6
-rw-r--r--tools/perf/util/header.c12
-rw-r--r--tools/perf/util/probe-finder.c49
-rw-r--r--tools/perf/util/session.c4
127 files changed, 676 insertions, 383 deletions
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index f911e3656209..85c362d8ea34 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -28,6 +28,7 @@ ALC269/270/275/276/28x/29x
28 alc269-dmic Enable ALC269(VA) digital mic workaround 28 alc269-dmic Enable ALC269(VA) digital mic workaround
29 alc271-dmic Enable ALC271X digital mic workaround 29 alc271-dmic Enable ALC271X digital mic workaround
30 inv-dmic Inverted internal mic workaround 30 inv-dmic Inverted internal mic workaround
31 headset-mic Indicates a combined headset (headphone+mic) jack
31 lenovo-dock Enables docking station I/O for some Lenovos 32 lenovo-dock Enables docking station I/O for some Lenovos
32 dell-headset-multi Headset jack, which can also be used as mic-in 33 dell-headset-multi Headset jack, which can also be used as mic-in
33 dell-headset-dock Headset jack (without mic-in), and also dock I/O 34 dell-headset-dock Headset jack (without mic-in), and also dock I/O
diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c
index 333238564b67..5d76706139dd 100644
--- a/arch/arc/kernel/ptrace.c
+++ b/arch/arc/kernel/ptrace.c
@@ -102,7 +102,7 @@ static int genregs_set(struct task_struct *target,
102 REG_IGNORE_ONE(pad2); 102 REG_IGNORE_ONE(pad2);
103 REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */ 103 REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */
104 REG_IGNORE_ONE(efa); /* efa update invalid */ 104 REG_IGNORE_ONE(efa); /* efa update invalid */
105 REG_IN_ONE(stop_pc, &ptregs->ret); /* stop_pc: PC update */ 105 REG_IGNORE_ONE(stop_pc); /* PC updated via @ret */
106 106
107 return ret; 107 return ret;
108} 108}
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a37a50f575a2..db50b626be98 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -296,10 +296,15 @@ archprepare:
296# Convert bzImage to zImage 296# Convert bzImage to zImage
297bzImage: zImage 297bzImage: zImage
298 298
299zImage Image xipImage bootpImage uImage: vmlinux 299BOOT_TARGETS = zImage Image xipImage bootpImage uImage
300INSTALL_TARGETS = zinstall uinstall install
301
302PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
303
304$(BOOT_TARGETS): vmlinux
300 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 305 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
301 306
302zinstall uinstall install: vmlinux 307$(INSTALL_TARGETS):
303 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 308 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
304 309
305%.dtb: | scripts 310%.dtb: | scripts
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 84aa2caf07ed..ec2f8065f955 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -95,24 +95,24 @@ initrd:
95 @test "$(INITRD)" != "" || \ 95 @test "$(INITRD)" != "" || \
96 (echo You must specify INITRD; exit -1) 96 (echo You must specify INITRD; exit -1)
97 97
98install: $(obj)/Image 98install:
99 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 99 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
100 $(obj)/Image System.map "$(INSTALL_PATH)" 100 $(obj)/Image System.map "$(INSTALL_PATH)"
101 101
102zinstall: $(obj)/zImage 102zinstall:
103 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 103 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
104 $(obj)/zImage System.map "$(INSTALL_PATH)" 104 $(obj)/zImage System.map "$(INSTALL_PATH)"
105 105
106uinstall: $(obj)/uImage 106uinstall:
107 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 107 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
108 $(obj)/uImage System.map "$(INSTALL_PATH)" 108 $(obj)/uImage System.map "$(INSTALL_PATH)"
109 109
110zi: 110zi:
111 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 111 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
112 $(obj)/zImage System.map "$(INSTALL_PATH)" 112 $(obj)/zImage System.map "$(INSTALL_PATH)"
113 113
114i: 114i:
115 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 115 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \
116 $(obj)/Image System.map "$(INSTALL_PATH)" 116 $(obj)/Image System.map "$(INSTALL_PATH)"
117 117
118subdir- := bootp compressed dts 118subdir- := bootp compressed dts
diff --git a/arch/arm/boot/install.sh b/arch/arm/boot/install.sh
index 06ea7d42ce8e..2a45092a40e3 100644
--- a/arch/arm/boot/install.sh
+++ b/arch/arm/boot/install.sh
@@ -20,6 +20,20 @@
20# $4 - default install path (blank if root directory) 20# $4 - default install path (blank if root directory)
21# 21#
22 22
23verify () {
24 if [ ! -f "$1" ]; then
25 echo "" 1>&2
26 echo " *** Missing file: $1" 1>&2
27 echo ' *** You need to run "make" before "make install".' 1>&2
28 echo "" 1>&2
29 exit 1
30 fi
31}
32
33# Make sure the files actually exist
34verify "$2"
35verify "$3"
36
23# User may have a custom install script 37# User may have a custom install script
24if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi 38if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
25if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi 39if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h
index bfc198c75913..863c892b4aaa 100644
--- a/arch/arm/include/asm/jump_label.h
+++ b/arch/arm/include/asm/jump_label.h
@@ -16,7 +16,7 @@
16 16
17static __always_inline bool arch_static_branch(struct static_key *key) 17static __always_inline bool arch_static_branch(struct static_key *key)
18{ 18{
19 asm goto("1:\n\t" 19 asm_volatile_goto("1:\n\t"
20 JUMP_LABEL_NOP "\n\t" 20 JUMP_LABEL_NOP "\n\t"
21 ".pushsection __jump_table, \"aw\"\n\t" 21 ".pushsection __jump_table, \"aw\"\n\t"
22 ".word 1b, %l[l_yes], %c0\n\t" 22 ".word 1b, %l[l_yes], %c0\n\t"
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h
index 4d6d77ed9b9d..e194f957ca8c 100644
--- a/arch/mips/include/asm/jump_label.h
+++ b/arch/mips/include/asm/jump_label.h
@@ -22,7 +22,7 @@
22 22
23static __always_inline bool arch_static_branch(struct static_key *key) 23static __always_inline bool arch_static_branch(struct static_key *key)
24{ 24{
25 asm goto("1:\tnop\n\t" 25 asm_volatile_goto("1:\tnop\n\t"
26 "nop\n\t" 26 "nop\n\t"
27 ".pushsection __jump_table, \"aw\"\n\t" 27 ".pushsection __jump_table, \"aw\"\n\t"
28 WORD_INSN " 1b, %l[l_yes], %0\n\t" 28 WORD_INSN " 1b, %l[l_yes], %0\n\t"
diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S
index 4204d76af854..029e002a4ea0 100644
--- a/arch/mips/kernel/octeon_switch.S
+++ b/arch/mips/kernel/octeon_switch.S
@@ -73,7 +73,7 @@
733: 733:
74 74
75#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 75#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
76 PTR_L t8, __stack_chk_guard 76 PTR_LA t8, __stack_chk_guard
77 LONG_L t9, TASK_STACK_CANARY(a1) 77 LONG_L t9, TASK_STACK_CANARY(a1)
78 LONG_S t9, 0(t8) 78 LONG_S t9, 0(t8)
79#endif 79#endif
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 38af83f84c4a..20b7b040e76f 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -67,7 +67,7 @@ LEAF(resume)
671: 671:
68 68
69#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 69#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
70 PTR_L t8, __stack_chk_guard 70 PTR_LA t8, __stack_chk_guard
71 LONG_L t9, TASK_STACK_CANARY(a1) 71 LONG_L t9, TASK_STACK_CANARY(a1)
72 LONG_S t9, 0(t8) 72 LONG_S t9, 0(t8)
73#endif 73#endif
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 921238a6bd26..078de5eaca8f 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -69,7 +69,7 @@
691: 691:
70 70
71#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 71#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
72 PTR_L t8, __stack_chk_guard 72 PTR_LA t8, __stack_chk_guard
73 LONG_L t9, TASK_STACK_CANARY(a1) 73 LONG_L t9, TASK_STACK_CANARY(a1)
74 LONG_S t9, 0(t8) 74 LONG_S t9, 0(t8)
75#endif 75#endif
diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
index ae098c438f00..f016bb699b5f 100644
--- a/arch/powerpc/include/asm/jump_label.h
+++ b/arch/powerpc/include/asm/jump_label.h
@@ -19,7 +19,7 @@
19 19
20static __always_inline bool arch_static_branch(struct static_key *key) 20static __always_inline bool arch_static_branch(struct static_key *key)
21{ 21{
22 asm goto("1:\n\t" 22 asm_volatile_goto("1:\n\t"
23 "nop\n\t" 23 "nop\n\t"
24 ".pushsection __jump_table, \"aw\"\n\t" 24 ".pushsection __jump_table, \"aw\"\n\t"
25 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t" 25 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t"
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 57d286a78f86..c7cb8c232d2f 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -495,14 +495,15 @@ void __do_irq(struct pt_regs *regs)
495void do_IRQ(struct pt_regs *regs) 495void do_IRQ(struct pt_regs *regs)
496{ 496{
497 struct pt_regs *old_regs = set_irq_regs(regs); 497 struct pt_regs *old_regs = set_irq_regs(regs);
498 struct thread_info *curtp, *irqtp; 498 struct thread_info *curtp, *irqtp, *sirqtp;
499 499
500 /* Switch to the irq stack to handle this */ 500 /* Switch to the irq stack to handle this */
501 curtp = current_thread_info(); 501 curtp = current_thread_info();
502 irqtp = hardirq_ctx[raw_smp_processor_id()]; 502 irqtp = hardirq_ctx[raw_smp_processor_id()];
503 sirqtp = softirq_ctx[raw_smp_processor_id()];
503 504
504 /* Already there ? */ 505 /* Already there ? */
505 if (unlikely(curtp == irqtp)) { 506 if (unlikely(curtp == irqtp || curtp == sirqtp)) {
506 __do_irq(regs); 507 __do_irq(regs);
507 set_irq_regs(old_regs); 508 set_irq_regs(old_regs);
508 return; 509 return;
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 294b7af28cdd..c71103b8a748 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1066,7 +1066,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1066BEGIN_FTR_SECTION 1066BEGIN_FTR_SECTION
1067 mfspr r8, SPRN_DSCR 1067 mfspr r8, SPRN_DSCR
1068 ld r7, HSTATE_DSCR(r13) 1068 ld r7, HSTATE_DSCR(r13)
1069 std r8, VCPU_DSCR(r7) 1069 std r8, VCPU_DSCR(r9)
1070 mtspr SPRN_DSCR, r7 1070 mtspr SPRN_DSCR, r7
1071END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 1071END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1072 1072
diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 1c6a9d729df4..c65593abae8e 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -332,6 +332,13 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
332 unsigned long hva; 332 unsigned long hva;
333 int pfnmap = 0; 333 int pfnmap = 0;
334 int tsize = BOOK3E_PAGESZ_4K; 334 int tsize = BOOK3E_PAGESZ_4K;
335 int ret = 0;
336 unsigned long mmu_seq;
337 struct kvm *kvm = vcpu_e500->vcpu.kvm;
338
339 /* used to check for invalidations in progress */
340 mmu_seq = kvm->mmu_notifier_seq;
341 smp_rmb();
335 342
336 /* 343 /*
337 * Translate guest physical to true physical, acquiring 344 * Translate guest physical to true physical, acquiring
@@ -449,6 +456,12 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
449 gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1); 456 gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1);
450 } 457 }
451 458
459 spin_lock(&kvm->mmu_lock);
460 if (mmu_notifier_retry(kvm, mmu_seq)) {
461 ret = -EAGAIN;
462 goto out;
463 }
464
452 kvmppc_e500_ref_setup(ref, gtlbe, pfn); 465 kvmppc_e500_ref_setup(ref, gtlbe, pfn);
453 466
454 kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize, 467 kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize,
@@ -457,10 +470,13 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
457 /* Clear i-cache for new pages */ 470 /* Clear i-cache for new pages */
458 kvmppc_mmu_flush_icache(pfn); 471 kvmppc_mmu_flush_icache(pfn);
459 472
473out:
474 spin_unlock(&kvm->mmu_lock);
475
460 /* Drop refcount on page, so that mmu notifiers can clear it */ 476 /* Drop refcount on page, so that mmu notifiers can clear it */
461 kvm_release_pfn_clean(pfn); 477 kvm_release_pfn_clean(pfn);
462 478
463 return 0; 479 return ret;
464} 480}
465 481
466/* XXX only map the one-one case, for now use TLB0 */ 482/* XXX only map the one-one case, for now use TLB0 */
diff --git a/arch/s390/include/asm/jump_label.h b/arch/s390/include/asm/jump_label.h
index 6c32190dc73e..346b1c85ffb4 100644
--- a/arch/s390/include/asm/jump_label.h
+++ b/arch/s390/include/asm/jump_label.h
@@ -15,7 +15,7 @@
15 15
16static __always_inline bool arch_static_branch(struct static_key *key) 16static __always_inline bool arch_static_branch(struct static_key *key)
17{ 17{
18 asm goto("0: brcl 0,0\n" 18 asm_volatile_goto("0: brcl 0,0\n"
19 ".pushsection __jump_table, \"aw\"\n" 19 ".pushsection __jump_table, \"aw\"\n"
20 ASM_ALIGN "\n" 20 ASM_ALIGN "\n"
21 ASM_PTR " 0b, %l[label], %0\n" 21 ASM_PTR " 0b, %l[label], %0\n"
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index c84f33d51f7b..7dd21720e5b0 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -40,28 +40,26 @@ static inline void *load_real_addr(void *addr)
40} 40}
41 41
42/* 42/*
43 * Copy up to one page to vmalloc or real memory 43 * Copy real to virtual or real memory
44 */ 44 */
45static ssize_t copy_page_real(void *buf, void *src, size_t csize) 45static int copy_from_realmem(void *dest, void *src, size_t count)
46{ 46{
47 size_t size; 47 unsigned long size;
48 int rc;
48 49
49 if (is_vmalloc_addr(buf)) { 50 if (!count)
50 BUG_ON(csize >= PAGE_SIZE); 51 return 0;
51 /* If buf is not page aligned, copy first part */ 52 if (!is_vmalloc_or_module_addr(dest))
52 size = min(roundup(__pa(buf), PAGE_SIZE) - __pa(buf), csize); 53 return memcpy_real(dest, src, count);
53 if (size) { 54 do {
54 if (memcpy_real(load_real_addr(buf), src, size)) 55 size = min(count, PAGE_SIZE - (__pa(dest) & ~PAGE_MASK));
55 return -EFAULT; 56 if (memcpy_real(load_real_addr(dest), src, size))
56 buf += size; 57 return -EFAULT;
57 src += size; 58 count -= size;
58 } 59 dest += size;
59 /* Copy second part */ 60 src += size;
60 size = csize - size; 61 } while (count);
61 return (size) ? memcpy_real(load_real_addr(buf), src, size) : 0; 62 return 0;
62 } else {
63 return memcpy_real(buf, src, csize);
64 }
65} 63}
66 64
67/* 65/*
@@ -114,7 +112,7 @@ static ssize_t copy_oldmem_page_kdump(char *buf, size_t csize,
114 rc = copy_to_user_real((void __force __user *) buf, 112 rc = copy_to_user_real((void __force __user *) buf,
115 (void *) src, csize); 113 (void *) src, csize);
116 else 114 else
117 rc = copy_page_real(buf, (void *) src, csize); 115 rc = copy_from_realmem(buf, (void *) src, csize);
118 return (rc == 0) ? rc : csize; 116 return (rc == 0) ? rc : csize;
119} 117}
120 118
@@ -210,7 +208,7 @@ int copy_from_oldmem(void *dest, void *src, size_t count)
210 if (OLDMEM_BASE) { 208 if (OLDMEM_BASE) {
211 if ((unsigned long) src < OLDMEM_SIZE) { 209 if ((unsigned long) src < OLDMEM_SIZE) {
212 copied = min(count, OLDMEM_SIZE - (unsigned long) src); 210 copied = min(count, OLDMEM_SIZE - (unsigned long) src);
213 rc = memcpy_real(dest, src + OLDMEM_BASE, copied); 211 rc = copy_from_realmem(dest, src + OLDMEM_BASE, copied);
214 if (rc) 212 if (rc)
215 return rc; 213 return rc;
216 } 214 }
@@ -223,7 +221,7 @@ int copy_from_oldmem(void *dest, void *src, size_t count)
223 return rc; 221 return rc;
224 } 222 }
225 } 223 }
226 return memcpy_real(dest + copied, src + copied, count - copied); 224 return copy_from_realmem(dest + copied, src + copied, count - copied);
227} 225}
228 226
229/* 227/*
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index cc30d1fb000c..0dc2b6d0a1ec 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -266,6 +266,7 @@ sysc_sigpending:
266 tm __TI_flags+3(%r12),_TIF_SYSCALL 266 tm __TI_flags+3(%r12),_TIF_SYSCALL
267 jno sysc_return 267 jno sysc_return
268 lm %r2,%r7,__PT_R2(%r11) # load svc arguments 268 lm %r2,%r7,__PT_R2(%r11) # load svc arguments
269 l %r10,__TI_sysc_table(%r12) # 31 bit system call table
269 xr %r8,%r8 # svc 0 returns -ENOSYS 270 xr %r8,%r8 # svc 0 returns -ENOSYS
270 clc __PT_INT_CODE+2(2,%r11),BASED(.Lnr_syscalls+2) 271 clc __PT_INT_CODE+2(2,%r11),BASED(.Lnr_syscalls+2)
271 jnl sysc_nr_ok # invalid svc number -> do svc 0 272 jnl sysc_nr_ok # invalid svc number -> do svc 0
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 2b2188b97c6a..e5b43c97a834 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -297,6 +297,7 @@ sysc_sigpending:
297 tm __TI_flags+7(%r12),_TIF_SYSCALL 297 tm __TI_flags+7(%r12),_TIF_SYSCALL
298 jno sysc_return 298 jno sysc_return
299 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments 299 lmg %r2,%r7,__PT_R2(%r11) # load svc arguments
300 lg %r10,__TI_sysc_table(%r12) # address of system call table
300 lghi %r8,0 # svc 0 returns -ENOSYS 301 lghi %r8,0 # svc 0 returns -ENOSYS
301 llgh %r1,__PT_INT_CODE+2(%r11) # load new svc number 302 llgh %r1,__PT_INT_CODE+2(%r11) # load new svc number
302 cghi %r1,NR_syscalls 303 cghi %r1,NR_syscalls
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 0ce9fb245034..d86e64eddb42 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -67,6 +67,11 @@ static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn)
67 case 0xac: /* stnsm */ 67 case 0xac: /* stnsm */
68 case 0xad: /* stosm */ 68 case 0xad: /* stosm */
69 return -EINVAL; 69 return -EINVAL;
70 case 0xc6:
71 switch (insn[0] & 0x0f) {
72 case 0x00: /* exrl */
73 return -EINVAL;
74 }
70 } 75 }
71 switch (insn[0]) { 76 switch (insn[0]) {
72 case 0x0101: /* pr */ 77 case 0x0101: /* pr */
@@ -180,7 +185,6 @@ static int __kprobes is_insn_relative_long(kprobe_opcode_t *insn)
180 break; 185 break;
181 case 0xc6: 186 case 0xc6:
182 switch (insn[0] & 0x0f) { 187 switch (insn[0] & 0x0f) {
183 case 0x00: /* exrl */
184 case 0x02: /* pfdrl */ 188 case 0x02: /* pfdrl */
185 case 0x04: /* cghrl */ 189 case 0x04: /* cghrl */
186 case 0x05: /* chrl */ 190 case 0x05: /* chrl */
diff --git a/arch/sparc/include/asm/jump_label.h b/arch/sparc/include/asm/jump_label.h
index 5080d16a832f..ec2e2e2aba7d 100644
--- a/arch/sparc/include/asm/jump_label.h
+++ b/arch/sparc/include/asm/jump_label.h
@@ -9,7 +9,7 @@
9 9
10static __always_inline bool arch_static_branch(struct static_key *key) 10static __always_inline bool arch_static_branch(struct static_key *key)
11{ 11{
12 asm goto("1:\n\t" 12 asm_volatile_goto("1:\n\t"
13 "nop\n\t" 13 "nop\n\t"
14 "nop\n\t" 14 "nop\n\t"
15 ".pushsection __jump_table, \"aw\"\n\t" 15 ".pushsection __jump_table, \"aw\"\n\t"
diff --git a/arch/tile/include/asm/atomic.h b/arch/tile/include/asm/atomic.h
index d385eaadece7..709798460763 100644
--- a/arch/tile/include/asm/atomic.h
+++ b/arch/tile/include/asm/atomic.h
@@ -166,7 +166,7 @@ static inline int atomic_cmpxchg(atomic_t *v, int o, int n)
166 * 166 *
167 * Atomically sets @v to @i and returns old @v 167 * Atomically sets @v to @i and returns old @v
168 */ 168 */
169static inline u64 atomic64_xchg(atomic64_t *v, u64 n) 169static inline long long atomic64_xchg(atomic64_t *v, long long n)
170{ 170{
171 return xchg64(&v->counter, n); 171 return xchg64(&v->counter, n);
172} 172}
@@ -180,7 +180,8 @@ static inline u64 atomic64_xchg(atomic64_t *v, u64 n)
180 * Atomically checks if @v holds @o and replaces it with @n if so. 180 * Atomically checks if @v holds @o and replaces it with @n if so.
181 * Returns the old value at @v. 181 * Returns the old value at @v.
182 */ 182 */
183static inline u64 atomic64_cmpxchg(atomic64_t *v, u64 o, u64 n) 183static inline long long atomic64_cmpxchg(atomic64_t *v, long long o,
184 long long n)
184{ 185{
185 return cmpxchg64(&v->counter, o, n); 186 return cmpxchg64(&v->counter, o, n);
186} 187}
diff --git a/arch/tile/include/asm/atomic_32.h b/arch/tile/include/asm/atomic_32.h
index 0d0395b1b152..1ad4a1f7d42b 100644
--- a/arch/tile/include/asm/atomic_32.h
+++ b/arch/tile/include/asm/atomic_32.h
@@ -80,7 +80,7 @@ static inline void atomic_set(atomic_t *v, int n)
80/* A 64bit atomic type */ 80/* A 64bit atomic type */
81 81
82typedef struct { 82typedef struct {
83 u64 __aligned(8) counter; 83 long long counter;
84} atomic64_t; 84} atomic64_t;
85 85
86#define ATOMIC64_INIT(val) { (val) } 86#define ATOMIC64_INIT(val) { (val) }
@@ -91,14 +91,14 @@ typedef struct {
91 * 91 *
92 * Atomically reads the value of @v. 92 * Atomically reads the value of @v.
93 */ 93 */
94static inline u64 atomic64_read(const atomic64_t *v) 94static inline long long atomic64_read(const atomic64_t *v)
95{ 95{
96 /* 96 /*
97 * Requires an atomic op to read both 32-bit parts consistently. 97 * Requires an atomic op to read both 32-bit parts consistently.
98 * Casting away const is safe since the atomic support routines 98 * Casting away const is safe since the atomic support routines
99 * do not write to memory if the value has not been modified. 99 * do not write to memory if the value has not been modified.
100 */ 100 */
101 return _atomic64_xchg_add((u64 *)&v->counter, 0); 101 return _atomic64_xchg_add((long long *)&v->counter, 0);
102} 102}
103 103
104/** 104/**
@@ -108,7 +108,7 @@ static inline u64 atomic64_read(const atomic64_t *v)
108 * 108 *
109 * Atomically adds @i to @v. 109 * Atomically adds @i to @v.
110 */ 110 */
111static inline void atomic64_add(u64 i, atomic64_t *v) 111static inline void atomic64_add(long long i, atomic64_t *v)
112{ 112{
113 _atomic64_xchg_add(&v->counter, i); 113 _atomic64_xchg_add(&v->counter, i);
114} 114}
@@ -120,7 +120,7 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
120 * 120 *
121 * Atomically adds @i to @v and returns @i + @v 121 * Atomically adds @i to @v and returns @i + @v
122 */ 122 */
123static inline u64 atomic64_add_return(u64 i, atomic64_t *v) 123static inline long long atomic64_add_return(long long i, atomic64_t *v)
124{ 124{
125 smp_mb(); /* barrier for proper semantics */ 125 smp_mb(); /* barrier for proper semantics */
126 return _atomic64_xchg_add(&v->counter, i) + i; 126 return _atomic64_xchg_add(&v->counter, i) + i;
@@ -135,7 +135,8 @@ static inline u64 atomic64_add_return(u64 i, atomic64_t *v)
135 * Atomically adds @a to @v, so long as @v was not already @u. 135 * Atomically adds @a to @v, so long as @v was not already @u.
136 * Returns non-zero if @v was not @u, and zero otherwise. 136 * Returns non-zero if @v was not @u, and zero otherwise.
137 */ 137 */
138static inline u64 atomic64_add_unless(atomic64_t *v, u64 a, u64 u) 138static inline long long atomic64_add_unless(atomic64_t *v, long long a,
139 long long u)
139{ 140{
140 smp_mb(); /* barrier for proper semantics */ 141 smp_mb(); /* barrier for proper semantics */
141 return _atomic64_xchg_add_unless(&v->counter, a, u) != u; 142 return _atomic64_xchg_add_unless(&v->counter, a, u) != u;
@@ -151,7 +152,7 @@ static inline u64 atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
151 * atomic64_set() can't be just a raw store, since it would be lost if it 152 * atomic64_set() can't be just a raw store, since it would be lost if it
152 * fell between the load and store of one of the other atomic ops. 153 * fell between the load and store of one of the other atomic ops.
153 */ 154 */
154static inline void atomic64_set(atomic64_t *v, u64 n) 155static inline void atomic64_set(atomic64_t *v, long long n)
155{ 156{
156 _atomic64_xchg(&v->counter, n); 157 _atomic64_xchg(&v->counter, n);
157} 158}
@@ -236,11 +237,13 @@ extern struct __get_user __atomic_xchg_add_unless(volatile int *p,
236extern struct __get_user __atomic_or(volatile int *p, int *lock, int n); 237extern struct __get_user __atomic_or(volatile int *p, int *lock, int n);
237extern struct __get_user __atomic_andn(volatile int *p, int *lock, int n); 238extern struct __get_user __atomic_andn(volatile int *p, int *lock, int n);
238extern struct __get_user __atomic_xor(volatile int *p, int *lock, int n); 239extern struct __get_user __atomic_xor(volatile int *p, int *lock, int n);
239extern u64 __atomic64_cmpxchg(volatile u64 *p, int *lock, u64 o, u64 n); 240extern long long __atomic64_cmpxchg(volatile long long *p, int *lock,
240extern u64 __atomic64_xchg(volatile u64 *p, int *lock, u64 n); 241 long long o, long long n);
241extern u64 __atomic64_xchg_add(volatile u64 *p, int *lock, u64 n); 242extern long long __atomic64_xchg(volatile long long *p, int *lock, long long n);
242extern u64 __atomic64_xchg_add_unless(volatile u64 *p, 243extern long long __atomic64_xchg_add(volatile long long *p, int *lock,
243 int *lock, u64 o, u64 n); 244 long long n);
245extern long long __atomic64_xchg_add_unless(volatile long long *p,
246 int *lock, long long o, long long n);
244 247
245/* Return failure from the atomic wrappers. */ 248/* Return failure from the atomic wrappers. */
246struct __get_user __atomic_bad_address(int __user *addr); 249struct __get_user __atomic_bad_address(int __user *addr);
diff --git a/arch/tile/include/asm/cmpxchg.h b/arch/tile/include/asm/cmpxchg.h
index 4001d5eab4bb..0ccda3c425be 100644
--- a/arch/tile/include/asm/cmpxchg.h
+++ b/arch/tile/include/asm/cmpxchg.h
@@ -35,10 +35,10 @@ int _atomic_xchg(int *ptr, int n);
35int _atomic_xchg_add(int *v, int i); 35int _atomic_xchg_add(int *v, int i);
36int _atomic_xchg_add_unless(int *v, int a, int u); 36int _atomic_xchg_add_unless(int *v, int a, int u);
37int _atomic_cmpxchg(int *ptr, int o, int n); 37int _atomic_cmpxchg(int *ptr, int o, int n);
38u64 _atomic64_xchg(u64 *v, u64 n); 38long long _atomic64_xchg(long long *v, long long n);
39u64 _atomic64_xchg_add(u64 *v, u64 i); 39long long _atomic64_xchg_add(long long *v, long long i);
40u64 _atomic64_xchg_add_unless(u64 *v, u64 a, u64 u); 40long long _atomic64_xchg_add_unless(long long *v, long long a, long long u);
41u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n); 41long long _atomic64_cmpxchg(long long *v, long long o, long long n);
42 42
43#define xchg(ptr, n) \ 43#define xchg(ptr, n) \
44 ({ \ 44 ({ \
@@ -53,7 +53,8 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
53 if (sizeof(*(ptr)) != 4) \ 53 if (sizeof(*(ptr)) != 4) \
54 __cmpxchg_called_with_bad_pointer(); \ 54 __cmpxchg_called_with_bad_pointer(); \
55 smp_mb(); \ 55 smp_mb(); \
56 (typeof(*(ptr)))_atomic_cmpxchg((int *)ptr, (int)o, (int)n); \ 56 (typeof(*(ptr)))_atomic_cmpxchg((int *)ptr, (int)o, \
57 (int)n); \
57 }) 58 })
58 59
59#define xchg64(ptr, n) \ 60#define xchg64(ptr, n) \
@@ -61,7 +62,8 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
61 if (sizeof(*(ptr)) != 8) \ 62 if (sizeof(*(ptr)) != 8) \
62 __xchg_called_with_bad_pointer(); \ 63 __xchg_called_with_bad_pointer(); \
63 smp_mb(); \ 64 smp_mb(); \
64 (typeof(*(ptr)))_atomic64_xchg((u64 *)(ptr), (u64)(n)); \ 65 (typeof(*(ptr)))_atomic64_xchg((long long *)(ptr), \
66 (long long)(n)); \
65 }) 67 })
66 68
67#define cmpxchg64(ptr, o, n) \ 69#define cmpxchg64(ptr, o, n) \
@@ -69,7 +71,8 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
69 if (sizeof(*(ptr)) != 8) \ 71 if (sizeof(*(ptr)) != 8) \
70 __cmpxchg_called_with_bad_pointer(); \ 72 __cmpxchg_called_with_bad_pointer(); \
71 smp_mb(); \ 73 smp_mb(); \
72 (typeof(*(ptr)))_atomic64_cmpxchg((u64 *)ptr, (u64)o, (u64)n); \ 74 (typeof(*(ptr)))_atomic64_cmpxchg((long long *)ptr, \
75 (long long)o, (long long)n); \
73 }) 76 })
74 77
75#else 78#else
@@ -81,10 +84,11 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
81 switch (sizeof(*(ptr))) { \ 84 switch (sizeof(*(ptr))) { \
82 case 4: \ 85 case 4: \
83 __x = (typeof(__x))(unsigned long) \ 86 __x = (typeof(__x))(unsigned long) \
84 __insn_exch4((ptr), (u32)(unsigned long)(n)); \ 87 __insn_exch4((ptr), \
88 (u32)(unsigned long)(n)); \
85 break; \ 89 break; \
86 case 8: \ 90 case 8: \
87 __x = (typeof(__x)) \ 91 __x = (typeof(__x)) \
88 __insn_exch((ptr), (unsigned long)(n)); \ 92 __insn_exch((ptr), (unsigned long)(n)); \
89 break; \ 93 break; \
90 default: \ 94 default: \
@@ -103,10 +107,12 @@ u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n);
103 switch (sizeof(*(ptr))) { \ 107 switch (sizeof(*(ptr))) { \
104 case 4: \ 108 case 4: \
105 __x = (typeof(__x))(unsigned long) \ 109 __x = (typeof(__x))(unsigned long) \
106 __insn_cmpexch4((ptr), (u32)(unsigned long)(n)); \ 110 __insn_cmpexch4((ptr), \
111 (u32)(unsigned long)(n)); \
107 break; \ 112 break; \
108 case 8: \ 113 case 8: \
109 __x = (typeof(__x))__insn_cmpexch((ptr), (u64)(n)); \ 114 __x = (typeof(__x))__insn_cmpexch((ptr), \
115 (long long)(n)); \
110 break; \ 116 break; \
111 default: \ 117 default: \
112 __cmpxchg_called_with_bad_pointer(); \ 118 __cmpxchg_called_with_bad_pointer(); \
diff --git a/arch/tile/include/asm/percpu.h b/arch/tile/include/asm/percpu.h
index 63294f5a8efb..4f7ae39fa202 100644
--- a/arch/tile/include/asm/percpu.h
+++ b/arch/tile/include/asm/percpu.h
@@ -15,9 +15,37 @@
15#ifndef _ASM_TILE_PERCPU_H 15#ifndef _ASM_TILE_PERCPU_H
16#define _ASM_TILE_PERCPU_H 16#define _ASM_TILE_PERCPU_H
17 17
18register unsigned long __my_cpu_offset __asm__("tp"); 18register unsigned long my_cpu_offset_reg asm("tp");
19#define __my_cpu_offset __my_cpu_offset 19
20#define set_my_cpu_offset(tp) (__my_cpu_offset = (tp)) 20#ifdef CONFIG_PREEMPT
21/*
22 * For full preemption, we can't just use the register variable
23 * directly, since we need barrier() to hazard against it, causing the
24 * compiler to reload anything computed from a previous "tp" value.
25 * But we also don't want to use volatile asm, since we'd like the
26 * compiler to be able to cache the value across multiple percpu reads.
27 * So we use a fake stack read as a hazard against barrier().
28 * The 'U' constraint is like 'm' but disallows postincrement.
29 */
30static inline unsigned long __my_cpu_offset(void)
31{
32 unsigned long tp;
33 register unsigned long *sp asm("sp");
34 asm("move %0, tp" : "=r" (tp) : "U" (*sp));
35 return tp;
36}
37#define __my_cpu_offset __my_cpu_offset()
38#else
39/*
40 * We don't need to hazard against barrier() since "tp" doesn't ever
41 * change with PREEMPT_NONE, and with PREEMPT_VOLUNTARY it only
42 * changes at function call points, at which we are already re-reading
43 * the value of "tp" due to "my_cpu_offset_reg" being a global variable.
44 */
45#define __my_cpu_offset my_cpu_offset_reg
46#endif
47
48#define set_my_cpu_offset(tp) (my_cpu_offset_reg = (tp))
21 49
22#include <asm-generic/percpu.h> 50#include <asm-generic/percpu.h>
23 51
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c
index df27a1fd94a3..531f4c365351 100644
--- a/arch/tile/kernel/hardwall.c
+++ b/arch/tile/kernel/hardwall.c
@@ -66,7 +66,7 @@ static struct hardwall_type hardwall_types[] = {
66 0, 66 0,
67 "udn", 67 "udn",
68 LIST_HEAD_INIT(hardwall_types[HARDWALL_UDN].list), 68 LIST_HEAD_INIT(hardwall_types[HARDWALL_UDN].list),
69 __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_UDN].lock), 69 __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_UDN].lock),
70 NULL 70 NULL
71 }, 71 },
72#ifndef __tilepro__ 72#ifndef __tilepro__
@@ -77,7 +77,7 @@ static struct hardwall_type hardwall_types[] = {
77 1, /* disabled pending hypervisor support */ 77 1, /* disabled pending hypervisor support */
78 "idn", 78 "idn",
79 LIST_HEAD_INIT(hardwall_types[HARDWALL_IDN].list), 79 LIST_HEAD_INIT(hardwall_types[HARDWALL_IDN].list),
80 __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_IDN].lock), 80 __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_IDN].lock),
81 NULL 81 NULL
82 }, 82 },
83 { /* access to user-space IPI */ 83 { /* access to user-space IPI */
@@ -87,7 +87,7 @@ static struct hardwall_type hardwall_types[] = {
87 0, 87 0,
88 "ipi", 88 "ipi",
89 LIST_HEAD_INIT(hardwall_types[HARDWALL_IPI].list), 89 LIST_HEAD_INIT(hardwall_types[HARDWALL_IPI].list),
90 __SPIN_LOCK_INITIALIZER(hardwall_types[HARDWALL_IPI].lock), 90 __SPIN_LOCK_UNLOCKED(hardwall_types[HARDWALL_IPI].lock),
91 NULL 91 NULL
92 }, 92 },
93#endif 93#endif
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index 088d5c141e68..2cbe6d5dd6b0 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -815,6 +815,9 @@ STD_ENTRY(interrupt_return)
815 } 815 }
816 bzt r28, 1f 816 bzt r28, 1f
817 bnz r29, 1f 817 bnz r29, 1f
818 /* Disable interrupts explicitly for preemption. */
819 IRQ_DISABLE(r20,r21)
820 TRACE_IRQS_OFF
818 jal preempt_schedule_irq 821 jal preempt_schedule_irq
819 FEEDBACK_REENTER(interrupt_return) 822 FEEDBACK_REENTER(interrupt_return)
8201: 8231:
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index ec755d3f3734..b8fc497f2437 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -841,6 +841,9 @@ STD_ENTRY(interrupt_return)
841 } 841 }
842 beqzt r28, 1f 842 beqzt r28, 1f
843 bnez r29, 1f 843 bnez r29, 1f
844 /* Disable interrupts explicitly for preemption. */
845 IRQ_DISABLE(r20,r21)
846 TRACE_IRQS_OFF
844 jal preempt_schedule_irq 847 jal preempt_schedule_irq
845 FEEDBACK_REENTER(interrupt_return) 848 FEEDBACK_REENTER(interrupt_return)
8461: 8491:
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c
index 362284af3afd..c93977a62116 100644
--- a/arch/tile/kernel/stack.c
+++ b/arch/tile/kernel/stack.c
@@ -23,6 +23,7 @@
23#include <linux/mmzone.h> 23#include <linux/mmzone.h>
24#include <linux/dcache.h> 24#include <linux/dcache.h>
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/string.h>
26#include <asm/backtrace.h> 27#include <asm/backtrace.h>
27#include <asm/page.h> 28#include <asm/page.h>
28#include <asm/ucontext.h> 29#include <asm/ucontext.h>
@@ -332,21 +333,18 @@ static void describe_addr(struct KBacktraceIterator *kbt,
332 } 333 }
333 334
334 if (vma->vm_file) { 335 if (vma->vm_file) {
335 char *s;
336 p = d_path(&vma->vm_file->f_path, buf, bufsize); 336 p = d_path(&vma->vm_file->f_path, buf, bufsize);
337 if (IS_ERR(p)) 337 if (IS_ERR(p))
338 p = "?"; 338 p = "?";
339 s = strrchr(p, '/'); 339 name = kbasename(p);
340 if (s)
341 p = s+1;
342 } else { 340 } else {
343 p = "anon"; 341 name = "anon";
344 } 342 }
345 343
346 /* Generate a string description of the vma info. */ 344 /* Generate a string description of the vma info. */
347 namelen = strlen(p); 345 namelen = strlen(name);
348 remaining = (bufsize - 1) - namelen; 346 remaining = (bufsize - 1) - namelen;
349 memmove(buf, p, namelen); 347 memmove(buf, name, namelen);
350 snprintf(buf + namelen, remaining, "[%lx+%lx] ", 348 snprintf(buf + namelen, remaining, "[%lx+%lx] ",
351 vma->vm_start, vma->vm_end - vma->vm_start); 349 vma->vm_start, vma->vm_end - vma->vm_start);
352} 350}
diff --git a/arch/tile/lib/atomic_32.c b/arch/tile/lib/atomic_32.c
index 759efa337be8..c89b211fd9e7 100644
--- a/arch/tile/lib/atomic_32.c
+++ b/arch/tile/lib/atomic_32.c
@@ -107,19 +107,19 @@ unsigned long _atomic_xor(volatile unsigned long *p, unsigned long mask)
107EXPORT_SYMBOL(_atomic_xor); 107EXPORT_SYMBOL(_atomic_xor);
108 108
109 109
110u64 _atomic64_xchg(u64 *v, u64 n) 110long long _atomic64_xchg(long long *v, long long n)
111{ 111{
112 return __atomic64_xchg(v, __atomic_setup(v), n); 112 return __atomic64_xchg(v, __atomic_setup(v), n);
113} 113}
114EXPORT_SYMBOL(_atomic64_xchg); 114EXPORT_SYMBOL(_atomic64_xchg);
115 115
116u64 _atomic64_xchg_add(u64 *v, u64 i) 116long long _atomic64_xchg_add(long long *v, long long i)
117{ 117{
118 return __atomic64_xchg_add(v, __atomic_setup(v), i); 118 return __atomic64_xchg_add(v, __atomic_setup(v), i);
119} 119}
120EXPORT_SYMBOL(_atomic64_xchg_add); 120EXPORT_SYMBOL(_atomic64_xchg_add);
121 121
122u64 _atomic64_xchg_add_unless(u64 *v, u64 a, u64 u) 122long long _atomic64_xchg_add_unless(long long *v, long long a, long long u)
123{ 123{
124 /* 124 /*
125 * Note: argument order is switched here since it is easier 125 * Note: argument order is switched here since it is easier
@@ -130,7 +130,7 @@ u64 _atomic64_xchg_add_unless(u64 *v, u64 a, u64 u)
130} 130}
131EXPORT_SYMBOL(_atomic64_xchg_add_unless); 131EXPORT_SYMBOL(_atomic64_xchg_add_unless);
132 132
133u64 _atomic64_cmpxchg(u64 *v, u64 o, u64 n) 133long long _atomic64_cmpxchg(long long *v, long long o, long long n)
134{ 134{
135 return __atomic64_cmpxchg(v, __atomic_setup(v), o, n); 135 return __atomic64_cmpxchg(v, __atomic_setup(v), o, n);
136} 136}
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ee2fb9d37745..145d703227bf 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -860,7 +860,7 @@ source "kernel/Kconfig.preempt"
860 860
861config X86_UP_APIC 861config X86_UP_APIC
862 bool "Local APIC support on uniprocessors" 862 bool "Local APIC support on uniprocessors"
863 depends on X86_32 && !SMP && !X86_32_NON_STANDARD 863 depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI
864 ---help--- 864 ---help---
865 A local APIC (Advanced Programmable Interrupt Controller) is an 865 A local APIC (Advanced Programmable Interrupt Controller) is an
866 integrated interrupt controller in the CPU. If you have a single-CPU 866 integrated interrupt controller in the CPU. If you have a single-CPU
@@ -885,11 +885,11 @@ config X86_UP_IOAPIC
885 885
886config X86_LOCAL_APIC 886config X86_LOCAL_APIC
887 def_bool y 887 def_bool y
888 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC 888 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC || PCI_MSI
889 889
890config X86_IO_APIC 890config X86_IO_APIC
891 def_bool y 891 def_bool y
892 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC 892 depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_IOAPIC || PCI_MSI
893 893
894config X86_VISWS_APIC 894config X86_VISWS_APIC
895 def_bool y 895 def_bool y
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index d3f5c63078d8..89270b4318db 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -374,7 +374,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
374 * Catch too early usage of this before alternatives 374 * Catch too early usage of this before alternatives
375 * have run. 375 * have run.
376 */ 376 */
377 asm goto("1: jmp %l[t_warn]\n" 377 asm_volatile_goto("1: jmp %l[t_warn]\n"
378 "2:\n" 378 "2:\n"
379 ".section .altinstructions,\"a\"\n" 379 ".section .altinstructions,\"a\"\n"
380 " .long 1b - .\n" 380 " .long 1b - .\n"
@@ -388,7 +388,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
388 388
389#endif 389#endif
390 390
391 asm goto("1: jmp %l[t_no]\n" 391 asm_volatile_goto("1: jmp %l[t_no]\n"
392 "2:\n" 392 "2:\n"
393 ".section .altinstructions,\"a\"\n" 393 ".section .altinstructions,\"a\"\n"
394 " .long 1b - .\n" 394 " .long 1b - .\n"
@@ -453,7 +453,7 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit)
453 * have. Thus, we force the jump to the widest, 4-byte, signed relative 453 * have. Thus, we force the jump to the widest, 4-byte, signed relative
454 * offset even though the last would often fit in less bytes. 454 * offset even though the last would often fit in less bytes.
455 */ 455 */
456 asm goto("1: .byte 0xe9\n .long %l[t_dynamic] - 2f\n" 456 asm_volatile_goto("1: .byte 0xe9\n .long %l[t_dynamic] - 2f\n"
457 "2:\n" 457 "2:\n"
458 ".section .altinstructions,\"a\"\n" 458 ".section .altinstructions,\"a\"\n"
459 " .long 1b - .\n" /* src offset */ 459 " .long 1b - .\n" /* src offset */
diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h
index 64507f35800c..6a2cefb4395a 100644
--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -18,7 +18,7 @@
18 18
19static __always_inline bool arch_static_branch(struct static_key *key) 19static __always_inline bool arch_static_branch(struct static_key *key)
20{ 20{
21 asm goto("1:" 21 asm_volatile_goto("1:"
22 ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t" 22 ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t"
23 ".pushsection __jump_table, \"aw\" \n\t" 23 ".pushsection __jump_table, \"aw\" \n\t"
24 _ASM_ALIGN "\n\t" 24 _ASM_ALIGN "\n\t"
diff --git a/arch/x86/include/asm/mutex_64.h b/arch/x86/include/asm/mutex_64.h
index e7e6751648ed..07537a44216e 100644
--- a/arch/x86/include/asm/mutex_64.h
+++ b/arch/x86/include/asm/mutex_64.h
@@ -20,7 +20,7 @@
20static inline void __mutex_fastpath_lock(atomic_t *v, 20static inline void __mutex_fastpath_lock(atomic_t *v,
21 void (*fail_fn)(atomic_t *)) 21 void (*fail_fn)(atomic_t *))
22{ 22{
23 asm volatile goto(LOCK_PREFIX " decl %0\n" 23 asm_volatile_goto(LOCK_PREFIX " decl %0\n"
24 " jns %l[exit]\n" 24 " jns %l[exit]\n"
25 : : "m" (v->counter) 25 : : "m" (v->counter)
26 : "memory", "cc" 26 : "memory", "cc"
@@ -75,7 +75,7 @@ static inline int __mutex_fastpath_lock_retval(atomic_t *count)
75static inline void __mutex_fastpath_unlock(atomic_t *v, 75static inline void __mutex_fastpath_unlock(atomic_t *v,
76 void (*fail_fn)(atomic_t *)) 76 void (*fail_fn)(atomic_t *))
77{ 77{
78 asm volatile goto(LOCK_PREFIX " incl %0\n" 78 asm_volatile_goto(LOCK_PREFIX " incl %0\n"
79 " jg %l[exit]\n" 79 " jg %l[exit]\n"
80 : : "m" (v->counter) 80 : : "m" (v->counter)
81 : "memory", "cc" 81 : "memory", "cc"
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 897783b3302a..9d8449158cf9 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1888,10 +1888,7 @@ void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
1888 userpg->cap_user_rdpmc = x86_pmu.attr_rdpmc; 1888 userpg->cap_user_rdpmc = x86_pmu.attr_rdpmc;
1889 userpg->pmc_width = x86_pmu.cntval_bits; 1889 userpg->pmc_width = x86_pmu.cntval_bits;
1890 1890
1891 if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) 1891 if (!sched_clock_stable)
1892 return;
1893
1894 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
1895 return; 1892 return;
1896 1893
1897 userpg->cap_user_time = 1; 1894 userpg->cap_user_time = 1;
@@ -1899,10 +1896,8 @@ void arch_perf_update_userpage(struct perf_event_mmap_page *userpg, u64 now)
1899 userpg->time_shift = CYC2NS_SCALE_FACTOR; 1896 userpg->time_shift = CYC2NS_SCALE_FACTOR;
1900 userpg->time_offset = this_cpu_read(cyc2ns_offset) - now; 1897 userpg->time_offset = this_cpu_read(cyc2ns_offset) - now;
1901 1898
1902 if (sched_clock_stable && !check_tsc_disabled()) { 1899 userpg->cap_user_time_zero = 1;
1903 userpg->cap_user_time_zero = 1; 1900 userpg->time_zero = this_cpu_read(cyc2ns_offset);
1904 userpg->time_zero = this_cpu_read(cyc2ns_offset);
1905 }
1906} 1901}
1907 1902
1908/* 1903/*
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index e643e744e4d8..7e920bff99a3 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -326,6 +326,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
326 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6320"), 326 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6320"),
327 }, 327 },
328 }, 328 },
329 { /* Handle problems with rebooting on the Latitude E5410. */
330 .callback = set_pci_reboot,
331 .ident = "Dell Latitude E5410",
332 .matches = {
333 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
334 DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E5410"),
335 },
336 },
329 { /* Handle problems with rebooting on the Latitude E5420. */ 337 { /* Handle problems with rebooting on the Latitude E5420. */
330 .callback = set_pci_reboot, 338 .callback = set_pci_reboot,
331 .ident = "Dell Latitude E5420", 339 .ident = "Dell Latitude E5420",
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 3b8e7459dd4d..2b2fce1b2009 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3255,25 +3255,29 @@ static void vmx_decache_cr4_guest_bits(struct kvm_vcpu *vcpu)
3255 3255
3256static void ept_load_pdptrs(struct kvm_vcpu *vcpu) 3256static void ept_load_pdptrs(struct kvm_vcpu *vcpu)
3257{ 3257{
3258 struct kvm_mmu *mmu = vcpu->arch.walk_mmu;
3259
3258 if (!test_bit(VCPU_EXREG_PDPTR, 3260 if (!test_bit(VCPU_EXREG_PDPTR,
3259 (unsigned long *)&vcpu->arch.regs_dirty)) 3261 (unsigned long *)&vcpu->arch.regs_dirty))
3260 return; 3262 return;
3261 3263
3262 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) { 3264 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) {
3263 vmcs_write64(GUEST_PDPTR0, vcpu->arch.mmu.pdptrs[0]); 3265 vmcs_write64(GUEST_PDPTR0, mmu->pdptrs[0]);
3264 vmcs_write64(GUEST_PDPTR1, vcpu->arch.mmu.pdptrs[1]); 3266 vmcs_write64(GUEST_PDPTR1, mmu->pdptrs[1]);
3265 vmcs_write64(GUEST_PDPTR2, vcpu->arch.mmu.pdptrs[2]); 3267 vmcs_write64(GUEST_PDPTR2, mmu->pdptrs[2]);
3266 vmcs_write64(GUEST_PDPTR3, vcpu->arch.mmu.pdptrs[3]); 3268 vmcs_write64(GUEST_PDPTR3, mmu->pdptrs[3]);
3267 } 3269 }
3268} 3270}
3269 3271
3270static void ept_save_pdptrs(struct kvm_vcpu *vcpu) 3272static void ept_save_pdptrs(struct kvm_vcpu *vcpu)
3271{ 3273{
3274 struct kvm_mmu *mmu = vcpu->arch.walk_mmu;
3275
3272 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) { 3276 if (is_paging(vcpu) && is_pae(vcpu) && !is_long_mode(vcpu)) {
3273 vcpu->arch.mmu.pdptrs[0] = vmcs_read64(GUEST_PDPTR0); 3277 mmu->pdptrs[0] = vmcs_read64(GUEST_PDPTR0);
3274 vcpu->arch.mmu.pdptrs[1] = vmcs_read64(GUEST_PDPTR1); 3278 mmu->pdptrs[1] = vmcs_read64(GUEST_PDPTR1);
3275 vcpu->arch.mmu.pdptrs[2] = vmcs_read64(GUEST_PDPTR2); 3279 mmu->pdptrs[2] = vmcs_read64(GUEST_PDPTR2);
3276 vcpu->arch.mmu.pdptrs[3] = vmcs_read64(GUEST_PDPTR3); 3280 mmu->pdptrs[3] = vmcs_read64(GUEST_PDPTR3);
3277 } 3281 }
3278 3282
3279 __set_bit(VCPU_EXREG_PDPTR, 3283 __set_bit(VCPU_EXREG_PDPTR,
@@ -7777,10 +7781,6 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
7777 vmcs_write64(GUEST_PDPTR1, vmcs12->guest_pdptr1); 7781 vmcs_write64(GUEST_PDPTR1, vmcs12->guest_pdptr1);
7778 vmcs_write64(GUEST_PDPTR2, vmcs12->guest_pdptr2); 7782 vmcs_write64(GUEST_PDPTR2, vmcs12->guest_pdptr2);
7779 vmcs_write64(GUEST_PDPTR3, vmcs12->guest_pdptr3); 7783 vmcs_write64(GUEST_PDPTR3, vmcs12->guest_pdptr3);
7780 __clear_bit(VCPU_EXREG_PDPTR,
7781 (unsigned long *)&vcpu->arch.regs_avail);
7782 __clear_bit(VCPU_EXREG_PDPTR,
7783 (unsigned long *)&vcpu->arch.regs_dirty);
7784 } 7784 }
7785 7785
7786 kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->guest_rsp); 7786 kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->guest_rsp);
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 7737b5bd26af..7a744d391756 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -640,7 +640,7 @@ struct timer_rand_state {
640 */ 640 */
641void add_device_randomness(const void *buf, unsigned int size) 641void add_device_randomness(const void *buf, unsigned int size)
642{ 642{
643 unsigned long time = get_cycles() ^ jiffies; 643 unsigned long time = random_get_entropy() ^ jiffies;
644 644
645 mix_pool_bytes(&input_pool, buf, size, NULL); 645 mix_pool_bytes(&input_pool, buf, size, NULL);
646 mix_pool_bytes(&input_pool, &time, sizeof(time), NULL); 646 mix_pool_bytes(&input_pool, &time, sizeof(time), NULL);
@@ -677,7 +677,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
677 goto out; 677 goto out;
678 678
679 sample.jiffies = jiffies; 679 sample.jiffies = jiffies;
680 sample.cycles = get_cycles(); 680 sample.cycles = random_get_entropy();
681 sample.num = num; 681 sample.num = num;
682 mix_pool_bytes(&input_pool, &sample, sizeof(sample), NULL); 682 mix_pool_bytes(&input_pool, &sample, sizeof(sample), NULL);
683 683
@@ -744,7 +744,7 @@ void add_interrupt_randomness(int irq, int irq_flags)
744 struct fast_pool *fast_pool = &__get_cpu_var(irq_randomness); 744 struct fast_pool *fast_pool = &__get_cpu_var(irq_randomness);
745 struct pt_regs *regs = get_irq_regs(); 745 struct pt_regs *regs = get_irq_regs();
746 unsigned long now = jiffies; 746 unsigned long now = jiffies;
747 __u32 input[4], cycles = get_cycles(); 747 __u32 input[4], cycles = random_get_entropy();
748 748
749 input[0] = cycles ^ jiffies; 749 input[0] = cycles ^ jiffies;
750 input[1] = irq; 750 input[1] = irq;
@@ -1459,12 +1459,11 @@ struct ctl_table random_table[] = {
1459 1459
1460static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned; 1460static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned;
1461 1461
1462static int __init random_int_secret_init(void) 1462int random_int_secret_init(void)
1463{ 1463{
1464 get_random_bytes(random_int_secret, sizeof(random_int_secret)); 1464 get_random_bytes(random_int_secret, sizeof(random_int_secret));
1465 return 0; 1465 return 0;
1466} 1466}
1467late_initcall(random_int_secret_init);
1468 1467
1469/* 1468/*
1470 * Get a random word for internal kernel use only. Similar to urandom but 1469 * Get a random word for internal kernel use only. Similar to urandom but
@@ -1483,7 +1482,7 @@ unsigned int get_random_int(void)
1483 1482
1484 hash = get_cpu_var(get_random_int_hash); 1483 hash = get_cpu_var(get_random_int_hash);
1485 1484
1486 hash[0] += current->pid + jiffies + get_cycles(); 1485 hash[0] += current->pid + jiffies + random_get_entropy();
1487 md5_transform(hash, random_int_secret); 1486 md5_transform(hash, random_int_secret);
1488 ret = hash[0]; 1487 ret = hash[0];
1489 put_cpu_var(get_random_int_hash); 1488 put_cpu_var(get_random_int_hash);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 1688ff500513..830f7501cb4d 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2925,6 +2925,8 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb)
2925 /* Speaker Allocation Data Block */ 2925 /* Speaker Allocation Data Block */
2926 if (dbl == 3) { 2926 if (dbl == 3) {
2927 *sadb = kmalloc(dbl, GFP_KERNEL); 2927 *sadb = kmalloc(dbl, GFP_KERNEL);
2928 if (!*sadb)
2929 return -ENOMEM;
2928 memcpy(*sadb, &db[1], dbl); 2930 memcpy(*sadb, &db[1], dbl);
2929 count = dbl; 2931 count = dbl;
2930 break; 2932 break;
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index f6f6cc7fc133..3d13ca6e257f 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -416,14 +416,6 @@ static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode)
416 return; 416 return;
417 417
418 /* 418 /*
419 * fbdev->blank can be called from irq context in case of a panic.
420 * Since we already have our own special panic handler which will
421 * restore the fbdev console mode completely, just bail out early.
422 */
423 if (oops_in_progress)
424 return;
425
426 /*
427 * For each CRTC in this fb, turn the connectors on/off. 419 * For each CRTC in this fb, turn the connectors on/off.
428 */ 420 */
429 drm_modeset_lock_all(dev); 421 drm_modeset_lock_all(dev);
diff --git a/drivers/gpu/drm/gma500/gtt.c b/drivers/gpu/drm/gma500/gtt.c
index 92babac362ec..2db731f00930 100644
--- a/drivers/gpu/drm/gma500/gtt.c
+++ b/drivers/gpu/drm/gma500/gtt.c
@@ -204,6 +204,7 @@ static int psb_gtt_attach_pages(struct gtt_range *gt)
204 if (IS_ERR(pages)) 204 if (IS_ERR(pages))
205 return PTR_ERR(pages); 205 return PTR_ERR(pages);
206 206
207 gt->npage = gt->gem.size / PAGE_SIZE;
207 gt->pages = pages; 208 gt->pages = pages;
208 209
209 return 0; 210 return 0;
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index c27a21034a5e..d5c784d48671 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1290,12 +1290,9 @@ static int i915_load_modeset_init(struct drm_device *dev)
1290 * then we do not take part in VGA arbitration and the 1290 * then we do not take part in VGA arbitration and the
1291 * vga_client_register() fails with -ENODEV. 1291 * vga_client_register() fails with -ENODEV.
1292 */ 1292 */
1293 if (!HAS_PCH_SPLIT(dev)) { 1293 ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode);
1294 ret = vga_client_register(dev->pdev, dev, NULL, 1294 if (ret && ret != -ENODEV)
1295 i915_vga_set_decode); 1295 goto out;
1296 if (ret && ret != -ENODEV)
1297 goto out;
1298 }
1299 1296
1300 intel_register_dsm_handler(); 1297 intel_register_dsm_handler();
1301 1298
@@ -1351,12 +1348,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
1351 */ 1348 */
1352 intel_fbdev_initial_config(dev); 1349 intel_fbdev_initial_config(dev);
1353 1350
1354 /*
1355 * Must do this after fbcon init so that
1356 * vgacon_save_screen() works during the handover.
1357 */
1358 i915_disable_vga_mem(dev);
1359
1360 /* Only enable hotplug handling once the fbdev is fully set up. */ 1351 /* Only enable hotplug handling once the fbdev is fully set up. */
1361 dev_priv->enable_hotplug_processing = true; 1352 dev_priv->enable_hotplug_processing = true;
1362 1353
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index c159e1a6810f..38f96f65d87a 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3881,6 +3881,9 @@
3881#define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG 0x9030 3881#define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG 0x9030
3882#define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11) 3882#define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11)
3883 3883
3884#define HSW_SCRATCH1 0xb038
3885#define HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE (1<<27)
3886
3884#define HSW_FUSE_STRAP 0x42014 3887#define HSW_FUSE_STRAP 0x42014
3885#define HSW_CDCLK_LIMIT (1 << 24) 3888#define HSW_CDCLK_LIMIT (1 << 24)
3886 3889
@@ -4728,6 +4731,9 @@
4728#define GEN7_ROW_CHICKEN2_GT2 0xf4f4 4731#define GEN7_ROW_CHICKEN2_GT2 0xf4f4
4729#define DOP_CLOCK_GATING_DISABLE (1<<0) 4732#define DOP_CLOCK_GATING_DISABLE (1<<0)
4730 4733
4734#define HSW_ROW_CHICKEN3 0xe49c
4735#define HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE (1 << 6)
4736
4731#define G4X_AUD_VID_DID (dev_priv->info->display_mmio_offset + 0x62020) 4737#define G4X_AUD_VID_DID (dev_priv->info->display_mmio_offset + 0x62020)
4732#define INTEL_AUDIO_DEVCL 0x808629FB 4738#define INTEL_AUDIO_DEVCL 0x808629FB
4733#define INTEL_AUDIO_DEVBLC 0x80862801 4739#define INTEL_AUDIO_DEVBLC 0x80862801
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e5822e79f912..581fb4b2f766 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3941,8 +3941,6 @@ static void intel_connector_check_state(struct intel_connector *connector)
3941 * consider. */ 3941 * consider. */
3942void intel_connector_dpms(struct drm_connector *connector, int mode) 3942void intel_connector_dpms(struct drm_connector *connector, int mode)
3943{ 3943{
3944 struct intel_encoder *encoder = intel_attached_encoder(connector);
3945
3946 /* All the simple cases only support two dpms states. */ 3944 /* All the simple cases only support two dpms states. */
3947 if (mode != DRM_MODE_DPMS_ON) 3945 if (mode != DRM_MODE_DPMS_ON)
3948 mode = DRM_MODE_DPMS_OFF; 3946 mode = DRM_MODE_DPMS_OFF;
@@ -3953,10 +3951,8 @@ void intel_connector_dpms(struct drm_connector *connector, int mode)
3953 connector->dpms = mode; 3951 connector->dpms = mode;
3954 3952
3955 /* Only need to change hw state when actually enabled */ 3953 /* Only need to change hw state when actually enabled */
3956 if (encoder->base.crtc) 3954 if (connector->encoder)
3957 intel_encoder_dpms(encoder, mode); 3955 intel_encoder_dpms(to_intel_encoder(connector->encoder), mode);
3958 else
3959 WARN_ON(encoder->connectors_active != false);
3960 3956
3961 intel_modeset_check_state(connector->dev); 3957 intel_modeset_check_state(connector->dev);
3962} 3958}
@@ -10049,33 +10045,6 @@ static void i915_disable_vga(struct drm_device *dev)
10049 POSTING_READ(vga_reg); 10045 POSTING_READ(vga_reg);
10050} 10046}
10051 10047
10052static void i915_enable_vga_mem(struct drm_device *dev)
10053{
10054 /* Enable VGA memory on Intel HD */
10055 if (HAS_PCH_SPLIT(dev)) {
10056 vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
10057 outb(inb(VGA_MSR_READ) | VGA_MSR_MEM_EN, VGA_MSR_WRITE);
10058 vga_set_legacy_decoding(dev->pdev, VGA_RSRC_LEGACY_IO |
10059 VGA_RSRC_LEGACY_MEM |
10060 VGA_RSRC_NORMAL_IO |
10061 VGA_RSRC_NORMAL_MEM);
10062 vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
10063 }
10064}
10065
10066void i915_disable_vga_mem(struct drm_device *dev)
10067{
10068 /* Disable VGA memory on Intel HD */
10069 if (HAS_PCH_SPLIT(dev)) {
10070 vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO);
10071 outb(inb(VGA_MSR_READ) & ~VGA_MSR_MEM_EN, VGA_MSR_WRITE);
10072 vga_set_legacy_decoding(dev->pdev, VGA_RSRC_LEGACY_IO |
10073 VGA_RSRC_NORMAL_IO |
10074 VGA_RSRC_NORMAL_MEM);
10075 vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
10076 }
10077}
10078
10079void intel_modeset_init_hw(struct drm_device *dev) 10048void intel_modeset_init_hw(struct drm_device *dev)
10080{ 10049{
10081 intel_init_power_well(dev); 10050 intel_init_power_well(dev);
@@ -10354,7 +10323,6 @@ void i915_redisable_vga(struct drm_device *dev)
10354 if (I915_READ(vga_reg) != VGA_DISP_DISABLE) { 10323 if (I915_READ(vga_reg) != VGA_DISP_DISABLE) {
10355 DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n"); 10324 DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
10356 i915_disable_vga(dev); 10325 i915_disable_vga(dev);
10357 i915_disable_vga_mem(dev);
10358 } 10326 }
10359} 10327}
10360 10328
@@ -10568,8 +10536,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
10568 10536
10569 intel_disable_fbc(dev); 10537 intel_disable_fbc(dev);
10570 10538
10571 i915_enable_vga_mem(dev);
10572
10573 intel_disable_gt_powersave(dev); 10539 intel_disable_gt_powersave(dev);
10574 10540
10575 ironlake_teardown_rc6(dev); 10541 ironlake_teardown_rc6(dev);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 79c14e298ba6..2c555f91bfae 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1467,7 +1467,7 @@ static void intel_edp_psr_setup(struct intel_dp *intel_dp)
1467 1467
1468 /* Avoid continuous PSR exit by masking memup and hpd */ 1468 /* Avoid continuous PSR exit by masking memup and hpd */
1469 I915_WRITE(EDP_PSR_DEBUG_CTL, EDP_PSR_DEBUG_MASK_MEMUP | 1469 I915_WRITE(EDP_PSR_DEBUG_CTL, EDP_PSR_DEBUG_MASK_MEMUP |
1470 EDP_PSR_DEBUG_MASK_HPD); 1470 EDP_PSR_DEBUG_MASK_HPD | EDP_PSR_DEBUG_MASK_LPSP);
1471 1471
1472 intel_dp->psr_setup_done = true; 1472 intel_dp->psr_setup_done = true;
1473} 1473}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 28cae80495e2..9b7b68fd5d47 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -793,6 +793,5 @@ extern void hsw_pc8_disable_interrupts(struct drm_device *dev);
793extern void hsw_pc8_restore_interrupts(struct drm_device *dev); 793extern void hsw_pc8_restore_interrupts(struct drm_device *dev);
794extern void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv); 794extern void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv);
795extern void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv); 795extern void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv);
796extern void i915_disable_vga_mem(struct drm_device *dev);
797 796
798#endif /* __INTEL_DRV_H__ */ 797#endif /* __INTEL_DRV_H__ */
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index dd176b7296c1..f4c5e95b2d6f 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3864,8 +3864,6 @@ static void valleyview_enable_rps(struct drm_device *dev)
3864 dev_priv->rps.rpe_delay), 3864 dev_priv->rps.rpe_delay),
3865 dev_priv->rps.rpe_delay); 3865 dev_priv->rps.rpe_delay);
3866 3866
3867 INIT_DELAYED_WORK(&dev_priv->rps.vlv_work, vlv_rps_timer_work);
3868
3869 valleyview_set_rps(dev_priv->dev, dev_priv->rps.rpe_delay); 3867 valleyview_set_rps(dev_priv->dev, dev_priv->rps.rpe_delay);
3870 3868
3871 gen6_enable_rps_interrupts(dev); 3869 gen6_enable_rps_interrupts(dev);
@@ -4955,6 +4953,11 @@ static void haswell_init_clock_gating(struct drm_device *dev)
4955 I915_WRITE(GEN7_L3_CHICKEN_MODE_REGISTER, 4953 I915_WRITE(GEN7_L3_CHICKEN_MODE_REGISTER,
4956 GEN7_WA_L3_CHICKEN_MODE); 4954 GEN7_WA_L3_CHICKEN_MODE);
4957 4955
4956 /* L3 caching of data atomics doesn't work -- disable it. */
4957 I915_WRITE(HSW_SCRATCH1, HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE);
4958 I915_WRITE(HSW_ROW_CHICKEN3,
4959 _MASKED_BIT_ENABLE(HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE));
4960
4958 /* This is required by WaCatErrorRejectionIssue:hsw */ 4961 /* This is required by WaCatErrorRejectionIssue:hsw */
4959 I915_WRITE(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, 4962 I915_WRITE(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG,
4960 I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | 4963 I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) |
@@ -5681,5 +5684,7 @@ void intel_pm_init(struct drm_device *dev)
5681 5684
5682 INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, 5685 INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work,
5683 intel_gen6_powersave_work); 5686 intel_gen6_powersave_work);
5687
5688 INIT_DELAYED_WORK(&dev_priv->rps.vlv_work, vlv_rps_timer_work);
5684} 5689}
5685 5690
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/base.c b/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
index 37712a6df923..e290cfa4acee 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
@@ -113,7 +113,7 @@ nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine,
113 pmc->use_msi = false; 113 pmc->use_msi = false;
114 break; 114 break;
115 default: 115 default:
116 pmc->use_msi = nouveau_boolopt(device->cfgopt, "NvMSI", true); 116 pmc->use_msi = nouveau_boolopt(device->cfgopt, "NvMSI", false);
117 if (pmc->use_msi) { 117 if (pmc->use_msi) {
118 pmc->use_msi = pci_enable_msi(device->pdev) == 0; 118 pmc->use_msi = pci_enable_msi(device->pdev) == 0;
119 if (pmc->use_msi) { 119 if (pmc->use_msi) {
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index b162e98a2953..9b6950d9b3c0 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -1930,7 +1930,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev,
1930 } 1930 }
1931 j++; 1931 j++;
1932 1932
1933 if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) 1933 if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
1934 return -EINVAL; 1934 return -EINVAL;
1935 1935
1936 tmp = RREG32(MC_PMG_CMD_MRS); 1936 tmp = RREG32(MC_PMG_CMD_MRS);
@@ -1945,7 +1945,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev,
1945 } 1945 }
1946 j++; 1946 j++;
1947 1947
1948 if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) 1948 if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
1949 return -EINVAL; 1949 return -EINVAL;
1950 break; 1950 break;
1951 case MC_SEQ_RESERVE_M >> 2: 1951 case MC_SEQ_RESERVE_M >> 2:
@@ -1959,7 +1959,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev,
1959 } 1959 }
1960 j++; 1960 j++;
1961 1961
1962 if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) 1962 if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
1963 return -EINVAL; 1963 return -EINVAL;
1964 break; 1964 break;
1965 default: 1965 default:
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index d02fd1c045d5..b874ccdf52f7 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -77,6 +77,8 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev);
77static void cik_program_aspm(struct radeon_device *rdev); 77static void cik_program_aspm(struct radeon_device *rdev);
78static void cik_init_pg(struct radeon_device *rdev); 78static void cik_init_pg(struct radeon_device *rdev);
79static void cik_init_cg(struct radeon_device *rdev); 79static void cik_init_cg(struct radeon_device *rdev);
80static void cik_fini_pg(struct radeon_device *rdev);
81static void cik_fini_cg(struct radeon_device *rdev);
80static void cik_enable_gui_idle_interrupt(struct radeon_device *rdev, 82static void cik_enable_gui_idle_interrupt(struct radeon_device *rdev,
81 bool enable); 83 bool enable);
82 84
@@ -4185,6 +4187,10 @@ static void cik_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask)
4185 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", 4187 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
4186 RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); 4188 RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS));
4187 4189
4190 /* disable CG/PG */
4191 cik_fini_pg(rdev);
4192 cik_fini_cg(rdev);
4193
4188 /* stop the rlc */ 4194 /* stop the rlc */
4189 cik_rlc_stop(rdev); 4195 cik_rlc_stop(rdev);
4190 4196
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 555164e270a7..b5c67a99dda9 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -3131,7 +3131,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
3131 rdev->config.evergreen.sx_max_export_size = 256; 3131 rdev->config.evergreen.sx_max_export_size = 256;
3132 rdev->config.evergreen.sx_max_export_pos_size = 64; 3132 rdev->config.evergreen.sx_max_export_pos_size = 64;
3133 rdev->config.evergreen.sx_max_export_smx_size = 192; 3133 rdev->config.evergreen.sx_max_export_smx_size = 192;
3134 rdev->config.evergreen.max_hw_contexts = 8; 3134 rdev->config.evergreen.max_hw_contexts = 4;
3135 rdev->config.evergreen.sq_num_cf_insts = 2; 3135 rdev->config.evergreen.sq_num_cf_insts = 2;
3136 3136
3137 rdev->config.evergreen.sc_prim_fifo_size = 0x40; 3137 rdev->config.evergreen.sc_prim_fifo_size = 0x40;
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index f71ce390aebe..f815c20640bd 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -288,8 +288,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
288 /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */ 288 /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */
289 289
290 WREG32(HDMI_ACR_PACKET_CONTROL + offset, 290 WREG32(HDMI_ACR_PACKET_CONTROL + offset,
291 HDMI_ACR_AUTO_SEND | /* allow hw to sent ACR packets when required */ 291 HDMI_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */
292 HDMI_ACR_SOURCE); /* select SW CTS value */
293 292
294 evergreen_hdmi_update_ACR(encoder, mode->clock); 293 evergreen_hdmi_update_ACR(encoder, mode->clock);
295 294
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 8768fd6a1e27..4f6d2962767d 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -1501,7 +1501,7 @@
1501 * 6. COMMAND [29:22] | BYTE_COUNT [20:0] 1501 * 6. COMMAND [29:22] | BYTE_COUNT [20:0]
1502 */ 1502 */
1503# define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20) 1503# define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20)
1504 /* 0 - SRC_ADDR 1504 /* 0 - DST_ADDR
1505 * 1 - GDS 1505 * 1 - GDS
1506 */ 1506 */
1507# define PACKET3_CP_DMA_ENGINE(x) ((x) << 27) 1507# define PACKET3_CP_DMA_ENGINE(x) ((x) << 27)
@@ -1516,7 +1516,7 @@
1516# define PACKET3_CP_DMA_CP_SYNC (1 << 31) 1516# define PACKET3_CP_DMA_CP_SYNC (1 << 31)
1517/* COMMAND */ 1517/* COMMAND */
1518# define PACKET3_CP_DMA_DIS_WC (1 << 21) 1518# define PACKET3_CP_DMA_DIS_WC (1 << 21)
1519# define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 23) 1519# define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22)
1520 /* 0 - none 1520 /* 0 - none
1521 * 1 - 8 in 16 1521 * 1 - 8 in 16
1522 * 2 - 8 in 32 1522 * 2 - 8 in 32
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index b0fa6002af3e..5b729319f27b 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -57,15 +57,15 @@ enum r600_hdmi_iec_status_bits {
57static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = { 57static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = {
58 /* 32kHz 44.1kHz 48kHz */ 58 /* 32kHz 44.1kHz 48kHz */
59 /* Clock N CTS N CTS N CTS */ 59 /* Clock N CTS N CTS N CTS */
60 { 25174, 4576, 28125, 7007, 31250, 6864, 28125 }, /* 25,20/1.001 MHz */ 60 { 25175, 4576, 28125, 7007, 31250, 6864, 28125 }, /* 25,20/1.001 MHz */
61 { 25200, 4096, 25200, 6272, 28000, 6144, 25200 }, /* 25.20 MHz */ 61 { 25200, 4096, 25200, 6272, 28000, 6144, 25200 }, /* 25.20 MHz */
62 { 27000, 4096, 27000, 6272, 30000, 6144, 27000 }, /* 27.00 MHz */ 62 { 27000, 4096, 27000, 6272, 30000, 6144, 27000 }, /* 27.00 MHz */
63 { 27027, 4096, 27027, 6272, 30030, 6144, 27027 }, /* 27.00*1.001 MHz */ 63 { 27027, 4096, 27027, 6272, 30030, 6144, 27027 }, /* 27.00*1.001 MHz */
64 { 54000, 4096, 54000, 6272, 60000, 6144, 54000 }, /* 54.00 MHz */ 64 { 54000, 4096, 54000, 6272, 60000, 6144, 54000 }, /* 54.00 MHz */
65 { 54054, 4096, 54054, 6272, 60060, 6144, 54054 }, /* 54.00*1.001 MHz */ 65 { 54054, 4096, 54054, 6272, 60060, 6144, 54054 }, /* 54.00*1.001 MHz */
66 { 74175, 11648, 210937, 17836, 234375, 11648, 140625 }, /* 74.25/1.001 MHz */ 66 { 74176, 11648, 210937, 17836, 234375, 11648, 140625 }, /* 74.25/1.001 MHz */
67 { 74250, 4096, 74250, 6272, 82500, 6144, 74250 }, /* 74.25 MHz */ 67 { 74250, 4096, 74250, 6272, 82500, 6144, 74250 }, /* 74.25 MHz */
68 { 148351, 11648, 421875, 8918, 234375, 5824, 140625 }, /* 148.50/1.001 MHz */ 68 { 148352, 11648, 421875, 8918, 234375, 5824, 140625 }, /* 148.50/1.001 MHz */
69 { 148500, 4096, 148500, 6272, 165000, 6144, 148500 }, /* 148.50 MHz */ 69 { 148500, 4096, 148500, 6272, 165000, 6144, 148500 }, /* 148.50 MHz */
70 { 0, 4096, 0, 6272, 0, 6144, 0 } /* Other */ 70 { 0, 4096, 0, 6272, 0, 6144, 0 } /* Other */
71}; 71};
@@ -75,8 +75,15 @@ static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = {
75 */ 75 */
76static void r600_hdmi_calc_cts(uint32_t clock, int *CTS, int N, int freq) 76static void r600_hdmi_calc_cts(uint32_t clock, int *CTS, int N, int freq)
77{ 77{
78 if (*CTS == 0) 78 u64 n;
79 *CTS = clock * N / (128 * freq) * 1000; 79 u32 d;
80
81 if (*CTS == 0) {
82 n = (u64)clock * (u64)N * 1000ULL;
83 d = 128 * freq;
84 do_div(n, d);
85 *CTS = n;
86 }
80 DRM_DEBUG("Using ACR timing N=%d CTS=%d for frequency %d\n", 87 DRM_DEBUG("Using ACR timing N=%d CTS=%d for frequency %d\n",
81 N, *CTS, freq); 88 N, *CTS, freq);
82} 89}
@@ -444,8 +451,8 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod
444 } 451 }
445 452
446 WREG32(HDMI0_ACR_PACKET_CONTROL + offset, 453 WREG32(HDMI0_ACR_PACKET_CONTROL + offset,
447 HDMI0_ACR_AUTO_SEND | /* allow hw to sent ACR packets when required */ 454 HDMI0_ACR_SOURCE | /* select SW CTS value - XXX verify that hw CTS works on all families */
448 HDMI0_ACR_SOURCE); /* select SW CTS value */ 455 HDMI0_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */
449 456
450 WREG32(HDMI0_VBI_PACKET_CONTROL + offset, 457 WREG32(HDMI0_VBI_PACKET_CONTROL + offset,
451 HDMI0_NULL_SEND | /* send null packets when required */ 458 HDMI0_NULL_SEND | /* send null packets when required */
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index e673fe26ea84..7b3c7b5932c5 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -1523,7 +1523,7 @@
1523 */ 1523 */
1524# define PACKET3_CP_DMA_CP_SYNC (1 << 31) 1524# define PACKET3_CP_DMA_CP_SYNC (1 << 31)
1525/* COMMAND */ 1525/* COMMAND */
1526# define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 23) 1526# define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22)
1527 /* 0 - none 1527 /* 0 - none
1528 * 1 - 8 in 16 1528 * 1 - 8 in 16
1529 * 2 - 8 in 32 1529 * 2 - 8 in 32
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index ac07ad1d4f8c..4f6b7fc7ad3c 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -945,6 +945,8 @@ void radeon_dpm_enable_uvd(struct radeon_device *rdev, bool enable)
945 if (enable) { 945 if (enable) {
946 mutex_lock(&rdev->pm.mutex); 946 mutex_lock(&rdev->pm.mutex);
947 rdev->pm.dpm.uvd_active = true; 947 rdev->pm.dpm.uvd_active = true;
948 /* disable this for now */
949#if 0
948 if ((rdev->pm.dpm.sd == 1) && (rdev->pm.dpm.hd == 0)) 950 if ((rdev->pm.dpm.sd == 1) && (rdev->pm.dpm.hd == 0))
949 dpm_state = POWER_STATE_TYPE_INTERNAL_UVD_SD; 951 dpm_state = POWER_STATE_TYPE_INTERNAL_UVD_SD;
950 else if ((rdev->pm.dpm.sd == 2) && (rdev->pm.dpm.hd == 0)) 952 else if ((rdev->pm.dpm.sd == 2) && (rdev->pm.dpm.hd == 0))
@@ -954,6 +956,7 @@ void radeon_dpm_enable_uvd(struct radeon_device *rdev, bool enable)
954 else if ((rdev->pm.dpm.sd == 0) && (rdev->pm.dpm.hd == 2)) 956 else if ((rdev->pm.dpm.sd == 0) && (rdev->pm.dpm.hd == 2))
955 dpm_state = POWER_STATE_TYPE_INTERNAL_UVD_HD2; 957 dpm_state = POWER_STATE_TYPE_INTERNAL_UVD_HD2;
956 else 958 else
959#endif
957 dpm_state = POWER_STATE_TYPE_INTERNAL_UVD; 960 dpm_state = POWER_STATE_TYPE_INTERNAL_UVD;
958 rdev->pm.dpm.state = dpm_state; 961 rdev->pm.dpm.state = dpm_state;
959 mutex_unlock(&rdev->pm.mutex); 962 mutex_unlock(&rdev->pm.mutex);
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
index f4d6bcee9006..12e8099a0823 100644
--- a/drivers/gpu/drm/radeon/radeon_test.c
+++ b/drivers/gpu/drm/radeon/radeon_test.c
@@ -36,8 +36,8 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)
36 struct radeon_bo *vram_obj = NULL; 36 struct radeon_bo *vram_obj = NULL;
37 struct radeon_bo **gtt_obj = NULL; 37 struct radeon_bo **gtt_obj = NULL;
38 uint64_t gtt_addr, vram_addr; 38 uint64_t gtt_addr, vram_addr;
39 unsigned i, n, size; 39 unsigned n, size;
40 int r, ring; 40 int i, r, ring;
41 41
42 switch (flag) { 42 switch (flag) {
43 case RADEON_TEST_COPY_DMA: 43 case RADEON_TEST_COPY_DMA:
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index a0f11856ddde..4f2e73f79638 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -798,7 +798,8 @@ void radeon_uvd_note_usage(struct radeon_device *rdev)
798 (rdev->pm.dpm.hd != hd)) { 798 (rdev->pm.dpm.hd != hd)) {
799 rdev->pm.dpm.sd = sd; 799 rdev->pm.dpm.sd = sd;
800 rdev->pm.dpm.hd = hd; 800 rdev->pm.dpm.hd = hd;
801 streams_changed = true; 801 /* disable this for now */
802 /*streams_changed = true;*/
802 } 803 }
803 } 804 }
804 805
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index c354c1094967..d4652af425b8 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -85,6 +85,9 @@ extern void si_dma_vm_set_page(struct radeon_device *rdev,
85 uint32_t incr, uint32_t flags); 85 uint32_t incr, uint32_t flags);
86static void si_enable_gui_idle_interrupt(struct radeon_device *rdev, 86static void si_enable_gui_idle_interrupt(struct radeon_device *rdev,
87 bool enable); 87 bool enable);
88static void si_fini_pg(struct radeon_device *rdev);
89static void si_fini_cg(struct radeon_device *rdev);
90static void si_rlc_stop(struct radeon_device *rdev);
88 91
89static const u32 verde_rlc_save_restore_register_list[] = 92static const u32 verde_rlc_save_restore_register_list[] =
90{ 93{
@@ -3608,6 +3611,13 @@ static void si_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask)
3608 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", 3611 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
3609 RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); 3612 RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS));
3610 3613
3614 /* disable PG/CG */
3615 si_fini_pg(rdev);
3616 si_fini_cg(rdev);
3617
3618 /* stop the rlc */
3619 si_rlc_stop(rdev);
3620
3611 /* Disable CP parsing/prefetching */ 3621 /* Disable CP parsing/prefetching */
3612 WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT | CP_CE_HALT); 3622 WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT | CP_CE_HALT);
3613 3623
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 9ace28702c76..2332aa1bf93c 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -5208,7 +5208,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev,
5208 table->mc_reg_table_entry[k].mc_data[j] |= 0x100; 5208 table->mc_reg_table_entry[k].mc_data[j] |= 0x100;
5209 } 5209 }
5210 j++; 5210 j++;
5211 if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5211 if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
5212 return -EINVAL; 5212 return -EINVAL;
5213 5213
5214 if (!pi->mem_gddr5) { 5214 if (!pi->mem_gddr5) {
@@ -5218,7 +5218,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev,
5218 table->mc_reg_table_entry[k].mc_data[j] = 5218 table->mc_reg_table_entry[k].mc_data[j] =
5219 (table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16; 5219 (table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16;
5220 j++; 5220 j++;
5221 if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5221 if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
5222 return -EINVAL; 5222 return -EINVAL;
5223 } 5223 }
5224 break; 5224 break;
@@ -5231,7 +5231,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev,
5231 (temp_reg & 0xffff0000) | 5231 (temp_reg & 0xffff0000) |
5232 (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); 5232 (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff);
5233 j++; 5233 j++;
5234 if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5234 if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
5235 return -EINVAL; 5235 return -EINVAL;
5236 break; 5236 break;
5237 default: 5237 default:
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h
index 52d2ab6b67a0..7e2e0ea66a00 100644
--- a/drivers/gpu/drm/radeon/sid.h
+++ b/drivers/gpu/drm/radeon/sid.h
@@ -1553,7 +1553,7 @@
1553 * 6. COMMAND [30:21] | BYTE_COUNT [20:0] 1553 * 6. COMMAND [30:21] | BYTE_COUNT [20:0]
1554 */ 1554 */
1555# define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20) 1555# define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20)
1556 /* 0 - SRC_ADDR 1556 /* 0 - DST_ADDR
1557 * 1 - GDS 1557 * 1 - GDS
1558 */ 1558 */
1559# define PACKET3_CP_DMA_ENGINE(x) ((x) << 27) 1559# define PACKET3_CP_DMA_ENGINE(x) ((x) << 27)
@@ -1568,7 +1568,7 @@
1568# define PACKET3_CP_DMA_CP_SYNC (1 << 31) 1568# define PACKET3_CP_DMA_CP_SYNC (1 << 31)
1569/* COMMAND */ 1569/* COMMAND */
1570# define PACKET3_CP_DMA_DIS_WC (1 << 21) 1570# define PACKET3_CP_DMA_DIS_WC (1 << 21)
1571# define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 23) 1571# define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22)
1572 /* 0 - none 1572 /* 0 - none
1573 * 1 - 8 in 16 1573 * 1 - 8 in 16
1574 * 2 - 8 in 32 1574 * 2 - 8 in 32
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c
index 7f998bf1cc9d..9364129ba292 100644
--- a/drivers/gpu/drm/radeon/trinity_dpm.c
+++ b/drivers/gpu/drm/radeon/trinity_dpm.c
@@ -1868,7 +1868,7 @@ int trinity_dpm_init(struct radeon_device *rdev)
1868 for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) 1868 for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++)
1869 pi->at[i] = TRINITY_AT_DFLT; 1869 pi->at[i] = TRINITY_AT_DFLT;
1870 1870
1871 pi->enable_bapm = true; 1871 pi->enable_bapm = false;
1872 pi->enable_nbps_policy = true; 1872 pi->enable_nbps_policy = true;
1873 pi->enable_sclk_ds = true; 1873 pi->enable_sclk_ds = true;
1874 pi->enable_gfx_power_gating = true; 1874 pi->enable_gfx_power_gating = true;
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 71b70e3a7a71..c91d547191dd 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -241,6 +241,7 @@ config HID_HOLTEK
241 - Sharkoon Drakonia / Perixx MX-2000 gaming mice 241 - Sharkoon Drakonia / Perixx MX-2000 gaming mice
242 - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 / 242 - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 /
243 Zalman ZM-GM1 243 Zalman ZM-GM1
244 - SHARKOON DarkGlider Gaming mouse
244 245
245config HOLTEK_FF 246config HOLTEK_FF
246 bool "Holtek On Line Grip force feedback support" 247 bool "Holtek On Line Grip force feedback support"
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b8470b1a10fe..5a8c01112a23 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1715,6 +1715,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1715 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, 1715 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) },
1716 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, 1716 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
1717 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, 1717 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
1718 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
1718 { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) }, 1719 { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) },
1719 { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, 1720 { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
1720 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, 1721 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c
index 7e6db3cf46f9..e696566cde46 100644
--- a/drivers/hid/hid-holtek-mouse.c
+++ b/drivers/hid/hid-holtek-mouse.c
@@ -27,6 +27,7 @@
27 * - USB ID 04d9:a067, sold as Sharkoon Drakonia and Perixx MX-2000 27 * - USB ID 04d9:a067, sold as Sharkoon Drakonia and Perixx MX-2000
28 * - USB ID 04d9:a04a, sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200 28 * - USB ID 04d9:a04a, sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200
29 * and Zalman ZM-GM1 29 * and Zalman ZM-GM1
30 * - USB ID 04d9:a081, sold as SHARKOON DarkGlider Gaming mouse
30 */ 31 */
31 32
32static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, 33static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -46,6 +47,7 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
46 } 47 }
47 break; 48 break;
48 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A: 49 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A:
50 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081:
49 if (*rsize >= 113 && rdesc[106] == 0xff && rdesc[107] == 0x7f 51 if (*rsize >= 113 && rdesc[106] == 0xff && rdesc[107] == 0x7f
50 && rdesc[111] == 0xff && rdesc[112] == 0x7f) { 52 && rdesc[111] == 0xff && rdesc[112] == 0x7f) {
51 hid_info(hdev, "Fixing up report descriptor\n"); 53 hid_info(hdev, "Fixing up report descriptor\n");
@@ -63,6 +65,8 @@ static const struct hid_device_id holtek_mouse_devices[] = {
63 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, 65 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
64 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, 66 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
65 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, 67 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
68 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
69 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
66 { } 70 { }
67}; 71};
68MODULE_DEVICE_TABLE(hid, holtek_mouse_devices); 72MODULE_DEVICE_TABLE(hid, holtek_mouse_devices);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index e60e8d530697..9cbc7ab07dfa 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -450,6 +450,7 @@
450#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 450#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055
451#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067 451#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067
452#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a 452#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a
453#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081
453 454
454#define USB_VENDOR_ID_IMATION 0x0718 455#define USB_VENDOR_ID_IMATION 0x0718
455#define USB_DEVICE_ID_DISC_STAKKA 0xd000 456#define USB_DEVICE_ID_DISC_STAKKA 0xd000
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index 602c188e9d86..6101816a7ddd 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -382,7 +382,7 @@ static ssize_t kone_sysfs_write_profilex(struct file *fp,
382} 382}
383#define PROFILE_ATTR(number) \ 383#define PROFILE_ATTR(number) \
384static struct bin_attribute bin_attr_profile##number = { \ 384static struct bin_attribute bin_attr_profile##number = { \
385 .attr = { .name = "profile##number", .mode = 0660 }, \ 385 .attr = { .name = "profile" #number, .mode = 0660 }, \
386 .size = sizeof(struct kone_profile), \ 386 .size = sizeof(struct kone_profile), \
387 .read = kone_sysfs_read_profilex, \ 387 .read = kone_sysfs_read_profilex, \
388 .write = kone_sysfs_write_profilex, \ 388 .write = kone_sysfs_write_profilex, \
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 5ddf605b6b89..5e99fcdc71b9 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -229,13 +229,13 @@ static ssize_t koneplus_sysfs_read_profilex_buttons(struct file *fp,
229 229
230#define PROFILE_ATTR(number) \ 230#define PROFILE_ATTR(number) \
231static struct bin_attribute bin_attr_profile##number##_settings = { \ 231static struct bin_attribute bin_attr_profile##number##_settings = { \
232 .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ 232 .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \
233 .size = KONEPLUS_SIZE_PROFILE_SETTINGS, \ 233 .size = KONEPLUS_SIZE_PROFILE_SETTINGS, \
234 .read = koneplus_sysfs_read_profilex_settings, \ 234 .read = koneplus_sysfs_read_profilex_settings, \
235 .private = &profile_numbers[number-1], \ 235 .private = &profile_numbers[number-1], \
236}; \ 236}; \
237static struct bin_attribute bin_attr_profile##number##_buttons = { \ 237static struct bin_attribute bin_attr_profile##number##_buttons = { \
238 .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ 238 .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \
239 .size = KONEPLUS_SIZE_PROFILE_BUTTONS, \ 239 .size = KONEPLUS_SIZE_PROFILE_BUTTONS, \
240 .read = koneplus_sysfs_read_profilex_buttons, \ 240 .read = koneplus_sysfs_read_profilex_buttons, \
241 .private = &profile_numbers[number-1], \ 241 .private = &profile_numbers[number-1], \
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c
index 515bc03136c0..0c8e1ef0b67d 100644
--- a/drivers/hid/hid-roccat-kovaplus.c
+++ b/drivers/hid/hid-roccat-kovaplus.c
@@ -257,13 +257,13 @@ static ssize_t kovaplus_sysfs_read_profilex_buttons(struct file *fp,
257 257
258#define PROFILE_ATTR(number) \ 258#define PROFILE_ATTR(number) \
259static struct bin_attribute bin_attr_profile##number##_settings = { \ 259static struct bin_attribute bin_attr_profile##number##_settings = { \
260 .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ 260 .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \
261 .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, \ 261 .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, \
262 .read = kovaplus_sysfs_read_profilex_settings, \ 262 .read = kovaplus_sysfs_read_profilex_settings, \
263 .private = &profile_numbers[number-1], \ 263 .private = &profile_numbers[number-1], \
264}; \ 264}; \
265static struct bin_attribute bin_attr_profile##number##_buttons = { \ 265static struct bin_attribute bin_attr_profile##number##_buttons = { \
266 .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ 266 .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \
267 .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, \ 267 .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, \
268 .read = kovaplus_sysfs_read_profilex_buttons, \ 268 .read = kovaplus_sysfs_read_profilex_buttons, \
269 .private = &profile_numbers[number-1], \ 269 .private = &profile_numbers[number-1], \
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index 5a6dbbeee790..1a07e07d99a0 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -225,13 +225,13 @@ static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp,
225 225
226#define PROFILE_ATTR(number) \ 226#define PROFILE_ATTR(number) \
227static struct bin_attribute bin_attr_profile##number##_settings = { \ 227static struct bin_attribute bin_attr_profile##number##_settings = { \
228 .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ 228 .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \
229 .size = PYRA_SIZE_PROFILE_SETTINGS, \ 229 .size = PYRA_SIZE_PROFILE_SETTINGS, \
230 .read = pyra_sysfs_read_profilex_settings, \ 230 .read = pyra_sysfs_read_profilex_settings, \
231 .private = &profile_numbers[number-1], \ 231 .private = &profile_numbers[number-1], \
232}; \ 232}; \
233static struct bin_attribute bin_attr_profile##number##_buttons = { \ 233static struct bin_attribute bin_attr_profile##number##_buttons = { \
234 .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ 234 .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \
235 .size = PYRA_SIZE_PROFILE_BUTTONS, \ 235 .size = PYRA_SIZE_PROFILE_BUTTONS, \
236 .read = pyra_sysfs_read_profilex_buttons, \ 236 .read = pyra_sysfs_read_profilex_buttons, \
237 .private = &profile_numbers[number-1], \ 237 .private = &profile_numbers[number-1], \
diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c
index 2e7d644dba18..71adf9e60b13 100644
--- a/drivers/hid/hid-wiimote-modules.c
+++ b/drivers/hid/hid-wiimote-modules.c
@@ -119,12 +119,22 @@ static const struct wiimod_ops wiimod_keys = {
119 * the rumble motor, this flag shouldn't be set. 119 * the rumble motor, this flag shouldn't be set.
120 */ 120 */
121 121
122/* used by wiimod_rumble and wiipro_rumble */
123static void wiimod_rumble_worker(struct work_struct *work)
124{
125 struct wiimote_data *wdata = container_of(work, struct wiimote_data,
126 rumble_worker);
127
128 spin_lock_irq(&wdata->state.lock);
129 wiiproto_req_rumble(wdata, wdata->state.cache_rumble);
130 spin_unlock_irq(&wdata->state.lock);
131}
132
122static int wiimod_rumble_play(struct input_dev *dev, void *data, 133static int wiimod_rumble_play(struct input_dev *dev, void *data,
123 struct ff_effect *eff) 134 struct ff_effect *eff)
124{ 135{
125 struct wiimote_data *wdata = input_get_drvdata(dev); 136 struct wiimote_data *wdata = input_get_drvdata(dev);
126 __u8 value; 137 __u8 value;
127 unsigned long flags;
128 138
129 /* 139 /*
130 * The wiimote supports only a single rumble motor so if any magnitude 140 * The wiimote supports only a single rumble motor so if any magnitude
@@ -137,9 +147,10 @@ static int wiimod_rumble_play(struct input_dev *dev, void *data,
137 else 147 else
138 value = 0; 148 value = 0;
139 149
140 spin_lock_irqsave(&wdata->state.lock, flags); 150 /* Locking state.lock here might deadlock with input_event() calls.
141 wiiproto_req_rumble(wdata, value); 151 * schedule_work acts as barrier. Merging multiple changes is fine. */
142 spin_unlock_irqrestore(&wdata->state.lock, flags); 152 wdata->state.cache_rumble = value;
153 schedule_work(&wdata->rumble_worker);
143 154
144 return 0; 155 return 0;
145} 156}
@@ -147,6 +158,8 @@ static int wiimod_rumble_play(struct input_dev *dev, void *data,
147static int wiimod_rumble_probe(const struct wiimod_ops *ops, 158static int wiimod_rumble_probe(const struct wiimod_ops *ops,
148 struct wiimote_data *wdata) 159 struct wiimote_data *wdata)
149{ 160{
161 INIT_WORK(&wdata->rumble_worker, wiimod_rumble_worker);
162
150 set_bit(FF_RUMBLE, wdata->input->ffbit); 163 set_bit(FF_RUMBLE, wdata->input->ffbit);
151 if (input_ff_create_memless(wdata->input, NULL, wiimod_rumble_play)) 164 if (input_ff_create_memless(wdata->input, NULL, wiimod_rumble_play))
152 return -ENOMEM; 165 return -ENOMEM;
@@ -159,6 +172,8 @@ static void wiimod_rumble_remove(const struct wiimod_ops *ops,
159{ 172{
160 unsigned long flags; 173 unsigned long flags;
161 174
175 cancel_work_sync(&wdata->rumble_worker);
176
162 spin_lock_irqsave(&wdata->state.lock, flags); 177 spin_lock_irqsave(&wdata->state.lock, flags);
163 wiiproto_req_rumble(wdata, 0); 178 wiiproto_req_rumble(wdata, 0);
164 spin_unlock_irqrestore(&wdata->state.lock, flags); 179 spin_unlock_irqrestore(&wdata->state.lock, flags);
@@ -1731,7 +1746,6 @@ static int wiimod_pro_play(struct input_dev *dev, void *data,
1731{ 1746{
1732 struct wiimote_data *wdata = input_get_drvdata(dev); 1747 struct wiimote_data *wdata = input_get_drvdata(dev);
1733 __u8 value; 1748 __u8 value;
1734 unsigned long flags;
1735 1749
1736 /* 1750 /*
1737 * The wiimote supports only a single rumble motor so if any magnitude 1751 * The wiimote supports only a single rumble motor so if any magnitude
@@ -1744,9 +1758,10 @@ static int wiimod_pro_play(struct input_dev *dev, void *data,
1744 else 1758 else
1745 value = 0; 1759 value = 0;
1746 1760
1747 spin_lock_irqsave(&wdata->state.lock, flags); 1761 /* Locking state.lock here might deadlock with input_event() calls.
1748 wiiproto_req_rumble(wdata, value); 1762 * schedule_work acts as barrier. Merging multiple changes is fine. */
1749 spin_unlock_irqrestore(&wdata->state.lock, flags); 1763 wdata->state.cache_rumble = value;
1764 schedule_work(&wdata->rumble_worker);
1750 1765
1751 return 0; 1766 return 0;
1752} 1767}
@@ -1756,6 +1771,8 @@ static int wiimod_pro_probe(const struct wiimod_ops *ops,
1756{ 1771{
1757 int ret, i; 1772 int ret, i;
1758 1773
1774 INIT_WORK(&wdata->rumble_worker, wiimod_rumble_worker);
1775
1759 wdata->extension.input = input_allocate_device(); 1776 wdata->extension.input = input_allocate_device();
1760 if (!wdata->extension.input) 1777 if (!wdata->extension.input)
1761 return -ENOMEM; 1778 return -ENOMEM;
@@ -1817,12 +1834,13 @@ static void wiimod_pro_remove(const struct wiimod_ops *ops,
1817 if (!wdata->extension.input) 1834 if (!wdata->extension.input)
1818 return; 1835 return;
1819 1836
1837 input_unregister_device(wdata->extension.input);
1838 wdata->extension.input = NULL;
1839 cancel_work_sync(&wdata->rumble_worker);
1840
1820 spin_lock_irqsave(&wdata->state.lock, flags); 1841 spin_lock_irqsave(&wdata->state.lock, flags);
1821 wiiproto_req_rumble(wdata, 0); 1842 wiiproto_req_rumble(wdata, 0);
1822 spin_unlock_irqrestore(&wdata->state.lock, flags); 1843 spin_unlock_irqrestore(&wdata->state.lock, flags);
1823
1824 input_unregister_device(wdata->extension.input);
1825 wdata->extension.input = NULL;
1826} 1844}
1827 1845
1828static const struct wiimod_ops wiimod_pro = { 1846static const struct wiimod_ops wiimod_pro = {
diff --git a/drivers/hid/hid-wiimote.h b/drivers/hid/hid-wiimote.h
index f1474f372c0b..75db0c400037 100644
--- a/drivers/hid/hid-wiimote.h
+++ b/drivers/hid/hid-wiimote.h
@@ -133,13 +133,15 @@ struct wiimote_state {
133 __u8 *cmd_read_buf; 133 __u8 *cmd_read_buf;
134 __u8 cmd_read_size; 134 __u8 cmd_read_size;
135 135
136 /* calibration data */ 136 /* calibration/cache data */
137 __u16 calib_bboard[4][3]; 137 __u16 calib_bboard[4][3];
138 __u8 cache_rumble;
138}; 139};
139 140
140struct wiimote_data { 141struct wiimote_data {
141 struct hid_device *hdev; 142 struct hid_device *hdev;
142 struct input_dev *input; 143 struct input_dev *input;
144 struct work_struct rumble_worker;
143 struct led_classdev *leds[4]; 145 struct led_classdev *leds[4];
144 struct input_dev *accel; 146 struct input_dev *accel;
145 struct input_dev *ir; 147 struct input_dev *ir;
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 8918dd12bb69..6a6dd5cd7833 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -308,18 +308,25 @@ static int hidraw_fasync(int fd, struct file *file, int on)
308static void drop_ref(struct hidraw *hidraw, int exists_bit) 308static void drop_ref(struct hidraw *hidraw, int exists_bit)
309{ 309{
310 if (exists_bit) { 310 if (exists_bit) {
311 hid_hw_close(hidraw->hid);
312 hidraw->exist = 0; 311 hidraw->exist = 0;
313 if (hidraw->open) 312 if (hidraw->open) {
313 hid_hw_close(hidraw->hid);
314 wake_up_interruptible(&hidraw->wait); 314 wake_up_interruptible(&hidraw->wait);
315 }
315 } else { 316 } else {
316 --hidraw->open; 317 --hidraw->open;
317 } 318 }
318 319 if (!hidraw->open) {
319 if (!hidraw->open && !hidraw->exist) { 320 if (!hidraw->exist) {
320 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor)); 321 device_destroy(hidraw_class,
321 hidraw_table[hidraw->minor] = NULL; 322 MKDEV(hidraw_major, hidraw->minor));
322 kfree(hidraw); 323 hidraw_table[hidraw->minor] = NULL;
324 kfree(hidraw);
325 } else {
326 /* close device for last reader */
327 hid_hw_power(hidraw->hid, PM_HINT_NORMAL);
328 hid_hw_close(hidraw->hid);
329 }
323 } 330 }
324} 331}
325 332
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 5bf2fb785844..93b00d76374c 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -615,7 +615,7 @@ static const struct file_operations uhid_fops = {
615 615
616static struct miscdevice uhid_misc = { 616static struct miscdevice uhid_misc = {
617 .fops = &uhid_fops, 617 .fops = &uhid_fops,
618 .minor = MISC_DYNAMIC_MINOR, 618 .minor = UHID_MINOR,
619 .name = UHID_NAME, 619 .name = UHID_NAME,
620}; 620};
621 621
@@ -634,4 +634,5 @@ module_exit(uhid_exit);
634MODULE_LICENSE("GPL"); 634MODULE_LICENSE("GPL");
635MODULE_AUTHOR("David Herrmann <dh.herrmann@gmail.com>"); 635MODULE_AUTHOR("David Herrmann <dh.herrmann@gmail.com>");
636MODULE_DESCRIPTION("User-space I/O driver support for HID subsystem"); 636MODULE_DESCRIPTION("User-space I/O driver support for HID subsystem");
637MODULE_ALIAS_MISCDEV(UHID_MINOR);
637MODULE_ALIAS("devname:" UHID_NAME); 638MODULE_ALIAS("devname:" UHID_NAME);
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 98814d12a604..3288f13d2d87 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -230,6 +230,7 @@ static int send_argument(const char *key)
230 230
231static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) 231static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
232{ 232{
233 u8 status, data = 0;
233 int i; 234 int i;
234 235
235 if (send_command(cmd) || send_argument(key)) { 236 if (send_command(cmd) || send_argument(key)) {
@@ -237,6 +238,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
237 return -EIO; 238 return -EIO;
238 } 239 }
239 240
241 /* This has no effect on newer (2012) SMCs */
240 if (send_byte(len, APPLESMC_DATA_PORT)) { 242 if (send_byte(len, APPLESMC_DATA_PORT)) {
241 pr_warn("%.4s: read len fail\n", key); 243 pr_warn("%.4s: read len fail\n", key);
242 return -EIO; 244 return -EIO;
@@ -250,6 +252,17 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
250 buffer[i] = inb(APPLESMC_DATA_PORT); 252 buffer[i] = inb(APPLESMC_DATA_PORT);
251 } 253 }
252 254
255 /* Read the data port until bit0 is cleared */
256 for (i = 0; i < 16; i++) {
257 udelay(APPLESMC_MIN_WAIT);
258 status = inb(APPLESMC_CMD_PORT);
259 if (!(status & 0x01))
260 break;
261 data = inb(APPLESMC_DATA_PORT);
262 }
263 if (i)
264 pr_warn("flushed %d bytes, last value is: %d\n", i, data);
265
253 return 0; 266 return 0;
254} 267}
255 268
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 4c1b60539a25..0aa01136f8d9 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -270,7 +270,8 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
270MODULE_ALIAS("platform:i2c_designware"); 270MODULE_ALIAS("platform:i2c_designware");
271 271
272static struct platform_driver dw_i2c_driver = { 272static struct platform_driver dw_i2c_driver = {
273 .remove = dw_i2c_remove, 273 .probe = dw_i2c_probe,
274 .remove = dw_i2c_remove,
274 .driver = { 275 .driver = {
275 .name = "i2c_designware", 276 .name = "i2c_designware",
276 .owner = THIS_MODULE, 277 .owner = THIS_MODULE,
@@ -282,7 +283,7 @@ static struct platform_driver dw_i2c_driver = {
282 283
283static int __init dw_i2c_init_driver(void) 284static int __init dw_i2c_init_driver(void)
284{ 285{
285 return platform_driver_probe(&dw_i2c_driver, dw_i2c_probe); 286 return platform_driver_register(&dw_i2c_driver);
286} 287}
287subsys_initcall(dw_i2c_init_driver); 288subsys_initcall(dw_i2c_init_driver);
288 289
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index ccf46656bdad..1d7efa3169cd 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -365,7 +365,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
365 clk_disable_unprepare(i2c_imx->clk); 365 clk_disable_unprepare(i2c_imx->clk);
366} 366}
367 367
368static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, 368static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
369 unsigned int rate) 369 unsigned int rate)
370{ 370{
371 struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div; 371 struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div;
@@ -589,7 +589,7 @@ static struct i2c_algorithm i2c_imx_algo = {
589 .functionality = i2c_imx_func, 589 .functionality = i2c_imx_func,
590}; 590};
591 591
592static int __init i2c_imx_probe(struct platform_device *pdev) 592static int i2c_imx_probe(struct platform_device *pdev)
593{ 593{
594 const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids, 594 const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids,
595 &pdev->dev); 595 &pdev->dev);
@@ -697,7 +697,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
697 return 0; /* Return OK */ 697 return 0; /* Return OK */
698} 698}
699 699
700static int __exit i2c_imx_remove(struct platform_device *pdev) 700static int i2c_imx_remove(struct platform_device *pdev)
701{ 701{
702 struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev); 702 struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev);
703 703
@@ -715,7 +715,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
715} 715}
716 716
717static struct platform_driver i2c_imx_driver = { 717static struct platform_driver i2c_imx_driver = {
718 .remove = __exit_p(i2c_imx_remove), 718 .probe = i2c_imx_probe,
719 .remove = i2c_imx_remove,
719 .driver = { 720 .driver = {
720 .name = DRIVER_NAME, 721 .name = DRIVER_NAME,
721 .owner = THIS_MODULE, 722 .owner = THIS_MODULE,
@@ -726,7 +727,7 @@ static struct platform_driver i2c_imx_driver = {
726 727
727static int __init i2c_adap_imx_init(void) 728static int __init i2c_adap_imx_init(void)
728{ 729{
729 return platform_driver_probe(&i2c_imx_driver, i2c_imx_probe); 730 return platform_driver_register(&i2c_imx_driver);
730} 731}
731subsys_initcall(i2c_adap_imx_init); 732subsys_initcall(i2c_adap_imx_init);
732 733
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index f4a01675fa71..b7c857774708 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -780,12 +780,13 @@ static struct platform_driver mxs_i2c_driver = {
780 .owner = THIS_MODULE, 780 .owner = THIS_MODULE,
781 .of_match_table = mxs_i2c_dt_ids, 781 .of_match_table = mxs_i2c_dt_ids,
782 }, 782 },
783 .probe = mxs_i2c_probe,
783 .remove = mxs_i2c_remove, 784 .remove = mxs_i2c_remove,
784}; 785};
785 786
786static int __init mxs_i2c_init(void) 787static int __init mxs_i2c_init(void)
787{ 788{
788 return platform_driver_probe(&mxs_i2c_driver, mxs_i2c_probe); 789 return platform_driver_register(&mxs_i2c_driver);
789} 790}
790subsys_initcall(mxs_i2c_init); 791subsys_initcall(mxs_i2c_init);
791 792
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 6d8308d5dc4e..9967a6f9c2ff 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -939,6 +939,9 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
939 /* 939 /*
940 * ProDB0017052: Clear ARDY bit twice 940 * ProDB0017052: Clear ARDY bit twice
941 */ 941 */
942 if (stat & OMAP_I2C_STAT_ARDY)
943 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_ARDY);
944
942 if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | 945 if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK |
943 OMAP_I2C_STAT_AL)) { 946 OMAP_I2C_STAT_AL)) {
944 omap_i2c_ack_stat(dev, (OMAP_I2C_STAT_RRDY | 947 omap_i2c_ack_stat(dev, (OMAP_I2C_STAT_RRDY |
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index f8f6f2e552db..04a17b9b38bb 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -859,8 +859,7 @@ static const struct i2c_algorithm stu300_algo = {
859 .functionality = stu300_func, 859 .functionality = stu300_func,
860}; 860};
861 861
862static int __init 862static int stu300_probe(struct platform_device *pdev)
863stu300_probe(struct platform_device *pdev)
864{ 863{
865 struct stu300_dev *dev; 864 struct stu300_dev *dev;
866 struct i2c_adapter *adap; 865 struct i2c_adapter *adap;
@@ -966,8 +965,7 @@ static SIMPLE_DEV_PM_OPS(stu300_pm, stu300_suspend, stu300_resume);
966#define STU300_I2C_PM NULL 965#define STU300_I2C_PM NULL
967#endif 966#endif
968 967
969static int __exit 968static int stu300_remove(struct platform_device *pdev)
970stu300_remove(struct platform_device *pdev)
971{ 969{
972 struct stu300_dev *dev = platform_get_drvdata(pdev); 970 struct stu300_dev *dev = platform_get_drvdata(pdev);
973 971
@@ -989,13 +987,14 @@ static struct platform_driver stu300_i2c_driver = {
989 .pm = STU300_I2C_PM, 987 .pm = STU300_I2C_PM,
990 .of_match_table = stu300_dt_match, 988 .of_match_table = stu300_dt_match,
991 }, 989 },
992 .remove = __exit_p(stu300_remove), 990 .probe = stu300_probe,
991 .remove = stu300_remove,
993 992
994}; 993};
995 994
996static int __init stu300_init(void) 995static int __init stu300_init(void)
997{ 996{
998 return platform_driver_probe(&stu300_i2c_driver, stu300_probe); 997 return platform_driver_register(&stu300_i2c_driver);
999} 998}
1000 999
1001static void __exit stu300_exit(void) 1000static void __exit stu300_exit(void)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 29d3f045a2bf..3be58f89ac77 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1134,6 +1134,9 @@ static void acpi_i2c_register_devices(struct i2c_adapter *adap)
1134 acpi_handle handle; 1134 acpi_handle handle;
1135 acpi_status status; 1135 acpi_status status;
1136 1136
1137 if (!adap->dev.parent)
1138 return;
1139
1137 handle = ACPI_HANDLE(adap->dev.parent); 1140 handle = ACPI_HANDLE(adap->dev.parent);
1138 if (!handle) 1141 if (!handle)
1139 return; 1142 return;
diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
index 74b41ae690f3..928656e241dd 100644
--- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
+++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
@@ -200,7 +200,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
200 arb->parent = of_find_i2c_adapter_by_node(parent_np); 200 arb->parent = of_find_i2c_adapter_by_node(parent_np);
201 if (!arb->parent) { 201 if (!arb->parent) {
202 dev_err(dev, "Cannot find parent bus\n"); 202 dev_err(dev, "Cannot find parent bus\n");
203 return -EINVAL; 203 return -EPROBE_DEFER;
204 } 204 }
205 205
206 /* Actually add the mux adapter */ 206 /* Actually add the mux adapter */
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index 5d4a99ba743e..a764da777f08 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -66,7 +66,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
66 struct device_node *adapter_np, *child; 66 struct device_node *adapter_np, *child;
67 struct i2c_adapter *adapter; 67 struct i2c_adapter *adapter;
68 unsigned *values, *gpios; 68 unsigned *values, *gpios;
69 int i = 0; 69 int i = 0, ret;
70 70
71 if (!np) 71 if (!np)
72 return -ENODEV; 72 return -ENODEV;
@@ -79,7 +79,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
79 adapter = of_find_i2c_adapter_by_node(adapter_np); 79 adapter = of_find_i2c_adapter_by_node(adapter_np);
80 if (!adapter) { 80 if (!adapter) {
81 dev_err(&pdev->dev, "Cannot find parent bus\n"); 81 dev_err(&pdev->dev, "Cannot find parent bus\n");
82 return -ENODEV; 82 return -EPROBE_DEFER;
83 } 83 }
84 mux->data.parent = i2c_adapter_id(adapter); 84 mux->data.parent = i2c_adapter_id(adapter);
85 put_device(&adapter->dev); 85 put_device(&adapter->dev);
@@ -116,8 +116,12 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
116 return -ENOMEM; 116 return -ENOMEM;
117 } 117 }
118 118
119 for (i = 0; i < mux->data.n_gpios; i++) 119 for (i = 0; i < mux->data.n_gpios; i++) {
120 gpios[i] = of_get_named_gpio(np, "mux-gpios", i); 120 ret = of_get_named_gpio(np, "mux-gpios", i);
121 if (ret < 0)
122 return ret;
123 gpios[i] = ret;
124 }
121 125
122 mux->data.gpios = gpios; 126 mux->data.gpios = gpios;
123 127
@@ -177,7 +181,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
177 if (!parent) { 181 if (!parent) {
178 dev_err(&pdev->dev, "Parent adapter (%d) not found\n", 182 dev_err(&pdev->dev, "Parent adapter (%d) not found\n",
179 mux->data.parent); 183 mux->data.parent);
180 return -ENODEV; 184 return -EPROBE_DEFER;
181 } 185 }
182 186
183 mux->parent = parent; 187 mux->parent = parent;
diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c
index 69a91732ae65..68a37157377d 100644
--- a/drivers/i2c/muxes/i2c-mux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c
@@ -113,7 +113,7 @@ static int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux,
113 adapter = of_find_i2c_adapter_by_node(adapter_np); 113 adapter = of_find_i2c_adapter_by_node(adapter_np);
114 if (!adapter) { 114 if (!adapter) {
115 dev_err(mux->dev, "Cannot find parent bus\n"); 115 dev_err(mux->dev, "Cannot find parent bus\n");
116 return -ENODEV; 116 return -EPROBE_DEFER;
117 } 117 }
118 mux->pdata->parent_bus_num = i2c_adapter_id(adapter); 118 mux->pdata->parent_bus_num = i2c_adapter_id(adapter);
119 put_device(&adapter->dev); 119 put_device(&adapter->dev);
@@ -211,7 +211,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
211 if (!mux->parent) { 211 if (!mux->parent) {
212 dev_err(&pdev->dev, "Parent adapter (%d) not found\n", 212 dev_err(&pdev->dev, "Parent adapter (%d) not found\n",
213 mux->pdata->parent_bus_num); 213 mux->pdata->parent_bus_num);
214 ret = -ENODEV; 214 ret = -EPROBE_DEFER;
215 goto err; 215 goto err;
216 } 216 }
217 217
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index fe302e33f72e..c880ebaf1553 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -52,7 +52,7 @@ config AMD_IOMMU
52 select PCI_PRI 52 select PCI_PRI
53 select PCI_PASID 53 select PCI_PASID
54 select IOMMU_API 54 select IOMMU_API
55 depends on X86_64 && PCI && ACPI && X86_IO_APIC 55 depends on X86_64 && PCI && ACPI
56 ---help--- 56 ---help---
57 With this option you can enable support for AMD IOMMU hardware in 57 With this option you can enable support for AMD IOMMU hardware in
58 your system. An IOMMU is a hardware component which provides 58 your system. An IOMMU is a hardware component which provides
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 71eb233b9ace..b6a74bcbb08f 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -996,6 +996,7 @@ static void request_write(struct cached_dev *dc, struct search *s)
996 closure_bio_submit(bio, cl, s->d); 996 closure_bio_submit(bio, cl, s->d);
997 } else { 997 } else {
998 bch_writeback_add(dc); 998 bch_writeback_add(dc);
999 s->op.cache_bio = bio;
999 1000
1000 if (bio->bi_rw & REQ_FLUSH) { 1001 if (bio->bi_rw & REQ_FLUSH) {
1001 /* Also need to send a flush to the backing device */ 1002 /* Also need to send a flush to the backing device */
@@ -1008,8 +1009,6 @@ static void request_write(struct cached_dev *dc, struct search *s)
1008 flush->bi_private = cl; 1009 flush->bi_private = cl;
1009 1010
1010 closure_bio_submit(flush, cl, s->d); 1011 closure_bio_submit(flush, cl, s->d);
1011 } else {
1012 s->op.cache_bio = bio;
1013 } 1012 }
1014 } 1013 }
1015out: 1014out:
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 26b14f9fcac6..6bc9618af094 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -168,12 +168,25 @@ static inline int write_disable(struct m25p *flash)
168 */ 168 */
169static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable) 169static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable)
170{ 170{
171 int status;
172 bool need_wren = false;
173
171 switch (JEDEC_MFR(jedec_id)) { 174 switch (JEDEC_MFR(jedec_id)) {
172 case CFI_MFR_MACRONIX:
173 case CFI_MFR_ST: /* Micron, actually */ 175 case CFI_MFR_ST: /* Micron, actually */
176 /* Some Micron need WREN command; all will accept it */
177 need_wren = true;
178 case CFI_MFR_MACRONIX:
174 case 0xEF /* winbond */: 179 case 0xEF /* winbond */:
180 if (need_wren)
181 write_enable(flash);
182
175 flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B; 183 flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B;
176 return spi_write(flash->spi, flash->command, 1); 184 status = spi_write(flash->spi, flash->command, 1);
185
186 if (need_wren)
187 write_disable(flash);
188
189 return status;
177 default: 190 default:
178 /* Spansion style */ 191 /* Spansion style */
179 flash->command[0] = OPCODE_BRWR; 192 flash->command[0] = OPCODE_BRWR;
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 7ed4841327f2..d340b2f198c6 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2869,10 +2869,8 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd,
2869 2869
2870 len = le16_to_cpu(p->ext_param_page_length) * 16; 2870 len = le16_to_cpu(p->ext_param_page_length) * 16;
2871 ep = kmalloc(len, GFP_KERNEL); 2871 ep = kmalloc(len, GFP_KERNEL);
2872 if (!ep) { 2872 if (!ep)
2873 ret = -ENOMEM; 2873 return -ENOMEM;
2874 goto ext_out;
2875 }
2876 2874
2877 /* Send our own NAND_CMD_PARAM. */ 2875 /* Send our own NAND_CMD_PARAM. */
2878 chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); 2876 chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
@@ -2920,7 +2918,7 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd,
2920 } 2918 }
2921 2919
2922 pr_info("ONFI extended param page detected.\n"); 2920 pr_info("ONFI extended param page detected.\n");
2923 return 0; 2921 ret = 0;
2924 2922
2925ext_out: 2923ext_out:
2926 kfree(ep); 2924 kfree(ep);
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 8cd34bf644b3..77df9cb00688 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -145,9 +145,11 @@ bool __init sclp_has_linemode(void)
145 145
146 if (sccb->header.response_code != 0x20) 146 if (sccb->header.response_code != 0x20)
147 return 0; 147 return 0;
148 if (sccb->sclp_send_mask & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK)) 148 if (!(sccb->sclp_send_mask & (EVTYP_OPCMD_MASK | EVTYP_PMSGCMD_MASK)))
149 return 1; 149 return 0;
150 return 0; 150 if (!(sccb->sclp_receive_mask & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK)))
151 return 0;
152 return 1;
151} 153}
152 154
153bool __init sclp_has_vt220(void) 155bool __init sclp_has_vt220(void)
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index a0f47c83fd62..3f4ca4e09a4c 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -810,7 +810,7 @@ static void tty3270_resize_work(struct work_struct *work)
810 struct winsize ws; 810 struct winsize ws;
811 811
812 screen = tty3270_alloc_screen(tp->n_rows, tp->n_cols); 812 screen = tty3270_alloc_screen(tp->n_rows, tp->n_cols);
813 if (!screen) 813 if (IS_ERR(screen))
814 return; 814 return;
815 /* Switch to new output size */ 815 /* Switch to new output size */
816 spin_lock_bh(&tp->view.lock); 816 spin_lock_bh(&tp->view.lock);
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index fd7cc566095a..d4ac60b4a56e 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1583,7 +1583,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
1583 /* Initialize the hardware */ 1583 /* Initialize the hardware */
1584 ret = clk_prepare_enable(clk); 1584 ret = clk_prepare_enable(clk);
1585 if (ret) 1585 if (ret)
1586 goto out_unmap_regs; 1586 goto out_free_irq;
1587 spi_writel(as, CR, SPI_BIT(SWRST)); 1587 spi_writel(as, CR, SPI_BIT(SWRST));
1588 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ 1588 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
1589 if (as->caps.has_wdrbt) { 1589 if (as->caps.has_wdrbt) {
@@ -1614,6 +1614,7 @@ out_free_dma:
1614 spi_writel(as, CR, SPI_BIT(SWRST)); 1614 spi_writel(as, CR, SPI_BIT(SWRST));
1615 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ 1615 spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
1616 clk_disable_unprepare(clk); 1616 clk_disable_unprepare(clk);
1617out_free_irq:
1617 free_irq(irq, master); 1618 free_irq(irq, master);
1618out_unmap_regs: 1619out_unmap_regs:
1619 iounmap(as->regs); 1620 iounmap(as->regs);
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c
index 5655acf55bfe..6416798828e7 100644
--- a/drivers/spi/spi-clps711x.c
+++ b/drivers/spi/spi-clps711x.c
@@ -226,7 +226,6 @@ static int spi_clps711x_probe(struct platform_device *pdev)
226 dev_name(&pdev->dev), hw); 226 dev_name(&pdev->dev), hw);
227 if (ret) { 227 if (ret) {
228 dev_err(&pdev->dev, "Can't request IRQ\n"); 228 dev_err(&pdev->dev, "Can't request IRQ\n");
229 clk_put(hw->spi_clk);
230 goto clk_out; 229 goto clk_out;
231 } 230 }
232 231
@@ -247,7 +246,6 @@ err_out:
247 gpio_free(hw->chipselect[i]); 246 gpio_free(hw->chipselect[i]);
248 247
249 spi_master_put(master); 248 spi_master_put(master);
250 kfree(master);
251 249
252 return ret; 250 return ret;
253} 251}
@@ -263,7 +261,6 @@ static int spi_clps711x_remove(struct platform_device *pdev)
263 gpio_free(hw->chipselect[i]); 261 gpio_free(hw->chipselect[i]);
264 262
265 spi_unregister_master(master); 263 spi_unregister_master(master);
266 kfree(master);
267 264
268 return 0; 265 return 0;
269} 266}
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 6cd07d13ecab..4e44575bd87a 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -476,15 +476,9 @@ static int dspi_probe(struct platform_device *pdev)
476 master->bus_num = bus_num; 476 master->bus_num = bus_num;
477 477
478 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 478 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
479 if (!res) {
480 dev_err(&pdev->dev, "can't get platform resource\n");
481 ret = -EINVAL;
482 goto out_master_put;
483 }
484
485 dspi->base = devm_ioremap_resource(&pdev->dev, res); 479 dspi->base = devm_ioremap_resource(&pdev->dev, res);
486 if (!dspi->base) { 480 if (IS_ERR(dspi->base)) {
487 ret = -EINVAL; 481 ret = PTR_ERR(dspi->base);
488 goto out_master_put; 482 goto out_master_put;
489 } 483 }
490 484
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index dbc5e999a1f5..6adf4e35816d 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -522,8 +522,10 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
522 psc_num = master->bus_num; 522 psc_num = master->bus_num;
523 snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num); 523 snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num);
524 clk = devm_clk_get(dev, clk_name); 524 clk = devm_clk_get(dev, clk_name);
525 if (IS_ERR(clk)) 525 if (IS_ERR(clk)) {
526 ret = PTR_ERR(clk);
526 goto free_irq; 527 goto free_irq;
528 }
527 ret = clk_prepare_enable(clk); 529 ret = clk_prepare_enable(clk);
528 if (ret) 530 if (ret)
529 goto free_irq; 531 goto free_irq;
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 2eb06ee0b326..c1a50674c1e3 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -546,8 +546,17 @@ static irqreturn_t ssp_int(int irq, void *dev_id)
546 if (pm_runtime_suspended(&drv_data->pdev->dev)) 546 if (pm_runtime_suspended(&drv_data->pdev->dev))
547 return IRQ_NONE; 547 return IRQ_NONE;
548 548
549 sccr1_reg = read_SSCR1(reg); 549 /*
550 * If the device is not yet in RPM suspended state and we get an
551 * interrupt that is meant for another device, check if status bits
552 * are all set to one. That means that the device is already
553 * powered off.
554 */
550 status = read_SSSR(reg); 555 status = read_SSSR(reg);
556 if (status == ~0)
557 return IRQ_NONE;
558
559 sccr1_reg = read_SSCR1(reg);
551 560
552 /* Ignore possible writes if we don't need to write */ 561 /* Ignore possible writes if we don't need to write */
553 if (!(sccr1_reg & SSCR1_TIE)) 562 if (!(sccr1_reg & SSCR1_TIE))
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 512b8893893b..a80376dc3a10 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1428,6 +1428,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1428 S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN, 1428 S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN,
1429 sdd->regs + S3C64XX_SPI_INT_EN); 1429 sdd->regs + S3C64XX_SPI_INT_EN);
1430 1430
1431 pm_runtime_enable(&pdev->dev);
1432
1431 if (spi_register_master(master)) { 1433 if (spi_register_master(master)) {
1432 dev_err(&pdev->dev, "cannot register SPI master\n"); 1434 dev_err(&pdev->dev, "cannot register SPI master\n");
1433 ret = -EBUSY; 1435 ret = -EBUSY;
@@ -1440,8 +1442,6 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1440 mem_res, 1442 mem_res,
1441 sdd->rx_dma.dmach, sdd->tx_dma.dmach); 1443 sdd->rx_dma.dmach, sdd->tx_dma.dmach);
1442 1444
1443 pm_runtime_enable(&pdev->dev);
1444
1445 return 0; 1445 return 0;
1446 1446
1447err3: 1447err3:
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c
index 0b68cb592fa4..e488a90a98b8 100644
--- a/drivers/spi/spi-sh-hspi.c
+++ b/drivers/spi/spi-sh-hspi.c
@@ -296,6 +296,8 @@ static int hspi_probe(struct platform_device *pdev)
296 goto error1; 296 goto error1;
297 } 297 }
298 298
299 pm_runtime_enable(&pdev->dev);
300
299 master->num_chipselect = 1; 301 master->num_chipselect = 1;
300 master->bus_num = pdev->id; 302 master->bus_num = pdev->id;
301 master->setup = hspi_setup; 303 master->setup = hspi_setup;
@@ -309,8 +311,6 @@ static int hspi_probe(struct platform_device *pdev)
309 goto error1; 311 goto error1;
310 } 312 }
311 313
312 pm_runtime_enable(&pdev->dev);
313
314 return 0; 314 return 0;
315 315
316 error1: 316 error1:
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 5be5e3d14f79..19f3c3fc65f4 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -802,6 +802,12 @@ static int hpwdt_init_one(struct pci_dev *dev,
802 return -ENODEV; 802 return -ENODEV;
803 } 803 }
804 804
805 /*
806 * Ignore all auxilary iLO devices with the following PCI ID
807 */
808 if (dev->subsystem_device == 0x1979)
809 return -ENODEV;
810
805 if (pci_enable_device(dev)) { 811 if (pci_enable_device(dev)) {
806 dev_warn(&dev->dev, 812 dev_warn(&dev->dev,
807 "Not possible to enable PCI Device: 0x%x:0x%x.\n", 813 "Not possible to enable PCI Device: 0x%x:0x%x.\n",
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4ae17ed13b32..62176ad89846 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1561,8 +1561,9 @@ int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
1561 return ret; 1561 return ret;
1562} 1562}
1563 1563
1564struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, 1564struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
1565 struct btrfs_key *location) 1565 struct btrfs_key *location,
1566 bool check_ref)
1566{ 1567{
1567 struct btrfs_root *root; 1568 struct btrfs_root *root;
1568 int ret; 1569 int ret;
@@ -1586,7 +1587,7 @@ struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
1586again: 1587again:
1587 root = btrfs_lookup_fs_root(fs_info, location->objectid); 1588 root = btrfs_lookup_fs_root(fs_info, location->objectid);
1588 if (root) { 1589 if (root) {
1589 if (btrfs_root_refs(&root->root_item) == 0) 1590 if (check_ref && btrfs_root_refs(&root->root_item) == 0)
1590 return ERR_PTR(-ENOENT); 1591 return ERR_PTR(-ENOENT);
1591 return root; 1592 return root;
1592 } 1593 }
@@ -1595,7 +1596,7 @@ again:
1595 if (IS_ERR(root)) 1596 if (IS_ERR(root))
1596 return root; 1597 return root;
1597 1598
1598 if (btrfs_root_refs(&root->root_item) == 0) { 1599 if (check_ref && btrfs_root_refs(&root->root_item) == 0) {
1599 ret = -ENOENT; 1600 ret = -ENOENT;
1600 goto fail; 1601 goto fail;
1601 } 1602 }
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index b71acd6e1e5b..5ce2a7da8b11 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -68,8 +68,17 @@ struct btrfs_root *btrfs_read_fs_root(struct btrfs_root *tree_root,
68int btrfs_init_fs_root(struct btrfs_root *root); 68int btrfs_init_fs_root(struct btrfs_root *root);
69int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info, 69int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info,
70 struct btrfs_root *root); 70 struct btrfs_root *root);
71struct btrfs_root *btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info, 71
72 struct btrfs_key *location); 72struct btrfs_root *btrfs_get_fs_root(struct btrfs_fs_info *fs_info,
73 struct btrfs_key *key,
74 bool check_ref);
75static inline struct btrfs_root *
76btrfs_read_fs_root_no_name(struct btrfs_fs_info *fs_info,
77 struct btrfs_key *location)
78{
79 return btrfs_get_fs_root(fs_info, location, true);
80}
81
73int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info); 82int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info);
74void btrfs_btree_balance_dirty(struct btrfs_root *root); 83void btrfs_btree_balance_dirty(struct btrfs_root *root);
75void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root); 84void btrfs_btree_balance_dirty_nodelay(struct btrfs_root *root);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 22bda32acb89..51731b76900d 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1490,10 +1490,8 @@ static noinline u64 find_delalloc_range(struct extent_io_tree *tree,
1490 cur_start = state->end + 1; 1490 cur_start = state->end + 1;
1491 node = rb_next(node); 1491 node = rb_next(node);
1492 total_bytes += state->end - state->start + 1; 1492 total_bytes += state->end - state->start + 1;
1493 if (total_bytes >= max_bytes) { 1493 if (total_bytes >= max_bytes)
1494 *end = *start + max_bytes - 1;
1495 break; 1494 break;
1496 }
1497 if (!node) 1495 if (!node)
1498 break; 1496 break;
1499 } 1497 }
@@ -1635,10 +1633,9 @@ again:
1635 1633
1636 /* 1634 /*
1637 * make sure to limit the number of pages we try to lock down 1635 * make sure to limit the number of pages we try to lock down
1638 * if we're looping.
1639 */ 1636 */
1640 if (delalloc_end + 1 - delalloc_start > max_bytes && loops) 1637 if (delalloc_end + 1 - delalloc_start > max_bytes)
1641 delalloc_end = delalloc_start + PAGE_CACHE_SIZE - 1; 1638 delalloc_end = delalloc_start + max_bytes - 1;
1642 1639
1643 /* step two, lock all the pages after the page that has start */ 1640 /* step two, lock all the pages after the page that has start */
1644 ret = lock_delalloc_pages(inode, locked_page, 1641 ret = lock_delalloc_pages(inode, locked_page,
@@ -1649,8 +1646,7 @@ again:
1649 */ 1646 */
1650 free_extent_state(cached_state); 1647 free_extent_state(cached_state);
1651 if (!loops) { 1648 if (!loops) {
1652 unsigned long offset = (*start) & (PAGE_CACHE_SIZE - 1); 1649 max_bytes = PAGE_CACHE_SIZE;
1653 max_bytes = PAGE_CACHE_SIZE - offset;
1654 loops = 1; 1650 loops = 1;
1655 goto again; 1651 goto again;
1656 } else { 1652 } else {
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 22ebc13b6c99..b0ef7b07b1b3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7986,7 +7986,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7986 7986
7987 7987
7988 /* check for collisions, even if the name isn't there */ 7988 /* check for collisions, even if the name isn't there */
7989 ret = btrfs_check_dir_item_collision(root, new_dir->i_ino, 7989 ret = btrfs_check_dir_item_collision(dest, new_dir->i_ino,
7990 new_dentry->d_name.name, 7990 new_dentry->d_name.name,
7991 new_dentry->d_name.len); 7991 new_dentry->d_name.len);
7992 7992
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index a5a26320503f..4a355726151e 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -588,7 +588,7 @@ static struct btrfs_root *read_fs_root(struct btrfs_fs_info *fs_info,
588 else 588 else
589 key.offset = (u64)-1; 589 key.offset = (u64)-1;
590 590
591 return btrfs_read_fs_root_no_name(fs_info, &key); 591 return btrfs_get_fs_root(fs_info, &key, false);
592} 592}
593 593
594#ifdef BTRFS_COMPAT_EXTENT_TREE_V0 594#ifdef BTRFS_COMPAT_EXTENT_TREE_V0
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 0b1f4ef8db98..ec71ea44d2b4 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -299,11 +299,6 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
299 continue; 299 continue;
300 } 300 }
301 301
302 if (btrfs_root_refs(&root->root_item) == 0) {
303 btrfs_add_dead_root(root);
304 continue;
305 }
306
307 err = btrfs_init_fs_root(root); 302 err = btrfs_init_fs_root(root);
308 if (err) { 303 if (err) {
309 btrfs_free_fs_root(root); 304 btrfs_free_fs_root(root);
@@ -318,6 +313,9 @@ int btrfs_find_orphan_roots(struct btrfs_root *tree_root)
318 btrfs_free_fs_root(root); 313 btrfs_free_fs_root(root);
319 break; 314 break;
320 } 315 }
316
317 if (btrfs_root_refs(&root->root_item) == 0)
318 btrfs_add_dead_root(root);
321 } 319 }
322 320
323 btrfs_free_path(path); 321 btrfs_free_path(path);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 0d424d7ac02b..e274e9c1171f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2563,7 +2563,7 @@ retry:
2563 break; 2563 break;
2564 } 2564 }
2565 blk_finish_plug(&plug); 2565 blk_finish_plug(&plug);
2566 if (!ret && !cycled) { 2566 if (!ret && !cycled && wbc->nr_to_write > 0) {
2567 cycled = 1; 2567 cycled = 1;
2568 mpd.last_page = writeback_index - 1; 2568 mpd.last_page = writeback_index - 1;
2569 mpd.first_page = 0; 2569 mpd.first_page = 0;
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index c081e34f717f..03e9bebba198 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1350,6 +1350,8 @@ retry:
1350 s_min_extra_isize) { 1350 s_min_extra_isize) {
1351 tried_min_extra_isize++; 1351 tried_min_extra_isize++;
1352 new_extra_isize = s_min_extra_isize; 1352 new_extra_isize = s_min_extra_isize;
1353 kfree(is); is = NULL;
1354 kfree(bs); bs = NULL;
1353 goto retry; 1355 goto retry;
1354 } 1356 }
1355 error = -1; 1357 error = -1;
diff --git a/fs/statfs.c b/fs/statfs.c
index c219e733f553..083dc0ac9140 100644
--- a/fs/statfs.c
+++ b/fs/statfs.c
@@ -94,7 +94,7 @@ retry:
94 94
95int fd_statfs(int fd, struct kstatfs *st) 95int fd_statfs(int fd, struct kstatfs *st)
96{ 96{
97 struct fd f = fdget(fd); 97 struct fd f = fdget_raw(fd);
98 int error = -EBADF; 98 int error = -EBADF;
99 if (f.file) { 99 if (f.file) {
100 error = vfs_statfs(&f.file->f_path, st); 100 error = vfs_statfs(&f.file->f_path, st);
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 842de225055f..ded429966c1f 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -65,6 +65,21 @@
65#define __visible __attribute__((externally_visible)) 65#define __visible __attribute__((externally_visible))
66#endif 66#endif
67 67
68/*
69 * GCC 'asm goto' miscompiles certain code sequences:
70 *
71 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
72 *
73 * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
74 * Fixed in GCC 4.8.2 and later versions.
75 *
76 * (asm goto is automatically volatile - the naming reflects this.)
77 */
78#if GCC_VERSION <= 40801
79# define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
80#else
81# define asm_volatile_goto(x...) do { asm goto(x); } while (0)
82#endif
68 83
69#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP 84#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
70#if GCC_VERSION >= 40400 85#if GCC_VERSION >= 40400
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 09c2300ddb37..cb358355ef43 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -45,6 +45,7 @@
45#define MAPPER_CTRL_MINOR 236 45#define MAPPER_CTRL_MINOR 236
46#define LOOP_CTRL_MINOR 237 46#define LOOP_CTRL_MINOR 237
47#define VHOST_NET_MINOR 238 47#define VHOST_NET_MINOR 238
48#define UHID_MINOR 239
48#define MISC_DYNAMIC_MINOR 255 49#define MISC_DYNAMIC_MINOR 255
49 50
50struct device; 51struct device;
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 866e85c5eb94..c8ba627c1d60 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -294,9 +294,31 @@ struct ring_buffer;
294 */ 294 */
295struct perf_event { 295struct perf_event {
296#ifdef CONFIG_PERF_EVENTS 296#ifdef CONFIG_PERF_EVENTS
297 struct list_head group_entry; 297 /*
298 * entry onto perf_event_context::event_list;
299 * modifications require ctx->lock
300 * RCU safe iterations.
301 */
298 struct list_head event_entry; 302 struct list_head event_entry;
303
304 /*
305 * XXX: group_entry and sibling_list should be mutually exclusive;
306 * either you're a sibling on a group, or you're the group leader.
307 * Rework the code to always use the same list element.
308 *
309 * Locked for modification by both ctx->mutex and ctx->lock; holding
310 * either sufficies for read.
311 */
312 struct list_head group_entry;
299 struct list_head sibling_list; 313 struct list_head sibling_list;
314
315 /*
316 * We need storage to track the entries in perf_pmu_migrate_context; we
317 * cannot use the event_entry because of RCU and we want to keep the
318 * group in tact which avoids us using the other two entries.
319 */
320 struct list_head migrate_entry;
321
300 struct hlist_node hlist_entry; 322 struct hlist_node hlist_entry;
301 int nr_siblings; 323 int nr_siblings;
302 int group_flags; 324 int group_flags;
diff --git a/include/linux/random.h b/include/linux/random.h
index 3b9377d6b7a5..6312dd9ba449 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -17,6 +17,7 @@ extern void add_interrupt_randomness(int irq, int irq_flags);
17extern void get_random_bytes(void *buf, int nbytes); 17extern void get_random_bytes(void *buf, int nbytes);
18extern void get_random_bytes_arch(void *buf, int nbytes); 18extern void get_random_bytes_arch(void *buf, int nbytes);
19void generate_random_uuid(unsigned char uuid_out[16]); 19void generate_random_uuid(unsigned char uuid_out[16]);
20extern int random_int_secret_init(void);
20 21
21#ifndef MODULE 22#ifndef MODULE
22extern const struct file_operations random_fops, urandom_fops; 23extern const struct file_operations random_fops, urandom_fops;
diff --git a/include/linux/timex.h b/include/linux/timex.h
index dd3edd7dfc94..9d3f1a5b6178 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -64,6 +64,20 @@
64 64
65#include <asm/timex.h> 65#include <asm/timex.h>
66 66
67#ifndef random_get_entropy
68/*
69 * The random_get_entropy() function is used by the /dev/random driver
70 * in order to extract entropy via the relative unpredictability of
71 * when an interrupt takes places versus a high speed, fine-grained
72 * timing source or cycle counter. Since it will be occurred on every
73 * single interrupt, it must have a very low cost/overhead.
74 *
75 * By default we use get_cycles() for this purpose, but individual
76 * architectures may override this in their asm/timex.h header file.
77 */
78#define random_get_entropy() get_cycles()
79#endif
80
67/* 81/*
68 * SHIFT_PLL is used as a dampening factor to define how much we 82 * SHIFT_PLL is used as a dampening factor to define how much we
69 * adjust the frequency correction for a given offset in PLL mode. 83 * adjust the frequency correction for a given offset in PLL mode.
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 80cf8173a65b..2c02f3a8d2ba 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -65,15 +65,8 @@ struct pci_dev;
65 * out of the arbitration process (and can be safe to take 65 * out of the arbitration process (and can be safe to take
66 * interrupts at any time. 66 * interrupts at any time.
67 */ 67 */
68#if defined(CONFIG_VGA_ARB)
69extern void vga_set_legacy_decoding(struct pci_dev *pdev, 68extern void vga_set_legacy_decoding(struct pci_dev *pdev,
70 unsigned int decodes); 69 unsigned int decodes);
71#else
72static inline void vga_set_legacy_decoding(struct pci_dev *pdev,
73 unsigned int decodes)
74{
75}
76#endif
77 70
78/** 71/**
79 * vga_get - acquire & locks VGA resources 72 * vga_get - acquire & locks VGA resources
diff --git a/init/main.c b/init/main.c
index af310afbef28..63d3e8f2970c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -76,6 +76,7 @@
76#include <linux/elevator.h> 76#include <linux/elevator.h>
77#include <linux/sched_clock.h> 77#include <linux/sched_clock.h>
78#include <linux/context_tracking.h> 78#include <linux/context_tracking.h>
79#include <linux/random.h>
79 80
80#include <asm/io.h> 81#include <asm/io.h>
81#include <asm/bugs.h> 82#include <asm/bugs.h>
@@ -780,6 +781,7 @@ static void __init do_basic_setup(void)
780 do_ctors(); 781 do_ctors();
781 usermodehelper_enable(); 782 usermodehelper_enable();
782 do_initcalls(); 783 do_initcalls();
784 random_int_secret_init();
783} 785}
784 786
785static void __init do_pre_smp_initcalls(void) 787static void __init do_pre_smp_initcalls(void)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index cb4238e85b38..d49a9d29334c 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7234,15 +7234,15 @@ void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)
7234 perf_remove_from_context(event); 7234 perf_remove_from_context(event);
7235 unaccount_event_cpu(event, src_cpu); 7235 unaccount_event_cpu(event, src_cpu);
7236 put_ctx(src_ctx); 7236 put_ctx(src_ctx);
7237 list_add(&event->event_entry, &events); 7237 list_add(&event->migrate_entry, &events);
7238 } 7238 }
7239 mutex_unlock(&src_ctx->mutex); 7239 mutex_unlock(&src_ctx->mutex);
7240 7240
7241 synchronize_rcu(); 7241 synchronize_rcu();
7242 7242
7243 mutex_lock(&dst_ctx->mutex); 7243 mutex_lock(&dst_ctx->mutex);
7244 list_for_each_entry_safe(event, tmp, &events, event_entry) { 7244 list_for_each_entry_safe(event, tmp, &events, migrate_entry) {
7245 list_del(&event->event_entry); 7245 list_del(&event->migrate_entry);
7246 if (event->state >= PERF_EVENT_STATE_OFF) 7246 if (event->state >= PERF_EVENT_STATE_OFF)
7247 event->state = PERF_EVENT_STATE_INACTIVE; 7247 event->state = PERF_EVENT_STATE_INACTIVE;
7248 account_event_cpu(event, dst_cpu); 7248 account_event_cpu(event, dst_cpu);
diff --git a/lib/kobject.c b/lib/kobject.c
index 669bf190d4fb..084f7b18d0c0 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -592,7 +592,7 @@ static void kobject_release(struct kref *kref)
592{ 592{
593 struct kobject *kobj = container_of(kref, struct kobject, kref); 593 struct kobject *kobj = container_of(kref, struct kobject, kref);
594#ifdef CONFIG_DEBUG_KOBJECT_RELEASE 594#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
595 pr_debug("kobject: '%s' (%p): %s, parent %p (delayed)\n", 595 pr_info("kobject: '%s' (%p): %s, parent %p (delayed)\n",
596 kobject_name(kobj), kobj, __func__, kobj->parent); 596 kobject_name(kobj), kobj, __func__, kobj->parent);
597 INIT_DELAYED_WORK(&kobj->release, kobject_delayed_cleanup); 597 INIT_DELAYED_WORK(&kobj->release, kobject_delayed_cleanup);
598 schedule_delayed_work(&kobj->release, HZ); 598 schedule_delayed_work(&kobj->release, HZ);
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 7ea0245fc6bd..50173d412ac5 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -937,6 +937,14 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
937 } 937 }
938 938
939 /* 939 /*
940 * always configure channel mapping, it may have been changed by the
941 * user in the meantime
942 */
943 hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca,
944 channels, per_pin->chmap,
945 per_pin->chmap_set);
946
947 /*
940 * sizeof(ai) is used instead of sizeof(*hdmi_ai) or 948 * sizeof(ai) is used instead of sizeof(*hdmi_ai) or
941 * sizeof(*dp_ai) to avoid partial match/update problems when 949 * sizeof(*dp_ai) to avoid partial match/update problems when
942 * the user switches between HDMI/DP monitors. 950 * the user switches between HDMI/DP monitors.
@@ -947,20 +955,10 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
947 "pin=%d channels=%d\n", 955 "pin=%d channels=%d\n",
948 pin_nid, 956 pin_nid,
949 channels); 957 channels);
950 hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca,
951 channels, per_pin->chmap,
952 per_pin->chmap_set);
953 hdmi_stop_infoframe_trans(codec, pin_nid); 958 hdmi_stop_infoframe_trans(codec, pin_nid);
954 hdmi_fill_audio_infoframe(codec, pin_nid, 959 hdmi_fill_audio_infoframe(codec, pin_nid,
955 ai.bytes, sizeof(ai)); 960 ai.bytes, sizeof(ai));
956 hdmi_start_infoframe_trans(codec, pin_nid); 961 hdmi_start_infoframe_trans(codec, pin_nid);
957 } else {
958 /* For non-pcm audio switch, setup new channel mapping
959 * accordingly */
960 if (per_pin->non_pcm != non_pcm)
961 hdmi_setup_channel_mapping(codec, pin_nid, non_pcm, ca,
962 channels, per_pin->chmap,
963 per_pin->chmap_set);
964 } 962 }
965 963
966 per_pin->non_pcm = non_pcm; 964 per_pin->non_pcm = non_pcm;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 0e303b99a47c..bf313bea7085 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2819,6 +2819,15 @@ static void alc269_fixup_hweq(struct hda_codec *codec,
2819 alc_write_coef_idx(codec, 0x1e, coef | 0x80); 2819 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
2820} 2820}
2821 2821
2822static void alc269_fixup_headset_mic(struct hda_codec *codec,
2823 const struct hda_fixup *fix, int action)
2824{
2825 struct alc_spec *spec = codec->spec;
2826
2827 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2828 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
2829}
2830
2822static void alc271_fixup_dmic(struct hda_codec *codec, 2831static void alc271_fixup_dmic(struct hda_codec *codec,
2823 const struct hda_fixup *fix, int action) 2832 const struct hda_fixup *fix, int action)
2824{ 2833{
@@ -3496,6 +3505,15 @@ static void alc282_fixup_asus_tx300(struct hda_codec *codec,
3496 } 3505 }
3497} 3506}
3498 3507
3508static void alc290_fixup_mono_speakers(struct hda_codec *codec,
3509 const struct hda_fixup *fix, int action)
3510{
3511 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3512 /* Remove DAC node 0x03, as it seems to be
3513 giving mono output */
3514 snd_hda_override_wcaps(codec, 0x03, 0);
3515}
3516
3499enum { 3517enum {
3500 ALC269_FIXUP_SONY_VAIO, 3518 ALC269_FIXUP_SONY_VAIO,
3501 ALC275_FIXUP_SONY_VAIO_GPIO2, 3519 ALC275_FIXUP_SONY_VAIO_GPIO2,
@@ -3507,6 +3525,7 @@ enum {
3507 ALC271_FIXUP_DMIC, 3525 ALC271_FIXUP_DMIC,
3508 ALC269_FIXUP_PCM_44K, 3526 ALC269_FIXUP_PCM_44K,
3509 ALC269_FIXUP_STEREO_DMIC, 3527 ALC269_FIXUP_STEREO_DMIC,
3528 ALC269_FIXUP_HEADSET_MIC,
3510 ALC269_FIXUP_QUANTA_MUTE, 3529 ALC269_FIXUP_QUANTA_MUTE,
3511 ALC269_FIXUP_LIFEBOOK, 3530 ALC269_FIXUP_LIFEBOOK,
3512 ALC269_FIXUP_AMIC, 3531 ALC269_FIXUP_AMIC,
@@ -3519,9 +3538,11 @@ enum {
3519 ALC269_FIXUP_HP_GPIO_LED, 3538 ALC269_FIXUP_HP_GPIO_LED,
3520 ALC269_FIXUP_INV_DMIC, 3539 ALC269_FIXUP_INV_DMIC,
3521 ALC269_FIXUP_LENOVO_DOCK, 3540 ALC269_FIXUP_LENOVO_DOCK,
3541 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
3522 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, 3542 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
3523 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, 3543 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
3524 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, 3544 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
3545 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
3525 ALC269_FIXUP_HEADSET_MODE, 3546 ALC269_FIXUP_HEADSET_MODE,
3526 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, 3547 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
3527 ALC269_FIXUP_ASUS_X101_FUNC, 3548 ALC269_FIXUP_ASUS_X101_FUNC,
@@ -3535,6 +3556,7 @@ enum {
3535 ALC283_FIXUP_CHROME_BOOK, 3556 ALC283_FIXUP_CHROME_BOOK,
3536 ALC282_FIXUP_ASUS_TX300, 3557 ALC282_FIXUP_ASUS_TX300,
3537 ALC283_FIXUP_INT_MIC, 3558 ALC283_FIXUP_INT_MIC,
3559 ALC290_FIXUP_MONO_SPEAKERS,
3538}; 3560};
3539 3561
3540static const struct hda_fixup alc269_fixups[] = { 3562static const struct hda_fixup alc269_fixups[] = {
@@ -3603,6 +3625,10 @@ static const struct hda_fixup alc269_fixups[] = {
3603 .type = HDA_FIXUP_FUNC, 3625 .type = HDA_FIXUP_FUNC,
3604 .v.func = alc269_fixup_stereo_dmic, 3626 .v.func = alc269_fixup_stereo_dmic,
3605 }, 3627 },
3628 [ALC269_FIXUP_HEADSET_MIC] = {
3629 .type = HDA_FIXUP_FUNC,
3630 .v.func = alc269_fixup_headset_mic,
3631 },
3606 [ALC269_FIXUP_QUANTA_MUTE] = { 3632 [ALC269_FIXUP_QUANTA_MUTE] = {
3607 .type = HDA_FIXUP_FUNC, 3633 .type = HDA_FIXUP_FUNC,
3608 .v.func = alc269_fixup_quanta_mute, 3634 .v.func = alc269_fixup_quanta_mute,
@@ -3712,6 +3738,15 @@ static const struct hda_fixup alc269_fixups[] = {
3712 .chained = true, 3738 .chained = true,
3713 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC 3739 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
3714 }, 3740 },
3741 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
3742 .type = HDA_FIXUP_PINS,
3743 .v.pins = (const struct hda_pintbl[]) {
3744 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
3745 { }
3746 },
3747 .chained = true,
3748 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
3749 },
3715 [ALC269_FIXUP_HEADSET_MODE] = { 3750 [ALC269_FIXUP_HEADSET_MODE] = {
3716 .type = HDA_FIXUP_FUNC, 3751 .type = HDA_FIXUP_FUNC,
3717 .v.func = alc_fixup_headset_mode, 3752 .v.func = alc_fixup_headset_mode,
@@ -3720,6 +3755,15 @@ static const struct hda_fixup alc269_fixups[] = {
3720 .type = HDA_FIXUP_FUNC, 3755 .type = HDA_FIXUP_FUNC,
3721 .v.func = alc_fixup_headset_mode_no_hp_mic, 3756 .v.func = alc_fixup_headset_mode_no_hp_mic,
3722 }, 3757 },
3758 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
3759 .type = HDA_FIXUP_PINS,
3760 .v.pins = (const struct hda_pintbl[]) {
3761 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
3762 { }
3763 },
3764 .chained = true,
3765 .chain_id = ALC269_FIXUP_HEADSET_MIC
3766 },
3723 [ALC269_FIXUP_ASUS_X101_FUNC] = { 3767 [ALC269_FIXUP_ASUS_X101_FUNC] = {
3724 .type = HDA_FIXUP_FUNC, 3768 .type = HDA_FIXUP_FUNC,
3725 .v.func = alc269_fixup_x101_headset_mic, 3769 .v.func = alc269_fixup_x101_headset_mic,
@@ -3804,6 +3848,12 @@ static const struct hda_fixup alc269_fixups[] = {
3804 .chained = true, 3848 .chained = true,
3805 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST 3849 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
3806 }, 3850 },
3851 [ALC290_FIXUP_MONO_SPEAKERS] = {
3852 .type = HDA_FIXUP_FUNC,
3853 .v.func = alc290_fixup_mono_speakers,
3854 .chained = true,
3855 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
3856 },
3807}; 3857};
3808 3858
3809static const struct snd_pci_quirk alc269_fixup_tbl[] = { 3859static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -3845,6 +3895,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3845 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3895 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3846 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3896 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3847 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 3897 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
3898 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS),
3848 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 3899 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
3849 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 3900 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
3850 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), 3901 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
@@ -3867,6 +3918,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3867 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), 3918 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
3868 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), 3919 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
3869 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101), 3920 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
3921 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
3870 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), 3922 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
3871 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 3923 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
3872 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 3924 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
@@ -3952,6 +4004,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
3952 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"}, 4004 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
3953 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"}, 4005 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
3954 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"}, 4006 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
4007 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
3955 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"}, 4008 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
3956 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, 4009 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
3957 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, 4010 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
@@ -4569,6 +4622,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
4569 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 4622 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
4570 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 4623 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
4571 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), 4624 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
4625 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_ASUS_MODE4),
4572 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), 4626 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
4573 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2), 4627 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
4574 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), 4628 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 63fb5219f0f8..6234a51625b1 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -299,19 +299,6 @@ static void usX2Y_error_urb_status(struct usX2Ydev *usX2Y,
299 usX2Y_clients_stop(usX2Y); 299 usX2Y_clients_stop(usX2Y);
300} 300}
301 301
302static void usX2Y_error_sequence(struct usX2Ydev *usX2Y,
303 struct snd_usX2Y_substream *subs, struct urb *urb)
304{
305 snd_printk(KERN_ERR
306"Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n"
307"Most probably some urb of usb-frame %i is still missing.\n"
308"Cause could be too long delays in usb-hcd interrupt handling.\n",
309 usb_get_current_frame_number(usX2Y->dev),
310 subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
311 usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame);
312 usX2Y_clients_stop(usX2Y);
313}
314
315static void i_usX2Y_urb_complete(struct urb *urb) 302static void i_usX2Y_urb_complete(struct urb *urb)
316{ 303{
317 struct snd_usX2Y_substream *subs = urb->context; 304 struct snd_usX2Y_substream *subs = urb->context;
@@ -328,12 +315,9 @@ static void i_usX2Y_urb_complete(struct urb *urb)
328 usX2Y_error_urb_status(usX2Y, subs, urb); 315 usX2Y_error_urb_status(usX2Y, subs, urb);
329 return; 316 return;
330 } 317 }
331 if (likely((urb->start_frame & 0xFFFF) == (usX2Y->wait_iso_frame & 0xFFFF))) 318
332 subs->completed_urb = urb; 319 subs->completed_urb = urb;
333 else { 320
334 usX2Y_error_sequence(usX2Y, subs, urb);
335 return;
336 }
337 { 321 {
338 struct snd_usX2Y_substream *capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE], 322 struct snd_usX2Y_substream *capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE],
339 *playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; 323 *playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index f2a1acdc4d83..814d0e887c62 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -244,13 +244,8 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb)
244 usX2Y_error_urb_status(usX2Y, subs, urb); 244 usX2Y_error_urb_status(usX2Y, subs, urb);
245 return; 245 return;
246 } 246 }
247 if (likely((urb->start_frame & 0xFFFF) == (usX2Y->wait_iso_frame & 0xFFFF)))
248 subs->completed_urb = urb;
249 else {
250 usX2Y_error_sequence(usX2Y, subs, urb);
251 return;
252 }
253 247
248 subs->completed_urb = urb;
254 capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; 249 capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE];
255 capsubs2 = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; 250 capsubs2 = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2];
256 playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; 251 playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3a0ff7fb71b6..64c043b7a438 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -770,6 +770,7 @@ check: $(OUTPUT)common-cmds.h
770install-bin: all 770install-bin: all
771 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' 771 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
772 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)' 772 $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
773 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
773 $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 774 $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
774ifndef NO_LIBPERL 775ifndef NO_LIBPERL
775 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' 776 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index f686d5ff594e..5098f144b92d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -457,6 +457,7 @@ static int __run_perf_stat(int argc, const char **argv)
457 perror("failed to prepare workload"); 457 perror("failed to prepare workload");
458 return -1; 458 return -1;
459 } 459 }
460 child_pid = evsel_list->workload.pid;
460 } 461 }
461 462
462 if (group) 463 if (group)
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index d5a8dd44945f..f79305739ecc 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -219,7 +219,7 @@ define SOURCE_LIBAUDIT
219 219
220int main(void) 220int main(void)
221{ 221{
222 printf(\"error message: %s\n\", audit_errno_to_name(0)); 222 printf(\"error message: %s\", audit_errno_to_name(0));
223 return audit_open(); 223 return audit_open();
224} 224}
225endef 225endef
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index e23bde19d590..7defd77105d0 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -426,7 +426,7 @@ static int __die_search_func_cb(Dwarf_Die *fn_die, void *data)
426 * @die_mem: a buffer for result DIE 426 * @die_mem: a buffer for result DIE
427 * 427 *
428 * Search a non-inlined function DIE which includes @addr. Stores the 428 * Search a non-inlined function DIE which includes @addr. Stores the
429 * DIE to @die_mem and returns it if found. Returns NULl if failed. 429 * DIE to @die_mem and returns it if found. Returns NULL if failed.
430 */ 430 */
431Dwarf_Die *die_find_realfunc(Dwarf_Die *cu_die, Dwarf_Addr addr, 431Dwarf_Die *die_find_realfunc(Dwarf_Die *cu_die, Dwarf_Addr addr,
432 Dwarf_Die *die_mem) 432 Dwarf_Die *die_mem)
@@ -454,15 +454,32 @@ static int __die_find_inline_cb(Dwarf_Die *die_mem, void *data)
454} 454}
455 455
456/** 456/**
457 * die_find_top_inlinefunc - Search the top inlined function at given address
458 * @sp_die: a subprogram DIE which including @addr
459 * @addr: target address
460 * @die_mem: a buffer for result DIE
461 *
462 * Search an inlined function DIE which includes @addr. Stores the
463 * DIE to @die_mem and returns it if found. Returns NULL if failed.
464 * Even if several inlined functions are expanded recursively, this
465 * doesn't trace it down, and returns the topmost one.
466 */
467Dwarf_Die *die_find_top_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr,
468 Dwarf_Die *die_mem)
469{
470 return die_find_child(sp_die, __die_find_inline_cb, &addr, die_mem);
471}
472
473/**
457 * die_find_inlinefunc - Search an inlined function at given address 474 * die_find_inlinefunc - Search an inlined function at given address
458 * @cu_die: a CU DIE which including @addr 475 * @sp_die: a subprogram DIE which including @addr
459 * @addr: target address 476 * @addr: target address
460 * @die_mem: a buffer for result DIE 477 * @die_mem: a buffer for result DIE
461 * 478 *
462 * Search an inlined function DIE which includes @addr. Stores the 479 * Search an inlined function DIE which includes @addr. Stores the
463 * DIE to @die_mem and returns it if found. Returns NULl if failed. 480 * DIE to @die_mem and returns it if found. Returns NULL if failed.
464 * If several inlined functions are expanded recursively, this trace 481 * If several inlined functions are expanded recursively, this trace
465 * it and returns deepest one. 482 * it down and returns deepest one.
466 */ 483 */
467Dwarf_Die *die_find_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr, 484Dwarf_Die *die_find_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr,
468 Dwarf_Die *die_mem) 485 Dwarf_Die *die_mem)
diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h
index 8658d41697d2..b4fe90c6cb2d 100644
--- a/tools/perf/util/dwarf-aux.h
+++ b/tools/perf/util/dwarf-aux.h
@@ -79,7 +79,11 @@ extern Dwarf_Die *die_find_child(Dwarf_Die *rt_die,
79extern Dwarf_Die *die_find_realfunc(Dwarf_Die *cu_die, Dwarf_Addr addr, 79extern Dwarf_Die *die_find_realfunc(Dwarf_Die *cu_die, Dwarf_Addr addr,
80 Dwarf_Die *die_mem); 80 Dwarf_Die *die_mem);
81 81
82/* Search an inlined function including given address */ 82/* Search the top inlined function including given address */
83extern Dwarf_Die *die_find_top_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr,
84 Dwarf_Die *die_mem);
85
86/* Search the deepest inlined function including given address */
83extern Dwarf_Die *die_find_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr, 87extern Dwarf_Die *die_find_inlinefunc(Dwarf_Die *sp_die, Dwarf_Addr addr,
84 Dwarf_Die *die_mem); 88 Dwarf_Die *die_mem);
85 89
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index ce69901176d8..c3e5a3b817ab 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2768,6 +2768,18 @@ int perf_session__read_header(struct perf_session *session)
2768 if (perf_file_header__read(&f_header, header, fd) < 0) 2768 if (perf_file_header__read(&f_header, header, fd) < 0)
2769 return -EINVAL; 2769 return -EINVAL;
2770 2770
2771 /*
2772 * Sanity check that perf.data was written cleanly; data size is
2773 * initialized to 0 and updated only if the on_exit function is run.
2774 * If data size is still 0 then the file contains only partial
2775 * information. Just warn user and process it as much as it can.
2776 */
2777 if (f_header.data.size == 0) {
2778 pr_warning("WARNING: The %s file's data size field is 0 which is unexpected.\n"
2779 "Was the 'perf record' command properly terminated?\n",
2780 session->filename);
2781 }
2782
2771 nr_attrs = f_header.attrs.size / f_header.attr_size; 2783 nr_attrs = f_header.attrs.size / f_header.attr_size;
2772 lseek(fd, f_header.attrs.offset, SEEK_SET); 2784 lseek(fd, f_header.attrs.offset, SEEK_SET);
2773 2785
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 371476cb8ddc..c09e0a9fdf4c 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1327,8 +1327,8 @@ int debuginfo__find_probe_point(struct debuginfo *self, unsigned long addr,
1327 struct perf_probe_point *ppt) 1327 struct perf_probe_point *ppt)
1328{ 1328{
1329 Dwarf_Die cudie, spdie, indie; 1329 Dwarf_Die cudie, spdie, indie;
1330 Dwarf_Addr _addr, baseaddr; 1330 Dwarf_Addr _addr = 0, baseaddr = 0;
1331 const char *fname = NULL, *func = NULL, *tmp; 1331 const char *fname = NULL, *func = NULL, *basefunc = NULL, *tmp;
1332 int baseline = 0, lineno = 0, ret = 0; 1332 int baseline = 0, lineno = 0, ret = 0;
1333 1333
1334 /* Adjust address with bias */ 1334 /* Adjust address with bias */
@@ -1349,27 +1349,36 @@ int debuginfo__find_probe_point(struct debuginfo *self, unsigned long addr,
1349 /* Find a corresponding function (name, baseline and baseaddr) */ 1349 /* Find a corresponding function (name, baseline and baseaddr) */
1350 if (die_find_realfunc(&cudie, (Dwarf_Addr)addr, &spdie)) { 1350 if (die_find_realfunc(&cudie, (Dwarf_Addr)addr, &spdie)) {
1351 /* Get function entry information */ 1351 /* Get function entry information */
1352 tmp = dwarf_diename(&spdie); 1352 func = basefunc = dwarf_diename(&spdie);
1353 if (!tmp || 1353 if (!func ||
1354 dwarf_entrypc(&spdie, &baseaddr) != 0 || 1354 dwarf_entrypc(&spdie, &baseaddr) != 0 ||
1355 dwarf_decl_line(&spdie, &baseline) != 0) 1355 dwarf_decl_line(&spdie, &baseline) != 0) {
1356 lineno = 0;
1356 goto post; 1357 goto post;
1357 func = tmp; 1358 }
1358 1359
1359 if (addr == (unsigned long)baseaddr) 1360 if (addr == (unsigned long)baseaddr) {
1360 /* Function entry - Relative line number is 0 */ 1361 /* Function entry - Relative line number is 0 */
1361 lineno = baseline; 1362 lineno = baseline;
1362 else if (die_find_inlinefunc(&spdie, (Dwarf_Addr)addr, 1363 fname = dwarf_decl_file(&spdie);
1363 &indie)) { 1364 goto post;
1365 }
1366
1367 /* Track down the inline functions step by step */
1368 while (die_find_top_inlinefunc(&spdie, (Dwarf_Addr)addr,
1369 &indie)) {
1370 /* There is an inline function */
1364 if (dwarf_entrypc(&indie, &_addr) == 0 && 1371 if (dwarf_entrypc(&indie, &_addr) == 0 &&
1365 _addr == addr) 1372 _addr == addr) {
1366 /* 1373 /*
1367 * addr is at an inline function entry. 1374 * addr is at an inline function entry.
1368 * In this case, lineno should be the call-site 1375 * In this case, lineno should be the call-site
1369 * line number. 1376 * line number. (overwrite lineinfo)
1370 */ 1377 */
1371 lineno = die_get_call_lineno(&indie); 1378 lineno = die_get_call_lineno(&indie);
1372 else { 1379 fname = die_get_call_file(&indie);
1380 break;
1381 } else {
1373 /* 1382 /*
1374 * addr is in an inline function body. 1383 * addr is in an inline function body.
1375 * Since lineno points one of the lines 1384 * Since lineno points one of the lines
@@ -1377,19 +1386,27 @@ int debuginfo__find_probe_point(struct debuginfo *self, unsigned long addr,
1377 * be the entry line of the inline function. 1386 * be the entry line of the inline function.
1378 */ 1387 */
1379 tmp = dwarf_diename(&indie); 1388 tmp = dwarf_diename(&indie);
1380 if (tmp && 1389 if (!tmp ||
1381 dwarf_decl_line(&spdie, &baseline) == 0) 1390 dwarf_decl_line(&indie, &baseline) != 0)
1382 func = tmp; 1391 break;
1392 func = tmp;
1393 spdie = indie;
1383 } 1394 }
1384 } 1395 }
1396 /* Verify the lineno and baseline are in a same file */
1397 tmp = dwarf_decl_file(&spdie);
1398 if (!tmp || strcmp(tmp, fname) != 0)
1399 lineno = 0;
1385 } 1400 }
1386 1401
1387post: 1402post:
1388 /* Make a relative line number or an offset */ 1403 /* Make a relative line number or an offset */
1389 if (lineno) 1404 if (lineno)
1390 ppt->line = lineno - baseline; 1405 ppt->line = lineno - baseline;
1391 else if (func) 1406 else if (basefunc) {
1392 ppt->offset = addr - (unsigned long)baseaddr; 1407 ppt->offset = addr - (unsigned long)baseaddr;
1408 func = basefunc;
1409 }
1393 1410
1394 /* Duplicate strings */ 1411 /* Duplicate strings */
1395 if (func) { 1412 if (func) {
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 70ffa41518f3..568b750c01f6 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -256,6 +256,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
256 tool->sample = process_event_sample_stub; 256 tool->sample = process_event_sample_stub;
257 if (tool->mmap == NULL) 257 if (tool->mmap == NULL)
258 tool->mmap = process_event_stub; 258 tool->mmap = process_event_stub;
259 if (tool->mmap2 == NULL)
260 tool->mmap2 = process_event_stub;
259 if (tool->comm == NULL) 261 if (tool->comm == NULL)
260 tool->comm = process_event_stub; 262 tool->comm = process_event_stub;
261 if (tool->fork == NULL) 263 if (tool->fork == NULL)
@@ -1310,7 +1312,7 @@ int __perf_session__process_events(struct perf_session *session,
1310 file_offset = page_offset; 1312 file_offset = page_offset;
1311 head = data_offset - page_offset; 1313 head = data_offset - page_offset;
1312 1314
1313 if (data_offset + data_size < file_size) 1315 if (data_size && (data_offset + data_size < file_size))
1314 file_size = data_offset + data_size; 1316 file_size = data_offset + data_size;
1315 1317
1316 progress_next = file_size / 16; 1318 progress_next = file_size / 16;