commit: 4723d181da46b67c394ef964bdad9457cf0132cf Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> AuthorDate: Sun Nov 24 15:41:00 2019 +0000 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> CommitDate: Sun Nov 24 15:41:51 2019 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4723d181
Linux patch 4.14.156 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> 0000_README | 4 + 1155_linux-4.14.156.patch | 4113 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 4117 insertions(+) diff --git a/0000_README b/0000_README index 277f581..b9dabd1 100644 --- a/0000_README +++ b/0000_README @@ -663,6 +663,10 @@ Patch: 1154_linux-4.14.155.patch From: https://www.kernel.org Desc: Linux 4.14.155 +Patch: 1155_linux-4.14.156.patch +From: https://www.kernel.org +Desc: Linux 4.14.156 + Patch: 1500_XATTR_USER_PREFIX.patch From: https://bugs.gentoo.org/show_bug.cgi?id=470644 Desc: Support for namespace user.pax.* on tmpfs. diff --git a/1155_linux-4.14.156.patch b/1155_linux-4.14.156.patch new file mode 100644 index 0000000..d068ac0 --- /dev/null +++ b/1155_linux-4.14.156.patch @@ -0,0 +1,4113 @@ +diff --git a/Makefile b/Makefile +index 1f427c8bcc56..b1db48ad832e 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 4 + PATCHLEVEL = 14 +-SUBLEVEL = 155 ++SUBLEVEL = 156 + EXTRAVERSION = + NAME = Petit Gorille + +diff --git a/arch/arm/boot/dts/at91-sama5d4_xplained.dts b/arch/arm/boot/dts/at91-sama5d4_xplained.dts +index cf712444b2c2..10f2fb9e0ea6 100644 +--- a/arch/arm/boot/dts/at91-sama5d4_xplained.dts ++++ b/arch/arm/boot/dts/at91-sama5d4_xplained.dts +@@ -240,7 +240,7 @@ + + rootfs@800000 { + label = "rootfs"; +- reg = <0x800000 0x0f800000>; ++ reg = <0x800000 0x1f800000>; + }; + }; + }; +diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi +index bdeaa0b64a5b..0a673a7082be 100644 +--- a/arch/arm/boot/dts/at91sam9x5cm.dtsi ++++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi +@@ -88,7 +88,7 @@ + + rootfs@800000 { + label = "rootfs"; +- reg = <0x800000 0x1f800000>; ++ reg = <0x800000 0x0f800000>; + }; + }; + }; +diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi +index 09686d73f947..fec965009b9f 100644 +--- a/arch/arm/boot/dts/dra7.dtsi ++++ b/arch/arm/boot/dts/dra7.dtsi +@@ -314,6 +314,7 @@ + <0 0 0 2 &pcie1_intc 2>, + <0 0 0 3 &pcie1_intc 3>, + <0 0 0 4 &pcie1_intc 4>; ++ ti,syscon-unaligned-access = <&scm_conf1 0x14 1>; + status = "disabled"; + pcie1_intc: interrupt-controller { + interrupt-controller; +@@ -367,6 +368,7 @@ + <0 0 0 2 &pcie2_intc 2>, + <0 0 0 3 &pcie2_intc 3>, + <0 0 0 4 &pcie2_intc 4>; ++ ti,syscon-unaligned-access = <&scm_conf1 0x14 2>; + pcie2_intc: interrupt-controller { + interrupt-controller; + #address-cells = <0>; +diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi +index 7824b2631cb6..c58f14de0145 100644 +--- a/arch/arm/boot/dts/omap5-board-common.dtsi ++++ b/arch/arm/boot/dts/omap5-board-common.dtsi +@@ -694,6 +694,11 @@ + vbus-supply = <&smps10_out1_reg>; + }; + ++&dwc3 { ++ extcon = <&extcon_usb3>; ++ dr_mode = "otg"; ++}; ++ + &mcspi1 { + + }; +diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi +index 11240a8313c2..03f37081fc64 100644 +--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi ++++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi +@@ -594,7 +594,7 @@ + clock-names = "apb", "ir"; + resets = <&r_ccu RST_APB0_IR>; + interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; +- reg = <0x01f02000 0x40>; ++ reg = <0x01f02000 0x400>; + status = "disabled"; + }; + +diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S +index d7dc808a3d15..08a7132f5600 100644 +--- a/arch/arm/kernel/entry-common.S ++++ b/arch/arm/kernel/entry-common.S +@@ -282,16 +282,15 @@ __sys_trace: + cmp scno, #-1 @ skip the syscall? + bne 2b + add sp, sp, #S_OFF @ restore stack +- b ret_slow_syscall + +-__sys_trace_return: +- str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 ++__sys_trace_return_nosave: ++ enable_irq_notrace + mov r0, sp + bl syscall_trace_exit + b ret_slow_syscall + +-__sys_trace_return_nosave: +- enable_irq_notrace ++__sys_trace_return: ++ str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 + mov r0, sp + bl syscall_trace_exit + b ret_slow_syscall +diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S +index 21ba0b29621b..4374020c824a 100644 +--- a/arch/arm64/lib/clear_user.S ++++ b/arch/arm64/lib/clear_user.S +@@ -57,5 +57,6 @@ ENDPROC(__arch_clear_user) + .section .fixup,"ax" + .align 2 + 9: mov x0, x2 // return the original size ++ uaccess_disable_not_uao x2, x3 + ret + .previous +diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S +index 20305d485046..96b22c0fa343 100644 +--- a/arch/arm64/lib/copy_from_user.S ++++ b/arch/arm64/lib/copy_from_user.S +@@ -75,5 +75,6 @@ ENDPROC(__arch_copy_from_user) + .section .fixup,"ax" + .align 2 + 9998: sub x0, end, dst // bytes not copied ++ uaccess_disable_not_uao x3, x4 + ret + .previous +diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S +index 54b75deb1d16..e56c705f1f23 100644 +--- a/arch/arm64/lib/copy_in_user.S ++++ b/arch/arm64/lib/copy_in_user.S +@@ -77,5 +77,6 @@ ENDPROC(__arch_copy_in_user) + .section .fixup,"ax" + .align 2 + 9998: sub x0, end, dst // bytes not copied ++ uaccess_disable_not_uao x3, x4 + ret + .previous +diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S +index fda6172d6b88..6b99b939c50f 100644 +--- a/arch/arm64/lib/copy_to_user.S ++++ b/arch/arm64/lib/copy_to_user.S +@@ -74,5 +74,6 @@ ENDPROC(__arch_copy_to_user) + .section .fixup,"ax" + .align 2 + 9998: sub x0, end, dst // bytes not copied ++ uaccess_disable_not_uao x3, x4 + ret + .previous +diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c +index dad128ba98bf..e9c843e0c172 100644 +--- a/arch/arm64/mm/numa.c ++++ b/arch/arm64/mm/numa.c +@@ -419,7 +419,7 @@ static int __init dummy_numa_init(void) + if (numa_off) + pr_info("NUMA disabled\n"); /* Forced off on command line. */ + pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n", +- 0LLU, PFN_PHYS(max_pfn) - 1); ++ memblock_start_of_DRAM(), memblock_end_of_DRAM() - 1); + + for_each_memblock(memory, mblk) { + ret = numa_add_memblk(0, mblk->base, mblk->base + mblk->size); +diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c +index fe6f3a285455..7c7c5a16284d 100644 +--- a/arch/powerpc/kernel/time.c ++++ b/arch/powerpc/kernel/time.c +@@ -984,10 +984,14 @@ static void register_decrementer_clockevent(int cpu) + *dec = decrementer_clockevent; + dec->cpumask = cpumask_of(cpu); + ++ clockevents_config_and_register(dec, ppc_tb_freq, 2, decrementer_max); ++ + printk_once(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n", + dec->name, dec->mult, dec->shift, cpu); + +- clockevents_register_device(dec); ++ /* Set values for KVM, see kvm_emulate_dec() */ ++ decrementer_clockevent.mult = dec->mult; ++ decrementer_clockevent.shift = dec->shift; + } + + static void enable_large_decrementer(void) +@@ -1035,18 +1039,7 @@ static void __init set_decrementer_max(void) + + static void __init init_decrementer_clockevent(void) + { +- int cpu = smp_processor_id(); +- +- clockevents_calc_mult_shift(&decrementer_clockevent, ppc_tb_freq, 4); +- +- decrementer_clockevent.max_delta_ns = +- clockevent_delta2ns(decrementer_max, &decrementer_clockevent); +- decrementer_clockevent.max_delta_ticks = decrementer_max; +- decrementer_clockevent.min_delta_ns = +- clockevent_delta2ns(2, &decrementer_clockevent); +- decrementer_clockevent.min_delta_ticks = 2; +- +- register_decrementer_clockevent(cpu); ++ register_decrementer_clockevent(smp_processor_id()); + } + + void secondary_cpu_time_init(void) +diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c +index d38280b01ef0..1eda81249937 100644 +--- a/arch/powerpc/kvm/book3s.c ++++ b/arch/powerpc/kvm/book3s.c +@@ -79,8 +79,11 @@ void kvmppc_unfixup_split_real(struct kvm_vcpu *vcpu) + { + if (vcpu->arch.hflags & BOOK3S_HFLAG_SPLIT_HACK) { + ulong pc = kvmppc_get_pc(vcpu); ++ ulong lr = kvmppc_get_lr(vcpu); + if ((pc & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS) + kvmppc_set_pc(vcpu, pc & ~SPLIT_HACK_MASK); ++ if ((lr & SPLIT_HACK_MASK) == SPLIT_HACK_OFFS) ++ kvmppc_set_lr(vcpu, lr & ~SPLIT_HACK_MASK); + vcpu->arch.hflags &= ~BOOK3S_HFLAG_SPLIT_HACK; + } + } +diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c +index 2c6cce8e7cfd..5e4446296021 100644 +--- a/arch/powerpc/kvm/book3s_64_vio.c ++++ b/arch/powerpc/kvm/book3s_64_vio.c +@@ -404,7 +404,7 @@ static long kvmppc_tce_iommu_unmap(struct kvm *kvm, + long ret; + + if (WARN_ON_ONCE(iommu_tce_xchg(tbl, entry, &hpa, &dir))) +- return H_HARDWARE; ++ return H_TOO_HARD; + + if (dir == DMA_NONE) + return H_SUCCESS; +@@ -434,15 +434,15 @@ long kvmppc_tce_iommu_map(struct kvm *kvm, struct iommu_table *tbl, + return H_TOO_HARD; + + if (WARN_ON_ONCE(mm_iommu_ua_to_hpa(mem, ua, tbl->it_page_shift, &hpa))) +- return H_HARDWARE; ++ return H_TOO_HARD; + + if (mm_iommu_mapped_inc(mem)) +- return H_CLOSED; ++ return H_TOO_HARD; + + ret = iommu_tce_xchg(tbl, entry, &hpa, &dir); + if (WARN_ON_ONCE(ret)) { + mm_iommu_mapped_dec(mem); +- return H_HARDWARE; ++ return H_TOO_HARD; + } + + if (dir != DMA_NONE) +diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c +index 23d6d1592f11..c75e5664fe3d 100644 +--- a/arch/powerpc/kvm/book3s_64_vio_hv.c ++++ b/arch/powerpc/kvm/book3s_64_vio_hv.c +@@ -264,14 +264,14 @@ static long kvmppc_rm_tce_iommu_map(struct kvm *kvm, struct iommu_table *tbl, + + if (WARN_ON_ONCE_RM(mm_iommu_ua_to_hpa_rm(mem, ua, tbl->it_page_shift, + &hpa))) +- return H_HARDWARE; ++ return H_TOO_HARD; + + pua = (void *) vmalloc_to_phys(pua); + if (WARN_ON_ONCE_RM(!pua)) + return H_HARDWARE; + + if (WARN_ON_ONCE_RM(mm_iommu_mapped_inc(mem))) +- return H_CLOSED; ++ return H_TOO_HARD; + + ret = iommu_tce_xchg_rm(tbl, entry, &hpa, &dir); + if (ret) { +@@ -448,7 +448,7 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu, + + rmap = (void *) vmalloc_to_phys(rmap); + if (WARN_ON_ONCE_RM(!rmap)) +- return H_HARDWARE; ++ return H_TOO_HARD; + + /* + * Synchronize with the MMU notifier callbacks in +diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c +index 18014cdeb590..ef6595153642 100644 +--- a/arch/powerpc/platforms/pseries/dtl.c ++++ b/arch/powerpc/platforms/pseries/dtl.c +@@ -149,7 +149,7 @@ static int dtl_start(struct dtl *dtl) + + /* Register our dtl buffer with the hypervisor. The HV expects the + * buffer size to be passed in the second word of the buffer */ +- ((u32 *)dtl->buf)[1] = DISPATCH_LOG_BYTES; ++ ((u32 *)dtl->buf)[1] = cpu_to_be32(DISPATCH_LOG_BYTES); + + hwcpu = get_hard_smp_processor_id(dtl->cpu); + addr = __pa(dtl->buf); +@@ -184,7 +184,7 @@ static void dtl_stop(struct dtl *dtl) + + static u64 dtl_current_index(struct dtl *dtl) + { +- return lppaca_of(dtl->cpu).dtl_idx; ++ return be64_to_cpu(lppaca_of(dtl->cpu).dtl_idx); + } + #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ + +diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c +index 818fc5351591..110d8bb16ebb 100644 +--- a/arch/powerpc/sysdev/xive/common.c ++++ b/arch/powerpc/sysdev/xive/common.c +@@ -1008,12 +1008,13 @@ static void xive_ipi_eoi(struct irq_data *d) + { + struct xive_cpu *xc = __this_cpu_read(xive_cpu); + +- DBG_VERBOSE("IPI eoi: irq=%d [0x%lx] (HW IRQ 0x%x) pending=%02x\n", +- d->irq, irqd_to_hwirq(d), xc->hw_ipi, xc->pending_prio); +- + /* Handle possible race with unplug and drop stale IPIs */ + if (!xc) + return; ++ ++ DBG_VERBOSE("IPI eoi: irq=%d [0x%lx] (HW IRQ 0x%x) pending=%02x\n", ++ d->irq, irqd_to_hwirq(d), xc->hw_ipi, xc->pending_prio); ++ + xive_do_source_eoi(xc->hw_ipi, &xc->ipi_data); + xive_do_queue_eoi(xc); + } +diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile +index 101cadabfc89..6d87f800b4f2 100644 +--- a/arch/s390/kernel/vdso32/Makefile ++++ b/arch/s390/kernel/vdso32/Makefile +@@ -25,9 +25,10 @@ obj-y += vdso32_wrapper.o + extra-y += vdso32.lds + CPPFLAGS_vdso32.lds += -P -C -U$(ARCH) + +-# Disable gcov profiling and ubsan for VDSO code ++# Disable gcov profiling, ubsan and kasan for VDSO code + GCOV_PROFILE := n + UBSAN_SANITIZE := n ++KASAN_SANITIZE := n + + # Force dependency (incbin is bad) + $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so +diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile +index 36bbafcf4a77..4bc166b8c0cb 100644 +--- a/arch/s390/kernel/vdso64/Makefile ++++ b/arch/s390/kernel/vdso64/Makefile +@@ -25,9 +25,10 @@ obj-y += vdso64_wrapper.o + extra-y += vdso64.lds + CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) + +-# Disable gcov profiling and ubsan for VDSO code ++# Disable gcov profiling, ubsan and kasan for VDSO code + GCOV_PROFILE := n + UBSAN_SANITIZE := n ++KASAN_SANITIZE := n + + # Force dependency (incbin is bad) + $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index b58daecc591e..c55870ac907e 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -2716,8 +2716,7 @@ config OLPC + + config OLPC_XO1_PM + bool "OLPC XO-1 Power Management" +- depends on OLPC && MFD_CS5535 && PM_SLEEP +- select MFD_CORE ++ depends on OLPC && MFD_CS5535=y && PM_SLEEP + ---help--- + Add support for poweroff and suspend of the OLPC XO-1 laptop. + +diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h +index f327236f0fa7..5125fca472bb 100644 +--- a/arch/x86/include/asm/kexec.h ++++ b/arch/x86/include/asm/kexec.h +@@ -67,7 +67,7 @@ struct kimage; + + /* Memory to backup during crash kdump */ + #define KEXEC_BACKUP_SRC_START (0UL) +-#define KEXEC_BACKUP_SRC_END (640 * 1024UL) /* 640K */ ++#define KEXEC_BACKUP_SRC_END (640 * 1024UL - 1) /* 640K */ + + /* + * CPU does not save ss and sp on stack if execution is already +diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c +index 584cdd475bb3..734549492a18 100644 +--- a/arch/x86/kernel/ptrace.c ++++ b/arch/x86/kernel/ptrace.c +@@ -40,6 +40,7 @@ + #include <asm/hw_breakpoint.h> + #include <asm/traps.h> + #include <asm/syscall.h> ++#include <asm/mmu_context.h> + + #include "tls.h" + +@@ -343,6 +344,49 @@ static int set_segment_reg(struct task_struct *task, + return 0; + } + ++static unsigned long task_seg_base(struct task_struct *task, ++ unsigned short selector) ++{ ++ unsigned short idx = selector >> 3; ++ unsigned long base; ++ ++ if (likely((selector & SEGMENT_TI_MASK) == 0)) { ++ if (unlikely(idx >= GDT_ENTRIES)) ++ return 0; ++ ++ /* ++ * There are no user segments in the GDT with nonzero bases ++ * other than the TLS segments. ++ */ ++ if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) ++ return 0; ++ ++ idx -= GDT_ENTRY_TLS_MIN; ++ base = get_desc_base(&task->thread.tls_array[idx]); ++ } else { ++#ifdef CONFIG_MODIFY_LDT_SYSCALL ++ struct ldt_struct *ldt; ++ ++ /* ++ * If performance here mattered, we could protect the LDT ++ * with RCU. This is a slow path, though, so we can just ++ * take the mutex. ++ */ ++ mutex_lock(&task->mm->context.lock); ++ ldt = task->mm->context.ldt; ++ if (unlikely(idx >= ldt->nr_entries)) ++ base = 0; ++ else ++ base = get_desc_base(ldt->entries + idx); ++ mutex_unlock(&task->mm->context.lock); ++#else ++ base = 0; ++#endif ++ } ++ ++ return base; ++} ++ + #endif /* CONFIG_X86_32 */ + + static unsigned long get_flags(struct task_struct *task) +@@ -436,18 +480,16 @@ static unsigned long getreg(struct task_struct *task, unsigned long offset) + + #ifdef CONFIG_X86_64 + case offsetof(struct user_regs_struct, fs_base): { +- /* +- * XXX: This will not behave as expected if called on +- * current or if fsindex != 0. +- */ +- return task->thread.fsbase; ++ if (task->thread.fsindex == 0) ++ return task->thread.fsbase; ++ else ++ return task_seg_base(task, task->thread.fsindex); + } + case offsetof(struct user_regs_struct, gs_base): { +- /* +- * XXX: This will not behave as expected if called on +- * current or if fsindex != 0. +- */ +- return task->thread.gsbase; ++ if (task->thread.gsindex == 0) ++ return task->thread.gsbase; ++ else ++ return task_seg_base(task, task->thread.gsindex); + } + #endif + } +diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c +index 9c80966c80ba..692a179b1ba3 100644 +--- a/arch/x86/power/hibernate_64.c ++++ b/arch/x86/power/hibernate_64.c +@@ -250,9 +250,9 @@ static int get_e820_md5(struct e820_table *table, void *buf) + return ret; + } + +-static void hibernation_e820_save(void *buf) ++static int hibernation_e820_save(void *buf) + { +- get_e820_md5(e820_table_firmware, buf); ++ return get_e820_md5(e820_table_firmware, buf); + } + + static bool hibernation_e820_mismatch(void *buf) +@@ -272,8 +272,9 @@ static bool hibernation_e820_mismatch(void *buf) + return memcmp(result, buf, MD5_DIGEST_SIZE) ? true : false; + } + #else +-static void hibernation_e820_save(void *buf) ++static int hibernation_e820_save(void *buf) + { ++ return 0; + } + + static bool hibernation_e820_mismatch(void *buf) +@@ -318,9 +319,7 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size) + + rdr->magic = RESTORE_MAGIC; + +- hibernation_e820_save(rdr->e820_digest); +- +- return 0; ++ return hibernation_e820_save(rdr->e820_digest); + } + + /** +diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h +index a2adfd42f85c..bfddcd989974 100644 +--- a/drivers/acpi/acpica/acevents.h ++++ b/drivers/acpi/acpica/acevents.h +@@ -245,6 +245,8 @@ acpi_ev_default_region_setup(acpi_handle handle, + + acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj); + ++u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); ++ + /* + * evsci - SCI (System Control Interrupt) handling/dispatch + */ +diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h +index 0d45b8bb1678..b10e92de7dd8 100644 +--- a/drivers/acpi/acpica/aclocal.h ++++ b/drivers/acpi/acpica/aclocal.h +@@ -429,9 +429,9 @@ struct acpi_simple_repair_info { + /* Info for running the _REG methods */ + + struct acpi_reg_walk_info { +- acpi_adr_space_type space_id; + u32 function; + u32 reg_run_count; ++ acpi_adr_space_type space_id; + }; + + /***************************************************************************** +diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c +index 28b447ff92df..3a3277f98292 100644 +--- a/drivers/acpi/acpica/evregion.c ++++ b/drivers/acpi/acpica/evregion.c +@@ -677,6 +677,19 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, + + ACPI_FUNCTION_TRACE(ev_execute_reg_methods); + ++ /* ++ * These address spaces do not need a call to _REG, since the ACPI ++ * specification defines them as: "must always be accessible". Since ++ * they never change state (never become unavailable), no need to ever ++ * call _REG on them. Also, a data_table is not a "real" address space, ++ * so do not call _REG. September 2018. ++ */ ++ if ((space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) || ++ (space_id == ACPI_ADR_SPACE_SYSTEM_IO) || ++ (space_id == ACPI_ADR_SPACE_DATA_TABLE)) { ++ return_VOID; ++ } ++ + info.space_id = space_id; + info.function = function; + info.reg_run_count = 0; +@@ -738,8 +751,8 @@ acpi_ev_reg_run(acpi_handle obj_handle, + } + + /* +- * We only care about regions.and objects that are allowed to have address +- * space handlers ++ * We only care about regions and objects that are allowed to have ++ * address space handlers + */ + if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { + return (AE_OK); +diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c +index 93ec528bcd9a..3b48f1ecb55b 100644 +--- a/drivers/acpi/acpica/evrgnini.c ++++ b/drivers/acpi/acpica/evrgnini.c +@@ -50,9 +50,6 @@ + #define _COMPONENT ACPI_EVENTS + ACPI_MODULE_NAME("evrgnini") + +-/* Local prototypes */ +-static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); +- + /******************************************************************************* + * + * FUNCTION: acpi_ev_system_memory_region_setup +@@ -67,7 +64,6 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); + * DESCRIPTION: Setup a system_memory operation region + * + ******************************************************************************/ +- + acpi_status + acpi_ev_system_memory_region_setup(acpi_handle handle, + u32 function, +@@ -347,7 +343,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, + * + ******************************************************************************/ + +-static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) ++u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) + { + acpi_status status; + struct acpi_pnp_device_id *hid; +diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c +index beba9d56a0d8..742a9fe6e235 100644 +--- a/drivers/acpi/acpica/evxfregn.c ++++ b/drivers/acpi/acpica/evxfregn.c +@@ -227,7 +227,6 @@ acpi_remove_address_space_handler(acpi_handle device, + */ + region_obj = + handler_obj->address_space.region_list; +- + } + + /* Remove this Handler object from the list */ +diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c +index 191e86c62037..9da7e7d874bd 100644 +--- a/drivers/acpi/osl.c ++++ b/drivers/acpi/osl.c +@@ -1116,6 +1116,7 @@ void acpi_os_wait_events_complete(void) + flush_workqueue(kacpid_wq); + flush_workqueue(kacpi_notify_wq); + } ++EXPORT_SYMBOL(acpi_os_wait_events_complete); + + struct acpi_hp_work { + struct work_struct work; +diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c +index 7a3431018e0a..5008ead4609a 100644 +--- a/drivers/acpi/sbshc.c ++++ b/drivers/acpi/sbshc.c +@@ -196,6 +196,7 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc) + hc->callback = NULL; + hc->context = NULL; + mutex_unlock(&hc->lock); ++ acpi_os_wait_events_complete(); + return 0; + } + +@@ -292,6 +293,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device) + + hc = acpi_driver_data(device); + acpi_ec_remove_query_handler(hc->ec, hc->query_bit); ++ acpi_os_wait_events_complete(); + kfree(hc); + device->driver_data = NULL; + return 0; +diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig +index cb5339166563..229a5ccd6b73 100644 +--- a/drivers/ata/Kconfig ++++ b/drivers/ata/Kconfig +@@ -102,7 +102,8 @@ config SATA_AHCI_PLATFORM + + config AHCI_BRCM + tristate "Broadcom AHCI SATA support" +- depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_NSP ++ depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_NSP || \ ++ ARCH_BCM_63XX + help + This option enables support for the AHCI SATA3 controller found on + Broadcom SoC's. +diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c +index 0a550190955a..cc6d06c1b2c7 100644 +--- a/drivers/ata/pata_ep93xx.c ++++ b/drivers/ata/pata_ep93xx.c +@@ -659,7 +659,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) + * start of new transfer. + */ + drv_data->dma_rx_data.port = EP93XX_DMA_IDE; +- drv_data->dma_rx_data.direction = DMA_FROM_DEVICE; ++ drv_data->dma_rx_data.direction = DMA_DEV_TO_MEM; + drv_data->dma_rx_data.name = "ep93xx-pata-rx"; + drv_data->dma_rx_channel = dma_request_channel(mask, + ep93xx_pata_dma_filter, &drv_data->dma_rx_data); +@@ -667,7 +667,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) + return; + + drv_data->dma_tx_data.port = EP93XX_DMA_IDE; +- drv_data->dma_tx_data.direction = DMA_TO_DEVICE; ++ drv_data->dma_tx_data.direction = DMA_MEM_TO_DEV; + drv_data->dma_tx_data.name = "ep93xx-pata-tx"; + drv_data->dma_tx_channel = dma_request_channel(mask, + ep93xx_pata_dma_filter, &drv_data->dma_tx_data); +@@ -678,7 +678,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) + + /* Configure receive channel direction and source address */ + memset(&conf, 0, sizeof(conf)); +- conf.direction = DMA_FROM_DEVICE; ++ conf.direction = DMA_DEV_TO_MEM; + conf.src_addr = drv_data->udma_in_phys; + conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + if (dmaengine_slave_config(drv_data->dma_rx_channel, &conf)) { +@@ -689,7 +689,7 @@ static void ep93xx_pata_dma_init(struct ep93xx_pata_data *drv_data) + + /* Configure transmit channel direction and destination address */ + memset(&conf, 0, sizeof(conf)); +- conf.direction = DMA_TO_DEVICE; ++ conf.direction = DMA_MEM_TO_DEV; + conf.dst_addr = drv_data->udma_out_phys; + conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + if (dmaengine_slave_config(drv_data->dma_tx_channel, &conf)) { +diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c +index 8100c8769149..d5e7e8cc4f22 100644 +--- a/drivers/base/power/opp/core.c ++++ b/drivers/base/power/opp/core.c +@@ -49,14 +49,9 @@ static struct opp_device *_find_opp_dev(const struct device *dev, + static struct opp_table *_find_opp_table_unlocked(struct device *dev) + { + struct opp_table *opp_table; +- bool found; + + list_for_each_entry(opp_table, &opp_tables, node) { +- mutex_lock(&opp_table->lock); +- found = !!_find_opp_dev(dev, opp_table); +- mutex_unlock(&opp_table->lock); +- +- if (found) { ++ if (_find_opp_dev(dev, opp_table)) { + _get_opp_table_kref(opp_table); + + return opp_table; +@@ -716,8 +711,6 @@ struct opp_device *_add_opp_dev(const struct device *dev, + + /* Initialize opp-dev */ + opp_dev->dev = dev; +- +- mutex_lock(&opp_table->lock); + list_add(&opp_dev->node, &opp_table->dev_list); + + /* Create debugfs entries for the opp_table */ +@@ -725,7 +718,6 @@ struct opp_device *_add_opp_dev(const struct device *dev, + if (ret) + dev_err(dev, "%s: Failed to register opp debugfs (%d)\n", + __func__, ret); +- mutex_unlock(&opp_table->lock); + + return opp_dev; + } +@@ -744,7 +736,6 @@ static struct opp_table *_allocate_opp_table(struct device *dev) + if (!opp_table) + return NULL; + +- mutex_init(&opp_table->lock); + INIT_LIST_HEAD(&opp_table->dev_list); + + opp_dev = _add_opp_dev(dev, opp_table); +@@ -766,6 +757,7 @@ static struct opp_table *_allocate_opp_table(struct device *dev) + + BLOCKING_INIT_NOTIFIER_HEAD(&opp_table->head); + INIT_LIST_HEAD(&opp_table->opp_list); ++ mutex_init(&opp_table->lock); + kref_init(&opp_table->kref); + + /* Secure the device table modification */ +@@ -807,10 +799,6 @@ static void _opp_table_kref_release(struct kref *kref) + if (!IS_ERR(opp_table->clk)) + clk_put(opp_table->clk); + +- /* +- * No need to take opp_table->lock here as we are guaranteed that no +- * references to the OPP table are taken at this point. +- */ + opp_dev = list_first_entry(&opp_table->dev_list, struct opp_device, + node); + +@@ -1714,9 +1702,6 @@ void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, + { + struct dev_pm_opp *opp, *tmp; + +- /* Protect dev_list */ +- mutex_lock(&opp_table->lock); +- + /* Find if opp_table manages a single device */ + if (list_is_singular(&opp_table->dev_list)) { + /* Free static OPPs */ +@@ -1727,8 +1712,6 @@ void _dev_pm_opp_remove_table(struct opp_table *opp_table, struct device *dev, + } else { + _remove_opp_dev(_find_opp_dev(dev, opp_table), opp_table); + } +- +- mutex_unlock(&opp_table->lock); + } + + void _dev_pm_opp_find_and_remove_table(struct device *dev, bool remove_all) +diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c +index 66e406bd4d62..2d87bc1adf38 100644 +--- a/drivers/base/power/opp/cpu.c ++++ b/drivers/base/power/opp/cpu.c +@@ -222,10 +222,8 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) + cpumask_clear(cpumask); + + if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) { +- mutex_lock(&opp_table->lock); + list_for_each_entry(opp_dev, &opp_table->dev_list, node) + cpumask_set_cpu(opp_dev->dev->id, cpumask); +- mutex_unlock(&opp_table->lock); + } else { + cpumask_set_cpu(cpu_dev->id, cpumask); + } +diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h +index 0a206c6b9086..166eef990599 100644 +--- a/drivers/base/power/opp/opp.h ++++ b/drivers/base/power/opp/opp.h +@@ -124,7 +124,7 @@ enum opp_table_access { + * @dev_list: list of devices that share these OPPs + * @opp_list: table of opps + * @kref: for reference count of the table. +- * @lock: mutex protecting the opp_list and dev_list. ++ * @lock: mutex protecting the opp_list. + * @np: struct device_node pointer for opp's DT node. + * @clock_latency_ns_max: Max clock latency in nanoseconds. + * @shared_opp: OPP is shared between multiple devices. +diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile +index f7f761b02bed..8ca03d9d693b 100644 +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -65,6 +65,7 @@ obj-$(CONFIG_ARCH_HISI) += hisilicon/ + obj-y += imgtec/ + obj-$(CONFIG_ARCH_MXC) += imx/ + obj-$(CONFIG_MACH_INGENIC) += ingenic/ ++obj-$(CONFIG_ARCH_K3) += keystone/ + obj-$(CONFIG_ARCH_KEYSTONE) += keystone/ + obj-$(CONFIG_MACH_LOONGSON32) += loongson1/ + obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ +diff --git a/drivers/clk/keystone/Kconfig b/drivers/clk/keystone/Kconfig +index 7e9f0176578a..b04927d06cd1 100644 +--- a/drivers/clk/keystone/Kconfig ++++ b/drivers/clk/keystone/Kconfig +@@ -7,7 +7,7 @@ config COMMON_CLK_KEYSTONE + + config TI_SCI_CLK + tristate "TI System Control Interface clock drivers" +- depends on (ARCH_KEYSTONE || COMPILE_TEST) && OF ++ depends on (ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST) && OF + depends on TI_SCI_PROTOCOL + default ARCH_KEYSTONE + ---help--- +diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c +index 6686e8ba61f9..82f023f29a61 100644 +--- a/drivers/clk/samsung/clk-cpu.c ++++ b/drivers/clk/samsung/clk-cpu.c +@@ -152,7 +152,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, + struct exynos_cpuclk *cpuclk, void __iomem *base) + { + const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg; +- unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent); ++ unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent); + unsigned long alt_div = 0, alt_div_mask = DIV_MASK; + unsigned long div0, div1 = 0, mux_reg; + unsigned long flags; +@@ -280,7 +280,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, + struct exynos_cpuclk *cpuclk, void __iomem *base) + { + const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg; +- unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent); ++ unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent); + unsigned long alt_div = 0, alt_div_mask = DIV_MASK; + unsigned long div0, div1 = 0, mux_reg; + unsigned long flags; +@@ -432,7 +432,7 @@ int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, + else + cpuclk->clk_nb.notifier_call = exynos_cpuclk_notifier_cb; + +- cpuclk->alt_parent = __clk_lookup(alt_parent); ++ cpuclk->alt_parent = __clk_get_hw(__clk_lookup(alt_parent)); + if (!cpuclk->alt_parent) { + pr_err("%s: could not lookup alternate parent %s\n", + __func__, alt_parent); +diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h +index d4b6b517fe1b..bd38c6aa3897 100644 +--- a/drivers/clk/samsung/clk-cpu.h ++++ b/drivers/clk/samsung/clk-cpu.h +@@ -49,7 +49,7 @@ struct exynos_cpuclk_cfg_data { + */ + struct exynos_cpuclk { + struct clk_hw hw; +- struct clk *alt_parent; ++ struct clk_hw *alt_parent; + void __iomem *ctrl_base; + spinlock_t *lock; + const struct exynos_cpuclk_cfg_data *cfg; +diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c +index 500a55415e90..a882f7038bce 100644 +--- a/drivers/clk/samsung/clk-exynos5420.c ++++ b/drivers/clk/samsung/clk-exynos5420.c +@@ -633,6 +633,7 @@ static const struct samsung_div_clock exynos5420_div_clks[] __initconst = { + }; + + static const struct samsung_gate_clock exynos5420_gate_clks[] __initconst = { ++ GATE(CLK_SECKEY, "seckey", "aclk66_psgen", GATE_BUS_PERIS1, 1, 0, 0), + GATE(CLK_MAU_EPLL, "mau_epll", "mout_mau_epll_clk", + SRC_MASK_TOP7, 20, CLK_SET_RATE_PARENT, 0), + }; +@@ -1167,8 +1168,6 @@ static const struct samsung_gate_clock exynos5x_gate_clks[] __initconst = { + GATE(CLK_TMU, "tmu", "aclk66_psgen", GATE_IP_PERIS, 21, 0, 0), + GATE(CLK_TMU_GPU, "tmu_gpu", "aclk66_psgen", GATE_IP_PERIS, 22, 0, 0), + +- GATE(CLK_SECKEY, "seckey", "aclk66_psgen", GATE_BUS_PERIS1, 1, 0, 0), +- + /* GEN Block */ + GATE(CLK_ROTATOR, "rotator", "mout_user_aclk266", GATE_IP_GEN, 1, 0, 0), + GATE(CLK_JPEG, "jpeg", "aclk300_jpeg", GATE_IP_GEN, 2, 0, 0), +diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c +index e09e8bf0bb9b..3cd62f7c33e3 100644 +--- a/drivers/clocksource/sh_cmt.c ++++ b/drivers/clocksource/sh_cmt.c +@@ -75,18 +75,17 @@ struct sh_cmt_info { + enum sh_cmt_model model; + + unsigned long width; /* 16 or 32 bit version of hardware block */ +- unsigned long overflow_bit; +- unsigned long clear_bits; ++ u32 overflow_bit; ++ u32 clear_bits; + + /* callbacks for CMSTR and CMCSR access */ +- unsigned long (*read_control)(void __iomem *base, unsigned long offs); ++ u32 (*read_control)(void __iomem *base, unsigned long offs); + void (*write_control)(void __iomem *base, unsigned long offs, +- unsigned long value); ++ u32 value); + + /* callbacks for CMCNT and CMCOR access */ +- unsigned long (*read_count)(void __iomem *base, unsigned long offs); +- void (*write_count)(void __iomem *base, unsigned long offs, +- unsigned long value); ++ u32 (*read_count)(void __iomem *base, unsigned long offs); ++ void (*write_count)(void __iomem *base, unsigned long offs, u32 value); + }; + + struct sh_cmt_channel { +@@ -100,13 +99,13 @@ struct sh_cmt_channel { + + unsigned int timer_bit; + unsigned long flags; +- unsigned long match_value; +- unsigned long next_match_value; +- unsigned long max_match_value; ++ u32 match_value; ++ u32 next_match_value; ++ u32 max_match_value; + raw_spinlock_t lock; + struct clock_event_device ced; + struct clocksource cs; +- unsigned long total_cycles; ++ u64 total_cycles; + bool cs_enabled; + }; + +@@ -157,24 +156,22 @@ struct sh_cmt_device { + #define SH_CMT32_CMCSR_CKS_RCLK1 (7 << 0) + #define SH_CMT32_CMCSR_CKS_MASK (7 << 0) + +-static unsigned long sh_cmt_read16(void __iomem *base, unsigned long offs) ++static u32 sh_cmt_read16(void __iomem *base, unsigned long offs) + { + return ioread16(base + (offs << 1)); + } + +-static unsigned long sh_cmt_read32(void __iomem *base, unsigned long offs) ++static u32 sh_cmt_read32(void __iomem *base, unsigned long offs) + { + return ioread32(base + (offs << 2)); + } + +-static void sh_cmt_write16(void __iomem *base, unsigned long offs, +- unsigned long value) ++static void sh_cmt_write16(void __iomem *base, unsigned long offs, u32 value) + { + iowrite16(value, base + (offs << 1)); + } + +-static void sh_cmt_write32(void __iomem *base, unsigned long offs, +- unsigned long value) ++static void sh_cmt_write32(void __iomem *base, unsigned long offs, u32 value) + { + iowrite32(value, base + (offs << 2)); + } +@@ -236,7 +233,7 @@ static const struct sh_cmt_info sh_cmt_info[] = { + #define CMCNT 1 /* channel register */ + #define CMCOR 2 /* channel register */ + +-static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_channel *ch) ++static inline u32 sh_cmt_read_cmstr(struct sh_cmt_channel *ch) + { + if (ch->iostart) + return ch->cmt->info->read_control(ch->iostart, 0); +@@ -244,8 +241,7 @@ static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_channel *ch) + return ch->cmt->info->read_control(ch->cmt->mapbase, 0); + } + +-static inline void sh_cmt_write_cmstr(struct sh_cmt_channel *ch, +- unsigned long value) ++static inline void sh_cmt_write_cmstr(struct sh_cmt_channel *ch, u32 value) + { + if (ch->iostart) + ch->cmt->info->write_control(ch->iostart, 0, value); +@@ -253,39 +249,35 @@ static inline void sh_cmt_write_cmstr(struct sh_cmt_channel *ch, + ch->cmt->info->write_control(ch->cmt->mapbase, 0, value); + } + +-static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_channel *ch) ++static inline u32 sh_cmt_read_cmcsr(struct sh_cmt_channel *ch) + { + return ch->cmt->info->read_control(ch->ioctrl, CMCSR); + } + +-static inline void sh_cmt_write_cmcsr(struct sh_cmt_channel *ch, +- unsigned long value) ++static inline void sh_cmt_write_cmcsr(struct sh_cmt_channel *ch, u32 value) + { + ch->cmt->info->write_control(ch->ioctrl, CMCSR, value); + } + +-static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_channel *ch) ++static inline u32 sh_cmt_read_cmcnt(struct sh_cmt_channel *ch) + { + return ch->cmt->info->read_count(ch->ioctrl, CMCNT); + } + +-static inline void sh_cmt_write_cmcnt(struct sh_cmt_channel *ch, +- unsigned long value) ++static inline void sh_cmt_write_cmcnt(struct sh_cmt_channel *ch, u32 value) + { + ch->cmt->info->write_count(ch->ioctrl, CMCNT, value); + } + +-static inline void sh_cmt_write_cmcor(struct sh_cmt_channel *ch, +- unsigned long value) ++static inline void sh_cmt_write_cmcor(struct sh_cmt_channel *ch, u32 value) + { + ch->cmt->info->write_count(ch->ioctrl, CMCOR, value); + } + +-static unsigned long sh_cmt_get_counter(struct sh_cmt_channel *ch, +- int *has_wrapped) ++static u32 sh_cmt_get_counter(struct sh_cmt_channel *ch, u32 *has_wrapped) + { +- unsigned long v1, v2, v3; +- int o1, o2; ++ u32 v1, v2, v3; ++ u32 o1, o2; + + o1 = sh_cmt_read_cmcsr(ch) & ch->cmt->info->overflow_bit; + +@@ -305,7 +297,8 @@ static unsigned long sh_cmt_get_counter(struct sh_cmt_channel *ch, + + static void sh_cmt_start_stop_ch(struct sh_cmt_channel *ch, int start) + { +- unsigned long flags, value; ++ unsigned long flags; ++ u32 value; + + /* start stop register shared by multiple timer channels */ + raw_spin_lock_irqsave(&ch->cmt->lock, flags); +@@ -412,11 +405,11 @@ static void sh_cmt_disable(struct sh_cmt_channel *ch) + static void sh_cmt_clock_event_program_verify(struct sh_cmt_channel *ch, + int absolute) + { +- unsigned long new_match; +- unsigned long value = ch->next_match_value; +- unsigned long delay = 0; +- unsigned long now = 0; +- int has_wrapped; ++ u32 value = ch->next_match_value; ++ u32 new_match; ++ u32 delay = 0; ++ u32 now = 0; ++ u32 has_wrapped; + + now = sh_cmt_get_counter(ch, &has_wrapped); + ch->flags |= FLAG_REPROGRAM; /* force reprogram */ +@@ -613,9 +606,10 @@ static struct sh_cmt_channel *cs_to_sh_cmt(struct clocksource *cs) + static u64 sh_cmt_clocksource_read(struct clocksource *cs) + { + struct sh_cmt_channel *ch = cs_to_sh_cmt(cs); +- unsigned long flags, raw; +- unsigned long value; +- int has_wrapped; ++ unsigned long flags; ++ u32 has_wrapped; ++ u64 value; ++ u32 raw; + + raw_spin_lock_irqsave(&ch->lock, flags); + value = ch->total_cycles; +@@ -688,7 +682,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_channel *ch, + cs->disable = sh_cmt_clocksource_disable; + cs->suspend = sh_cmt_clocksource_suspend; + cs->resume = sh_cmt_clocksource_resume; +- cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); ++ cs->mask = CLOCKSOURCE_MASK(sizeof(u64) * 8); + cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; + + dev_info(&ch->cmt->pdev->dev, "ch%u: used as clock source\n", +diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c +index a98a25733a22..e1e1e8110790 100644 +--- a/drivers/crypto/mxs-dcp.c ++++ b/drivers/crypto/mxs-dcp.c +@@ -28,9 +28,24 @@ + + #define DCP_MAX_CHANS 4 + #define DCP_BUF_SZ PAGE_SIZE ++#define DCP_SHA_PAY_SZ 64 + + #define DCP_ALIGNMENT 64 + ++/* ++ * Null hashes to align with hw behavior on imx6sl and ull ++ * these are flipped for consistency with hw output ++ */ ++const uint8_t sha1_null_hash[] = ++ "\x09\x07\xd8\xaf\x90\x18\x60\x95\xef\xbf" ++ "\x55\x32\x0d\x4b\x6b\x5e\xee\xa3\x39\xda"; ++ ++const uint8_t sha256_null_hash[] = ++ "\x55\xb8\x52\x78\x1b\x99\x95\xa4" ++ "\x4c\x93\x9b\x64\xe4\x41\xae\x27" ++ "\x24\xb9\x6f\x99\xc8\xf4\xfb\x9a" ++ "\x14\x1c\xfc\x98\x42\xc4\xb0\xe3"; ++ + /* DCP DMA descriptor. */ + struct dcp_dma_desc { + uint32_t next_cmd_addr; +@@ -48,6 +63,7 @@ struct dcp_coherent_block { + uint8_t aes_in_buf[DCP_BUF_SZ]; + uint8_t aes_out_buf[DCP_BUF_SZ]; + uint8_t sha_in_buf[DCP_BUF_SZ]; ++ uint8_t sha_out_buf[DCP_SHA_PAY_SZ]; + + uint8_t aes_key[2 * AES_KEYSIZE_128]; + +@@ -209,6 +225,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, + dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf, + DCP_BUF_SZ, DMA_FROM_DEVICE); + ++ if (actx->fill % AES_BLOCK_SIZE) { ++ dev_err(sdcp->dev, "Invalid block size!\n"); ++ ret = -EINVAL; ++ goto aes_done_run; ++ } ++ + /* Fill in the DMA descriptor. */ + desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE | + MXS_DCP_CONTROL0_INTERRUPT | +@@ -238,6 +260,7 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, + + ret = mxs_dcp_start_dma(actx); + ++aes_done_run: + dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128, + DMA_TO_DEVICE); + dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE); +@@ -264,13 +287,15 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) + + uint8_t *out_tmp, *src_buf, *dst_buf = NULL; + uint32_t dst_off = 0; ++ uint32_t last_out_len = 0; + + uint8_t *key = sdcp->coh->aes_key; + + int ret = 0; + int split = 0; +- unsigned int i, len, clen, rem = 0; ++ unsigned int i, len, clen, rem = 0, tlen = 0; + int init = 0; ++ bool limit_hit = false; + + actx->fill = 0; + +@@ -289,6 +314,11 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) + for_each_sg(req->src, src, nents, i) { + src_buf = sg_virt(src); + len = sg_dma_len(src); ++ tlen += len; ++ limit_hit = tlen > req->nbytes; ++ ++ if (limit_hit) ++ len = req->nbytes - (tlen - len); + + do { + if (actx->fill + len > out_off) +@@ -305,13 +335,15 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) + * If we filled the buffer or this is the last SG, + * submit the buffer. + */ +- if (actx->fill == out_off || sg_is_last(src)) { ++ if (actx->fill == out_off || sg_is_last(src) || ++ limit_hit) { + ret = mxs_dcp_run_aes(actx, req, init); + if (ret) + return ret; + init = 0; + + out_tmp = out_buf; ++ last_out_len = actx->fill; + while (dst && actx->fill) { + if (!split) { + dst_buf = sg_virt(dst); +@@ -334,6 +366,19 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) + } + } + } while (len); ++ ++ if (limit_hit) ++ break; ++ } ++ ++ /* Copy the IV for CBC for chaining */ ++ if (!rctx->ecb) { ++ if (rctx->enc) ++ memcpy(req->info, out_buf+(last_out_len-AES_BLOCK_SIZE), ++ AES_BLOCK_SIZE); ++ else ++ memcpy(req->info, in_buf+(last_out_len-AES_BLOCK_SIZE), ++ AES_BLOCK_SIZE); + } + + return ret; +@@ -513,8 +558,6 @@ static int mxs_dcp_run_sha(struct ahash_request *req) + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); + struct dcp_async_ctx *actx = crypto_ahash_ctx(tfm); + struct dcp_sha_req_ctx *rctx = ahash_request_ctx(req); +- struct hash_alg_common *halg = crypto_hash_alg_common(tfm); +- + struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; + + dma_addr_t digest_phys = 0; +@@ -536,10 +579,23 @@ static int mxs_dcp_run_sha(struct ahash_request *req) + desc->payload = 0; + desc->status = 0; + ++ /* ++ * Align driver with hw behavior when generating null hashes ++ */ ++ if (rctx->init && rctx->fini && desc->size == 0) { ++ struct hash_alg_common *halg = crypto_hash_alg_common(tfm); ++ const uint8_t *sha_buf = ++ (actx->alg == MXS_DCP_CONTROL1_HASH_SELECT_SHA1) ? ++ sha1_null_hash : sha256_null_hash; ++ memcpy(sdcp->coh->sha_out_buf, sha_buf, halg->digestsize); ++ ret = 0; ++ goto done_run; ++ } ++ + /* Set HASH_TERM bit for last transfer block. */ + if (rctx->fini) { +- digest_phys = dma_map_single(sdcp->dev, req->result, +- halg->digestsize, DMA_FROM_DEVICE); ++ digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf, ++ DCP_SHA_PAY_SZ, DMA_FROM_DEVICE); + desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM; + desc->payload = digest_phys; + } +@@ -547,9 +603,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req) + ret = mxs_dcp_start_dma(actx); + + if (rctx->fini) +- dma_unmap_single(sdcp->dev, digest_phys, halg->digestsize, ++ dma_unmap_single(sdcp->dev, digest_phys, DCP_SHA_PAY_SZ, + DMA_FROM_DEVICE); + ++done_run: + dma_unmap_single(sdcp->dev, buf_phys, DCP_BUF_SZ, DMA_TO_DEVICE); + + return ret; +@@ -567,6 +624,7 @@ static int dcp_sha_req_to_buf(struct crypto_async_request *arq) + const int nents = sg_nents(req->src); + + uint8_t *in_buf = sdcp->coh->sha_in_buf; ++ uint8_t *out_buf = sdcp->coh->sha_out_buf; + + uint8_t *src_buf; + +@@ -621,11 +679,9 @@ static int dcp_sha_req_to_buf(struct crypto_async_request *arq) + + actx->fill = 0; + +- /* For some reason, the result is flipped. */ +- for (i = 0; i < halg->digestsize / 2; i++) { +- swap(req->result[i], +- req->result[halg->digestsize - i - 1]); +- } ++ /* For some reason the result is flipped */ ++ for (i = 0; i < halg->digestsize; i++) ++ req->result[i] = out_buf[halg->digestsize - i - 1]; + } + + return 0; +diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c +index 68680e4151ea..9103a0425f75 100644 +--- a/drivers/dma/ioat/init.c ++++ b/drivers/dma/ioat/init.c +@@ -129,7 +129,7 @@ static void + ioat_init_channel(struct ioatdma_device *ioat_dma, + struct ioatdma_chan *ioat_chan, int idx); + static void ioat_intr_quirk(struct ioatdma_device *ioat_dma); +-static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma); ++static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma); + static int ioat3_dma_self_test(struct ioatdma_device *ioat_dma); + + static int ioat_dca_enabled = 1; +@@ -575,7 +575,7 @@ static void ioat_dma_remove(struct ioatdma_device *ioat_dma) + * ioat_enumerate_channels - find and initialize the device's channels + * @ioat_dma: the ioat dma device to be enumerated + */ +-static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) ++static void ioat_enumerate_channels(struct ioatdma_device *ioat_dma) + { + struct ioatdma_chan *ioat_chan; + struct device *dev = &ioat_dma->pdev->dev; +@@ -594,7 +594,7 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) + xfercap_log = readb(ioat_dma->reg_base + IOAT_XFERCAP_OFFSET); + xfercap_log &= 0x1f; /* bits [4:0] valid */ + if (xfercap_log == 0) +- return 0; ++ return; + dev_dbg(dev, "%s: xfercap = %d\n", __func__, 1 << xfercap_log); + + for (i = 0; i < dma->chancnt; i++) { +@@ -611,7 +611,6 @@ static int ioat_enumerate_channels(struct ioatdma_device *ioat_dma) + } + } + dma->chancnt = i; +- return i; + } + + /** +diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c +index 19c7433e8309..f7ca57125ac7 100644 +--- a/drivers/dma/sh/rcar-dmac.c ++++ b/drivers/dma/sh/rcar-dmac.c +@@ -200,6 +200,7 @@ struct rcar_dmac { + struct dma_device engine; + struct device *dev; + void __iomem *iomem; ++ struct device_dma_parameters parms; + + unsigned int n_channels; + struct rcar_dmac_chan *channels; +@@ -1764,6 +1765,8 @@ static int rcar_dmac_probe(struct platform_device *pdev) + + dmac->dev = &pdev->dev; + platform_set_drvdata(pdev, dmac); ++ dmac->dev->dma_parms = &dmac->parms; ++ dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); + dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); + + ret = rcar_dmac_parse_of(&pdev->dev, dmac); +diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c +index 896bafb7a532..cf6588cc3efd 100644 +--- a/drivers/dma/timb_dma.c ++++ b/drivers/dma/timb_dma.c +@@ -545,7 +545,7 @@ static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan, + } + + dma_sync_single_for_device(chan2dmadev(chan), td_desc->txd.phys, +- td_desc->desc_list_len, DMA_MEM_TO_DEV); ++ td_desc->desc_list_len, DMA_TO_DEVICE); + + return &td_desc->txd; + } +diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c +index 537cec7583fc..cf88a0bfe99e 100644 +--- a/drivers/gpio/gpio-syscon.c ++++ b/drivers/gpio/gpio-syscon.c +@@ -122,7 +122,7 @@ static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val) + BIT(offs % SYSCON_REG_BITS)); + } + +- priv->data->set(chip, offset, val); ++ chip->set(chip, offset, val); + + return 0; + } +diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c +index e6b49500c52a..8c9555313fc3 100644 +--- a/drivers/hwmon/ina3221.c ++++ b/drivers/hwmon/ina3221.c +@@ -38,9 +38,9 @@ + #define INA3221_WARN3 0x0c + #define INA3221_MASK_ENABLE 0x0f + +-#define INA3221_CONFIG_MODE_SHUNT BIT(1) +-#define INA3221_CONFIG_MODE_BUS BIT(2) +-#define INA3221_CONFIG_MODE_CONTINUOUS BIT(3) ++#define INA3221_CONFIG_MODE_SHUNT BIT(0) ++#define INA3221_CONFIG_MODE_BUS BIT(1) ++#define INA3221_CONFIG_MODE_CONTINUOUS BIT(2) + + #define INA3221_RSHUNT_DEFAULT 10000 + +diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c +index 6d30bec04f2d..f981da686d7e 100644 +--- a/drivers/hwmon/pwm-fan.c ++++ b/drivers/hwmon/pwm-fan.c +@@ -221,8 +221,12 @@ static int pwm_fan_probe(struct platform_device *pdev) + + ctx->pwm = devm_of_pwm_get(&pdev->dev, pdev->dev.of_node, NULL); + if (IS_ERR(ctx->pwm)) { +- dev_err(&pdev->dev, "Could not get PWM\n"); +- return PTR_ERR(ctx->pwm); ++ ret = PTR_ERR(ctx->pwm); ++ ++ if (ret != -EPROBE_DEFER) ++ dev_err(&pdev->dev, "Could not get PWM: %d\n", ret); ++ ++ return ret; + } + + platform_set_drvdata(pdev, ctx); +diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig +index 45a3f3ca29b3..b72a25585d52 100644 +--- a/drivers/i2c/busses/Kconfig ++++ b/drivers/i2c/busses/Kconfig +@@ -429,12 +429,13 @@ config I2C_BCM_KONA + If you do not need KONA I2C interface, say N. + + config I2C_BRCMSTB +- tristate "BRCM Settop I2C controller" +- depends on ARCH_BRCMSTB || BMIPS_GENERIC || COMPILE_TEST ++ tristate "BRCM Settop/DSL I2C controller" ++ depends on ARCH_BRCMSTB || BMIPS_GENERIC || ARCH_BCM_63XX || \ ++ COMPILE_TEST + default y + help + If you say yes to this option, support will be included for the +- I2C interface on the Broadcom Settop SoCs. ++ I2C interface on the Broadcom Settop/DSL SoCs. + + If you do not need I2C interface, say N. + +diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c +index e36a9bc52268..ccf50dafce9c 100644 +--- a/drivers/infiniband/hw/mthca/mthca_main.c ++++ b/drivers/infiniband/hw/mthca/mthca_main.c +@@ -986,7 +986,8 @@ static int __mthca_init_one(struct pci_dev *pdev, int hca_type) + goto err_free_dev; + } + +- if (mthca_cmd_init(mdev)) { ++ err = mthca_cmd_init(mdev); ++ if (err) { + mthca_err(mdev, "Failed to init command interface, aborting.\n"); + goto err_free_dev; + } +diff --git a/drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c b/drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c +index a72278e9cd27..9c8ddaaa6fbb 100644 +--- a/drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c ++++ b/drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c +@@ -351,7 +351,8 @@ static uint32_t opa_vnic_get_dlid(struct opa_vnic_adapter *adapter, + if (unlikely(!dlid)) + v_warn("Null dlid in MAC address\n"); + } else if (def_port != OPA_VNIC_INVALID_PORT) { +- dlid = info->vesw.u_ucast_dlid[def_port]; ++ if (def_port < OPA_VESW_MAX_NUM_DEF_PORT) ++ dlid = info->vesw.u_ucast_dlid[def_port]; + } + } + +diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c +index 0dbcf105f7db..7c0eeef29b3c 100644 +--- a/drivers/input/touchscreen/silead.c ++++ b/drivers/input/touchscreen/silead.c +@@ -534,20 +534,33 @@ static int __maybe_unused silead_ts_suspend(struct device *dev) + static int __maybe_unused silead_ts_resume(struct device *dev) + { + struct i2c_client *client = to_i2c_client(dev); ++ bool second_try = false; + int error, status; + + silead_ts_set_power(client, SILEAD_POWER_ON); + ++ retry: + error = silead_ts_reset(client); + if (error) + return error; + ++ if (second_try) { ++ error = silead_ts_load_fw(client); ++ if (error) ++ return error; ++ } ++ + error = silead_ts_startup(client); + if (error) + return error; + + status = silead_ts_get_status(client); + if (status != SILEAD_STATUS_OK) { ++ if (!second_try) { ++ second_try = true; ++ dev_dbg(dev, "Reloading firmware after unsuccessful resume\n"); ++ goto retry; ++ } + dev_err(dev, "Resume error, status: 0x%02x\n", status); + return -ENODEV; + } +diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c +index be5615c6bf8f..482f97e1c9d3 100644 +--- a/drivers/input/touchscreen/st1232.c ++++ b/drivers/input/touchscreen/st1232.c +@@ -203,6 +203,7 @@ static int st1232_ts_probe(struct i2c_client *client, + input_dev->id.bustype = BUS_I2C; + input_dev->dev.parent = &client->dev; + ++ __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); + __set_bit(EV_SYN, input_dev->evbit); + __set_bit(EV_KEY, input_dev->evbit); + __set_bit(EV_ABS, input_dev->evbit); +diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c +index e8018a308868..17a9225283dd 100644 +--- a/drivers/iommu/io-pgtable-arm.c ++++ b/drivers/iommu/io-pgtable-arm.c +@@ -551,13 +551,12 @@ static int arm_lpae_split_blk_unmap(struct arm_lpae_io_pgtable *data, + return 0; + + tablep = iopte_deref(pte, data); ++ } else if (unmap_idx >= 0) { ++ io_pgtable_tlb_add_flush(&data->iop, iova, size, size, true); ++ return size; + } + +- if (unmap_idx < 0) +- return __arm_lpae_unmap(data, iova, size, lvl, tablep); +- +- io_pgtable_tlb_add_flush(&data->iop, iova, size, size, true); +- return size; ++ return __arm_lpae_unmap(data, iova, size, lvl, tablep); + } + + static int __arm_lpae_unmap(struct arm_lpae_io_pgtable *data, +diff --git a/drivers/irqchip/irq-mvebu-icu.c b/drivers/irqchip/irq-mvebu-icu.c +index e18c48d3a92e..6a77b9ea8e41 100644 +--- a/drivers/irqchip/irq-mvebu-icu.c ++++ b/drivers/irqchip/irq-mvebu-icu.c +@@ -92,7 +92,7 @@ static int + mvebu_icu_irq_domain_translate(struct irq_domain *d, struct irq_fwspec *fwspec, + unsigned long *hwirq, unsigned int *type) + { +- struct mvebu_icu *icu = d->host_data; ++ struct mvebu_icu *icu = platform_msi_get_host_data(d); + unsigned int icu_group; + + /* Check the count of the parameters in dt */ +diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c +index 1a270e2262f5..690aeb09bbf5 100644 +--- a/drivers/md/bcache/super.c ++++ b/drivers/md/bcache/super.c +@@ -905,6 +905,7 @@ static void cached_dev_detach_finish(struct work_struct *w) + bch_write_bdev_super(dc, &cl); + closure_sync(&cl); + ++ calc_cached_dev_sectors(dc->disk.c); + bcache_device_detach(&dc->disk); + list_move(&dc->list, &uncached_devices); + +diff --git a/drivers/md/md.c b/drivers/md/md.c +index e529cef5483a..b942c74f1ce8 100644 +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -8736,6 +8736,18 @@ static void md_start_sync(struct work_struct *ws) + */ + void md_check_recovery(struct mddev *mddev) + { ++ if (test_bit(MD_ALLOW_SB_UPDATE, &mddev->flags) && mddev->sb_flags) { ++ /* Write superblock - thread that called mddev_suspend() ++ * holds reconfig_mutex for us. ++ */ ++ set_bit(MD_UPDATING_SB, &mddev->flags); ++ smp_mb__after_atomic(); ++ if (test_bit(MD_ALLOW_SB_UPDATE, &mddev->flags)) ++ md_update_sb(mddev, 0); ++ clear_bit_unlock(MD_UPDATING_SB, &mddev->flags); ++ wake_up(&mddev->sb_wait); ++ } ++ + if (mddev->suspended) + return; + +@@ -8896,16 +8908,6 @@ void md_check_recovery(struct mddev *mddev) + unlock: + wake_up(&mddev->sb_wait); + mddev_unlock(mddev); +- } else if (test_bit(MD_ALLOW_SB_UPDATE, &mddev->flags) && mddev->sb_flags) { +- /* Write superblock - thread that called mddev_suspend() +- * holds reconfig_mutex for us. +- */ +- set_bit(MD_UPDATING_SB, &mddev->flags); +- smp_mb__after_atomic(); +- if (test_bit(MD_ALLOW_SB_UPDATE, &mddev->flags)) +- md_update_sb(mddev, 0); +- clear_bit_unlock(MD_UPDATING_SB, &mddev->flags); +- wake_up(&mddev->sb_wait); + } + } + EXPORT_SYMBOL(md_check_recovery); +diff --git a/drivers/media/cec/cec-pin.c b/drivers/media/cec/cec-pin.c +index c003b8eac617..68fc6a24d077 100644 +--- a/drivers/media/cec/cec-pin.c ++++ b/drivers/media/cec/cec-pin.c +@@ -529,6 +529,17 @@ static enum hrtimer_restart cec_pin_timer(struct hrtimer *timer) + /* Start bit, switch to receive state */ + pin->ts = ts; + pin->state = CEC_ST_RX_START_BIT_LOW; ++ /* ++ * If a transmit is pending, then that transmit should ++ * use a signal free time of no more than ++ * CEC_SIGNAL_FREE_TIME_NEW_INITIATOR since it will ++ * have a new initiator due to the receive that is now ++ * starting. ++ */ ++ if (pin->tx_msg.len && pin->tx_signal_free_time > ++ CEC_SIGNAL_FREE_TIME_NEW_INITIATOR) ++ pin->tx_signal_free_time = ++ CEC_SIGNAL_FREE_TIME_NEW_INITIATOR; + break; + } + if (pin->ts == 0) +@@ -690,6 +701,15 @@ static int cec_pin_adap_transmit(struct cec_adapter *adap, u8 attempts, + { + struct cec_pin *pin = adap->pin; + ++ /* ++ * If a receive is in progress, then this transmit should use ++ * a signal free time of max CEC_SIGNAL_FREE_TIME_NEW_INITIATOR ++ * since when it starts transmitting it will have a new initiator. ++ */ ++ if (pin->state != CEC_ST_IDLE && ++ signal_free_time > CEC_SIGNAL_FREE_TIME_NEW_INITIATOR) ++ signal_free_time = CEC_SIGNAL_FREE_TIME_NEW_INITIATOR; ++ + pin->tx_signal_free_time = signal_free_time; + pin->tx_msg = *msg; + pin->work_tx_status = 0; +diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c +index 5ee14f2c2747..cfec08593ac8 100644 +--- a/drivers/media/i2c/adv748x/adv748x-core.c ++++ b/drivers/media/i2c/adv748x/adv748x-core.c +@@ -642,7 +642,8 @@ static int adv748x_parse_dt(struct adv748x_state *state) + { + struct device_node *ep_np = NULL; + struct of_endpoint ep; +- bool found = false; ++ bool out_found = false; ++ bool in_found = false; + + for_each_endpoint_of_node(state->dev->of_node, ep_np) { + of_graph_parse_endpoint(ep_np, &ep); +@@ -667,10 +668,17 @@ static int adv748x_parse_dt(struct adv748x_state *state) + of_node_get(ep_np); + state->endpoints[ep.port] = ep_np; + +- found = true; ++ /* ++ * At least one input endpoint and one output endpoint shall ++ * be defined. ++ */ ++ if (ep.port < ADV748X_PORT_TXA) ++ in_found = true; ++ else ++ out_found = true; + } + +- return found ? 0 : -ENODEV; ++ return in_found && out_found ? 0 : -ENODEV; + } + + static void adv748x_dt_cleanup(struct adv748x_state *state) +@@ -702,6 +710,17 @@ static int adv748x_probe(struct i2c_client *client, + state->i2c_clients[ADV748X_PAGE_IO] = client; + i2c_set_clientdata(client, state); + ++ /* ++ * We can not use container_of to get back to the state with two TXs; ++ * Initialize the TXs's fields unconditionally on the endpoint ++ * presence to access them later. ++ */ ++ state->txa.state = state->txb.state = state; ++ state->txa.page = ADV748X_PAGE_TXA; ++ state->txb.page = ADV748X_PAGE_TXB; ++ state->txa.port = ADV748X_PORT_TXA; ++ state->txb.port = ADV748X_PORT_TXB; ++ + /* Discover and process ports declared by the Device tree endpoints */ + ret = adv748x_parse_dt(state); + if (ret) { +diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c +index 979825d4a419..0953ba0bcc09 100644 +--- a/drivers/media/i2c/adv748x/adv748x-csi2.c ++++ b/drivers/media/i2c/adv748x/adv748x-csi2.c +@@ -265,19 +265,10 @@ static int adv748x_csi2_init_controls(struct adv748x_csi2 *tx) + + int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx) + { +- struct device_node *ep; + int ret; + +- /* We can not use container_of to get back to the state with two TXs */ +- tx->state = state; +- tx->page = is_txa(tx) ? ADV748X_PAGE_TXA : ADV748X_PAGE_TXB; +- +- ep = state->endpoints[is_txa(tx) ? ADV748X_PORT_TXA : ADV748X_PORT_TXB]; +- if (!ep) { +- adv_err(state, "No endpoint found for %s\n", +- is_txa(tx) ? "txa" : "txb"); +- return -ENODEV; +- } ++ if (!is_tx_enabled(tx)) ++ return 0; + + /* Initialise the virtual channel */ + adv748x_csi2_set_virtual_channel(tx, 0); +@@ -287,7 +278,7 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx) + is_txa(tx) ? "txa" : "txb"); + + /* Ensure that matching is based upon the endpoint fwnodes */ +- tx->sd.fwnode = of_fwnode_handle(ep); ++ tx->sd.fwnode = of_fwnode_handle(state->endpoints[tx->port]); + + /* Register internal ops for incremental subdev registration */ + tx->sd.internal_ops = &adv748x_csi2_internal_ops; +@@ -320,6 +311,9 @@ err_free_media: + + void adv748x_csi2_cleanup(struct adv748x_csi2 *tx) + { ++ if (!is_tx_enabled(tx)) ++ return; ++ + v4l2_async_unregister_subdev(&tx->sd); + media_entity_cleanup(&tx->sd.entity); + v4l2_ctrl_handler_free(&tx->ctrl_hdl); +diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h +index cc4151b5b31e..296c5f8a8c63 100644 +--- a/drivers/media/i2c/adv748x/adv748x.h ++++ b/drivers/media/i2c/adv748x/adv748x.h +@@ -94,6 +94,7 @@ struct adv748x_csi2 { + struct adv748x_state *state; + struct v4l2_mbus_framefmt format; + unsigned int page; ++ unsigned int port; + + struct media_pad pads[ADV748X_CSI2_NR_PADS]; + struct v4l2_ctrl_handler ctrl_hdl; +@@ -102,6 +103,7 @@ struct adv748x_csi2 { + + #define notifier_to_csi2(n) container_of(n, struct adv748x_csi2, notifier) + #define adv748x_sd_to_csi2(sd) container_of(sd, struct adv748x_csi2, sd) ++#define is_tx_enabled(_tx) ((_tx)->state->endpoints[(_tx)->port] != NULL) + + enum adv748x_hdmi_pads { + ADV748X_HDMI_SINK, +diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c +index 95af4fc99cd0..c1273bcd5901 100644 +--- a/drivers/media/i2c/dw9714.c ++++ b/drivers/media/i2c/dw9714.c +@@ -182,7 +182,8 @@ static int dw9714_probe(struct i2c_client *client) + return 0; + + err_cleanup: +- dw9714_subdev_cleanup(dw9714_dev); ++ v4l2_ctrl_handler_free(&dw9714_dev->ctrls_vcm); ++ media_entity_cleanup(&dw9714_dev->sd.entity); + dev_err(&client->dev, "Probe failed: %d\n", rval); + return rval; + } +diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c +index 5813b49391ed..90d0f13283ae 100644 +--- a/drivers/media/platform/davinci/isif.c ++++ b/drivers/media/platform/davinci/isif.c +@@ -1102,7 +1102,8 @@ fail_nobase_res: + + while (i >= 0) { + res = platform_get_resource(pdev, IORESOURCE_MEM, i); +- release_mem_region(res->start, resource_size(res)); ++ if (res) ++ release_mem_region(res->start, resource_size(res)); + i--; + } + vpfe_unregister_ccdc_device(&isif_hw_dev); +diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c +index edca993c2b1f..d270a23299cc 100644 +--- a/drivers/media/platform/pxa_camera.c ++++ b/drivers/media/platform/pxa_camera.c +@@ -2374,7 +2374,7 @@ static int pxa_camera_probe(struct platform_device *pdev) + pcdev->res = res; + + pcdev->pdata = pdev->dev.platform_data; +- if (&pdev->dev.of_node && !pcdev->pdata) { ++ if (pdev->dev.of_node && !pcdev->pdata) { + err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev, &pcdev->asd); + } else { + pcdev->platform_flags = pcdev->pdata->flags; +diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c +index 5d0d2fe3b7a7..90f7930444a1 100644 +--- a/drivers/media/rc/ir-rc6-decoder.c ++++ b/drivers/media/rc/ir-rc6-decoder.c +@@ -40,6 +40,7 @@ + #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ + #define RC6_6A_LCC_MASK 0xffff0000 /* RC6-6A-32 long customer code mask */ + #define RC6_6A_MCE_CC 0x800f0000 /* MCE customer code */ ++#define RC6_6A_KATHREIN_CC 0x80460000 /* Kathrein RCU-676 customer code */ + #ifndef CHAR_BIT + #define CHAR_BIT 8 /* Normally in <limits.h> */ + #endif +@@ -252,13 +253,17 @@ again: + toggle = 0; + break; + case 32: +- if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { ++ switch (scancode & RC6_6A_LCC_MASK) { ++ case RC6_6A_MCE_CC: ++ case RC6_6A_KATHREIN_CC: + protocol = RC_PROTO_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; +- } else { ++ break; ++ default: + protocol = RC_PROTO_RC6_6A_32; + toggle = 0; ++ break; + } + break; + default: +diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c +index 179b8481a870..fd33c2e9327d 100644 +--- a/drivers/media/usb/cx231xx/cx231xx-video.c ++++ b/drivers/media/usb/cx231xx/cx231xx-video.c +@@ -1389,7 +1389,7 @@ int cx231xx_g_register(struct file *file, void *priv, + ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, + (u16)reg->reg, value, 4); + reg->val = value[0] | value[1] << 8 | +- value[2] << 16 | value[3] << 24; ++ value[2] << 16 | (u32)value[3] << 24; + reg->size = 4; + break; + case 1: /* AFE - read byte */ +diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c +index 5894d6c16fab..ca9f0c8d1ed0 100644 +--- a/drivers/mfd/ti_am335x_tscadc.c ++++ b/drivers/mfd/ti_am335x_tscadc.c +@@ -296,11 +296,24 @@ static int ti_tscadc_remove(struct platform_device *pdev) + return 0; + } + ++static int __maybe_unused ti_tscadc_can_wakeup(struct device *dev, void *data) ++{ ++ return device_may_wakeup(dev); ++} ++ + static int __maybe_unused tscadc_suspend(struct device *dev) + { + struct ti_tscadc_dev *tscadc = dev_get_drvdata(dev); + + regmap_write(tscadc->regmap, REG_SE, 0x00); ++ if (device_for_each_child(dev, NULL, ti_tscadc_can_wakeup)) { ++ u32 ctrl; ++ ++ regmap_read(tscadc->regmap, REG_CTRL, &ctrl); ++ ctrl &= ~(CNTRLREG_POWERDOWN); ++ ctrl |= CNTRLREG_TSCSSENB; ++ regmap_write(tscadc->regmap, REG_CTRL, ctrl); ++ } + pm_runtime_put_sync(dev); + + return 0; +diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c +index 1a64eb185cfd..de2ce5539545 100644 +--- a/drivers/misc/cxl/guest.c ++++ b/drivers/misc/cxl/guest.c +@@ -1028,8 +1028,6 @@ err1: + + void cxl_guest_remove_afu(struct cxl_afu *afu) + { +- pr_devel("in %s - AFU(%d)\n", __func__, afu->slice); +- + if (!afu) + return; + +diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c +index 2437fcde915a..2fd862dc9770 100644 +--- a/drivers/mmc/host/tmio_mmc_core.c ++++ b/drivers/mmc/host/tmio_mmc_core.c +@@ -914,8 +914,9 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host) + if (mrq->cmd->error || (mrq->data && mrq->data->error)) + tmio_mmc_abort_dma(host); + +- if (host->check_scc_error) +- host->check_scc_error(host); ++ /* SCC error means retune, but executed command was still successful */ ++ if (host->check_scc_error && host->check_scc_error(host)) ++ mmc_retune_needed(host->mmc); + + /* If SET_BLOCK_COUNT, continue with main command */ + if (host->mrq && !mrq->cmd->error) { +diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c +index b1bd4faecfb2..5d8399742c75 100644 +--- a/drivers/mtd/maps/physmap_of_core.c ++++ b/drivers/mtd/maps/physmap_of_core.c +@@ -30,7 +30,6 @@ + struct of_flash_list { + struct mtd_info *mtd; + struct map_info map; +- struct resource *res; + }; + + struct of_flash { +@@ -55,18 +54,10 @@ static int of_flash_remove(struct platform_device *dev) + mtd_concat_destroy(info->cmtd); + } + +- for (i = 0; i < info->list_size; i++) { ++ for (i = 0; i < info->list_size; i++) + if (info->list[i].mtd) + map_destroy(info->list[i].mtd); + +- if (info->list[i].map.virt) +- iounmap(info->list[i].map.virt); +- +- if (info->list[i].res) { +- release_resource(info->list[i].res); +- kfree(info->list[i].res); +- } +- } + return 0; + } + +@@ -214,10 +205,11 @@ static int of_flash_probe(struct platform_device *dev) + + err = -EBUSY; + res_size = resource_size(&res); +- info->list[i].res = request_mem_region(res.start, res_size, +- dev_name(&dev->dev)); +- if (!info->list[i].res) ++ info->list[i].map.virt = devm_ioremap_resource(&dev->dev, &res); ++ if (IS_ERR(info->list[i].map.virt)) { ++ err = PTR_ERR(info->list[i].map.virt); + goto err_out; ++ } + + err = -ENXIO; + width = of_get_property(dp, "bank-width", NULL); +@@ -240,15 +232,6 @@ static int of_flash_probe(struct platform_device *dev) + if (err) + goto err_out; + +- err = -ENOMEM; +- info->list[i].map.virt = ioremap(info->list[i].map.phys, +- info->list[i].map.size); +- if (!info->list[i].map.virt) { +- dev_err(&dev->dev, "Failed to ioremap() flash" +- " region\n"); +- goto err_out; +- } +- + simple_map_init(&info->list[i].map); + + /* +diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c +index e7f3c98487e6..43db80e5d994 100644 +--- a/drivers/mtd/nand/sh_flctl.c ++++ b/drivers/mtd/nand/sh_flctl.c +@@ -480,7 +480,7 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset) + + /* initiate DMA transfer */ + if (flctl->chan_fifo0_rx && rlen >= 32 && +- flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_DEV_TO_MEM) > 0) ++ flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_FROM_DEVICE) > 0) + goto convert; /* DMA success */ + + /* do polling transfer */ +@@ -539,7 +539,7 @@ static void write_ec_fiforeg(struct sh_flctl *flctl, int rlen, + + /* initiate DMA transfer */ + if (flctl->chan_fifo0_tx && rlen >= 32 && +- flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_MEM_TO_DEV) > 0) ++ flctl_dma_fifo0_transfer(flctl, buf, rlen, DMA_TO_DEVICE) > 0) + return; /* DMA success */ + + /* do polling transfer */ +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +index 6ee2ed30626b..306b4b320616 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +@@ -266,8 +266,8 @@ void cxgb4_dcb_handle_fw_update(struct adapter *adap, + enum cxgb4_dcb_state_input input = + ((pcmd->u.dcb.control.all_syncd_pkd & + FW_PORT_CMD_ALL_SYNCD_F) +- ? CXGB4_DCB_STATE_FW_ALLSYNCED +- : CXGB4_DCB_STATE_FW_INCOMPLETE); ++ ? CXGB4_DCB_INPUT_FW_ALLSYNCED ++ : CXGB4_DCB_INPUT_FW_INCOMPLETE); + + if (dcb->dcb_version != FW_PORT_DCB_VER_UNKNOWN) { + dcb_running_version = FW_PORT_CMD_DCB_VERSION_G( +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h +index ccf24d3dc982..2c418c405c50 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h +@@ -67,7 +67,7 @@ + do { \ + if ((__dcb)->dcb_version == FW_PORT_DCB_VER_IEEE) \ + cxgb4_dcb_state_fsm((__dev), \ +- CXGB4_DCB_STATE_FW_ALLSYNCED); \ ++ CXGB4_DCB_INPUT_FW_ALLSYNCED); \ + } while (0) + + /* States we can be in for a port's Data Center Bridging. +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +index 69726908e72c..5483cb23c08a 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c +@@ -1307,13 +1307,11 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu) + } + + ret = h->ae_algo->ops->set_mtu(h, new_mtu); +- if (ret) { ++ if (ret) + netdev_err(netdev, "failed to change MTU in hardware %d\n", + ret); +- return ret; +- } +- +- netdev->mtu = new_mtu; ++ else ++ netdev->mtu = new_mtu; + + /* if the netdev was running earlier, bring it up again */ + if (if_running && hns3_nic_net_open(netdev)) +diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +index b3307b1b3aac..fae3625ec0b6 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +@@ -3201,7 +3201,7 @@ int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link) + vf->link_forced = true; + vf->link_up = true; + pfe.event_data.link_event.link_status = true; +- pfe.event_data.link_event.link_speed = I40E_LINK_SPEED_40GB; ++ pfe.event_data.link_event.link_speed = VIRTCHNL_LINK_SPEED_40GB; + break; + case IFLA_VF_LINK_STATE_DISABLE: + vf->link_forced = true; +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +index 01c120d656c5..4801d96c4fa9 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +@@ -3490,12 +3490,18 @@ static void ixgbe_setup_mtqc(struct ixgbe_adapter *adapter) + else + mtqc |= IXGBE_MTQC_64VF; + } else { +- if (tcs > 4) ++ if (tcs > 4) { + mtqc = IXGBE_MTQC_RT_ENA | IXGBE_MTQC_8TC_8TQ; +- else if (tcs > 1) ++ } else if (tcs > 1) { + mtqc = IXGBE_MTQC_RT_ENA | IXGBE_MTQC_4TC_4TQ; +- else +- mtqc = IXGBE_MTQC_64Q_1PB; ++ } else { ++ u8 max_txq = adapter->num_tx_queues + ++ adapter->num_xdp_queues; ++ if (max_txq > 63) ++ mtqc = IXGBE_MTQC_RT_ENA | IXGBE_MTQC_4TC_4TQ; ++ else ++ mtqc = IXGBE_MTQC_64Q_1PB; ++ } + } + + IXGBE_WRITE_REG(hw, IXGBE_MTQC, mtqc); +@@ -5123,6 +5129,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) + struct ixgbe_hw *hw = &adapter->hw; + struct hlist_node *node2; + struct ixgbe_fdir_filter *filter; ++ u64 action; + + spin_lock(&adapter->fdir_perfect_lock); + +@@ -5131,12 +5138,17 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter) + + hlist_for_each_entry_safe(filter, node2, + &adapter->fdir_filter_list, fdir_node) { ++ action = filter->action; ++ if (action != IXGBE_FDIR_DROP_QUEUE && action != 0) ++ action = ++ (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1; ++ + ixgbe_fdir_write_perfect_filter_82599(hw, + &filter->filter, + filter->sw_idx, +- (filter->action == IXGBE_FDIR_DROP_QUEUE) ? ++ (action == IXGBE_FDIR_DROP_QUEUE) ? + IXGBE_FDIR_DROP_QUEUE : +- adapter->rx_ring[filter->action]->reg_idx); ++ adapter->rx_ring[action]->reg_idx); + } + + spin_unlock(&adapter->fdir_perfect_lock); +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +index 8a1788108f52..698de51b3fef 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +@@ -1939,8 +1939,15 @@ static int mlxsw_sp_switchdev_event(struct notifier_block *unused, + struct net_device *dev = switchdev_notifier_info_to_dev(ptr); + struct mlxsw_sp_switchdev_event_work *switchdev_work; + struct switchdev_notifier_fdb_info *fdb_info = ptr; ++ struct net_device *br_dev; + +- if (!mlxsw_sp_port_dev_lower_find_rcu(dev)) ++ /* Tunnel devices are not our uppers, so check their master instead */ ++ br_dev = netdev_master_upper_dev_get_rcu(dev); ++ if (!br_dev) ++ return NOTIFY_DONE; ++ if (!netif_is_bridge_master(br_dev)) ++ return NOTIFY_DONE; ++ if (!mlxsw_sp_port_dev_lower_find_rcu(br_dev)) + return NOTIFY_DONE; + + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); +diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c +index d53b4a41c583..cb4c9d419bd3 100644 +--- a/drivers/net/usb/cdc_ncm.c ++++ b/drivers/net/usb/cdc_ncm.c +@@ -579,7 +579,7 @@ static void cdc_ncm_set_dgram_size(struct usbnet *dev, int new_size) + err = usbnet_read_cmd(dev, USB_CDC_GET_MAX_DATAGRAM_SIZE, + USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE, + 0, iface_no, &max_datagram_size, sizeof(max_datagram_size)); +- if (err < sizeof(max_datagram_size)) { ++ if (err != sizeof(max_datagram_size)) { + dev_dbg(&dev->intf->dev, "GET_MAX_DATAGRAM_SIZE failed\n"); + goto out; + } +diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h +index 949ebb3e967b..be9ec265dfe5 100644 +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -881,6 +881,7 @@ struct ath10k { + + struct completion install_key_done; + ++ int last_wmi_vdev_start_status; + struct completion vdev_setup_done; + + struct workqueue_struct *workqueue; +diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c +index 8c4bb56c262f..dff34448588f 100644 +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -955,7 +955,7 @@ static inline int ath10k_vdev_setup_sync(struct ath10k *ar) + if (time_left == 0) + return -ETIMEDOUT; + +- return 0; ++ return ar->last_wmi_vdev_start_status; + } + + static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id) +diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c +index 4d6c2986c40d..25f51ca06093 100644 +--- a/drivers/net/wireless/ath/ath10k/wmi.c ++++ b/drivers/net/wireless/ath/ath10k/wmi.c +@@ -3133,18 +3133,31 @@ void ath10k_wmi_event_vdev_start_resp(struct ath10k *ar, struct sk_buff *skb) + { + struct wmi_vdev_start_ev_arg arg = {}; + int ret; ++ u32 status; + + ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_VDEV_START_RESP_EVENTID\n"); + ++ ar->last_wmi_vdev_start_status = 0; ++ + ret = ath10k_wmi_pull_vdev_start(ar, skb, &arg); + if (ret) { + ath10k_warn(ar, "failed to parse vdev start event: %d\n", ret); +- return; ++ ar->last_wmi_vdev_start_status = ret; ++ goto out; + } + +- if (WARN_ON(__le32_to_cpu(arg.status))) +- return; ++ status = __le32_to_cpu(arg.status); ++ if (WARN_ON_ONCE(status)) { ++ ath10k_warn(ar, "vdev-start-response reports status error: %d (%s)\n", ++ status, (status == WMI_VDEV_START_CHAN_INVALID) ? ++ "chan-invalid" : "unknown"); ++ /* Setup is done one way or another though, so we should still ++ * do the completion, so don't return here. ++ */ ++ ar->last_wmi_vdev_start_status = -EINVAL; ++ } + ++out: + complete(&ar->vdev_setup_done); + } + +diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h +index d0e05aa437e3..947b74c64fec 100644 +--- a/drivers/net/wireless/ath/ath10k/wmi.h ++++ b/drivers/net/wireless/ath/ath10k/wmi.h +@@ -6480,11 +6480,17 @@ struct wmi_ch_info_ev_arg { + __le32 rx_frame_count; + }; + ++/* From 10.4 firmware, not sure all have the same values. */ ++enum wmi_vdev_start_status { ++ WMI_VDEV_START_OK = 0, ++ WMI_VDEV_START_CHAN_INVALID, ++}; ++ + struct wmi_vdev_start_ev_arg { + __le32 vdev_id; + __le32 req_id; + __le32 resp_type; /* %WMI_VDEV_RESP_ */ +- __le32 status; ++ __le32 status; /* See wmi_vdev_start_status enum above */ + }; + + struct wmi_peer_kick_ev_arg { +diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net/wireless/ath/ath9k/common-spectral.c +index a41bcbda1d9e..37d5994eb1cc 100644 +--- a/drivers/net/wireless/ath/ath9k/common-spectral.c ++++ b/drivers/net/wireless/ath/ath9k/common-spectral.c +@@ -411,7 +411,7 @@ ath_cmn_process_ht20_40_fft(struct ath_rx_status *rs, + + ath_dbg(common, SPECTRAL_SCAN, + "Calculated new upper max 0x%X at %i\n", +- tmp_mag, i); ++ tmp_mag, fft_sample_40.upper_max_index); + } else + for (i = dc_pos; i < SPECTRAL_HT20_40_NUM_BINS; i++) { + if (fft_sample_40.data[i] == (upper_mag >> max_exp)) +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +index 450f2216fac2..4a883f4bbf88 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -74,7 +74,7 @@ + #define P2P_AF_MAX_WAIT_TIME msecs_to_jiffies(2000) + #define P2P_INVALID_CHANNEL -1 + #define P2P_CHANNEL_SYNC_RETRY 5 +-#define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(1500) ++#define P2P_AF_FRM_SCAN_MAX_WAIT msecs_to_jiffies(450) + #define P2P_DEFAULT_SLEEP_TIME_VSDB 200 + + /* WiFi P2P Public Action Frame OUI Subtypes */ +@@ -1139,7 +1139,6 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) + { + struct afx_hdl *afx_hdl = &p2p->afx_hdl; + struct brcmf_cfg80211_vif *pri_vif; +- unsigned long duration; + s32 retry; + + brcmf_dbg(TRACE, "Enter\n"); +@@ -1155,7 +1154,6 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) + * pending action frame tx is cancelled. + */ + retry = 0; +- duration = msecs_to_jiffies(P2P_AF_FRM_SCAN_MAX_WAIT); + while ((retry < P2P_CHANNEL_SYNC_RETRY) && + (afx_hdl->peer_chan == P2P_INVALID_CHANNEL)) { + afx_hdl->is_listen = false; +@@ -1163,7 +1161,8 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) + retry); + /* search peer on peer's listen channel */ + schedule_work(&afx_hdl->afx_work); +- wait_for_completion_timeout(&afx_hdl->act_frm_scan, duration); ++ wait_for_completion_timeout(&afx_hdl->act_frm_scan, ++ P2P_AF_FRM_SCAN_MAX_WAIT); + if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || + (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, + &p2p->status))) +@@ -1176,7 +1175,7 @@ static s32 brcmf_p2p_af_searching_channel(struct brcmf_p2p_info *p2p) + afx_hdl->is_listen = true; + schedule_work(&afx_hdl->afx_work); + wait_for_completion_timeout(&afx_hdl->act_frm_scan, +- duration); ++ P2P_AF_FRM_SCAN_MAX_WAIT); + } + if ((afx_hdl->peer_chan != P2P_INVALID_CHANNEL) || + (!test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, +@@ -1463,10 +1462,12 @@ int brcmf_p2p_notify_action_tx_complete(struct brcmf_if *ifp, + return 0; + + if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) { +- if (e->status == BRCMF_E_STATUS_SUCCESS) ++ if (e->status == BRCMF_E_STATUS_SUCCESS) { + set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED, + &p2p->status); +- else { ++ if (!p2p->wait_for_offchan_complete) ++ complete(&p2p->send_af_done); ++ } else { + set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status); + /* If there is no ack, we don't need to wait for + * WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE event +@@ -1517,6 +1518,17 @@ static s32 brcmf_p2p_tx_action_frame(struct brcmf_p2p_info *p2p, + p2p->af_sent_channel = le32_to_cpu(af_params->channel); + p2p->af_tx_sent_jiffies = jiffies; + ++ if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status) && ++ p2p->af_sent_channel == ++ ieee80211_frequency_to_channel(p2p->remain_on_channel.center_freq)) ++ p2p->wait_for_offchan_complete = false; ++ else ++ p2p->wait_for_offchan_complete = true; ++ ++ brcmf_dbg(TRACE, "Waiting for %s tx completion event\n", ++ (p2p->wait_for_offchan_complete) ? ++ "off-channel" : "on-channel"); ++ + timeout = wait_for_completion_timeout(&p2p->send_af_done, + P2P_AF_MAX_WAIT_TIME); + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h +index 0e8b34d2d85c..39f0d0218088 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h +@@ -124,6 +124,7 @@ struct afx_hdl { + * @gon_req_action: about to send go negotiation requets frame. + * @block_gon_req_tx: drop tx go negotiation requets frame. + * @p2pdev_dynamically: is p2p device if created by module param or supplicant. ++ * @wait_for_offchan_complete: wait for off-channel tx completion event. + */ + struct brcmf_p2p_info { + struct brcmf_cfg80211_info *cfg; +@@ -144,6 +145,7 @@ struct brcmf_p2p_info { + bool gon_req_action; + bool block_gon_req_tx; + bool p2pdev_dynamically; ++ bool wait_for_offchan_complete; + }; + + s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced); +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +index b205a7bfb828..65c51c698328 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c +@@ -947,8 +947,10 @@ int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, + { + struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {}; + struct iwl_wowlan_tkip_params_cmd tkip_cmd = {}; ++ bool unified = fw_has_capa(&mvm->fw->ucode_capa, ++ IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); + struct wowlan_key_data key_data = { +- .configure_keys = !d0i3, ++ .configure_keys = !d0i3 && !unified, + .use_rsc_tsc = false, + .tkip = &tkip_cmd, + .use_tkip = false, +diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +index a450bc6bc774..d02f68792ce4 100644 +--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c ++++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +@@ -509,9 +509,16 @@ static int qtnf_del_key(struct wiphy *wiphy, struct net_device *dev, + int ret; + + ret = qtnf_cmd_send_del_key(vif, key_index, pairwise, mac_addr); +- if (ret) +- pr_err("VIF%u.%u: failed to delete key: idx=%u pw=%u\n", +- vif->mac->macid, vif->vifid, key_index, pairwise); ++ if (ret) { ++ if (ret == -ENOENT) { ++ pr_debug("VIF%u.%u: key index %d out of bounds\n", ++ vif->mac->macid, vif->vifid, key_index); ++ } else { ++ pr_err("VIF%u.%u: failed to delete key: idx=%u pw=%u\n", ++ vif->mac->macid, vif->vifid, ++ key_index, pairwise); ++ } ++ } + + return ret; + } +diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c +index 4206886b110c..ed087bbc6f63 100644 +--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c ++++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c +@@ -485,6 +485,9 @@ qtnf_sta_info_parse_rate(struct rate_info *rate_dst, + rate_dst->flags |= RATE_INFO_FLAGS_MCS; + else if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_VHT_MCS) + rate_dst->flags |= RATE_INFO_FLAGS_VHT_MCS; ++ ++ if (rate_src->flags & QLINK_STA_INFO_RATE_FLAG_SHORT_GI) ++ rate_dst->flags |= RATE_INFO_FLAGS_SHORT_GI; + } + + static void +diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c +index 2641e76d03d9..b5fa910b47b7 100644 +--- a/drivers/net/xen-netback/interface.c ++++ b/drivers/net/xen-netback/interface.c +@@ -172,7 +172,8 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, + return vif->hash.mapping[skb_get_hash_raw(skb) % size]; + } + +-static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) ++static netdev_tx_t ++xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct xenvif *vif = netdev_priv(dev); + struct xenvif_queue *queue = NULL; +diff --git a/drivers/pinctrl/pinctrl-gemini.c b/drivers/pinctrl/pinctrl-gemini.c +index 39e6221e7100..78fa26c1a89f 100644 +--- a/drivers/pinctrl/pinctrl-gemini.c ++++ b/drivers/pinctrl/pinctrl-gemini.c +@@ -551,13 +551,16 @@ static const unsigned int tvc_3512_pins[] = { + 319, /* TVC_DATA[1] */ + 301, /* TVC_DATA[2] */ + 283, /* TVC_DATA[3] */ +- 265, /* TVC_CLK */ + 320, /* TVC_DATA[4] */ + 302, /* TVC_DATA[5] */ + 284, /* TVC_DATA[6] */ + 266, /* TVC_DATA[7] */ + }; + ++static const unsigned int tvc_clk_3512_pins[] = { ++ 265, /* TVC_CLK */ ++}; ++ + /* NAND flash pins */ + static const unsigned int nflash_3512_pins[] = { + 199, 200, 201, 202, 216, 217, 218, 219, 220, 234, 235, 236, 237, 252, +@@ -589,7 +592,7 @@ static const unsigned int pflash_3512_pins_extended[] = { + /* Serial flash pins CE0, CE1, DI, DO, CK */ + static const unsigned int sflash_3512_pins[] = { 230, 231, 232, 233, 211 }; + +-/* The GPIO0A (0) pin overlap with TVC and extended parallel flash */ ++/* The GPIO0A (0) pin overlap with TVC CLK and extended parallel flash */ + static const unsigned int gpio0a_3512_pins[] = { 265 }; + + /* The GPIO0B (1-4) pins overlap with TVC and ICE */ +@@ -772,7 +775,13 @@ static const struct gemini_pin_group gemini_3512_pin_groups[] = { + .num_pins = ARRAY_SIZE(tvc_3512_pins), + /* Conflict with character LCD and ICE */ + .mask = LCD_PADS_ENABLE, +- .value = TVC_PADS_ENABLE | TVC_CLK_PAD_ENABLE, ++ .value = TVC_PADS_ENABLE, ++ }, ++ { ++ .name = "tvcclkgrp", ++ .pins = tvc_clk_3512_pins, ++ .num_pins = ARRAY_SIZE(tvc_clk_3512_pins), ++ .value = TVC_CLK_PAD_ENABLE, + }, + /* + * The construction is done such that it is possible to use a serial +@@ -809,8 +818,8 @@ static const struct gemini_pin_group gemini_3512_pin_groups[] = { + .name = "gpio0agrp", + .pins = gpio0a_3512_pins, + .num_pins = ARRAY_SIZE(gpio0a_3512_pins), +- /* Conflict with TVC */ +- .mask = TVC_PADS_ENABLE, ++ /* Conflict with TVC CLK */ ++ .mask = TVC_CLK_PAD_ENABLE, + }, + { + .name = "gpio0bgrp", +@@ -1476,13 +1485,16 @@ static const unsigned int tvc_3516_pins[] = { + 311, /* TVC_DATA[1] */ + 394, /* TVC_DATA[2] */ + 374, /* TVC_DATA[3] */ +- 333, /* TVC_CLK */ + 354, /* TVC_DATA[4] */ + 395, /* TVC_DATA[5] */ + 312, /* TVC_DATA[6] */ + 334, /* TVC_DATA[7] */ + }; + ++static const unsigned int tvc_clk_3516_pins[] = { ++ 333, /* TVC_CLK */ ++}; ++ + /* NAND flash pins */ + static const unsigned int nflash_3516_pins[] = { + 243, 260, 261, 224, 280, 262, 281, 264, 300, 263, 282, 301, 320, 283, +@@ -1515,7 +1527,7 @@ static const unsigned int pflash_3516_pins_extended[] = { + static const unsigned int sflash_3516_pins[] = { 296, 338, 295, 359, 339 }; + + /* The GPIO0A (0-4) pins overlap with TVC and extended parallel flash */ +-static const unsigned int gpio0a_3516_pins[] = { 333, 354, 395, 312, 334 }; ++static const unsigned int gpio0a_3516_pins[] = { 354, 395, 312, 334 }; + + /* The GPIO0B (5-7) pins overlap with ICE */ + static const unsigned int gpio0b_3516_pins[] = { 375, 396, 376 }; +@@ -1547,6 +1559,9 @@ static const unsigned int gpio0j_3516_pins[] = { 359, 339 }; + /* The GPIO0K (30,31) pins overlap with NAND flash */ + static const unsigned int gpio0k_3516_pins[] = { 275, 298 }; + ++/* The GPIO0L (0) pins overlap with TVC_CLK */ ++static const unsigned int gpio0l_3516_pins[] = { 333 }; ++ + /* The GPIO1A (0-4) pins that overlap with IDE and parallel flash */ + static const unsigned int gpio1a_3516_pins[] = { 221, 200, 222, 201, 220 }; + +@@ -1693,7 +1708,13 @@ static const struct gemini_pin_group gemini_3516_pin_groups[] = { + .num_pins = ARRAY_SIZE(tvc_3516_pins), + /* Conflict with character LCD */ + .mask = LCD_PADS_ENABLE, +- .value = TVC_PADS_ENABLE | TVC_CLK_PAD_ENABLE, ++ .value = TVC_PADS_ENABLE, ++ }, ++ { ++ .name = "tvcclkgrp", ++ .pins = tvc_clk_3516_pins, ++ .num_pins = ARRAY_SIZE(tvc_clk_3516_pins), ++ .value = TVC_CLK_PAD_ENABLE, + }, + /* + * The construction is done such that it is possible to use a serial +@@ -1804,6 +1825,13 @@ static const struct gemini_pin_group gemini_3516_pin_groups[] = { + /* Conflict with parallel and NAND flash */ + .value = PFLASH_PADS_DISABLE | NAND_PADS_DISABLE, + }, ++ { ++ .name = "gpio0lgrp", ++ .pins = gpio0l_3516_pins, ++ .num_pins = ARRAY_SIZE(gpio0l_3516_pins), ++ /* Conflict with TVE CLK */ ++ .mask = TVC_CLK_PAD_ENABLE, ++ }, + { + .name = "gpio1agrp", + .pins = gpio1a_3516_pins, +@@ -2164,7 +2192,8 @@ static int gemini_pmx_set_mux(struct pinctrl_dev *pctldev, + func->name, grp->name); + + regmap_read(pmx->map, GLOBAL_MISC_CTRL, &before); +- regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL, grp->mask, ++ regmap_update_bits(pmx->map, GLOBAL_MISC_CTRL, ++ grp->mask | grp->value, + grp->value); + regmap_read(pmx->map, GLOBAL_MISC_CTRL, &after); + +diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c +index 47be411400e5..3a4c3d7cafca 100644 +--- a/drivers/remoteproc/remoteproc_sysfs.c ++++ b/drivers/remoteproc/remoteproc_sysfs.c +@@ -48,6 +48,11 @@ static ssize_t firmware_store(struct device *dev, + } + + len = strcspn(buf, "\n"); ++ if (!len) { ++ dev_err(dev, "can't provide a NULL firmware\n"); ++ err = -EINVAL; ++ goto out; ++ } + + p = kstrndup(buf, len, GFP_KERNEL); + if (!p) { +diff --git a/drivers/reset/core.c b/drivers/reset/core.c +index da4292e9de97..72b96b5c75a8 100644 +--- a/drivers/reset/core.c ++++ b/drivers/reset/core.c +@@ -466,28 +466,29 @@ struct reset_control *__of_reset_control_get(struct device_node *node, + break; + } + } +- of_node_put(args.np); + + if (!rcdev) { +- mutex_unlock(&reset_list_mutex); +- return ERR_PTR(-EPROBE_DEFER); ++ rstc = ERR_PTR(-EPROBE_DEFER); ++ goto out; + } + + if (WARN_ON(args.args_count != rcdev->of_reset_n_cells)) { +- mutex_unlock(&reset_list_mutex); +- return ERR_PTR(-EINVAL); ++ rstc = ERR_PTR(-EINVAL); ++ goto out; + } + + rstc_id = rcdev->of_xlate(rcdev, &args); + if (rstc_id < 0) { +- mutex_unlock(&reset_list_mutex); +- return ERR_PTR(rstc_id); ++ rstc = ERR_PTR(rstc_id); ++ goto out; + } + + /* reset_list_mutex also protects the rcdev's reset_control list */ + rstc = __reset_control_get_internal(rcdev, rstc_id, shared); + ++out: + mutex_unlock(&reset_list_mutex); ++ of_node_put(args.np); + + return rstc; + } +diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c +index cb3c73007ca1..8fe51f7541bb 100644 +--- a/drivers/spi/spi-fsl-lpspi.c ++++ b/drivers/spi/spi-fsl-lpspi.c +@@ -287,7 +287,7 @@ static int fsl_lpspi_config(struct fsl_lpspi_data *fsl_lpspi) + + fsl_lpspi_set_watermark(fsl_lpspi); + +- temp = CFGR1_PCSCFG | CFGR1_MASTER | CFGR1_NOSTALL; ++ temp = CFGR1_PCSCFG | CFGR1_MASTER; + if (fsl_lpspi->config.mode & SPI_CS_HIGH) + temp |= CFGR1_PCSPOL; + writel(temp, fsl_lpspi->base + IMX7ULP_CFGR1); +diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c +index 3dc31627c655..0c2867deb36f 100644 +--- a/drivers/spi/spi-mt65xx.c ++++ b/drivers/spi/spi-mt65xx.c +@@ -522,11 +522,11 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) + mdata->xfer_len = min(MTK_SPI_MAX_FIFO_SIZE, len); + mtk_spi_setup_packet(master); + +- cnt = len / 4; ++ cnt = mdata->xfer_len / 4; + iowrite32_rep(mdata->base + SPI_TX_DATA_REG, + trans->tx_buf + mdata->num_xfered, cnt); + +- remainder = len % 4; ++ remainder = mdata->xfer_len % 4; + if (remainder > 0) { + reg_val = 0; + memcpy(®_val, +diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c +index fdcf3076681b..185bbdce62b1 100644 +--- a/drivers/spi/spi-rockchip.c ++++ b/drivers/spi/spi-rockchip.c +@@ -445,6 +445,9 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) + struct dma_slave_config rxconf, txconf; + struct dma_async_tx_descriptor *rxdesc, *txdesc; + ++ memset(&rxconf, 0, sizeof(rxconf)); ++ memset(&txconf, 0, sizeof(txconf)); ++ + spin_lock_irqsave(&rs->lock, flags); + rs->state &= ~RXBUSY; + rs->state &= ~TXBUSY; +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index cda10719d1d1..c5fe08bc34a0 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -724,11 +724,9 @@ static int spidev_probe(struct spi_device *spi) + * compatible string, it is a Linux implementation thing + * rather than a description of the hardware. + */ +- if (spi->dev.of_node && !of_match_device(spidev_dt_ids, &spi->dev)) { +- dev_err(&spi->dev, "buggy DT: spidev listed directly in DT\n"); +- WARN_ON(spi->dev.of_node && +- !of_match_device(spidev_dt_ids, &spi->dev)); +- } ++ WARN(spi->dev.of_node && ++ of_device_is_compatible(spi->dev.of_node, "spidev"), ++ "%pOF: buggy DT: spidev listed directly in DT\n", spi->dev.of_node); + + spidev_probe_acpi(spi); + +diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c +index ca79c2ba2ef2..834884c370c5 100644 +--- a/drivers/tee/optee/core.c ++++ b/drivers/tee/optee/core.c +@@ -590,8 +590,10 @@ static int __init optee_driver_init(void) + return -ENODEV; + + np = of_find_matching_node(fw_np, optee_match); +- if (!np || !of_device_is_available(np)) ++ if (!np || !of_device_is_available(np)) { ++ of_node_put(np); + return -ENODEV; ++ } + + optee = optee_probe(np); + of_node_put(np); +diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c +index 5916340c4162..e96b22d6fa52 100644 +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -277,27 +277,36 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd, + const struct usb_endpoint_descriptor *desc = dep->endpoint.desc; + struct dwc3 *dwc = dep->dwc; + u32 timeout = 1000; ++ u32 saved_config = 0; + u32 reg; + + int cmd_status = 0; +- int susphy = false; + int ret = -EINVAL; + + /* +- * Synopsys Databook 2.60a states, on section 6.3.2.5.[1-8], that if +- * we're issuing an endpoint command, we must check if +- * GUSB2PHYCFG.SUSPHY bit is set. If it is, then we need to clear it. ++ * When operating in USB 2.0 speeds (HS/FS), if GUSB2PHYCFG.ENBLSLPM or ++ * GUSB2PHYCFG.SUSPHY is set, it must be cleared before issuing an ++ * endpoint command. + * +- * We will also set SUSPHY bit to what it was before returning as stated +- * by the same section on Synopsys databook. ++ * Save and clear both GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY ++ * settings. Restore them after the command is completed. ++ * ++ * DWC_usb3 3.30a and DWC_usb31 1.90a programming guide section 3.2.2 + */ + if (dwc->gadget.speed <= USB_SPEED_HIGH) { + reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); + if (unlikely(reg & DWC3_GUSB2PHYCFG_SUSPHY)) { +- susphy = true; ++ saved_config |= DWC3_GUSB2PHYCFG_SUSPHY; + reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; +- dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); + } ++ ++ if (reg & DWC3_GUSB2PHYCFG_ENBLSLPM) { ++ saved_config |= DWC3_GUSB2PHYCFG_ENBLSLPM; ++ reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; ++ } ++ ++ if (saved_config) ++ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); + } + + if (DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_STARTTRANSFER) { +@@ -395,9 +404,9 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd, + } + } + +- if (unlikely(susphy)) { ++ if (saved_config) { + reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); +- reg |= DWC3_GUSB2PHYCFG_SUSPHY; ++ reg |= saved_config; + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); + } + +diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c +index d17d7052605b..6866a0be249e 100644 +--- a/drivers/usb/gadget/udc/fotg210-udc.c ++++ b/drivers/usb/gadget/udc/fotg210-udc.c +@@ -744,7 +744,7 @@ static void fotg210_get_status(struct fotg210_udc *fotg210, + fotg210->ep0_req->length = 2; + + spin_unlock(&fotg210->lock); +- fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_KERNEL); ++ fotg210_ep_queue(fotg210->gadget.ep0, fotg210->ep0_req, GFP_ATOMIC); + spin_lock(&fotg210->lock); + } + +diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c +index 90110de715e0..d0aa4c853f56 100644 +--- a/drivers/usb/serial/cypress_m8.c ++++ b/drivers/usb/serial/cypress_m8.c +@@ -773,7 +773,7 @@ send: + + usb_fill_int_urb(port->interrupt_out_urb, port->serial->dev, + usb_sndintpipe(port->serial->dev, port->interrupt_out_endpointAddress), +- port->interrupt_out_buffer, port->interrupt_out_size, ++ port->interrupt_out_buffer, actual_size, + cypress_write_int_callback, port, priv->write_urb_interval); + result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); + if (result) { +diff --git a/drivers/video/backlight/lm3639_bl.c b/drivers/video/backlight/lm3639_bl.c +index cd50df5807ea..086611c7bc03 100644 +--- a/drivers/video/backlight/lm3639_bl.c ++++ b/drivers/video/backlight/lm3639_bl.c +@@ -400,10 +400,8 @@ static int lm3639_remove(struct i2c_client *client) + + regmap_write(pchip->regmap, REG_ENABLE, 0x00); + +- if (&pchip->cdev_torch) +- led_classdev_unregister(&pchip->cdev_torch); +- if (&pchip->cdev_flash) +- led_classdev_unregister(&pchip->cdev_flash); ++ led_classdev_unregister(&pchip->cdev_torch); ++ led_classdev_unregister(&pchip->cdev_flash); + if (pchip->bled) + device_remove_file(&(pchip->bled->dev), &dev_attr_bled_mode); + return 0; +diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c +index 2b2d67328514..ed202f1e13b8 100644 +--- a/drivers/video/fbdev/core/fbmon.c ++++ b/drivers/video/fbdev/core/fbmon.c +@@ -997,97 +997,6 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) + DPRINTK("========================================\n"); + } + +-/** +- * fb_edid_add_monspecs() - add monitor video modes from E-EDID data +- * @edid: 128 byte array with an E-EDID block +- * @spacs: monitor specs to be extended +- */ +-void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) +-{ +- unsigned char *block; +- struct fb_videomode *m; +- int num = 0, i; +- u8 svd[64], edt[(128 - 4) / DETAILED_TIMING_DESCRIPTION_SIZE]; +- u8 pos = 4, svd_n = 0; +- +- if (!edid) +- return; +- +- if (!edid_checksum(edid)) +- return; +- +- if (edid[0] != 0x2 || +- edid[2] < 4 || edid[2] > 128 - DETAILED_TIMING_DESCRIPTION_SIZE) +- return; +- +- DPRINTK(" Short Video Descriptors\n"); +- +- while (pos < edid[2]) { +- u8 len = edid[pos] & 0x1f, type = (edid[pos] >> 5) & 7; +- pr_debug("Data block %u of %u bytes\n", type, len); +- if (type == 2) { +- for (i = pos; i < pos + len; i++) { +- u8 idx = edid[pos + i] & 0x7f; +- svd[svd_n++] = idx; +- pr_debug("N%sative mode #%d\n", +- edid[pos + i] & 0x80 ? "" : "on-n", idx); +- } +- } else if (type == 3 && len >= 3) { +- /* Check Vendor Specific Data Block. For HDMI, +- it is always 00-0C-03 for HDMI Licensing, LLC. */ +- if (edid[pos + 1] == 3 && edid[pos + 2] == 0xc && +- edid[pos + 3] == 0) +- specs->misc |= FB_MISC_HDMI; +- } +- pos += len + 1; +- } +- +- block = edid + edid[2]; +- +- DPRINTK(" Extended Detailed Timings\n"); +- +- for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE; +- i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) +- if (PIXEL_CLOCK != 0) +- edt[num++] = block - edid; +- +- /* Yikes, EDID data is totally useless */ +- if (!(num + svd_n)) +- return; +- +- m = kzalloc((specs->modedb_len + num + svd_n) * +- sizeof(struct fb_videomode), GFP_KERNEL); +- +- if (!m) +- return; +- +- memcpy(m, specs->modedb, specs->modedb_len * sizeof(struct fb_videomode)); +- +- for (i = specs->modedb_len; i < specs->modedb_len + num; i++) { +- get_detailed_timing(edid + edt[i - specs->modedb_len], &m[i]); +- if (i == specs->modedb_len) +- m[i].flag |= FB_MODE_IS_FIRST; +- pr_debug("Adding %ux%u@%u\n", m[i].xres, m[i].yres, m[i].refresh); +- } +- +- for (i = specs->modedb_len + num; i < specs->modedb_len + num + svd_n; i++) { +- int idx = svd[i - specs->modedb_len - num]; +- if (!idx || idx >= ARRAY_SIZE(cea_modes)) { +- pr_warn("Reserved SVD code %d\n", idx); +- } else if (!cea_modes[idx].xres) { +- pr_warn("Unimplemented SVD code %d\n", idx); +- } else { +- memcpy(&m[i], cea_modes + idx, sizeof(m[i])); +- pr_debug("Adding SVD #%d: %ux%u@%u\n", idx, +- m[i].xres, m[i].yres, m[i].refresh); +- } +- } +- +- kfree(specs->modedb); +- specs->modedb = m; +- specs->modedb_len = specs->modedb_len + num + svd_n; +-} +- + /* + * VESA Generalized Timing Formula (GTF) + */ +@@ -1497,9 +1406,6 @@ int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) + void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) + { + } +-void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) +-{ +-} + void fb_destroy_modedb(struct fb_videomode *modedb) + { + } +@@ -1607,7 +1513,6 @@ EXPORT_SYMBOL(fb_firmware_edid); + + EXPORT_SYMBOL(fb_parse_edid); + EXPORT_SYMBOL(fb_edid_to_monspecs); +-EXPORT_SYMBOL(fb_edid_add_monspecs); + EXPORT_SYMBOL(fb_get_mode); + EXPORT_SYMBOL(fb_validate_mode); + EXPORT_SYMBOL(fb_destroy_modedb); +diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c +index 455a15f70172..a9d76e1b4378 100644 +--- a/drivers/video/fbdev/core/modedb.c ++++ b/drivers/video/fbdev/core/modedb.c +@@ -289,63 +289,6 @@ static const struct fb_videomode modedb[] = { + }; + + #ifdef CONFIG_FB_MODE_HELPERS +-const struct fb_videomode cea_modes[65] = { +- /* #1: 640x480p@59.94/60Hz */ +- [1] = { +- NULL, 60, 640, 480, 39722, 48, 16, 33, 10, 96, 2, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #3: 720x480p@59.94/60Hz */ +- [3] = { +- NULL, 60, 720, 480, 37037, 60, 16, 30, 9, 62, 6, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #5: 1920x1080i@59.94/60Hz */ +- [5] = { +- NULL, 60, 1920, 1080, 13763, 148, 88, 15, 2, 44, 5, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_INTERLACED, 0, +- }, +- /* #7: 720(1440)x480iH@59.94/60Hz */ +- [7] = { +- NULL, 60, 1440, 480, 18554/*37108*/, 114, 38, 15, 4, 124, 3, 0, +- FB_VMODE_INTERLACED, 0, +- }, +- /* #9: 720(1440)x240pH@59.94/60Hz */ +- [9] = { +- NULL, 60, 1440, 240, 18554, 114, 38, 16, 4, 124, 3, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #18: 720x576pH@50Hz */ +- [18] = { +- NULL, 50, 720, 576, 37037, 68, 12, 39, 5, 64, 5, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #19: 1280x720p@50Hz */ +- [19] = { +- NULL, 50, 1280, 720, 13468, 220, 440, 20, 5, 40, 5, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #20: 1920x1080i@50Hz */ +- [20] = { +- NULL, 50, 1920, 1080, 13480, 148, 528, 15, 5, 528, 5, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_INTERLACED, 0, +- }, +- /* #32: 1920x1080p@23.98/24Hz */ +- [32] = { +- NULL, 24, 1920, 1080, 13468, 148, 638, 36, 4, 44, 5, +- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, +- FB_VMODE_NONINTERLACED, 0, +- }, +- /* #35: (2880)x480p4x@59.94/60Hz */ +- [35] = { +- NULL, 60, 2880, 480, 9250, 240, 64, 30, 9, 248, 6, 0, +- FB_VMODE_NONINTERLACED, 0, +- }, +-}; +- + const struct fb_videomode vesa_modes[] = { + /* 0 640x350-85 VESA */ + { NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3, +diff --git a/drivers/video/fbdev/sbuslib.c b/drivers/video/fbdev/sbuslib.c +index a436d44f1b7f..01a7110e61a7 100644 +--- a/drivers/video/fbdev/sbuslib.c ++++ b/drivers/video/fbdev/sbuslib.c +@@ -106,11 +106,11 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, + struct fbtype __user *f = (struct fbtype __user *) arg; + + if (put_user(type, &f->fb_type) || +- __put_user(info->var.yres, &f->fb_height) || +- __put_user(info->var.xres, &f->fb_width) || +- __put_user(fb_depth, &f->fb_depth) || +- __put_user(0, &f->fb_cmsize) || +- __put_user(fb_size, &f->fb_cmsize)) ++ put_user(info->var.yres, &f->fb_height) || ++ put_user(info->var.xres, &f->fb_width) || ++ put_user(fb_depth, &f->fb_depth) || ++ put_user(0, &f->fb_cmsize) || ++ put_user(fb_size, &f->fb_cmsize)) + return -EFAULT; + return 0; + } +@@ -125,10 +125,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, + unsigned int index, count, i; + + if (get_user(index, &c->index) || +- __get_user(count, &c->count) || +- __get_user(ured, &c->red) || +- __get_user(ugreen, &c->green) || +- __get_user(ublue, &c->blue)) ++ get_user(count, &c->count) || ++ get_user(ured, &c->red) || ++ get_user(ugreen, &c->green) || ++ get_user(ublue, &c->blue)) + return -EFAULT; + + cmap.len = 1; +@@ -165,13 +165,13 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, + u8 red, green, blue; + + if (get_user(index, &c->index) || +- __get_user(count, &c->count) || +- __get_user(ured, &c->red) || +- __get_user(ugreen, &c->green) || +- __get_user(ublue, &c->blue)) ++ get_user(count, &c->count) || ++ get_user(ured, &c->red) || ++ get_user(ugreen, &c->green) || ++ get_user(ublue, &c->blue)) + return -EFAULT; + +- if (index + count > cmap->len) ++ if (index > cmap->len || count > cmap->len - index) + return -EINVAL; + + for (i = 0; i < count; i++) { +diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c +index 7817836bff55..4b9365d4de7a 100644 +--- a/drivers/watchdog/w83627hf_wdt.c ++++ b/drivers/watchdog/w83627hf_wdt.c +@@ -50,7 +50,7 @@ static int cr_wdt_csr; /* WDT control & status register */ + enum chips { w83627hf, w83627s, w83697hf, w83697ug, w83637hf, w83627thf, + w83687thf, w83627ehf, w83627dhg, w83627uhg, w83667hg, w83627dhg_p, + w83667hg_b, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793, +- nct6795, nct6102 }; ++ nct6795, nct6796, nct6102 }; + + static int timeout; /* in seconds */ + module_param(timeout, int, 0); +@@ -100,6 +100,7 @@ MODULE_PARM_DESC(early_disable, "Disable watchdog at boot time (default=0)"); + #define NCT6792_ID 0xc9 + #define NCT6793_ID 0xd1 + #define NCT6795_ID 0xd3 ++#define NCT6796_ID 0xd4 /* also NCT9697D, NCT9698D */ + + #define W83627HF_WDT_TIMEOUT 0xf6 + #define W83697HF_WDT_TIMEOUT 0xf4 +@@ -209,6 +210,7 @@ static int w83627hf_init(struct watchdog_device *wdog, enum chips chip) + case nct6792: + case nct6793: + case nct6795: ++ case nct6796: + case nct6102: + /* + * These chips have a fixed WDTO# output pin (W83627UHG), +@@ -407,6 +409,9 @@ static int wdt_find(int addr) + case NCT6795_ID: + ret = nct6795; + break; ++ case NCT6796_ID: ++ ret = nct6796; ++ break; + case NCT6102_ID: + ret = nct6102; + cr_wdt_timeout = NCT6102D_WDT_TIMEOUT; +@@ -450,6 +455,7 @@ static int __init wdt_init(void) + "NCT6792", + "NCT6793", + "NCT6795", ++ "NCT6796", + "NCT6102", + }; + +diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c +index 162e853dc5d6..212b01861d94 100644 +--- a/fs/ext4/namei.c ++++ b/fs/ext4/namei.c +@@ -2293,7 +2293,7 @@ again: + dxroot->info.indirect_levels += 1; + dxtrace(printk(KERN_DEBUG + "Creating %d level index...\n", +- info->indirect_levels)); ++ dxroot->info.indirect_levels)); + err = ext4_handle_dirty_dx_node(handle, dir, frame->bh); + if (err) + goto journal_error; +diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c +index ceb6023786bd..67120181dc2a 100644 +--- a/fs/f2fs/gc.c ++++ b/fs/f2fs/gc.c +@@ -1091,7 +1091,7 @@ stop: + + put_gc_inode(&gc_list); + +- if (sync) ++ if (sync && !ret) + ret = sec_freed ? 0 : -EAGAIN; + return ret; + } +diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c +index 8e54f2e3a304..c3f3f1ae4e1b 100644 +--- a/fs/gfs2/super.c ++++ b/fs/gfs2/super.c +@@ -845,10 +845,10 @@ static int gfs2_make_fs_ro(struct gfs2_sbd *sdp) + if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags)) + return error; + ++ flush_workqueue(gfs2_delete_workqueue); + kthread_stop(sdp->sd_quotad_process); + kthread_stop(sdp->sd_logd_process); + +- flush_workqueue(gfs2_delete_workqueue); + gfs2_quota_sync(sdp->sd_vfs, 0); + gfs2_statfs_sync(sdp->sd_vfs, 0); + +diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c +index 61bc0a6ba08b..04d57e11577e 100644 +--- a/fs/nfs/delegation.c ++++ b/fs/nfs/delegation.c +@@ -101,7 +101,7 @@ int nfs4_check_delegation(struct inode *inode, fmode_t flags) + return nfs4_do_check_delegation(inode, flags, false); + } + +-static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid) ++static int nfs_delegation_claim_locks(struct nfs4_state *state, const nfs4_stateid *stateid) + { + struct inode *inode = state->inode; + struct file_lock *fl; +@@ -116,7 +116,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_ + spin_lock(&flctx->flc_lock); + restart: + list_for_each_entry(fl, list, fl_list) { +- if (nfs_file_open_context(fl->fl_file) != ctx) ++ if (nfs_file_open_context(fl->fl_file)->state != state) + continue; + spin_unlock(&flctx->flc_lock); + status = nfs4_lock_delegation_recall(fl, state, stateid); +@@ -163,7 +163,7 @@ again: + seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); + err = nfs4_open_delegation_recall(ctx, state, stateid, type); + if (!err) +- err = nfs_delegation_claim_locks(ctx, state, stateid); ++ err = nfs_delegation_claim_locks(state, stateid); + if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) + err = -EAGAIN; + mutex_unlock(&sp->so_delegreturn_mutex); +diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c +index 079a465796f3..bc56df2ae705 100644 +--- a/fs/orangefs/orangefs-sysfs.c ++++ b/fs/orangefs/orangefs-sysfs.c +@@ -323,7 +323,7 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj, + /* Can't do a service_operation if the client is not running... */ + rc = is_daemon_in_service(); + if (rc) { +- pr_info("%s: Client not running :%d:\n", ++ pr_info_ratelimited("%s: Client not running :%d:\n", + __func__, + is_daemon_in_service()); + goto out; +diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c +index 885d445afa0d..ce400f97370d 100644 +--- a/fs/proc/vmcore.c ++++ b/fs/proc/vmcore.c +@@ -164,6 +164,16 @@ int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma, + return remap_pfn_range(vma, from, pfn, size, prot); + } + ++/* ++ * Architectures which support memory encryption override this. ++ */ ++ssize_t __weak ++copy_oldmem_page_encrypted(unsigned long pfn, char *buf, size_t csize, ++ unsigned long offset, int userbuf) ++{ ++ return copy_oldmem_page(pfn, buf, csize, offset, userbuf); ++} ++ + /* + * Copy to either kernel or user space + */ +diff --git a/include/linux/fb.h b/include/linux/fb.h +index bc24e48e396d..ccd1f74ca6ab 100644 +--- a/include/linux/fb.h ++++ b/include/linux/fb.h +@@ -725,8 +725,6 @@ extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); + extern const unsigned char *fb_firmware_edid(struct device *device); + extern void fb_edid_to_monspecs(unsigned char *edid, + struct fb_monspecs *specs); +-extern void fb_edid_add_monspecs(unsigned char *edid, +- struct fb_monspecs *specs); + extern void fb_destroy_modedb(struct fb_videomode *modedb); + extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb); + extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter); +@@ -800,7 +798,6 @@ struct dmt_videomode { + + extern const char *fb_mode_option; + extern const struct fb_videomode vesa_modes[]; +-extern const struct fb_videomode cea_modes[65]; + extern const struct dmt_videomode dmt_modes[]; + + struct fb_modelist { +diff --git a/include/linux/platform_data/dma-ep93xx.h b/include/linux/platform_data/dma-ep93xx.h +index f8f1f6b952a6..eb9805bb3fe8 100644 +--- a/include/linux/platform_data/dma-ep93xx.h ++++ b/include/linux/platform_data/dma-ep93xx.h +@@ -85,7 +85,7 @@ static inline enum dma_transfer_direction + ep93xx_dma_chan_direction(struct dma_chan *chan) + { + if (!ep93xx_dma_chan_is_m2p(chan)) +- return DMA_NONE; ++ return DMA_TRANS_NONE; + + /* even channels are for TX, odd for RX */ + return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; +diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h +index d96e74e114c0..c9548a63d09b 100644 +--- a/include/linux/sunrpc/sched.h ++++ b/include/linux/sunrpc/sched.h +@@ -188,7 +188,6 @@ struct rpc_timer { + struct rpc_wait_queue { + spinlock_t lock; + struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */ +- pid_t owner; /* process id of last task serviced */ + unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */ + unsigned char priority; /* current priority */ + unsigned char nr; /* # tasks remaining for cookie */ +@@ -204,7 +203,6 @@ struct rpc_wait_queue { + * from a single cookie. The aim is to improve + * performance of NFS operations such as read/write. + */ +-#define RPC_BATCH_COUNT 16 + #define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0) + + /* +diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h +index 4a4319331989..73cc5cfb72e0 100644 +--- a/include/rdma/ib_verbs.h ++++ b/include/rdma/ib_verbs.h +@@ -1120,7 +1120,7 @@ struct ib_qp_init_attr { + struct ib_qp_cap cap; + enum ib_sig_type sq_sig_type; + enum ib_qp_type qp_type; +- enum ib_qp_create_flags create_flags; ++ u32 create_flags; + + /* + * Only needed for special QP types, or when using the RW API. +diff --git a/kernel/cpu.c b/kernel/cpu.c +index 96f970d77339..49273130e4f1 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -376,6 +376,7 @@ void __init cpu_smt_disable(bool force) + pr_info("SMT: Force disabled\n"); + cpu_smt_control = CPU_SMT_FORCE_DISABLED; + } else { ++ pr_info("SMT: disabled\n"); + cpu_smt_control = CPU_SMT_DISABLED; + } + } +diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c +index 8f15665ab616..27cf24e285e0 100644 +--- a/kernel/kexec_core.c ++++ b/kernel/kexec_core.c +@@ -473,6 +473,10 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, + } + } + ++ /* Ensure that these pages are decrypted if SME is enabled. */ ++ if (pages) ++ arch_kexec_post_alloc_pages(page_address(pages), 1 << order, 0); ++ + return pages; + } + +@@ -867,6 +871,7 @@ static int kimage_load_crash_segment(struct kimage *image, + result = -ENOMEM; + goto out; + } ++ arch_kexec_post_alloc_pages(page_address(page), 1, 0); + ptr = kmap(page); + ptr += maddr & ~PAGE_MASK; + mchunk = min_t(size_t, mbytes, +@@ -884,6 +889,7 @@ static int kimage_load_crash_segment(struct kimage *image, + result = copy_from_user(ptr, buf, uchunk); + kexec_flush_icache_page(page); + kunmap(page); ++ arch_kexec_pre_free_pages(page_address(page), 1); + if (result) { + result = -EFAULT; + goto out; +diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c +index 5aa96098c64d..5b33c14ab8b2 100644 +--- a/kernel/printk/printk.c ++++ b/kernel/printk/printk.c +@@ -432,6 +432,7 @@ static u32 clear_idx; + /* record buffer */ + #define LOG_ALIGN __alignof__(struct printk_log) + #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) ++#define LOG_BUF_LEN_MAX (u32)(1 << 31) + static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); + static char *log_buf = __log_buf; + static u32 log_buf_len = __LOG_BUF_LEN; +@@ -1032,18 +1033,23 @@ void log_buf_vmcoreinfo_setup(void) + static unsigned long __initdata new_log_buf_len; + + /* we practice scaling the ring buffer by powers of 2 */ +-static void __init log_buf_len_update(unsigned size) ++static void __init log_buf_len_update(u64 size) + { ++ if (size > (u64)LOG_BUF_LEN_MAX) { ++ size = (u64)LOG_BUF_LEN_MAX; ++ pr_err("log_buf over 2G is not supported.\n"); ++ } ++ + if (size) + size = roundup_pow_of_two(size); + if (size > log_buf_len) +- new_log_buf_len = size; ++ new_log_buf_len = (unsigned long)size; + } + + /* save requested log_buf_len since it's too early to process it */ + static int __init log_buf_len_setup(char *str) + { +- unsigned int size; ++ u64 size; + + if (!str) + return -EINVAL; +@@ -1113,7 +1119,7 @@ void __init setup_log_buf(int early) + } + + if (unlikely(!new_log_buf)) { +- pr_err("log_buf_len: %ld bytes not available\n", ++ pr_err("log_buf_len: %lu bytes not available\n", + new_log_buf_len); + return; + } +@@ -1126,8 +1132,8 @@ void __init setup_log_buf(int early) + memcpy(log_buf, __log_buf, __LOG_BUF_LEN); + logbuf_unlock_irqrestore(flags); + +- pr_info("log_buf_len: %d bytes\n", log_buf_len); +- pr_info("early log buf free: %d(%d%%)\n", ++ pr_info("log_buf_len: %u bytes\n", log_buf_len); ++ pr_info("early log buf free: %u(%u%%)\n", + free, (free * 100) / __LOG_BUF_LEN); + } + +diff --git a/lib/idr.c b/lib/idr.c +index edd9b2be1651..8c1a98d03164 100644 +--- a/lib/idr.c ++++ b/lib/idr.c +@@ -111,13 +111,27 @@ void *idr_get_next(struct idr *idr, int *nextid) + { + struct radix_tree_iter iter; + void __rcu **slot; +- +- slot = radix_tree_iter_find(&idr->idr_rt, &iter, *nextid); ++ void *entry = NULL; ++ ++ radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, *nextid) { ++ entry = rcu_dereference_raw(*slot); ++ if (!entry) ++ continue; ++ if (!radix_tree_deref_retry(entry)) ++ break; ++ if (slot != (void *)&idr->idr_rt.rnode && ++ entry != (void *)RADIX_TREE_INTERNAL_NODE) ++ break; ++ slot = radix_tree_iter_retry(&iter); ++ } + if (!slot) + return NULL; + ++ if (WARN_ON_ONCE(iter.index > INT_MAX)) ++ return NULL; ++ + *nextid = iter.index; +- return rcu_dereference_raw(*slot); ++ return entry; + } + EXPORT_SYMBOL(idr_get_next); + +diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c +index c9d3a49bd4e2..d4affa9982ca 100644 +--- a/mm/memory_hotplug.c ++++ b/mm/memory_hotplug.c +@@ -459,70 +459,33 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, + zone_span_writeunlock(zone); + } + +-static void shrink_pgdat_span(struct pglist_data *pgdat, +- unsigned long start_pfn, unsigned long end_pfn) ++static void update_pgdat_span(struct pglist_data *pgdat) + { +- unsigned long pgdat_start_pfn = pgdat->node_start_pfn; +- unsigned long p = pgdat_end_pfn(pgdat); /* pgdat_end_pfn namespace clash */ +- unsigned long pgdat_end_pfn = p; +- unsigned long pfn; +- struct mem_section *ms; +- int nid = pgdat->node_id; +- +- if (pgdat_start_pfn == start_pfn) { +- /* +- * If the section is smallest section in the pgdat, it need +- * shrink pgdat->node_start_pfn and pgdat->node_spanned_pages. +- * In this case, we find second smallest valid mem_section +- * for shrinking zone. +- */ +- pfn = find_smallest_section_pfn(nid, NULL, end_pfn, +- pgdat_end_pfn); +- if (pfn) { +- pgdat->node_start_pfn = pfn; +- pgdat->node_spanned_pages = pgdat_end_pfn - pfn; +- } +- } else if (pgdat_end_pfn == end_pfn) { +- /* +- * If the section is biggest section in the pgdat, it need +- * shrink pgdat->node_spanned_pages. +- * In this case, we find second biggest valid mem_section for +- * shrinking zone. +- */ +- pfn = find_biggest_section_pfn(nid, NULL, pgdat_start_pfn, +- start_pfn); +- if (pfn) +- pgdat->node_spanned_pages = pfn - pgdat_start_pfn + 1; +- } ++ unsigned long node_start_pfn = 0, node_end_pfn = 0; ++ struct zone *zone; + +- /* +- * If the section is not biggest or smallest mem_section in the pgdat, +- * it only creates a hole in the pgdat. So in this case, we need not +- * change the pgdat. +- * But perhaps, the pgdat has only hole data. Thus it check the pgdat +- * has only hole or not. +- */ +- pfn = pgdat_start_pfn; +- for (; pfn < pgdat_end_pfn; pfn += PAGES_PER_SECTION) { +- ms = __pfn_to_section(pfn); ++ for (zone = pgdat->node_zones; ++ zone < pgdat->node_zones + MAX_NR_ZONES; zone++) { ++ unsigned long zone_end_pfn = zone->zone_start_pfn + ++ zone->spanned_pages; + +- if (unlikely(!valid_section(ms))) ++ /* No need to lock the zones, they can't change. */ ++ if (!zone->spanned_pages) + continue; +- +- if (pfn_to_nid(pfn) != nid) +- continue; +- +- /* If the section is current section, it continues the loop */ +- if (start_pfn == pfn) ++ if (!node_end_pfn) { ++ node_start_pfn = zone->zone_start_pfn; ++ node_end_pfn = zone_end_pfn; + continue; ++ } + +- /* If we find valid section, we have nothing to do */ +- return; ++ if (zone_end_pfn > node_end_pfn) ++ node_end_pfn = zone_end_pfn; ++ if (zone->zone_start_pfn < node_start_pfn) ++ node_start_pfn = zone->zone_start_pfn; + } + +- /* The pgdat has no valid section */ +- pgdat->node_start_pfn = 0; +- pgdat->node_spanned_pages = 0; ++ pgdat->node_start_pfn = node_start_pfn; ++ pgdat->node_spanned_pages = node_end_pfn - node_start_pfn; + } + + static void __remove_zone(struct zone *zone, unsigned long start_pfn) +@@ -533,7 +496,7 @@ static void __remove_zone(struct zone *zone, unsigned long start_pfn) + + pgdat_resize_lock(zone->zone_pgdat, &flags); + shrink_zone_span(zone, start_pfn, start_pfn + nr_pages); +- shrink_pgdat_span(pgdat, start_pfn, start_pfn + nr_pages); ++ update_pgdat_span(pgdat); + pgdat_resize_unlock(zone->zone_pgdat, &flags); + } + +diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c +index 4a5bdad9f303..e57811e4b91f 100644 +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -129,7 +129,7 @@ + + #define CCK_GROUP \ + [MINSTREL_CCK_GROUP] = { \ +- .streams = 0, \ ++ .streams = 1, \ + .flags = 0, \ + .duration = { \ + CCK_DURATION_LIST(false), \ +@@ -282,7 +282,8 @@ minstrel_ht_get_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, + break; + + /* short preamble */ +- if (!(mi->supported[group] & BIT(idx))) ++ if ((mi->supported[group] & BIT(idx + 4)) && ++ (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)) + idx += 4; + } + return &mi->groups[group].rates[idx]; +@@ -1077,18 +1078,23 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, + return; + + sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; ++ sample_idx %= MCS_GROUP_RATES; ++ ++ if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP] && ++ (sample_idx >= 4) != txrc->short_preamble) ++ return; ++ + info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; + rate->count = 1; + +- if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { ++ if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP]) { + int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); + rate->idx = mp->cck_rates[idx]; + } else if (sample_group->flags & IEEE80211_TX_RC_VHT_MCS) { + ieee80211_rate_set_vht(rate, sample_idx % MCS_GROUP_RATES, + sample_group->streams); + } else { +- rate->idx = sample_idx % MCS_GROUP_RATES + +- (sample_group->streams - 1) * 8; ++ rate->idx = sample_idx + (sample_group->streams - 1) * 8; + } + + rate->flags = sample_group->flags; +@@ -1132,7 +1138,6 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; + u16 sta_cap = sta->ht_cap.cap; + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; +- struct sta_info *sinfo = container_of(sta, struct sta_info, sta); + int use_vht; + int n_supported = 0; + int ack_dur; +@@ -1258,8 +1263,7 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, + if (!n_supported) + goto use_legacy; + +- if (test_sta_flag(sinfo, WLAN_STA_SHORT_PREAMBLE)) +- mi->cck_supported_short |= mi->cck_supported_short << 4; ++ mi->supported[MINSTREL_CCK_GROUP] |= mi->cck_supported_short << 4; + + /* create an initial rate table with the lowest supported rates */ + minstrel_ht_update_stats(mp, mi); +diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c +index 7344ec7fff2a..8281656808ae 100644 +--- a/net/netfilter/nft_compat.c ++++ b/net/netfilter/nft_compat.c +@@ -291,6 +291,24 @@ nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) + module_put(me); + } + ++static int nft_extension_dump_info(struct sk_buff *skb, int attr, ++ const void *info, ++ unsigned int size, unsigned int user_size) ++{ ++ unsigned int info_size, aligned_size = XT_ALIGN(size); ++ struct nlattr *nla; ++ ++ nla = nla_reserve(skb, attr, aligned_size); ++ if (!nla) ++ return -1; ++ ++ info_size = user_size ? : size; ++ memcpy(nla_data(nla), info, info_size); ++ memset(nla_data(nla) + info_size, 0, aligned_size - info_size); ++ ++ return 0; ++} ++ + static int nft_target_dump(struct sk_buff *skb, const struct nft_expr *expr) + { + const struct xt_target *target = expr->ops->data; +@@ -298,7 +316,8 @@ static int nft_target_dump(struct sk_buff *skb, const struct nft_expr *expr) + + if (nla_put_string(skb, NFTA_TARGET_NAME, target->name) || + nla_put_be32(skb, NFTA_TARGET_REV, htonl(target->revision)) || +- nla_put(skb, NFTA_TARGET_INFO, XT_ALIGN(target->targetsize), info)) ++ nft_extension_dump_info(skb, NFTA_TARGET_INFO, info, ++ target->targetsize, target->usersize)) + goto nla_put_failure; + + return 0; +@@ -534,7 +553,8 @@ static int __nft_match_dump(struct sk_buff *skb, const struct nft_expr *expr, + + if (nla_put_string(skb, NFTA_MATCH_NAME, match->name) || + nla_put_be32(skb, NFTA_MATCH_REV, htonl(match->revision)) || +- nla_put(skb, NFTA_MATCH_INFO, XT_ALIGN(match->matchsize), info)) ++ nft_extension_dump_info(skb, NFTA_MATCH_INFO, info, ++ match->matchsize, match->usersize)) + goto nla_put_failure; + + return 0; +diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c +index 1c09ad457d2a..1083b5e90134 100644 +--- a/net/openvswitch/vport-internal_dev.c ++++ b/net/openvswitch/vport-internal_dev.c +@@ -44,7 +44,8 @@ static struct internal_dev *internal_dev_priv(struct net_device *netdev) + } + + /* Called with rcu_read_lock_bh. */ +-static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) ++static netdev_tx_t ++internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) + { + int len, err; + +@@ -63,7 +64,7 @@ static int internal_dev_xmit(struct sk_buff *skb, struct net_device *netdev) + } else { + netdev->stats.tx_errors++; + } +- return 0; ++ return NETDEV_TX_OK; + } + + static int internal_dev_open(struct net_device *netdev) +diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c +index f9db5fe52d36..aff76fb43430 100644 +--- a/net/sunrpc/sched.c ++++ b/net/sunrpc/sched.c +@@ -99,64 +99,78 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task) + list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list); + } + +-static void rpc_rotate_queue_owner(struct rpc_wait_queue *queue) +-{ +- struct list_head *q = &queue->tasks[queue->priority]; +- struct rpc_task *task; +- +- if (!list_empty(q)) { +- task = list_first_entry(q, struct rpc_task, u.tk_wait.list); +- if (task->tk_owner == queue->owner) +- list_move_tail(&task->u.tk_wait.list, q); +- } +-} +- + static void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority) + { + if (queue->priority != priority) { +- /* Fairness: rotate the list when changing priority */ +- rpc_rotate_queue_owner(queue); + queue->priority = priority; ++ queue->nr = 1U << priority; + } + } + +-static void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid) +-{ +- queue->owner = pid; +- queue->nr = RPC_BATCH_COUNT; +-} +- + static void rpc_reset_waitqueue_priority(struct rpc_wait_queue *queue) + { + rpc_set_waitqueue_priority(queue, queue->maxpriority); +- rpc_set_waitqueue_owner(queue, 0); + } + + /* +- * Add new request to a priority queue. ++ * Add a request to a queue list + */ +-static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue, +- struct rpc_task *task, +- unsigned char queue_priority) ++static void ++__rpc_list_enqueue_task(struct list_head *q, struct rpc_task *task) + { +- struct list_head *q; + struct rpc_task *t; + +- INIT_LIST_HEAD(&task->u.tk_wait.links); +- if (unlikely(queue_priority > queue->maxpriority)) +- queue_priority = queue->maxpriority; +- if (queue_priority > queue->priority) +- rpc_set_waitqueue_priority(queue, queue_priority); +- q = &queue->tasks[queue_priority]; + list_for_each_entry(t, q, u.tk_wait.list) { + if (t->tk_owner == task->tk_owner) { +- list_add_tail(&task->u.tk_wait.list, &t->u.tk_wait.links); ++ list_add_tail(&task->u.tk_wait.links, ++ &t->u.tk_wait.links); ++ /* Cache the queue head in task->u.tk_wait.list */ ++ task->u.tk_wait.list.next = q; ++ task->u.tk_wait.list.prev = NULL; + return; + } + } ++ INIT_LIST_HEAD(&task->u.tk_wait.links); + list_add_tail(&task->u.tk_wait.list, q); + } + ++/* ++ * Remove request from a queue list ++ */ ++static void ++__rpc_list_dequeue_task(struct rpc_task *task) ++{ ++ struct list_head *q; ++ struct rpc_task *t; ++ ++ if (task->u.tk_wait.list.prev == NULL) { ++ list_del(&task->u.tk_wait.links); ++ return; ++ } ++ if (!list_empty(&task->u.tk_wait.links)) { ++ t = list_first_entry(&task->u.tk_wait.links, ++ struct rpc_task, ++ u.tk_wait.links); ++ /* Assume __rpc_list_enqueue_task() cached the queue head */ ++ q = t->u.tk_wait.list.next; ++ list_add_tail(&t->u.tk_wait.list, q); ++ list_del(&task->u.tk_wait.links); ++ } ++ list_del(&task->u.tk_wait.list); ++} ++ ++/* ++ * Add new request to a priority queue. ++ */ ++static void __rpc_add_wait_queue_priority(struct rpc_wait_queue *queue, ++ struct rpc_task *task, ++ unsigned char queue_priority) ++{ ++ if (unlikely(queue_priority > queue->maxpriority)) ++ queue_priority = queue->maxpriority; ++ __rpc_list_enqueue_task(&queue->tasks[queue_priority], task); ++} ++ + /* + * Add new request to wait queue. + * +@@ -194,13 +208,7 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue, + */ + static void __rpc_remove_wait_queue_priority(struct rpc_task *task) + { +- struct rpc_task *t; +- +- if (!list_empty(&task->u.tk_wait.links)) { +- t = list_entry(task->u.tk_wait.links.next, struct rpc_task, u.tk_wait.list); +- list_move(&t->u.tk_wait.list, &task->u.tk_wait.list); +- list_splice_init(&task->u.tk_wait.links, &t->u.tk_wait.links); +- } ++ __rpc_list_dequeue_task(task); + } + + /* +@@ -212,7 +220,8 @@ static void __rpc_remove_wait_queue(struct rpc_wait_queue *queue, struct rpc_tas + __rpc_disable_timer(queue, task); + if (RPC_IS_PRIORITY(queue)) + __rpc_remove_wait_queue_priority(task); +- list_del(&task->u.tk_wait.list); ++ else ++ list_del(&task->u.tk_wait.list); + queue->qlen--; + dprintk("RPC: %5u removed from queue %p \"%s\"\n", + task->tk_pid, queue, rpc_qname(queue)); +@@ -481,17 +490,9 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q + * Service a batch of tasks from a single owner. + */ + q = &queue->tasks[queue->priority]; +- if (!list_empty(q)) { +- task = list_entry(q->next, struct rpc_task, u.tk_wait.list); +- if (queue->owner == task->tk_owner) { +- if (--queue->nr) +- goto out; +- list_move_tail(&task->u.tk_wait.list, q); +- } +- /* +- * Check if we need to switch queues. +- */ +- goto new_owner; ++ if (!list_empty(q) && --queue->nr) { ++ task = list_first_entry(q, struct rpc_task, u.tk_wait.list); ++ goto out; + } + + /* +@@ -503,7 +504,7 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q + else + q = q - 1; + if (!list_empty(q)) { +- task = list_entry(q->next, struct rpc_task, u.tk_wait.list); ++ task = list_first_entry(q, struct rpc_task, u.tk_wait.list); + goto new_queue; + } + } while (q != &queue->tasks[queue->priority]); +@@ -513,8 +514,6 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q + + new_queue: + rpc_set_waitqueue_priority(queue, (unsigned int)(q - &queue->tasks[0])); +-new_owner: +- rpc_set_waitqueue_owner(queue, task->tk_owner); + out: + return task; + } +diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c +index d0282cc88b14..b852c34bb637 100644 +--- a/net/sunrpc/xprt.c ++++ b/net/sunrpc/xprt.c +@@ -795,17 +795,11 @@ void xprt_connect(struct rpc_task *task) + + static void xprt_connect_status(struct rpc_task *task) + { +- struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; +- +- if (task->tk_status == 0) { +- xprt->stat.connect_count++; +- xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_start; ++ switch (task->tk_status) { ++ case 0: + dprintk("RPC: %5u xprt_connect_status: connection established\n", + task->tk_pid); +- return; +- } +- +- switch (task->tk_status) { ++ break; + case -ECONNREFUSED: + case -ECONNRESET: + case -ECONNABORTED: +@@ -822,7 +816,7 @@ static void xprt_connect_status(struct rpc_task *task) + default: + dprintk("RPC: %5u xprt_connect_status: error %d connecting to " + "server %s\n", task->tk_pid, -task->tk_status, +- xprt->servername); ++ task->tk_rqstp->rq_xprt->servername); + task->tk_status = -EIO; + } + } +diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c +index 8cf5ccfe180d..b1b40a1be8c5 100644 +--- a/net/sunrpc/xprtrdma/transport.c ++++ b/net/sunrpc/xprtrdma/transport.c +@@ -238,8 +238,12 @@ rpcrdma_connect_worker(struct work_struct *work) + if (++xprt->connect_cookie == 0) /* maintain a reserved value */ + ++xprt->connect_cookie; + if (ep->rep_connected > 0) { +- if (!xprt_test_and_set_connected(xprt)) ++ if (!xprt_test_and_set_connected(xprt)) { ++ xprt->stat.connect_count++; ++ xprt->stat.connect_time += (long)jiffies - ++ xprt->stat.connect_start; + xprt_wake_pending_tasks(xprt, 0); ++ } + } else { + if (xprt_test_and_clear_connected(xprt)) + xprt_wake_pending_tasks(xprt, -ENOTCONN); +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c +index 05a58cc1b0cd..a42871a59f3b 100644 +--- a/net/sunrpc/xprtsock.c ++++ b/net/sunrpc/xprtsock.c +@@ -1592,6 +1592,9 @@ static void xs_tcp_state_change(struct sock *sk) + clear_bit(XPRT_SOCK_CONNECTING, &transport->sock_state); + xprt_clear_connecting(xprt); + ++ xprt->stat.connect_count++; ++ xprt->stat.connect_time += (long)jiffies - ++ xprt->stat.connect_start; + xprt_wake_pending_tasks(xprt, -EAGAIN); + } + spin_unlock(&xprt->transport_lock); +@@ -2008,8 +2011,6 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt, + } + + /* Tell the socket layer to start connecting... */ +- xprt->stat.connect_count++; +- xprt->stat.connect_start = jiffies; + return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, 0); + } + +@@ -2041,6 +2042,9 @@ static int xs_local_setup_socket(struct sock_xprt *transport) + case 0: + dprintk("RPC: xprt %p connected to %s\n", + xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); ++ xprt->stat.connect_count++; ++ xprt->stat.connect_time += (long)jiffies - ++ xprt->stat.connect_start; + xprt_set_connected(xprt); + case -ENOBUFS: + break; +@@ -2361,8 +2365,6 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) + xs_set_memalloc(xprt); + + /* Tell the socket layer to start connecting... */ +- xprt->stat.connect_count++; +- xprt->stat.connect_start = jiffies; + set_bit(XPRT_SOCK_CONNECTING, &transport->sock_state); + ret = kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK); + switch (ret) { +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 9627c52c3f93..df8c5312f26a 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -3118,7 +3118,7 @@ static void get_key_callback(void *c, struct key_params *params) + params->cipher))) + goto nla_put_failure; + +- if (nla_put_u8(cookie->msg, NL80211_ATTR_KEY_IDX, cookie->idx)) ++ if (nla_put_u8(cookie->msg, NL80211_KEY_IDX, cookie->idx)) + goto nla_put_failure; + + nla_nest_end(cookie->msg, key); +diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c +index 06dec32503bd..fc0a9ce1be18 100644 +--- a/net/xfrm/xfrm_input.c ++++ b/net/xfrm/xfrm_input.c +@@ -130,7 +130,7 @@ struct sec_path *secpath_dup(struct sec_path *src) + sp->len = 0; + sp->olen = 0; + +- memset(sp->ovec, 0, sizeof(sp->ovec[XFRM_MAX_OFFLOAD_DEPTH])); ++ memset(sp->ovec, 0, sizeof(sp->ovec)); + + if (src) { + int i; +diff --git a/samples/mei/mei-amt-version.c b/samples/mei/mei-amt-version.c +index bb9988914a56..32234481ad7d 100644 +--- a/samples/mei/mei-amt-version.c ++++ b/samples/mei/mei-amt-version.c +@@ -370,7 +370,7 @@ static uint32_t amt_host_if_call(struct amt_host_if *acmd, + unsigned int expected_sz) + { + uint32_t in_buf_sz; +- uint32_t out_buf_sz; ++ ssize_t out_buf_sz; + ssize_t written; + uint32_t status; + struct amt_host_if_resp_header *msg_hdr; +diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c +index 63d15b545b33..7cd147411b22 100644 +--- a/sound/pci/hda/patch_sigmatel.c ++++ b/sound/pci/hda/patch_sigmatel.c +@@ -77,6 +77,7 @@ enum { + STAC_DELL_M6_BOTH, + STAC_DELL_EQ, + STAC_ALIENWARE_M17X, ++ STAC_ELO_VUPOINT_15MX, + STAC_92HD89XX_HP_FRONT_JACK, + STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, + STAC_92HD73XX_ASUS_MOBO, +@@ -1897,6 +1898,18 @@ static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec, + codec->no_jack_detect = 1; + } + ++ ++static void stac92hd73xx_disable_automute(struct hda_codec *codec, ++ const struct hda_fixup *fix, int action) ++{ ++ struct sigmatel_spec *spec = codec->spec; ++ ++ if (action != HDA_FIXUP_ACT_PRE_PROBE) ++ return; ++ ++ spec->gen.suppress_auto_mute = 1; ++} ++ + static const struct hda_fixup stac92hd73xx_fixups[] = { + [STAC_92HD73XX_REF] = { + .type = HDA_FIXUP_FUNC, +@@ -1922,6 +1935,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { + .type = HDA_FIXUP_FUNC, + .v.func = stac92hd73xx_fixup_alienware_m17x, + }, ++ [STAC_ELO_VUPOINT_15MX] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = stac92hd73xx_disable_automute, ++ }, + [STAC_92HD73XX_INTEL] = { + .type = HDA_FIXUP_PINS, + .v.pins = intel_dg45id_pin_configs, +@@ -1960,6 +1977,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { + { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, + { .id = STAC_DELL_EQ, .name = "dell-eq" }, + { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, ++ { .id = STAC_ELO_VUPOINT_15MX, .name = "elo-vupoint-15mx" }, + { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, + {} + }; +@@ -2009,6 +2027,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { + "Alienware M17x", STAC_ALIENWARE_M17X), + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, + "Alienware M17x R3", STAC_DELL_EQ), ++ SND_PCI_QUIRK(0x1059, 0x1011, ++ "ELO VuPoint 15MX", STAC_ELO_VUPOINT_15MX), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927, + "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, +diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c +index 9074b477bff0..7002df55826f 100644 +--- a/tools/pci/pcitest.c ++++ b/tools/pci/pcitest.c +@@ -23,7 +23,6 @@ + #include <stdio.h> + #include <stdlib.h> + #include <sys/ioctl.h> +-#include <time.h> + #include <unistd.h> + + #include <linux/pcitest.h> +@@ -45,15 +44,13 @@ struct pci_test { + + static int run_test(struct pci_test *test) + { +- long ret; ++ int ret = -EINVAL; + int fd; +- struct timespec start, end; +- double time; + + fd = open(test->device, O_RDWR); + if (fd < 0) { + perror("can't open PCI Endpoint Test device"); +- return fd; ++ return -ENODEV; + } + + if (test->barnum >= 0 && test->barnum <= 5) { +diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c +index 8e61aad0ca3f..07cec1b5a0d8 100644 +--- a/tools/testing/radix-tree/idr-test.c ++++ b/tools/testing/radix-tree/idr-test.c +@@ -177,6 +177,57 @@ void idr_get_next_test(void) + idr_destroy(&idr); + } + ++static inline void *idr_mk_value(unsigned long v) ++{ ++ BUG_ON((long)v < 0); ++ return (void *)((v & 1) | 2 | (v << 1)); ++} ++ ++DEFINE_IDR(find_idr); ++ ++static void *idr_throbber(void *arg) ++{ ++ time_t start = time(NULL); ++ int id = *(int *)arg; ++ ++ rcu_register_thread(); ++ do { ++ idr_alloc(&find_idr, idr_mk_value(id), id, id + 1, GFP_KERNEL); ++ idr_remove(&find_idr, id); ++ } while (time(NULL) < start + 10); ++ rcu_unregister_thread(); ++ ++ return NULL; ++} ++ ++void idr_find_test_1(int anchor_id, int throbber_id) ++{ ++ pthread_t throbber; ++ time_t start = time(NULL); ++ ++ pthread_create(&throbber, NULL, idr_throbber, &throbber_id); ++ ++ BUG_ON(idr_alloc(&find_idr, idr_mk_value(anchor_id), anchor_id, ++ anchor_id + 1, GFP_KERNEL) != anchor_id); ++ ++ do { ++ int id = 0; ++ void *entry = idr_get_next(&find_idr, &id); ++ BUG_ON(entry != idr_mk_value(id)); ++ } while (time(NULL) < start + 11); ++ ++ pthread_join(throbber, NULL); ++ ++ idr_remove(&find_idr, anchor_id); ++ BUG_ON(!idr_is_empty(&find_idr)); ++} ++ ++void idr_find_test(void) ++{ ++ idr_find_test_1(100000, 0); ++ idr_find_test_1(0, 100000); ++} ++ + void idr_checks(void) + { + unsigned long i; +@@ -234,6 +285,7 @@ void idr_checks(void) + idr_null_test(); + idr_nowait_test(); + idr_get_next_test(); ++ idr_find_test(); + } + + /* +diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c +index 1f4cac53b923..9f69202d8e49 100644 +--- a/virt/kvm/arm/mmu.c ++++ b/virt/kvm/arm/mmu.c +@@ -375,7 +375,8 @@ static void stage2_flush_memslot(struct kvm *kvm, + pgd = kvm->arch.pgd + stage2_pgd_index(addr); + do { + next = stage2_pgd_addr_end(addr, end); +- stage2_flush_puds(kvm, pgd, addr, next); ++ if (!stage2_pgd_none(*pgd)) ++ stage2_flush_puds(kvm, pgd, addr, next); + } while (pgd++, addr = next, addr != end); + } +