commit:     76de9404b65aea0cc23a24d0f97d0b833e93bb45
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 20 04:45:01 2014 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sat Dec 20 04:45:01 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=76de9404

Linux patch 3.12.35

---
 0000_README              |    4 +
 1034_linux-3.12.35.patch | 2597 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 2601 insertions(+)

diff --git a/0000_README b/0000_README
index da28ca8..202ddb1 100644
--- a/0000_README
+++ b/0000_README
@@ -178,6 +178,10 @@ Patch:  1033_linux-3.12.34.patch
 From:   http://www.kernel.org
 Desc:   Linux 3.12.34
 
+Patch:  1034_linux-3.12.35.patch
+From:   http://www.kernel.org
+Desc:   Linux 3.12.35
+
 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/1034_linux-3.12.35.patch b/1034_linux-3.12.35.patch
new file mode 100644
index 0000000..bc1c67b
--- /dev/null
+++ b/1034_linux-3.12.35.patch
@@ -0,0 +1,2597 @@
+diff --git a/Makefile b/Makefile
+index 9f1b68fba514..8d030709ef0f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 3
+ PATCHLEVEL = 12
+-SUBLEVEL = 34
++SUBLEVEL = 35
+ EXTRAVERSION =
+ NAME = One Giant Leap for Frogkind
+ 
+diff --git a/arch/arm/include/asm/thread_info.h 
b/arch/arm/include/asm/thread_info.h
+index df5e13d64f2c..2b8114fcba09 100644
+--- a/arch/arm/include/asm/thread_info.h
++++ b/arch/arm/include/asm/thread_info.h
+@@ -43,16 +43,6 @@ struct cpu_context_save {
+       __u32   extra[2];               /* Xscale 'acc' register, etc */
+ };
+ 
+-struct arm_restart_block {
+-      union {
+-              /* For user cache flushing */
+-              struct {
+-                      unsigned long start;
+-                      unsigned long end;
+-              } cache;
+-      };
+-};
+-
+ /*
+  * low level task data that entry.S needs immediate access to.
+  * __switch_to() assumes cpu_context follows immediately after cpu_domain.
+@@ -78,7 +68,6 @@ struct thread_info {
+       unsigned long           thumbee_state;  /* ThumbEE Handler Base 
register */
+ #endif
+       struct restart_block    restart_block;
+-      struct arm_restart_block        arm_restart_block;
+ };
+ 
+ #define INIT_THREAD_INFO(tsk)                                         \
+diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
+index a8dd111ff99a..8e6cd760cc68 100644
+--- a/arch/arm/kernel/traps.c
++++ b/arch/arm/kernel/traps.c
+@@ -503,8 +503,6 @@ static int bad_syscall(int n, struct pt_regs *regs)
+       return regs->ARM_r0;
+ }
+ 
+-static long do_cache_op_restart(struct restart_block *);
+-
+ static inline int
+ __do_cache_op(unsigned long start, unsigned long end)
+ {
+@@ -513,24 +511,8 @@ __do_cache_op(unsigned long start, unsigned long end)
+       do {
+               unsigned long chunk = min(PAGE_SIZE, end - start);
+ 
+-              if (signal_pending(current)) {
+-                      struct thread_info *ti = current_thread_info();
+-
+-                      ti->restart_block = (struct restart_block) {
+-                              .fn     = do_cache_op_restart,
+-                      };
+-
+-                      ti->arm_restart_block = (struct arm_restart_block) {
+-                              {
+-                                      .cache = {
+-                                              .start  = start,
+-                                              .end    = end,
+-                                      },
+-                              },
+-                      };
+-
+-                      return -ERESTART_RESTARTBLOCK;
+-              }
++              if (fatal_signal_pending(current))
++                      return 0;
+ 
+               ret = flush_cache_user_range(start, start + chunk);
+               if (ret)
+@@ -543,15 +525,6 @@ __do_cache_op(unsigned long start, unsigned long end)
+       return 0;
+ }
+ 
+-static long do_cache_op_restart(struct restart_block *unused)
+-{
+-      struct arm_restart_block *restart_block;
+-
+-      restart_block = &current_thread_info()->arm_restart_block;
+-      return __do_cache_op(restart_block->cache.start,
+-                           restart_block->cache.end);
+-}
+-
+ static inline int
+ do_cache_op(unsigned long start, unsigned long end, int flags)
+ {
+diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
+index ced046d9f825..2e381582ffee 100644
+--- a/arch/arm/mm/proc-v7.S
++++ b/arch/arm/mm/proc-v7.S
+@@ -204,7 +204,6 @@ __v7_pj4b_setup:
+ /* Auxiliary Debug Modes Control 1 Register */
+ #define PJ4B_STATIC_BP (1 << 2) /* Enable Static BP */
+ #define PJ4B_INTER_PARITY (1 << 8) /* Disable Internal Parity Handling */
+-#define PJ4B_BCK_OFF_STREX (1 << 5) /* Enable the back off of STREX instr */
+ #define PJ4B_CLEAN_LINE (1 << 16) /* Disable data transfer for clean line */
+ 
+ /* Auxiliary Debug Modes Control 2 Register */
+@@ -227,7 +226,6 @@ __v7_pj4b_setup:
+       /* Auxiliary Debug Modes Control 1 Register */
+       mrc     p15, 1, r0, c15, c1, 1
+       orr     r0, r0, #PJ4B_CLEAN_LINE
+-      orr     r0, r0, #PJ4B_BCK_OFF_STREX
+       orr     r0, r0, #PJ4B_INTER_PARITY
+       bic     r0, r0, #PJ4B_STATIC_BP
+       mcr     p15, 1, r0, c15, c1, 1
+diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
+index d19b1cfcad91..b34b95f45cb3 100644
+--- a/arch/arm/mm/proc-xscale.S
++++ b/arch/arm/mm/proc-xscale.S
+@@ -535,7 +535,7 @@ ENTRY(cpu_xscale_do_suspend)
+       mrc     p15, 0, r5, c15, c1, 0  @ CP access reg
+       mrc     p15, 0, r6, c13, c0, 0  @ PID
+       mrc     p15, 0, r7, c3, c0, 0   @ domain ID
+-      mrc     p15, 0, r8, c1, c1, 0   @ auxiliary control reg
++      mrc     p15, 0, r8, c1, c0, 1   @ auxiliary control reg
+       mrc     p15, 0, r9, c1, c0, 0   @ control reg
+       bic     r4, r4, #2              @ clear frequency change bit
+       stmia   r0, {r4 - r9}           @ store cp regs
+@@ -552,7 +552,7 @@ ENTRY(cpu_xscale_do_resume)
+       mcr     p15, 0, r6, c13, c0, 0  @ PID
+       mcr     p15, 0, r7, c3, c0, 0   @ domain ID
+       mcr     p15, 0, r1, c2, c0, 0   @ translation table base addr
+-      mcr     p15, 0, r8, c1, c1, 0   @ auxiliary control reg
++      mcr     p15, 0, r8, c1, c0, 1   @ auxiliary control reg
+       mov     r0, r9                  @ control register
+       b       cpu_resume_mmu
+ ENDPROC(cpu_xscale_do_resume)
+diff --git a/arch/mips/loongson/common/Makefile 
b/arch/mips/loongson/common/Makefile
+index 9e4484ccbb03..9005a8d60969 100644
+--- a/arch/mips/loongson/common/Makefile
++++ b/arch/mips/loongson/common/Makefile
+@@ -11,7 +11,8 @@ obj-$(CONFIG_PCI) += pci.o
+ # Serial port support
+ #
+ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
+-obj-$(CONFIG_SERIAL_8250) += serial.o
++loongson-serial-$(CONFIG_SERIAL_8250) := serial.o
++obj-y += $(loongson-serial-m) $(loongson-serial-y)
+ obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o
+ obj-$(CONFIG_LOONGSON_MC146818) += rtc.o
+ 
+diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c
+index 6854ed5097d2..83a1dfd8f0e3 100644
+--- a/arch/mips/oprofile/backtrace.c
++++ b/arch/mips/oprofile/backtrace.c
+@@ -92,7 +92,7 @@ static inline int unwind_user_frame(struct stackframe 
*old_frame,
+                               /* This marks the end of the previous function,
+                                  which means we overran. */
+                               break;
+-                      stack_size = (unsigned) stack_adjustment;
++                      stack_size = (unsigned long) stack_adjustment;
+               } else if (is_ra_save_ins(&ip)) {
+                       int ra_slot = ip.i_format.simmediate;
+                       if (ra_slot < 0)
+diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c 
b/arch/powerpc/platforms/powernv/pci-ioda.c
+index 930e1fe78214..f077513bed97 100644
+--- a/arch/powerpc/platforms/powernv/pci-ioda.c
++++ b/arch/powerpc/platforms/powernv/pci-ioda.c
+@@ -792,7 +792,6 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, 
struct pci_dev *dev,
+                                 unsigned int is_64, struct msi_msg *msg)
+ {
+       struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev);
+-      struct pci_dn *pdn = pci_get_pdn(dev);
+       struct irq_data *idata;
+       struct irq_chip *ichip;
+       unsigned int xive_num = hwirq - phb->msi_base;
+@@ -809,7 +808,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, 
struct pci_dev *dev,
+               return -ENXIO;
+ 
+       /* Force 32-bit MSI on some broken devices */
+-      if (pdn && pdn->force_32bit_msi)
++      if (dev->no_64bit_msi)
+               is_64 = 0;
+ 
+       /* Assign XIVE to PE */
+diff --git a/arch/powerpc/platforms/powernv/pci.c 
b/arch/powerpc/platforms/powernv/pci.c
+index a28d3b5e6393..7dcf8628f626 100644
+--- a/arch/powerpc/platforms/powernv/pci.c
++++ b/arch/powerpc/platforms/powernv/pci.c
+@@ -1,3 +1,4 @@
++
+ /*
+  * Support PCI/PCIe on PowerNV platforms
+  *
+@@ -50,9 +51,8 @@ static int pnv_msi_check_device(struct pci_dev* pdev, int 
nvec, int type)
+ {
+       struct pci_controller *hose = pci_bus_to_host(pdev->bus);
+       struct pnv_phb *phb = hose->private_data;
+-      struct pci_dn *pdn = pci_get_pdn(pdev);
+ 
+-      if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
++      if (pdev->no_64bit_msi && !phb->msi32_support)
+               return -ENODEV;
+ 
+       return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV;
+diff --git a/arch/powerpc/platforms/pseries/msi.c 
b/arch/powerpc/platforms/pseries/msi.c
+index 6d2f0abce6fa..3b350fb91285 100644
+--- a/arch/powerpc/platforms/pseries/msi.c
++++ b/arch/powerpc/platforms/pseries/msi.c
+@@ -426,7 +426,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int 
nvec_in, int type)
+        */
+ again:
+       if (type == PCI_CAP_ID_MSI) {
+-              if (pdn->force_32bit_msi) {
++              if (pdev->no_64bit_msi) {
+                       rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec);
+                       if (rc < 0) {
+                               /*
+diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
+index af9d3469fb99..489820356f2d 100644
+--- a/arch/powerpc/xmon/xmon.c
++++ b/arch/powerpc/xmon/xmon.c
+@@ -288,10 +288,10 @@ static inline void disable_surveillance(void)
+       args.token = rtas_token("set-indicator");
+       if (args.token == RTAS_UNKNOWN_SERVICE)
+               return;
+-      args.nargs = 3;
+-      args.nret = 1;
++      args.nargs = cpu_to_be32(3);
++      args.nret = cpu_to_be32(1);
+       args.rets = &args.args[3];
+-      args.args[0] = SURVEILLANCE_TOKEN;
++      args.args[0] = cpu_to_be32(SURVEILLANCE_TOKEN);
+       args.args[1] = 0;
+       args.args[2] = 0;
+       enter_rtas(__pa(&args));
+diff --git a/arch/x86/include/asm/page_32_types.h 
b/arch/x86/include/asm/page_32_types.h
+index f48b17df4224..3a52ee0e726d 100644
+--- a/arch/x86/include/asm/page_32_types.h
++++ b/arch/x86/include/asm/page_32_types.h
+@@ -20,7 +20,6 @@
+ #define THREAD_SIZE_ORDER     1
+ #define THREAD_SIZE           (PAGE_SIZE << THREAD_SIZE_ORDER)
+ 
+-#define STACKFAULT_STACK 0
+ #define DOUBLEFAULT_STACK 1
+ #define NMI_STACK 0
+ #define DEBUG_STACK 0
+diff --git a/arch/x86/include/asm/page_64_types.h 
b/arch/x86/include/asm/page_64_types.h
+index 43dcd804ebd5..d1d2972a54db 100644
+--- a/arch/x86/include/asm/page_64_types.h
++++ b/arch/x86/include/asm/page_64_types.h
+@@ -14,12 +14,11 @@
+ #define IRQ_STACK_ORDER 2
+ #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER)
+ 
+-#define STACKFAULT_STACK 1
+-#define DOUBLEFAULT_STACK 2
+-#define NMI_STACK 3
+-#define DEBUG_STACK 4
+-#define MCE_STACK 5
+-#define N_EXCEPTION_STACKS 5  /* hw limit: 7 */
++#define DOUBLEFAULT_STACK 1
++#define NMI_STACK 2
++#define DEBUG_STACK 3
++#define MCE_STACK 4
++#define N_EXCEPTION_STACKS 4  /* hw limit: 7 */
+ 
+ #define PUD_PAGE_SIZE         (_AC(1, UL) << PUD_SHIFT)
+ #define PUD_PAGE_MASK         (~(PUD_PAGE_SIZE-1))
+diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
+index 27811190cbd7..bbbac9207419 100644
+--- a/arch/x86/include/asm/thread_info.h
++++ b/arch/x86/include/asm/thread_info.h
+@@ -145,7 +145,7 @@ struct thread_info {
+ /* Only used for 64 bit */
+ #define _TIF_DO_NOTIFY_MASK                                           \
+       (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME |       \
+-       _TIF_USER_RETURN_NOTIFY)
++       _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE)
+ 
+ /* flags to check in __switch_to() */
+ #define _TIF_WORK_CTXSW                                                       
\
+diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
+index d5f63dacf030..00cc6f79615d 100644
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -144,6 +144,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
+ 
+ static int __init x86_xsave_setup(char *s)
+ {
++      if (strlen(s))
++              return 0;
+       setup_clear_cpu_cap(X86_FEATURE_XSAVE);
+       setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
+       setup_clear_cpu_cap(X86_FEATURE_AVX);
+diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
+index addb207dab92..66e274a3d968 100644
+--- a/arch/x86/kernel/dumpstack_64.c
++++ b/arch/x86/kernel/dumpstack_64.c
+@@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = {
+               [ DEBUG_STACK-1                 ]       = "#DB",
+               [ NMI_STACK-1                   ]       = "NMI",
+               [ DOUBLEFAULT_STACK-1           ]       = "#DF",
+-              [ STACKFAULT_STACK-1            ]       = "#SS",
+               [ MCE_STACK-1                   ]       = "#MC",
+ #if DEBUG_STKSZ > EXCEPTION_STKSZ
+               [ N_EXCEPTION_STACKS ...
+diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
+index 207da8d92f75..e96560628571 100644
+--- a/arch/x86/kernel/entry_64.S
++++ b/arch/x86/kernel/entry_64.S
+@@ -1053,9 +1053,15 @@ ENTRY(native_iret)
+       jnz native_irq_return_ldt
+ #endif
+ 
++.global native_irq_return_iret
+ native_irq_return_iret:
++      /*
++       * This may fault.  Non-paranoid faults on return to userspace are
++       * handled by fixup_bad_iret.  These include #SS, #GP, and #NP.
++       * Double-faults due to espfix64 are handled in do_double_fault.
++       * Other faults here are fatal.
++       */
+       iretq
+-      _ASM_EXTABLE(native_irq_return_iret, bad_iret)
+ 
+ #ifdef CONFIG_X86_ESPFIX64
+ native_irq_return_ldt:
+@@ -1083,25 +1089,6 @@ native_irq_return_ldt:
+       jmp native_irq_return_iret
+ #endif
+ 
+-      .section .fixup,"ax"
+-bad_iret:
+-      /*
+-       * The iret traps when the %cs or %ss being restored is bogus.
+-       * We've lost the original trap vector and error code.
+-       * #GPF is the most likely one to get for an invalid selector.
+-       * So pretend we completed the iret and took the #GPF in user mode.
+-       *
+-       * We are now running with the kernel GS after exception recovery.
+-       * But error_entry expects us to have user GS to match the user %cs,
+-       * so swap back.
+-       */
+-      pushq $0
+-
+-      SWAPGS
+-      jmp general_protection
+-
+-      .previous
+-
+       /* edi: workmask, edx: work */
+ retint_careful:
+       CFI_RESTORE_STATE
+@@ -1149,37 +1136,6 @@ ENTRY(retint_kernel)
+       CFI_ENDPROC
+ END(common_interrupt)
+ 
+-      /*
+-       * If IRET takes a fault on the espfix stack, then we
+-       * end up promoting it to a doublefault.  In that case,
+-       * modify the stack to make it look like we just entered
+-       * the #GP handler from user space, similar to bad_iret.
+-       */
+-#ifdef CONFIG_X86_ESPFIX64
+-      ALIGN
+-__do_double_fault:
+-      XCPT_FRAME 1 RDI+8
+-      movq RSP(%rdi),%rax             /* Trap on the espfix stack? */
+-      sarq $PGDIR_SHIFT,%rax
+-      cmpl $ESPFIX_PGD_ENTRY,%eax
+-      jne do_double_fault             /* No, just deliver the fault */
+-      cmpl $__KERNEL_CS,CS(%rdi)
+-      jne do_double_fault
+-      movq RIP(%rdi),%rax
+-      cmpq $native_irq_return_iret,%rax
+-      jne do_double_fault             /* This shouldn't happen... */
+-      movq PER_CPU_VAR(kernel_stack),%rax
+-      subq $(6*8-KERNEL_STACK_OFFSET),%rax    /* Reset to original stack */
+-      movq %rax,RSP(%rdi)
+-      movq $0,(%rax)                  /* Missing (lost) #GP error code */
+-      movq $general_protection,RIP(%rdi)
+-      retq
+-      CFI_ENDPROC
+-END(__do_double_fault)
+-#else
+-# define __do_double_fault do_double_fault
+-#endif
+-
+ /*
+  * End of kprobes section
+  */
+@@ -1370,7 +1326,7 @@ zeroentry overflow do_overflow
+ zeroentry bounds do_bounds
+ zeroentry invalid_op do_invalid_op
+ zeroentry device_not_available do_device_not_available
+-paranoiderrorentry double_fault __do_double_fault
++paranoiderrorentry double_fault do_double_fault
+ zeroentry coprocessor_segment_overrun do_coprocessor_segment_overrun
+ errorentry invalid_TSS do_invalid_TSS
+ errorentry segment_not_present do_segment_not_present
+@@ -1540,7 +1496,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
+ 
+ paranoidzeroentry_ist debug do_debug DEBUG_STACK
+ paranoidzeroentry_ist int3 do_int3 DEBUG_STACK
+-paranoiderrorentry stack_segment do_stack_segment
++errorentry stack_segment do_stack_segment
+ #ifdef CONFIG_XEN
+ zeroentry xen_debug do_debug
+ zeroentry xen_int3 do_int3
+@@ -1650,16 +1606,15 @@ error_sti:
+ 
+ /*
+  * There are two places in the kernel that can potentially fault with
+- * usergs. Handle them here. The exception handlers after iret run with
+- * kernel gs again, so don't set the user space flag. B stepping K8s
+- * sometimes report an truncated RIP for IRET exceptions returning to
+- * compat mode. Check for these here too.
++ * usergs. Handle them here.  B stepping K8s sometimes report a
++ * truncated RIP for IRET exceptions returning to compat mode. Check
++ * for these here too.
+  */
+ error_kernelspace:
+       incl %ebx
+       leaq native_irq_return_iret(%rip),%rcx
+       cmpq %rcx,RIP+8(%rsp)
+-      je error_swapgs
++      je error_bad_iret
+       movl %ecx,%eax  /* zero extend */
+       cmpq %rax,RIP+8(%rsp)
+       je bstep_iret
+@@ -1670,7 +1625,15 @@ error_kernelspace:
+ bstep_iret:
+       /* Fix truncated RIP */
+       movq %rcx,RIP+8(%rsp)
+-      jmp error_swapgs
++      /* fall through */
++
++error_bad_iret:
++      SWAPGS
++      mov %rsp,%rdi
++      call fixup_bad_iret
++      mov %rax,%rsp
++      decl %ebx       /* Return to usergs */
++      jmp error_sti
+       CFI_ENDPROC
+ END(error_entry)
+ 
+diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
+index 8c8093b146ca..5739ab5359a3 100644
+--- a/arch/x86/kernel/traps.c
++++ b/arch/x86/kernel/traps.c
+@@ -221,33 +221,41 @@ DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment 
overrun",
+               coprocessor_segment_overrun)
+ DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS)
+ DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present)
+-#ifdef CONFIG_X86_32
+ DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment)
+-#endif
+ DO_ERROR_INFO(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check,
+               BUS_ADRALN, 0)
+ 
+ #ifdef CONFIG_X86_64
+ /* Runs on IST stack */
+-dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)
+-{
+-      enum ctx_state prev_state;
+-
+-      prev_state = exception_enter();
+-      if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
+-                     X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) {
+-              preempt_conditional_sti(regs);
+-              do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, 
NULL);
+-              preempt_conditional_cli(regs);
+-      }
+-      exception_exit(prev_state);
+-}
+-
+ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
+ {
+       static const char str[] = "double fault";
+       struct task_struct *tsk = current;
+ 
++#ifdef CONFIG_X86_ESPFIX64
++      extern unsigned char native_irq_return_iret[];
++
++      /*
++       * If IRET takes a non-IST fault on the espfix64 stack, then we
++       * end up promoting it to a doublefault.  In that case, modify
++       * the stack to make it look like we just entered the #GP
++       * handler from user space, similar to bad_iret.
++       */
++      if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY &&
++              regs->cs == __KERNEL_CS &&
++              regs->ip == (unsigned long)native_irq_return_iret)
++      {
++              struct pt_regs *normal_regs = task_pt_regs(current);
++
++              /* Fake a #GP(0) from userspace. */
++              memmove(&normal_regs->ip, (void *)regs->sp, 5*8);
++              normal_regs->orig_ax = 0;  /* Missing (lost) #GP error code */
++              regs->ip = (unsigned long)general_protection;
++              regs->sp = (unsigned long)&normal_regs->orig_ax;
++              return;
++      }
++#endif
++
+       exception_enter();
+       /* Return not checked because double check cannot be ignored */
+       notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);
+@@ -380,6 +388,35 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct 
pt_regs *eregs)
+               *regs = *eregs;
+       return regs;
+ }
++
++struct bad_iret_stack {
++      void *error_entry_ret;
++      struct pt_regs regs;
++};
++
++asmlinkage __visible
++struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
++{
++      /*
++       * This is called from entry_64.S early in handling a fault
++       * caused by a bad iret to user mode.  To handle the fault
++       * correctly, we want move our stack frame to task_pt_regs
++       * and we want to pretend that the exception came from the
++       * iret target.
++       */
++      struct bad_iret_stack *new_stack =
++              container_of(task_pt_regs(current),
++                           struct bad_iret_stack, regs);
++
++      /* Copy the IRET target to the new stack. */
++      memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8);
++
++      /* Copy the remainder of the stack from the current stack. */
++      memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip));
++
++      BUG_ON(!user_mode_vm(&new_stack->regs));
++      return new_stack;
++}
+ #endif
+ 
+ /*
+@@ -752,7 +789,7 @@ void __init trap_init(void)
+       set_intr_gate(X86_TRAP_OLD_MF, &coprocessor_segment_overrun);
+       set_intr_gate(X86_TRAP_TS, &invalid_TSS);
+       set_intr_gate(X86_TRAP_NP, &segment_not_present);
+-      set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK);
++      set_intr_gate(X86_TRAP_SS, stack_segment);
+       set_intr_gate(X86_TRAP_GP, &general_protection);
+       set_intr_gate(X86_TRAP_SPURIOUS, &spurious_interrupt_bug);
+       set_intr_gate(X86_TRAP_MF, &coprocessor_error);
+diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
+index 104d56a9245f..b599241aea81 100644
+--- a/arch/x86/mm/init_64.c
++++ b/arch/x86/mm/init_64.c
+@@ -1110,7 +1110,7 @@ void mark_rodata_ro(void)
+       unsigned long end = (unsigned long) &__end_rodata_hpage_align;
+       unsigned long text_end = PFN_ALIGN(&__stop___ex_table);
+       unsigned long rodata_end = PFN_ALIGN(&__end_rodata);
+-      unsigned long all_end = PFN_ALIGN(&_end);
++      unsigned long all_end;
+ 
+       printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
+              (end - start) >> 10);
+@@ -1121,7 +1121,16 @@ void mark_rodata_ro(void)
+       /*
+        * The rodata/data/bss/brk section (but not the kernel text!)
+        * should also be not-executable.
++       *
++       * We align all_end to PMD_SIZE because the existing mapping
++       * is a full PMD. If we would align _brk_end to PAGE_SIZE we
++       * split the PMD and the reminder between _brk_end and the end
++       * of the PMD will remain mapped executable.
++       *
++       * Any PMD which was setup after the one which covers _brk_end
++       * has been zapped already via cleanup_highmem().
+        */
++      all_end = roundup((unsigned long)_brk_end, PMD_SIZE);
+       set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT);
+ 
+       rodata_test();
+diff --git a/drivers/clocksource/sun4i_timer.c 
b/drivers/clocksource/sun4i_timer.c
+index 8ead0258740a..4fe6ac85ea1d 100644
+--- a/drivers/clocksource/sun4i_timer.c
++++ b/drivers/clocksource/sun4i_timer.c
+@@ -177,6 +177,11 @@ static void __init sun4i_timer_init(struct device_node 
*node)
+       writel(TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
+              timer_base + TIMER_CTL_REG(0));
+ 
++      sun4i_clockevent.cpumask = cpumask_of(0);
++
++      clockevents_config_and_register(&sun4i_clockevent, rate, 0x1,
++                                      0xffffffff);
++
+       ret = setup_irq(irq, &sun4i_timer_irq);
+       if (ret)
+               pr_warn("failed to setup irq %d\n", irq);
+@@ -184,11 +189,6 @@ static void __init sun4i_timer_init(struct device_node 
*node)
+       /* Enable timer0 interrupt */
+       val = readl(timer_base + TIMER_IRQ_EN_REG);
+       writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG);
+-
+-      sun4i_clockevent.cpumask = cpumask_of(0);
+-
+-      clockevents_config_and_register(&sun4i_clockevent, rate, 0x1,
+-                                      0xffffffff);
+ }
+ CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-timer",
+                      sun4i_timer_init);
+diff --git a/drivers/gpu/drm/radeon/r600_dpm.c 
b/drivers/gpu/drm/radeon/r600_dpm.c
+index 2df683aab9e9..cc4258a853fd 100644
+--- a/drivers/gpu/drm/radeon/r600_dpm.c
++++ b/drivers/gpu/drm/radeon/r600_dpm.c
+@@ -1193,7 +1193,7 @@ int r600_parse_extended_power_table(struct radeon_device 
*rdev)
+                                       (mode_info->atom_context->bios + 
data_offset +
+                                        
le16_to_cpu(ext_hdr->usPowerTuneTableOffset));
+                               
rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit =
+-                                      ppt->usMaximumPowerDeliveryLimit;
++                                      
le16_to_cpu(ppt->usMaximumPowerDeliveryLimit);
+                               pt = &ppt->power_tune_table;
+                       } else {
+                               ATOM_PPLIB_POWERTUNE_Table *ppt = 
(ATOM_PPLIB_POWERTUNE_Table *)
+diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c 
b/drivers/gpu/drm/radeon/radeon_irq_kms.c
+index cc9e8482cf30..a1a843058369 100644
+--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
++++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
+@@ -196,6 +196,16 @@ static bool radeon_msi_ok(struct radeon_device *rdev)
+       if (rdev->flags & RADEON_IS_AGP)
+               return false;
+ 
++      /*
++       * Older chips have a HW limitation, they can only generate 40 bits
++       * of address for "64-bit" MSIs which breaks on some platforms, notably
++       * IBM POWER servers, so we limit them
++       */
++      if (rdev->family < CHIP_BONAIRE) {
++              dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n");
++              rdev->pdev->no_64bit_msi = 1;
++      }
++
+       /* force MSI on */
+       if (radeon_msi == 1)
+               return true;
+diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
+index 4c2b42bf6cde..7fb89a46d864 100644
+--- a/drivers/infiniband/ulp/isert/ib_isert.c
++++ b/drivers/infiniband/ulp/isert/ib_isert.c
+@@ -111,9 +111,12 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct 
rdma_cm_id *cma_id)
+       attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS;
+       /*
+        * FIXME: Use devattr.max_sge - 2 for max_send_sge as
+-       * work-around for RDMA_READ..
++       * work-around for RDMA_READs with ConnectX-2.
++       *
++       * Also, still make sure to have at least two SGEs for
++       * outgoing control PDU responses.
+        */
+-      attr.cap.max_send_sge = device->dev_attr.max_sge - 2;
++      attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2);
+       isert_conn->max_sge = attr.cap.max_send_sge;
+ 
+       attr.cap.max_recv_sge = 1;
+@@ -219,12 +222,16 @@ isert_create_device_ib_res(struct isert_device *device)
+       struct isert_cq_desc *cq_desc;
+       struct ib_device_attr *dev_attr;
+       int ret = 0, i, j;
++      int max_rx_cqe, max_tx_cqe;
+ 
+       dev_attr = &device->dev_attr;
+       ret = isert_query_device(ib_dev, dev_attr);
+       if (ret)
+               return ret;
+ 
++      max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr->max_cqe);
++      max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr->max_cqe);
++
+       /* asign function handlers */
+       if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) {
+               device->use_frwr = 1;
+@@ -266,7 +273,7 @@ isert_create_device_ib_res(struct isert_device *device)
+                                               isert_cq_rx_callback,
+                                               isert_cq_event_callback,
+                                               (void *)&cq_desc[i],
+-                                              ISER_MAX_RX_CQ_LEN, i);
++                                              max_rx_cqe, i);
+               if (IS_ERR(device->dev_rx_cq[i])) {
+                       ret = PTR_ERR(device->dev_rx_cq[i]);
+                       device->dev_rx_cq[i] = NULL;
+@@ -278,7 +285,7 @@ isert_create_device_ib_res(struct isert_device *device)
+                                               isert_cq_tx_callback,
+                                               isert_cq_event_callback,
+                                               (void *)&cq_desc[i],
+-                                              ISER_MAX_TX_CQ_LEN, i);
++                                              max_tx_cqe, i);
+               if (IS_ERR(device->dev_tx_cq[i])) {
+                       ret = PTR_ERR(device->dev_tx_cq[i]);
+                       device->dev_tx_cq[i] = NULL;
+@@ -701,14 +708,25 @@ wake_up:
+       complete(&isert_conn->conn_wait);
+ }
+ 
+-static void
++static int
+ isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect)
+ {
+-      struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context;
++      struct isert_conn *isert_conn;
++
++      if (!cma_id->qp) {
++              struct isert_np *isert_np = cma_id->context;
++
++              isert_np->np_cm_id = NULL;
++              return -1;
++      }
++
++      isert_conn = (struct isert_conn *)cma_id->context;
+ 
+       isert_conn->disconnect = disconnect;
+       INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work);
+       schedule_work(&isert_conn->conn_logout_work);
++
++      return 0;
+ }
+ 
+ static int
+@@ -723,6 +741,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct 
rdma_cm_event *event)
+       switch (event->event) {
+       case RDMA_CM_EVENT_CONNECT_REQUEST:
+               ret = isert_connect_request(cma_id, event);
++              if (ret)
++                      pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x 
%d\n",
++                              event->event, ret);
+               break;
+       case RDMA_CM_EVENT_ESTABLISHED:
+               isert_connected_handler(cma_id);
+@@ -732,7 +753,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct 
rdma_cm_event *event)
+       case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */
+               disconnect = true;
+       case RDMA_CM_EVENT_TIMEWAIT_EXIT:  /* FALLTHRU */
+-              isert_disconnected_handler(cma_id, disconnect);
++              ret = isert_disconnected_handler(cma_id, disconnect);
+               break;
+       case RDMA_CM_EVENT_CONNECT_ERROR:
+       default:
+@@ -740,12 +761,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct 
rdma_cm_event *event)
+               break;
+       }
+ 
+-      if (ret != 0) {
+-              pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n",
+-                     event->event, ret);
+-              dump_stack();
+-      }
+-
+       return ret;
+ }
+ 
+@@ -2676,7 +2691,8 @@ isert_free_np(struct iscsi_np *np)
+ {
+       struct isert_np *isert_np = (struct isert_np *)np->np_context;
+ 
+-      rdma_destroy_id(isert_np->np_cm_id);
++      if (isert_np->np_cm_id)
++              rdma_destroy_id(isert_np->np_cm_id);
+ 
+       np->np_context = NULL;
+       kfree(isert_np);
+diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c 
b/drivers/infiniband/ulp/srpt/ib_srpt.c
+index 56f2cf790779..1ed08cc2e190 100644
+--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
+@@ -2101,6 +2101,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
+       if (!qp_init)
+               goto out;
+ 
++retry:
+       ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
+                             ch->rq_size + srp_sq_size, 0);
+       if (IS_ERR(ch->cq)) {
+@@ -2124,6 +2125,13 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
+       ch->qp = ib_create_qp(sdev->pd, qp_init);
+       if (IS_ERR(ch->qp)) {
+               ret = PTR_ERR(ch->qp);
++              if (ret == -ENOMEM) {
++                      srp_sq_size /= 2;
++                      if (srp_sq_size >= MIN_SRPT_SQ_SIZE) {
++                              ib_destroy_cq(ch->cq);
++                              goto retry;
++                      }
++              }
+               printk(KERN_ERR "failed to create_qp ret= %d\n", ret);
+               goto err_destroy_cq;
+       }
+diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
+index 7b717d8b6897..90c7f97ea0ad 100644
+--- a/drivers/input/joystick/xpad.c
++++ b/drivers/input/joystick/xpad.c
+@@ -1039,9 +1039,19 @@ static int xpad_probe(struct usb_interface *intf, const 
struct usb_device_id *id
+               }
+ 
+               ep_irq_in = &intf->cur_altsetting->endpoint[1].desc;
+-              usb_fill_bulk_urb(xpad->bulk_out, udev,
+-                              usb_sndbulkpipe(udev, 
ep_irq_in->bEndpointAddress),
+-                              xpad->bdata, XPAD_PKT_LEN, xpad_bulk_out, xpad);
++              if (usb_endpoint_is_bulk_out(ep_irq_in)) {
++                      usb_fill_bulk_urb(xpad->bulk_out, udev,
++                                        usb_sndbulkpipe(udev,
++                                                        
ep_irq_in->bEndpointAddress),
++                                        xpad->bdata, XPAD_PKT_LEN,
++                                        xpad_bulk_out, xpad);
++              } else {
++                      usb_fill_int_urb(xpad->bulk_out, udev,
++                                       usb_sndintpipe(udev,
++                                                      
ep_irq_in->bEndpointAddress),
++                                       xpad->bdata, XPAD_PKT_LEN,
++                                       xpad_bulk_out, xpad, 0);
++              }
+ 
+               /*
+                * Submit the int URB immediately rather than waiting for open
+diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
+index 4b7996ebd150..a3769cf84381 100644
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -117,6 +117,87 @@ void synaptics_reset(struct psmouse *psmouse)
+ }
+ 
+ #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
++struct min_max_quirk {
++      const char * const *pnp_ids;
++      int x_min, x_max, y_min, y_max;
++};
++
++static const struct min_max_quirk min_max_pnpid_table[] = {
++      {
++              (const char * const []){"LEN0033", NULL},
++              1024, 5052, 2258, 4832
++      },
++      {
++              (const char * const []){"LEN0035", "LEN0042", NULL},
++              1232, 5710, 1156, 4696
++      },
++      {
++              (const char * const []){"LEN0034", "LEN0036", "LEN0039",
++                                      "LEN2002", "LEN2004", NULL},
++              1024, 5112, 2024, 4832
++      },
++      {
++              (const char * const []){"LEN2001", NULL},
++              1024, 5022, 2508, 4832
++      },
++      {
++              (const char * const []){"LEN2006", NULL},
++              1264, 5675, 1171, 4688
++      },
++      { }
++};
++
++/* This list has been kindly provided by Synaptics. */
++static const char * const topbuttonpad_pnp_ids[] = {
++      "LEN0017",
++      "LEN0018",
++      "LEN0019",
++      "LEN0023",
++      "LEN002A",
++      "LEN002B",
++      "LEN002C",
++      "LEN002D",
++      "LEN002E",
++      "LEN0033", /* Helix */
++      "LEN0034", /* T431s, L440, L540, T540, W540, X1 Carbon 2nd */
++      "LEN0035", /* X240 */
++      "LEN0036", /* T440 */
++      "LEN0037",
++      "LEN0038",
++      "LEN0039", /* T440s */
++      "LEN0041",
++      "LEN0042", /* Yoga */
++      "LEN0045",
++      "LEN0046",
++      "LEN0047",
++      "LEN0048",
++      "LEN0049",
++      "LEN2000",
++      "LEN2001", /* Edge E431 */
++      "LEN2002", /* Edge E531 */
++      "LEN2003",
++      "LEN2004", /* L440 */
++      "LEN2005",
++      "LEN2006",
++      "LEN2007",
++      "LEN2008",
++      "LEN2009",
++      "LEN200A",
++      "LEN200B",
++      NULL
++};
++
++static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
++{
++      int i;
++
++      if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
++              for (i = 0; ids[i]; i++)
++                      if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
++                              return true;
++
++      return false;
++}
+ 
+ /*****************************************************************************
+  *    Synaptics communications functions
+@@ -266,20 +347,11 @@ static int synaptics_identify(struct psmouse *psmouse)
+  * Resolution is left zero if touchpad does not support the query
+  */
+ 
+-static const int *quirk_min_max;
+-
+ static int synaptics_resolution(struct psmouse *psmouse)
+ {
+       struct synaptics_data *priv = psmouse->private;
+       unsigned char resp[3];
+-
+-      if (quirk_min_max) {
+-              priv->x_min = quirk_min_max[0];
+-              priv->x_max = quirk_min_max[1];
+-              priv->y_min = quirk_min_max[2];
+-              priv->y_max = quirk_min_max[3];
+-              return 0;
+-      }
++      int i;
+ 
+       if (SYN_ID_MAJOR(priv->identity) < 4)
+               return 0;
+@@ -291,6 +363,16 @@ static int synaptics_resolution(struct psmouse *psmouse)
+               }
+       }
+ 
++      for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
++              if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
++                      priv->x_min = min_max_pnpid_table[i].x_min;
++                      priv->x_max = min_max_pnpid_table[i].x_max;
++                      priv->y_min = min_max_pnpid_table[i].y_min;
++                      priv->y_max = min_max_pnpid_table[i].y_max;
++                      return 0;
++              }
++      }
++
+       if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
+           SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
+               if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
+@@ -1291,8 +1373,10 @@ static void set_abs_position_params(struct input_dev 
*dev,
+       input_abs_set_res(dev, y_code, priv->y_res);
+ }
+ 
+-static void set_input_params(struct input_dev *dev, struct synaptics_data 
*priv)
++static void set_input_params(struct psmouse *psmouse,
++                           struct synaptics_data *priv)
+ {
++      struct input_dev *dev = psmouse->dev;
+       int i;
+ 
+       /* Things that apply to both modes */
+@@ -1361,6 +1445,8 @@ static void set_input_params(struct input_dev *dev, 
struct synaptics_data *priv)
+ 
+       if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
+               __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
++              if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
++                      __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
+               /* Clickpads report only left button */
+               __clear_bit(BTN_RIGHT, dev->keybit);
+               __clear_bit(BTN_MIDDLE, dev->keybit);
+@@ -1532,112 +1618,10 @@ static const struct dmi_system_id olpc_dmi_table[] 
__initconst = {
+       { }
+ };
+ 
+-static const struct dmi_system_id min_max_dmi_table[] __initconst = {
+-#if defined(CONFIG_DMI)
+-      {
+-              /* Lenovo ThinkPad Helix */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
+-              },
+-              .driver_data = (int []){1024, 5052, 2258, 4832},
+-      },
+-      {
+-              /* Lenovo ThinkPad X240 */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
+-              },
+-              .driver_data = (int []){1232, 5710, 1156, 4696},
+-      },
+-      {
+-              /* Lenovo ThinkPad Edge E431 */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"),
+-              },
+-              .driver_data = (int []){1024, 5022, 2508, 4832},
+-      },
+-      {
+-              /* Lenovo ThinkPad T431s */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"),
+-              },
+-              .driver_data = (int []){1024, 5112, 2024, 4832},
+-      },
+-      {
+-              /* Lenovo ThinkPad T440s */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
+-              },
+-              .driver_data = (int []){1024, 5112, 2024, 4832},
+-      },
+-      {
+-              /* Lenovo ThinkPad L440 */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"),
+-              },
+-              .driver_data = (int []){1024, 5112, 2024, 4832},
+-      },
+-      {
+-              /* Lenovo ThinkPad T540p */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
+-              },
+-              .driver_data = (int []){1024, 5112, 2024, 4832},
+-      },
+-      {
+-              /* Lenovo ThinkPad L540 */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"),
+-              },
+-              .driver_data = (int []){1024, 5112, 2024, 4832},
+-      },
+-      {
+-              /* Lenovo ThinkPad W540 */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W540"),
+-              },
+-              .driver_data = (int []){1024, 5112, 2024, 4832},
+-      },
+-      {
+-              /* Lenovo Yoga S1 */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
+-                                      "ThinkPad S1 Yoga"),
+-              },
+-              .driver_data = (int []){1232, 5710, 1156, 4696},
+-      },
+-      {
+-              /* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+-                      DMI_MATCH(DMI_PRODUCT_VERSION,
+-                                      "ThinkPad X1 Carbon 2nd"),
+-              },
+-              .driver_data = (int []){1024, 5112, 2024, 4832},
+-      },
+-#endif
+-      { }
+-};
+-
+ void __init synaptics_module_init(void)
+ {
+-      const struct dmi_system_id *min_max_dmi;
+-
+       impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
+       broken_olpc_ec = dmi_check_system(olpc_dmi_table);
+-
+-      min_max_dmi = dmi_first_match(min_max_dmi_table);
+-      if (min_max_dmi)
+-              quirk_min_max = min_max_dmi->driver_data;
+ }
+ 
+ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
+@@ -1687,7 +1671,7 @@ static int __synaptics_init(struct psmouse *psmouse, 
bool absolute_mode)
+                    priv->capabilities, priv->ext_cap, priv->ext_cap_0c,
+                    priv->board_id, priv->firmware_id);
+ 
+-      set_input_params(psmouse->dev, priv);
++      set_input_params(psmouse, priv);
+ 
+       /*
+        * Encode touchpad model so that it can be used to set
+diff --git a/drivers/input/serio/i8042-x86ia64io.h 
b/drivers/input/serio/i8042-x86ia64io.h
+index 2b888f1e6421..a4ac027637b9 100644
+--- a/drivers/input/serio/i8042-x86ia64io.h
++++ b/drivers/input/serio/i8042-x86ia64io.h
+@@ -746,6 +746,17 @@ static int i8042_pnp_aux_irq;
+ static char i8042_pnp_kbd_name[32];
+ static char i8042_pnp_aux_name[32];
+ 
++static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size)
++{
++      strlcpy(dst, "PNP:", dst_size);
++
++      while (id) {
++              strlcat(dst, " ", dst_size);
++              strlcat(dst, id->id, dst_size);
++              id = id->next;
++      }
++}
++
+ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct 
pnp_device_id *did)
+ {
+       if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1)
+@@ -762,6 +773,8 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const 
struct pnp_device_id *
+               strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name));
+               strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), 
sizeof(i8042_pnp_kbd_name));
+       }
++      i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id,
++                             sizeof(i8042_kbd_firmware_id));
+ 
+       /* Keyboard ports are always supposed to be wakeup-enabled */
+       device_set_wakeup_enable(&dev->dev, true);
+@@ -786,6 +799,8 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const 
struct pnp_device_id *
+               strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name));
+               strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), 
sizeof(i8042_pnp_aux_name));
+       }
++      i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id,
++                             sizeof(i8042_aux_firmware_id));
+ 
+       i8042_pnp_aux_devices++;
+       return 0;
+diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
+index 52c9ebf94729..03ab163857dd 100644
+--- a/drivers/input/serio/i8042.c
++++ b/drivers/input/serio/i8042.c
+@@ -87,6 +87,8 @@ MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and 
off");
+ #endif
+ 
+ static bool i8042_bypass_aux_irq_test;
++static char i8042_kbd_firmware_id[128];
++static char i8042_aux_firmware_id[128];
+ 
+ #include "i8042.h"
+ 
+@@ -1218,6 +1220,8 @@ static int __init i8042_create_kbd_port(void)
+       serio->dev.parent       = &i8042_platform_device->dev;
+       strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name));
+       strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys));
++      strlcpy(serio->firmware_id, i8042_kbd_firmware_id,
++              sizeof(serio->firmware_id));
+ 
+       port->serio = serio;
+       port->irq = I8042_KBD_IRQ;
+@@ -1244,6 +1248,8 @@ static int __init i8042_create_aux_port(int idx)
+       if (idx < 0) {
+               strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name));
+               strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys));
++              strlcpy(serio->firmware_id, i8042_aux_firmware_id,
++                      sizeof(serio->firmware_id));
+               serio->close = i8042_port_close;
+       } else {
+               snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", 
idx);
+diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
+index de019ebb7e29..fffc0a69c6ff 100644
+--- a/drivers/input/serio/serio.c
++++ b/drivers/input/serio/serio.c
+@@ -474,11 +474,19 @@ static ssize_t serio_set_bind_mode(struct device *dev, 
struct device_attribute *
+       return retval;
+ }
+ 
++static ssize_t firmware_id_show(struct device *dev, struct device_attribute 
*attr, char *buf)
++{
++      struct serio *serio = to_serio_port(dev);
++
++      return sprintf(buf, "%s\n", serio->firmware_id);
++}
++
+ static struct device_attribute serio_device_attrs[] = {
+       __ATTR(description, S_IRUGO, serio_show_description, NULL),
+       __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL),
+       __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
+       __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, 
serio_set_bind_mode),
++      __ATTR(firmware_id, S_IRUGO, firmware_id_show, NULL),
+       __ATTR_NULL
+ };
+ 
+@@ -912,9 +920,14 @@ static int serio_uevent(struct device *dev, struct 
kobj_uevent_env *env)
+       SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto);
+       SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id);
+       SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);
++
+       SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
+                               serio->id.type, serio->id.proto, serio->id.id, 
serio->id.extra);
+ 
++      if (serio->firmware_id[0])
++              SERIO_ADD_UEVENT_VAR("SERIO_FIRMWARE_ID=%s",
++                                   serio->firmware_id);
++
+       return 0;
+ }
+ #undef SERIO_ADD_UEVENT_VAR
+diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
+index 539239d8e9ab..9bf47a064cdf 100644
+--- a/drivers/net/can/dev.c
++++ b/drivers/net/can/dev.c
+@@ -385,7 +385,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned 
int idx)
+       BUG_ON(idx >= priv->echo_skb_max);
+ 
+       if (priv->echo_skb[idx]) {
+-              kfree_skb(priv->echo_skb[idx]);
++              dev_kfree_skb_any(priv->echo_skb[idx]);
+               priv->echo_skb[idx] = NULL;
+       }
+ }
+diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
+index ac6177d3befc..91654d09275f 100644
+--- a/drivers/net/can/usb/esd_usb2.c
++++ b/drivers/net/can/usb/esd_usb2.c
+@@ -1142,6 +1142,7 @@ static void esd_usb2_disconnect(struct usb_interface 
*intf)
+                       }
+               }
+               unlink_all_urbs(dev);
++              kfree(dev);
+       }
+ }
+ 
+diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c 
b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+index e897648d3233..5092343efd7d 100644
+--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+@@ -648,6 +648,19 @@ static void ar9003_hw_override_ini(struct ath_hw *ah)
+               else
+                       ah->enabled_cals &= ~TX_CL_CAL;
+       }
++
++      if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) {
++              if (ah->is_clk_25mhz) {
++                      REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
++                      REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
++                      REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae);
++              } else {
++                      REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
++                      REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
++                      REG_WRITE(ah, AR_SLP32_INC, 0x0001e800);
++              }
++              udelay(100);
++      }
+ }
+ 
+ static void ar9003_hw_prog_ini(struct ath_hw *ah,
+diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
+index 4e0a9429e192..c6f255f1c95e 100644
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -916,19 +916,6 @@ static void ath9k_hw_init_pll(struct ath_hw *ah,
+       udelay(RTC_PLL_SETTLE_DELAY);
+ 
+       REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK);
+-
+-      if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) {
+-              if (ah->is_clk_25mhz) {
+-                      REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
+-                      REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
+-                      REG_WRITE(ah,  AR_SLP32_INC, 0x0001e7ae);
+-              } else {
+-                      REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
+-                      REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
+-                      REG_WRITE(ah,  AR_SLP32_INC, 0x0001e800);
+-              }
+-              udelay(100);
+-      }
+ }
+ 
+ static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
+diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c 
b/drivers/net/wireless/rt2x00/rt2x00queue.c
+index 66a2db8c260d..e6182170e791 100644
+--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
++++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
+@@ -160,55 +160,29 @@ void rt2x00queue_align_frame(struct sk_buff *skb)
+       skb_trim(skb, frame_length);
+ }
+ 
+-void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length)
++/*
++ * H/W needs L2 padding between the header and the paylod if header size
++ * is not 4 bytes aligned.
++ */
++void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len)
+ {
+-      unsigned int payload_length = skb->len - header_length;
+-      unsigned int header_align = ALIGN_SIZE(skb, 0);
+-      unsigned int payload_align = ALIGN_SIZE(skb, header_length);
+-      unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0;
++      unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0;
+ 
+-      /*
+-       * Adjust the header alignment if the payload needs to be moved more
+-       * than the header.
+-       */
+-      if (payload_align > header_align)
+-              header_align += 4;
+-
+-      /* There is nothing to do if no alignment is needed */
+-      if (!header_align)
++      if (!l2pad)
+               return;
+ 
+-      /* Reserve the amount of space needed in front of the frame */
+-      skb_push(skb, header_align);
+-
+-      /*
+-       * Move the header.
+-       */
+-      memmove(skb->data, skb->data + header_align, header_length);
+-
+-      /* Move the payload, if present and if required */
+-      if (payload_length && payload_align)
+-              memmove(skb->data + header_length + l2pad,
+-                      skb->data + header_length + l2pad + payload_align,
+-                      payload_length);
+-
+-      /* Trim the skb to the correct size */
+-      skb_trim(skb, header_length + l2pad + payload_length);
++      skb_push(skb, l2pad);
++      memmove(skb->data, skb->data + l2pad, hdr_len);
+ }
+ 
+-void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length)
++void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len)
+ {
+-      /*
+-       * L2 padding is only present if the skb contains more than just the
+-       * IEEE 802.11 header.
+-       */
+-      unsigned int l2pad = (skb->len > header_length) ?
+-                              L2PAD_SIZE(header_length) : 0;
++      unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0;
+ 
+       if (!l2pad)
+               return;
+ 
+-      memmove(skb->data + l2pad, skb->data, header_length);
++      memmove(skb->data + l2pad, skb->data, hdr_len);
+       skb_pull(skb, l2pad);
+ }
+ 
+diff --git a/drivers/of/address.c b/drivers/of/address.c
+index 503b4e4cb551..f5582f3a06a4 100644
+--- a/drivers/of/address.c
++++ b/drivers/of/address.c
+@@ -401,6 +401,21 @@ static struct of_bus *of_match_bus(struct device_node *np)
+       return NULL;
+ }
+ 
++static int of_empty_ranges_quirk(void)
++{
++      if (IS_ENABLED(CONFIG_PPC)) {
++              /* To save cycles, we cache the result */
++              static int quirk_state = -1;
++
++              if (quirk_state < 0)
++                      quirk_state =
++                              of_machine_is_compatible("Power Macintosh") ||
++                              of_machine_is_compatible("MacRISC");
++              return quirk_state;
++      }
++      return false;
++}
++
+ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
+                           struct of_bus *pbus, __be32 *addr,
+                           int na, int ns, int pna, const char *rprop)
+@@ -426,12 +441,10 @@ static int of_translate_one(struct device_node *parent, 
struct of_bus *bus,
+        * This code is only enabled on powerpc. --gcl
+        */
+       ranges = of_get_property(parent, rprop, &rlen);
+-#if !defined(CONFIG_PPC)
+-      if (ranges == NULL) {
++      if (ranges == NULL && !of_empty_ranges_quirk()) {
+               pr_err("OF: no ranges; cannot translate\n");
+               return 1;
+       }
+-#endif /* !defined(CONFIG_PPC) */
+       if (ranges == NULL || rlen == 0) {
+               offset = of_read_number(addr, na);
+               memset(addr, 0, pna * 4);
+diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
+index d5f90d6383bc..89237c8eab1d 100644
+--- a/drivers/pci/msi.c
++++ b/drivers/pci/msi.c
+@@ -553,6 +553,20 @@ out_unroll:
+       return ret;
+ }
+ 
++static int msi_verify_entries(struct pci_dev *dev)
++{
++      struct msi_desc *entry;
++
++      list_for_each_entry(entry, &dev->msi_list, list) {
++              if (!dev->no_64bit_msi || !entry->msg.address_hi)
++                      continue;
++              dev_err(&dev->dev, "Device has broken 64-bit MSI but arch"
++                      " tried to assign one above 4G\n");
++              return -EIO;
++      }
++      return 0;
++}
++
+ /**
+  * msi_capability_init - configure device's MSI capability structure
+  * @dev: pointer to the pci_dev data structure of MSI device function
+@@ -606,6 +620,13 @@ static int msi_capability_init(struct pci_dev *dev, int 
nvec)
+               return ret;
+       }
+ 
++      ret = msi_verify_entries(dev);
++      if (ret) {
++              msi_mask_irq(entry, mask, ~mask);
++              free_msi_irqs(dev);
++              return ret;
++      }
++
+       ret = populate_msi_sysfs(dev);
+       if (ret) {
+               msi_mask_irq(entry, mask, ~mask);
+@@ -719,7 +740,12 @@ static int msix_capability_init(struct pci_dev *dev,
+ 
+       ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
+       if (ret)
+-              goto error;
++              goto out_avail;
++
++      /* Check if all MSI entries honor device restrictions */
++      ret = msi_verify_entries(dev);
++      if (ret)
++              goto out_free;
+ 
+       /*
+        * Some devices require MSI-X to be enabled before we can touch the
+@@ -732,10 +758,8 @@ static int msix_capability_init(struct pci_dev *dev,
+       msix_program_entries(dev, entries);
+ 
+       ret = populate_msi_sysfs(dev);
+-      if (ret) {
+-              ret = 0;
+-              goto error;
+-      }
++      if (ret)
++              goto out_free;
+ 
+       /* Set MSI-X enabled bits and unmask the function */
+       pci_intx_for_msi(dev, 0);
+@@ -746,7 +770,7 @@ static int msix_capability_init(struct pci_dev *dev,
+ 
+       return 0;
+ 
+-error:
++out_avail:
+       if (ret < 0) {
+               /*
+                * If we had some success, report the number of irqs
+@@ -763,6 +787,7 @@ error:
+                       ret = avail;
+       }
+ 
++out_free:
+       free_msi_irqs(dev);
+ 
+       return ret;
+diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+index 69ac55495c1d..aad5535db782 100644
+--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+@@ -411,6 +411,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct 
net_device *dev,
+       struct fc_frame_header *fh;
+       struct fcoe_rcv_info *fr;
+       struct fcoe_percpu_s *bg;
++      struct sk_buff *tmp_skb;
+       unsigned short oxid;
+ 
+       interface = container_of(ptype, struct bnx2fc_interface,
+@@ -423,6 +424,12 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct 
net_device *dev,
+               goto err;
+       }
+ 
++      tmp_skb = skb_share_check(skb, GFP_ATOMIC);
++      if (!tmp_skb)
++              goto err;
++
++      skb = tmp_skb;
++
+       if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) {
+               printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n");
+               goto err;
+diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
+index 49014a143c6a..c1d04d4d3c6c 100644
+--- a/drivers/scsi/scsi_devinfo.c
++++ b/drivers/scsi/scsi_devinfo.c
+@@ -202,6 +202,7 @@ static struct {
+       {"IOMEGA", "Io20S         *F", NULL, BLIST_KEY},
+       {"INSITE", "Floptical   F*8I", NULL, BLIST_KEY},
+       {"INSITE", "I325VM", NULL, BLIST_KEY},
++      {"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC},
+       {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | 
BLIST_INQUIRY_36},
+       {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN},
+       {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
+diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
+index 79c958e49f61..bb91bd8a21dc 100644
+--- a/drivers/spi/spi-dw.c
++++ b/drivers/spi/spi-dw.c
+@@ -394,9 +394,6 @@ static void pump_transfers(unsigned long data)
+       chip = dws->cur_chip;
+       spi = message->spi;
+ 
+-      if (unlikely(!chip->clk_div))
+-              chip->clk_div = dws->max_freq / chip->speed_hz;
+-
+       if (message->state == ERROR_STATE) {
+               message->status = -EIO;
+               goto early_exit;
+@@ -438,7 +435,7 @@ static void pump_transfers(unsigned long data)
+       if (transfer->speed_hz) {
+               speed = chip->speed_hz;
+ 
+-              if (transfer->speed_hz != speed) {
++              if ((transfer->speed_hz != speed) || (!chip->clk_div)) {
+                       speed = transfer->speed_hz;
+                       if (speed > dws->max_freq) {
+                               printk(KERN_ERR "MRST SPI0: unsupported"
+@@ -658,7 +655,6 @@ static int dw_spi_setup(struct spi_device *spi)
+               dev_err(&spi->dev, "No max speed HZ parameter\n");
+               return -EINVAL;
+       }
+-      chip->speed_hz = spi->max_speed_hz;
+ 
+       chip->tmode = 0; /* Tx & Rx */
+       /* Default SPI mode is SCPOL = 0, SCPH = 0 */
+diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+index d1eea2d426bd..6a2c8ab6b638 100644
+--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
++++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+@@ -57,6 +57,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
+       {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */
+       {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
+       {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */
++      {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */
+       {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
+       {}      /* Terminating entry */
+ };
+diff --git a/drivers/target/target_core_transport.c 
b/drivers/target/target_core_transport.c
+index b37371ee9f95..3931b50eeefd 100644
+--- a/drivers/target/target_core_transport.c
++++ b/drivers/target/target_core_transport.c
+@@ -2231,7 +2231,7 @@ transport_generic_new_cmd(struct se_cmd *cmd)
+        * and let it call back once the write buffers are ready.
+        */
+       target_add_to_state_list(cmd);
+-      if (cmd->data_direction != DMA_TO_DEVICE) {
++      if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) {
+               target_execute_cmd(cmd);
+               return 0;
+       }
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
+index 0d088e9d4ded..aa7759583c73 100644
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -43,6 +43,9 @@ static const struct usb_device_id usb_quirk_list[] = {
+       /* Creative SB Audigy 2 NX */
+       { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
+ 
++      /* Microsoft Wireless Laser Mouse 6000 Receiver */
++      { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME },
++
+       /* Microsoft LifeCam-VX700 v2.0 */
+       { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
+ 
+diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
+index 1cfe0c743092..7dad9e5ad2f3 100644
+--- a/drivers/usb/host/xhci-pci.c
++++ b/drivers/usb/host/xhci-pci.c
+@@ -283,7 +283,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool 
do_wakeup)
+       if (xhci_compliance_mode_recovery_timer_quirk_check())
+               pdev->no_d3cold = true;
+ 
+-      return xhci_suspend(xhci);
++      return xhci_suspend(xhci, do_wakeup);
+ }
+ 
+ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
+index d9c169f470d3..bb50d309b8e6 100644
+--- a/drivers/usb/host/xhci-plat.c
++++ b/drivers/usb/host/xhci-plat.c
+@@ -203,7 +203,15 @@ static int xhci_plat_suspend(struct device *dev)
+       struct usb_hcd  *hcd = dev_get_drvdata(dev);
+       struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ 
+-      return xhci_suspend(xhci);
++      /*
++       * xhci_suspend() needs `do_wakeup` to know whether host is allowed
++       * to do wakeup during suspend. Since xhci_plat_suspend is currently
++       * only designed for system suspend, device_may_wakeup() is enough
++       * to dertermine whether host is allowed to do wakeup. Need to
++       * reconsider this when xhci_plat_suspend enlarges its scope, e.g.,
++       * also applies to runtime suspend.
++       */
++      return xhci_suspend(xhci, device_may_wakeup(dev));
+ }
+ 
+ static int xhci_plat_resume(struct device *dev)
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
+index 46ad9f3f589d..d761c040ee2e 100644
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -1206,9 +1206,8 @@ static void handle_reset_ep_completion(struct xhci_hcd 
*xhci,
+                               false);
+               xhci_ring_cmd_db(xhci);
+       } else {
+-              /* Clear our internal halted state and restart the ring(s) */
++              /* Clear our internal halted state */
+               xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED;
+-              ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
+       }
+ }
+ 
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
+index de1901222c00..381965957a67 100644
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -35,6 +35,8 @@
+ #define DRIVER_AUTHOR "Sarah Sharp"
+ #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver"
+ 
++#define       PORT_WAKE_BITS  (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E)
++
+ /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared 
*/
+ static int link_quirk;
+ module_param(link_quirk, int, S_IRUGO | S_IWUSR);
+@@ -840,13 +842,47 @@ static void xhci_clear_command_ring(struct xhci_hcd 
*xhci)
+       xhci_set_cmd_ring_deq(xhci);
+ }
+ 
++static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
++{
++      int port_index;
++      __le32 __iomem **port_array;
++      unsigned long flags;
++      u32 t1, t2;
++
++      spin_lock_irqsave(&xhci->lock, flags);
++
++      /* disble usb3 ports Wake bits*/
++      port_index = xhci->num_usb3_ports;
++      port_array = xhci->usb3_ports;
++      while (port_index--) {
++              t1 = readl(port_array[port_index]);
++              t1 = xhci_port_state_to_neutral(t1);
++              t2 = t1 & ~PORT_WAKE_BITS;
++              if (t1 != t2)
++                      writel(t2, port_array[port_index]);
++      }
++
++      /* disble usb2 ports Wake bits*/
++      port_index = xhci->num_usb2_ports;
++      port_array = xhci->usb2_ports;
++      while (port_index--) {
++              t1 = readl(port_array[port_index]);
++              t1 = xhci_port_state_to_neutral(t1);
++              t2 = t1 & ~PORT_WAKE_BITS;
++              if (t1 != t2)
++                      writel(t2, port_array[port_index]);
++      }
++
++      spin_unlock_irqrestore(&xhci->lock, flags);
++}
++
+ /*
+  * Stop HC (not bus-specific)
+  *
+  * This is called when the machine transition into S3/S4 mode.
+  *
+  */
+-int xhci_suspend(struct xhci_hcd *xhci)
++int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
+ {
+       int                     rc = 0;
+       unsigned int            delay = XHCI_MAX_HALT_USEC;
+@@ -857,6 +893,10 @@ int xhci_suspend(struct xhci_hcd *xhci)
+                       xhci->shared_hcd->state != HC_STATE_SUSPENDED)
+               return -EINVAL;
+ 
++      /* Clear root port wake on bits if wakeup not allowed. */
++      if (!do_wakeup)
++              xhci_disable_port_wake_on_bits(xhci);
++
+       /* Don't poll the roothubs on bus suspend. */
+       xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
+       clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
+index 75f775c993ee..1703de9f0509 100644
+--- a/drivers/usb/host/xhci.h
++++ b/drivers/usb/host/xhci.h
+@@ -1767,7 +1767,7 @@ void xhci_shutdown(struct usb_hcd *hcd);
+ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks);
+ 
+ #ifdef        CONFIG_PM
+-int xhci_suspend(struct xhci_hcd *xhci);
++int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup);
+ int xhci_resume(struct xhci_hcd *xhci, bool hibernated);
+ #else
+ #define       xhci_suspend    NULL
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
+index 34b16b226f74..59fd7187daff 100644
+--- a/drivers/usb/serial/cp210x.c
++++ b/drivers/usb/serial/cp210x.c
+@@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = {
+       { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
+       { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
+       { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
++      { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */
+       { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
+       { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB 
Device */
+       { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
+index 74c20472c25b..00710ff5ebb8 100644
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -484,6 +484,39 @@ static struct usb_device_id id_table_combined [] = {
+       { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) },
+       { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) },
+       { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) },
++      { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
b/drivers/usb/serial/ftdi_sio_ids.h
+index 6786b705ccf6..e52409c9be99 100644
+--- a/drivers/usb/serial/ftdi_sio_ids.h
++++ b/drivers/usb/serial/ftdi_sio_ids.h
+@@ -926,8 +926,8 @@
+ #define BAYER_CONTOUR_CABLE_PID        0x6001
+ 
+ /*
+- * The following are the values for the Matrix Orbital FTDI Range
+- * Anything in this range will use an FT232RL.
++ * Matrix Orbital Intelligent USB displays.
++ * http://www.matrixorbital.com
+  */
+ #define MTXORB_VID                    0x1B3D
+ #define MTXORB_FTDI_RANGE_0100_PID    0x0100
+@@ -1186,8 +1186,39 @@
+ #define MTXORB_FTDI_RANGE_01FD_PID    0x01FD
+ #define MTXORB_FTDI_RANGE_01FE_PID    0x01FE
+ #define MTXORB_FTDI_RANGE_01FF_PID    0x01FF
+-
+-
++#define MTXORB_FTDI_RANGE_4701_PID    0x4701
++#define MTXORB_FTDI_RANGE_9300_PID    0x9300
++#define MTXORB_FTDI_RANGE_9301_PID    0x9301
++#define MTXORB_FTDI_RANGE_9302_PID    0x9302
++#define MTXORB_FTDI_RANGE_9303_PID    0x9303
++#define MTXORB_FTDI_RANGE_9304_PID    0x9304
++#define MTXORB_FTDI_RANGE_9305_PID    0x9305
++#define MTXORB_FTDI_RANGE_9306_PID    0x9306
++#define MTXORB_FTDI_RANGE_9307_PID    0x9307
++#define MTXORB_FTDI_RANGE_9308_PID    0x9308
++#define MTXORB_FTDI_RANGE_9309_PID    0x9309
++#define MTXORB_FTDI_RANGE_930A_PID    0x930A
++#define MTXORB_FTDI_RANGE_930B_PID    0x930B
++#define MTXORB_FTDI_RANGE_930C_PID    0x930C
++#define MTXORB_FTDI_RANGE_930D_PID    0x930D
++#define MTXORB_FTDI_RANGE_930E_PID    0x930E
++#define MTXORB_FTDI_RANGE_930F_PID    0x930F
++#define MTXORB_FTDI_RANGE_9310_PID    0x9310
++#define MTXORB_FTDI_RANGE_9311_PID    0x9311
++#define MTXORB_FTDI_RANGE_9312_PID    0x9312
++#define MTXORB_FTDI_RANGE_9313_PID    0x9313
++#define MTXORB_FTDI_RANGE_9314_PID    0x9314
++#define MTXORB_FTDI_RANGE_9315_PID    0x9315
++#define MTXORB_FTDI_RANGE_9316_PID    0x9316
++#define MTXORB_FTDI_RANGE_9317_PID    0x9317
++#define MTXORB_FTDI_RANGE_9318_PID    0x9318
++#define MTXORB_FTDI_RANGE_9319_PID    0x9319
++#define MTXORB_FTDI_RANGE_931A_PID    0x931A
++#define MTXORB_FTDI_RANGE_931B_PID    0x931B
++#define MTXORB_FTDI_RANGE_931C_PID    0x931C
++#define MTXORB_FTDI_RANGE_931D_PID    0x931D
++#define MTXORB_FTDI_RANGE_931E_PID    0x931E
++#define MTXORB_FTDI_RANGE_931F_PID    0x931F
+ 
+ /*
+  * The Mobility Lab (TML)
+diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
+index d6960aebe246..dc3a77c8cd83 100644
+--- a/drivers/usb/serial/keyspan.c
++++ b/drivers/usb/serial/keyspan.c
+@@ -312,24 +312,30 @@ static void      usa26_indat_callback(struct urb *urb)
+               if ((data[0] & 0x80) == 0) {
+                       /* no errors on individual bytes, only
+                          possible overrun err */
+-                      if (data[0] & RXERROR_OVERRUN)
+-                              err = TTY_OVERRUN;
+-                      else
+-                              err = 0;
++                      if (data[0] & RXERROR_OVERRUN) {
++                              tty_insert_flip_char(&port->port, 0,
++                                                              TTY_OVERRUN);
++                      }
+                       for (i = 1; i < urb->actual_length ; ++i)
+-                              tty_insert_flip_char(&port->port, data[i], err);
++                              tty_insert_flip_char(&port->port, data[i],
++                                                              TTY_NORMAL);
+               } else {
+                       /* some bytes had errors, every byte has status */
+                       dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
+                       for (i = 0; i + 1 < urb->actual_length; i += 2) {
+-                              int stat = data[i], flag = 0;
+-                              if (stat & RXERROR_OVERRUN)
+-                                      flag |= TTY_OVERRUN;
+-                              if (stat & RXERROR_FRAMING)
+-                                      flag |= TTY_FRAME;
+-                              if (stat & RXERROR_PARITY)
+-                                      flag |= TTY_PARITY;
++                              int stat = data[i];
++                              int flag = TTY_NORMAL;
++
++                              if (stat & RXERROR_OVERRUN) {
++                                      tty_insert_flip_char(&port->port, 0,
++                                                              TTY_OVERRUN);
++                              }
+                               /* XXX should handle break (0x10) */
++                              if (stat & RXERROR_PARITY)
++                                      flag = TTY_PARITY;
++                              else if (stat & RXERROR_FRAMING)
++                                      flag = TTY_FRAME;
++
+                               tty_insert_flip_char(&port->port, data[i+1],
+                                               flag);
+                       }
+@@ -667,14 +673,19 @@ static void      usa49_indat_callback(struct urb *urb)
+               } else {
+                       /* some bytes had errors, every byte has status */
+                       for (i = 0; i + 1 < urb->actual_length; i += 2) {
+-                              int stat = data[i], flag = 0;
+-                              if (stat & RXERROR_OVERRUN)
+-                                      flag |= TTY_OVERRUN;
+-                              if (stat & RXERROR_FRAMING)
+-                                      flag |= TTY_FRAME;
+-                              if (stat & RXERROR_PARITY)
+-                                      flag |= TTY_PARITY;
++                              int stat = data[i];
++                              int flag = TTY_NORMAL;
++
++                              if (stat & RXERROR_OVERRUN) {
++                                      tty_insert_flip_char(&port->port, 0,
++                                                              TTY_OVERRUN);
++                              }
+                               /* XXX should handle break (0x10) */
++                              if (stat & RXERROR_PARITY)
++                                      flag = TTY_PARITY;
++                              else if (stat & RXERROR_FRAMING)
++                                      flag = TTY_FRAME;
++
+                               tty_insert_flip_char(&port->port, data[i+1],
+                                               flag);
+                       }
+@@ -731,15 +742,19 @@ static void usa49wg_indat_callback(struct urb *urb)
+                        */
+                       for (x = 0; x + 1 < len &&
+                                   i + 1 < urb->actual_length; x += 2) {
+-                              int stat = data[i], flag = 0;
++                              int stat = data[i];
++                              int flag = TTY_NORMAL;
+ 
+-                              if (stat & RXERROR_OVERRUN)
+-                                      flag |= TTY_OVERRUN;
+-                              if (stat & RXERROR_FRAMING)
+-                                      flag |= TTY_FRAME;
+-                              if (stat & RXERROR_PARITY)
+-                                      flag |= TTY_PARITY;
++                              if (stat & RXERROR_OVERRUN) {
++                                      tty_insert_flip_char(&port->port, 0,
++                                                              TTY_OVERRUN);
++                              }
+                               /* XXX should handle break (0x10) */
++                              if (stat & RXERROR_PARITY)
++                                      flag = TTY_PARITY;
++                              else if (stat & RXERROR_FRAMING)
++                                      flag = TTY_FRAME;
++
+                               tty_insert_flip_char(&port->port, data[i+1],
+                                                    flag);
+                               i += 2;
+@@ -791,25 +806,31 @@ static void usa90_indat_callback(struct urb *urb)
+                       if ((data[0] & 0x80) == 0) {
+                               /* no errors on individual bytes, only
+                                  possible overrun err*/
+-                              if (data[0] & RXERROR_OVERRUN)
+-                                      err = TTY_OVERRUN;
+-                              else
+-                                      err = 0;
++                              if (data[0] & RXERROR_OVERRUN) {
++                                      tty_insert_flip_char(&port->port, 0,
++                                                              TTY_OVERRUN);
++                              }
+                               for (i = 1; i < urb->actual_length ; ++i)
+                                       tty_insert_flip_char(&port->port,
+-                                                      data[i], err);
++                                                      data[i], TTY_NORMAL);
+                       }  else {
+                       /* some bytes had errors, every byte has status */
+                               dev_dbg(&port->dev, "%s - RX error!!!!\n", 
__func__);
+                               for (i = 0; i + 1 < urb->actual_length; i += 2) 
{
+-                                      int stat = data[i], flag = 0;
+-                                      if (stat & RXERROR_OVERRUN)
+-                                              flag |= TTY_OVERRUN;
+-                                      if (stat & RXERROR_FRAMING)
+-                                              flag |= TTY_FRAME;
+-                                      if (stat & RXERROR_PARITY)
+-                                              flag |= TTY_PARITY;
++                                      int stat = data[i];
++                                      int flag = TTY_NORMAL;
++
++                                      if (stat & RXERROR_OVERRUN) {
++                                              tty_insert_flip_char(
++                                                              &port->port, 0,
++                                                              TTY_OVERRUN);
++                                      }
+                                       /* XXX should handle break (0x10) */
++                                      if (stat & RXERROR_PARITY)
++                                              flag = TTY_PARITY;
++                                      else if (stat & RXERROR_FRAMING)
++                                              flag = TTY_FRAME;
++
+                                       tty_insert_flip_char(&port->port,
+                                                       data[i+1], flag);
+                               }
+diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
+index e5750be49054..d667ff95ade4 100644
+--- a/drivers/usb/serial/ssu100.c
++++ b/drivers/usb/serial/ssu100.c
+@@ -495,10 +495,9 @@ static void ssu100_update_lsr(struct usb_serial_port 
*port, u8 lsr,
+                       if (*tty_flag == TTY_NORMAL)
+                               *tty_flag = TTY_FRAME;
+               }
+-              if (lsr & UART_LSR_OE){
++              if (lsr & UART_LSR_OE) {
+                       port->icount.overrun++;
+-                      if (*tty_flag == TTY_NORMAL)
+-                              *tty_flag = TTY_OVERRUN;
++                      tty_insert_flip_char(&port->port, 0, TTY_OVERRUN);
+               }
+       }
+ 
+@@ -516,12 +515,8 @@ static void ssu100_process_read_urb(struct urb *urb)
+       if ((len >= 4) &&
+           (packet[0] == 0x1b) && (packet[1] == 0x1b) &&
+           ((packet[2] == 0x00) || (packet[2] == 0x01))) {
+-              if (packet[2] == 0x00) {
++              if (packet[2] == 0x00)
+                       ssu100_update_lsr(port, packet[3], &flag);
+-                      if (flag == TTY_OVERRUN)
+-                              tty_insert_flip_char(&port->port, 0,
+-                                              TTY_OVERRUN);
+-              }
+               if (packet[2] == 0x01)
+                       ssu100_update_msr(port, packet[3]);
+ 
+diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
+index d300fd99a2b8..c5b631cceb4c 100644
+--- a/drivers/vhost/scsi.c
++++ b/drivers/vhost/scsi.c
+@@ -1194,6 +1194,7 @@ static int
+ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
+                       struct vhost_scsi_target *t)
+ {
++      struct se_portal_group *se_tpg;
+       struct tcm_vhost_tport *tv_tport;
+       struct tcm_vhost_tpg *tpg;
+       struct tcm_vhost_tpg **vs_tpg;
+@@ -1241,6 +1242,21 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
+                               ret = -EEXIST;
+                               goto out;
+                       }
++                      /*
++                       * In order to ensure individual vhost-scsi configfs
++                       * groups cannot be removed while in use by vhost ioctl,
++                       * go ahead and take an explicit 
se_tpg->tpg_group.cg_item
++                       * dependency now.
++                       */
++                      se_tpg = &tpg->se_tpg;
++                      ret = 
configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys,
++                                                 &se_tpg->tpg_group.cg_item);
++                      if (ret) {
++                              pr_warn("configfs_depend_item() failed: %d\n", 
ret);
++                              kfree(vs_tpg);
++                              mutex_unlock(&tpg->tv_tpg_mutex);
++                              goto out;
++                      }
+                       tpg->tv_tpg_vhost_count++;
+                       tpg->vhost_scsi = vs;
+                       vs_tpg[tpg->tport_tpgt] = tpg;
+@@ -1283,6 +1299,7 @@ static int
+ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
+                         struct vhost_scsi_target *t)
+ {
++      struct se_portal_group *se_tpg;
+       struct tcm_vhost_tport *tv_tport;
+       struct tcm_vhost_tpg *tpg;
+       struct vhost_virtqueue *vq;
+@@ -1331,6 +1348,13 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
+               vs->vs_tpg[target] = NULL;
+               match = true;
+               mutex_unlock(&tpg->tv_tpg_mutex);
++              /*
++               * Release se_tpg->tpg_group.cg_item configfs dependency now
++               * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur.
++               */
++              se_tpg = &tpg->se_tpg;
++              configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys,
++                                     &se_tpg->tpg_group.cg_item);
+       }
+       if (match) {
+               for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
+diff --git a/fs/aio.c b/fs/aio.c
+index 66bd7e4447ad..307d7708dc00 100644
+--- a/fs/aio.c
++++ b/fs/aio.c
+@@ -164,6 +164,15 @@ static struct vfsmount *aio_mnt;
+ static const struct file_operations aio_ring_fops;
+ static const struct address_space_operations aio_ctx_aops;
+ 
++/* Backing dev info for aio fs.
++ * -no dirty page accounting or writeback happens
++ */
++static struct backing_dev_info aio_fs_backing_dev_info = {
++      .name           = "aiofs",
++      .state          = 0,
++      .capabilities   = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_MAP_COPY,
++};
++
+ static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages)
+ {
+       struct qstr this = QSTR_INIT("[aio]", 5);
+@@ -175,6 +184,7 @@ static struct file *aio_private_file(struct kioctx *ctx, 
loff_t nr_pages)
+ 
+       inode->i_mapping->a_ops = &aio_ctx_aops;
+       inode->i_mapping->private_data = ctx;
++      inode->i_mapping->backing_dev_info = &aio_fs_backing_dev_info;
+       inode->i_size = PAGE_SIZE * nr_pages;
+ 
+       path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this);
+@@ -220,6 +230,9 @@ static int __init aio_setup(void)
+       if (IS_ERR(aio_mnt))
+               panic("Failed to create aio fs mount.");
+ 
++      if (bdi_init(&aio_fs_backing_dev_info))
++              panic("Failed to init aio fs backing dev info.");
++
+       kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
+       kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
+ 
+@@ -281,11 +294,6 @@ static const struct file_operations aio_ring_fops = {
+       .mmap = aio_ring_mmap,
+ };
+ 
+-static int aio_set_page_dirty(struct page *page)
+-{
+-      return 0;
+-}
+-
+ #if IS_ENABLED(CONFIG_MIGRATION)
+ static int aio_migratepage(struct address_space *mapping, struct page *new,
+                       struct page *old, enum migrate_mode mode)
+@@ -357,7 +365,7 @@ out:
+ #endif
+ 
+ static const struct address_space_operations aio_ctx_aops = {
+-      .set_page_dirty = aio_set_page_dirty,
++      .set_page_dirty = __set_page_dirty_no_writeback,
+ #if IS_ENABLED(CONFIG_MIGRATION)
+       .migratepage    = aio_migratepage,
+ #endif
+@@ -412,7 +420,6 @@ static int aio_setup_ring(struct kioctx *ctx)
+               pr_debug("pid(%d) page[%d]->count=%d\n",
+                        current->pid, i, page_count(page));
+               SetPageUptodate(page);
+-              SetPageDirty(page);
+               unlock_page(page);
+ 
+               ctx->ring_pages[i] = page;
+diff --git a/fs/locks.c b/fs/locks.c
+index ad95fbd20f8a..0d2b5febc627 100644
+--- a/fs/locks.c
++++ b/fs/locks.c
+@@ -2199,16 +2199,28 @@ void locks_remove_flock(struct file *filp)
+ 
+       while ((fl = *before) != NULL) {
+               if (fl->fl_file == filp) {
+-                      if (IS_FLOCK(fl)) {
+-                              locks_delete_lock(before);
+-                              continue;
+-                      }
+                       if (IS_LEASE(fl)) {
+                               lease_modify(before, F_UNLCK);
+                               continue;
+                       }
+-                      /* What? */
+-                      BUG();
++
++                      /*
++                       * There's a leftover lock on the list of a type that
++                       * we didn't expect to see. Most likely a classic
++                       * POSIX lock that ended up not getting released
++                       * properly, or that raced onto the list somehow. Log
++                       * some info about it and then just remove it from
++                       * the list.
++                       */
++                      WARN(!IS_FLOCK(fl),
++                              "leftover lock: dev=%u:%u ino=%lu type=%hhd 
flags=0x%x start=%lld end=%lld\n",
++                              MAJOR(inode->i_sb->s_dev),
++                              MINOR(inode->i_sb->s_dev), inode->i_ino,
++                              fl->fl_type, fl->fl_flags,
++                              fl->fl_start, fl->fl_end);
++
++                      locks_delete_lock(before);
++                      continue;
+               }
+               before = &fl->fl_next;
+       }
+diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
+index cc8c5b32043c..f42bbe5fbc0a 100644
+--- a/fs/nfsd/nfs4callback.c
++++ b/fs/nfsd/nfs4callback.c
+@@ -784,8 +784,12 @@ static bool nfsd41_cb_get_slot(struct nfs4_client *clp, 
struct rpc_task *task)
+ {
+       if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
+               rpc_sleep_on(&clp->cl_cb_waitq, task, NULL);
+-              dprintk("%s slot is busy\n", __func__);
+-              return false;
++              /* Race breaker */
++              if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
++                      dprintk("%s slot is busy\n", __func__);
++                      return false;
++              }
++              rpc_wake_up_queued_task(&clp->cl_cb_waitq, task);
+       }
+       return true;
+ }
+diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
+index 479eb681c27c..f417fef17118 100644
+--- a/fs/nfsd/nfsd.h
++++ b/fs/nfsd/nfsd.h
+@@ -328,12 +328,15 @@ void             nfsd_lockd_shutdown(void);
+       (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT)
+ 
+ #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
+-#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \
+-      (NFSD4_1_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SECURITY_LABEL)
++#define NFSD4_2_SECURITY_ATTRS                FATTR4_WORD2_SECURITY_LABEL
+ #else
+-#define NFSD4_2_SUPPORTED_ATTRS_WORD2 0
++#define NFSD4_2_SECURITY_ATTRS                0
+ #endif
+ 
++#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \
++      (NFSD4_1_SUPPORTED_ATTRS_WORD2 | \
++      NFSD4_2_SECURITY_ATTRS)
++
+ static inline u32 nfsd_suppattrs0(u32 minorversion)
+ {
+       return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0
+diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
+index 13ce220c7003..593ae7ce07c7 100644
+--- a/include/linux/iio/events.h
++++ b/include/linux/iio/events.h
+@@ -90,7 +90,7 @@ enum iio_event_direction {
+ 
+ #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
+ 
+-#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
++#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
+ 
+ #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
+ 
+diff --git a/include/linux/pci.h b/include/linux/pci.h
+index db4ce115705e..573c04929bd1 100644
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -323,6 +323,7 @@ struct pci_dev {
+       unsigned int    is_added:1;
+       unsigned int    is_busmaster:1; /* device is busmaster */
+       unsigned int    no_msi:1;       /* device may not use msi */
++      unsigned int    no_64bit_msi:1; /* device may only use 32-bit MSIs */
+       unsigned int    block_cfg_access:1;     /* config space access is 
blocked */
+       unsigned int    broken_parity_status:1; /* Device generates false 
positive parity */
+       unsigned int    irq_reroute_variant:2;  /* device needs IRQ rerouting 
variant */
+diff --git a/include/linux/serio.h b/include/linux/serio.h
+index 36aac733840a..9f779c7a2da4 100644
+--- a/include/linux/serio.h
++++ b/include/linux/serio.h
+@@ -23,6 +23,7 @@ struct serio {
+ 
+       char name[32];
+       char phys[32];
++      char firmware_id[128];
+ 
+       bool manual_bind;
+ 
+diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
+index 047d657c331c..3007641f2385 100644
+--- a/include/sound/soc-dpcm.h
++++ b/include/sound/soc-dpcm.h
+@@ -101,6 +101,8 @@ struct snd_soc_dpcm_runtime {
+       /* state and update */
+       enum snd_soc_dpcm_update runtime_update;
+       enum snd_soc_dpcm_state state;
++
++      int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */
+ };
+ 
+ /* can this BE stop and free */
+diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
+index a3726275876d..f30db096455f 100644
+--- a/include/uapi/linux/input.h
++++ b/include/uapi/linux/input.h
+@@ -164,6 +164,7 @@ struct input_keymap_entry {
+ #define INPUT_PROP_DIRECT             0x01    /* direct input devices */
+ #define INPUT_PROP_BUTTONPAD          0x02    /* has button(s) under pad */
+ #define INPUT_PROP_SEMI_MT            0x03    /* touch rectangle only */
++#define INPUT_PROP_TOPBUTTONPAD               0x04    /* softbuttons at top 
of pad */
+ 
+ #define INPUT_PROP_MAX                        0x1f
+ #define INPUT_PROP_CNT                        (INPUT_PROP_MAX + 1)
+diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
+index ad8e1bdca70e..8176caf6efd9 100644
+--- a/kernel/events/uprobes.c
++++ b/kernel/events/uprobes.c
+@@ -1511,7 +1511,6 @@ bool uprobe_deny_signal(void)
+               if (__fatal_signal_pending(t) || 
arch_uprobe_xol_was_trapped(t)) {
+                       utask->state = UTASK_SSTEP_TRAPPED;
+                       set_tsk_thread_flag(t, TIF_UPROBE);
+-                      set_tsk_thread_flag(t, TIF_NOTIFY_RESUME);
+               }
+       }
+ 
+diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
+index c478e6bcf89b..75f8c72a1f8f 100644
+--- a/net/batman-adv/hard-interface.c
++++ b/net/batman-adv/hard-interface.c
+@@ -83,7 +83,7 @@ static bool batadv_is_on_batman_iface(const struct 
net_device *net_dev)
+               return true;
+ 
+       /* no more parents..stop recursion */
+-      if (net_dev->iflink == net_dev->ifindex)
++      if (net_dev->iflink == 0 || net_dev->iflink == net_dev->ifindex)
+               return false;
+ 
+       /* recurse over the parent device */
+diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
+index c211607b79b3..8bd51f49aa96 100644
+--- a/net/ipv4/ping.c
++++ b/net/ipv4/ping.c
+@@ -214,6 +214,8 @@ static struct sock *ping_lookup(struct net *net, struct 
sk_buff *skb, u16 ident)
+                                            &ipv6_hdr(skb)->daddr))
+                               continue;
+ #endif
++              } else {
++                      continue;
+               }
+ 
+               if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)
+diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
+index 1f4093f3f3a1..b76c6b619227 100644
+--- a/sound/soc/codecs/sgtl5000.c
++++ b/sound/soc/codecs/sgtl5000.c
+@@ -1398,8 +1398,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
+ 
+       /* enable small pop, introduce 400ms delay in turning off */
+       snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL,
+-                              SGTL5000_SMALL_POP,
+-                              SGTL5000_SMALL_POP);
++                              SGTL5000_SMALL_POP, 1);
+ 
+       /* disable short cut detector */
+       snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0);
+diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h
+index 2f8c88931f69..bd7a344bf8c5 100644
+--- a/sound/soc/codecs/sgtl5000.h
++++ b/sound/soc/codecs/sgtl5000.h
+@@ -275,7 +275,7 @@
+ #define SGTL5000_BIAS_CTRL_MASK                       0x000e
+ #define SGTL5000_BIAS_CTRL_SHIFT              1
+ #define SGTL5000_BIAS_CTRL_WIDTH              3
+-#define SGTL5000_SMALL_POP                    0x0001
++#define SGTL5000_SMALL_POP                    0
+ 
+ /*
+  * SGTL5000_CHIP_MIC_CTRL
+diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
+index 61e871bf63dd..f0e97fcde1bf 100644
+--- a/sound/soc/codecs/wm_adsp.c
++++ b/sound/soc/codecs/wm_adsp.c
+@@ -1341,6 +1341,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
+                         file, blocks, pos - firmware->size);
+ 
+ out_fw:
++      regmap_async_complete(regmap);
+       release_firmware(firmware);
+       wm_adsp_buf_free(&buf_list);
+ out:
+diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
+index b33ca7cd085b..5dbf49481cae 100644
+--- a/sound/soc/sh/fsi.c
++++ b/sound/soc/sh/fsi.c
+@@ -1775,8 +1775,7 @@ static const struct snd_soc_dai_ops fsi_dai_ops = {
+ static struct snd_pcm_hardware fsi_pcm_hardware = {
+       .info =         SNDRV_PCM_INFO_INTERLEAVED      |
+                       SNDRV_PCM_INFO_MMAP             |
+-                      SNDRV_PCM_INFO_MMAP_VALID       |
+-                      SNDRV_PCM_INFO_PAUSE,
++                      SNDRV_PCM_INFO_MMAP_VALID,
+       .formats                = FSI_FMTS,
+       .rates                  = FSI_RATES,
+       .rate_min               = 8000,
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index a35706028514..f6e45b1e5533 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -662,8 +662,7 @@ static void rsnd_dai_remove(struct platform_device *pdev,
+ static struct snd_pcm_hardware rsnd_pcm_hardware = {
+       .info =         SNDRV_PCM_INFO_INTERLEAVED      |
+                       SNDRV_PCM_INFO_MMAP             |
+-                      SNDRV_PCM_INFO_MMAP_VALID       |
+-                      SNDRV_PCM_INFO_PAUSE,
++                      SNDRV_PCM_INFO_MMAP_VALID,
+       .formats                = RSND_FMTS,
+       .rates                  = RSND_RATES,
+       .rate_min               = 8000,
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
+index 875cae86d708..8457ebb7439e 100644
+--- a/sound/soc/soc-pcm.c
++++ b/sound/soc/soc-pcm.c
+@@ -1129,13 +1129,36 @@ static void dpcm_set_fe_runtime(struct 
snd_pcm_substream *substream)
+       }
+ }
+ 
++static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int 
cmd);
++
++/* Set FE's runtime_update state; the state is protected via PCM stream lock
++ * for avoiding the race with trigger callback.
++ * If the state is unset and a trigger is pending while the previous 
operation,
++ * process the pending trigger action here.
++ */
++static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe,
++                                   int stream, enum snd_soc_dpcm_update state)
++{
++      struct snd_pcm_substream *substream =
++              snd_soc_dpcm_get_substream(fe, stream);
++
++      snd_pcm_stream_lock_irq(substream);
++      if (state == SND_SOC_DPCM_UPDATE_NO && 
fe->dpcm[stream].trigger_pending) {
++              dpcm_fe_dai_do_trigger(substream,
++                                     fe->dpcm[stream].trigger_pending - 1);
++              fe->dpcm[stream].trigger_pending = 0;
++      }
++      fe->dpcm[stream].runtime_update = state;
++      snd_pcm_stream_unlock_irq(substream);
++}
++
+ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
+ {
+       struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
+       struct snd_pcm_runtime *runtime = fe_substream->runtime;
+       int stream = fe_substream->stream, ret = 0;
+ 
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
+ 
+       ret = dpcm_be_dai_startup(fe, fe_substream->stream);
+       if (ret < 0) {
+@@ -1157,13 +1180,13 @@ static int dpcm_fe_dai_startup(struct 
snd_pcm_substream *fe_substream)
+       dpcm_set_fe_runtime(fe_substream);
+       snd_pcm_limit_hw_rates(runtime);
+ 
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
+       return 0;
+ 
+ unwind:
+       dpcm_be_dai_startup_unwind(fe, fe_substream->stream);
+ be_err:
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
+       return ret;
+ }
+ 
+@@ -1210,7 +1233,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream 
*substream)
+       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       int stream = substream->stream;
+ 
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
+ 
+       /* shutdown the BEs */
+       dpcm_be_dai_shutdown(fe, substream->stream);
+@@ -1224,7 +1247,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream 
*substream)
+       dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
+ 
+       fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
+       return 0;
+ }
+ 
+@@ -1272,7 +1295,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream 
*substream)
+       int err, stream = substream->stream;
+ 
+       mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
+ 
+       dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name);
+ 
+@@ -1287,7 +1310,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream 
*substream)
+       err = dpcm_be_dai_hw_free(fe, stream);
+ 
+       fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
+ 
+       mutex_unlock(&fe->card->mutex);
+       return 0;
+@@ -1380,7 +1403,7 @@ static int dpcm_fe_dai_hw_params(struct 
snd_pcm_substream *substream,
+       int ret, stream = substream->stream;
+ 
+       mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
+ 
+       memcpy(&fe->dpcm[substream->stream].hw_params, params,
+                       sizeof(struct snd_pcm_hw_params));
+@@ -1403,7 +1426,7 @@ static int dpcm_fe_dai_hw_params(struct 
snd_pcm_substream *substream,
+               fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
+ 
+ out:
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
+       mutex_unlock(&fe->card->mutex);
+       return ret;
+ }
+@@ -1517,7 +1540,7 @@ static int dpcm_be_dai_trigger(struct 
snd_soc_pcm_runtime *fe, int stream,
+ }
+ EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger);
+ 
+-static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
++static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int 
cmd)
+ {
+       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       int stream = substream->stream, ret;
+@@ -1591,6 +1614,23 @@ out:
+       return ret;
+ }
+ 
++static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
++{
++      struct snd_soc_pcm_runtime *fe = substream->private_data;
++      int stream = substream->stream;
++
++      /* if FE's runtime_update is already set, we're in race;
++       * process this trigger later at exit
++       */
++      if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) {
++              fe->dpcm[stream].trigger_pending = cmd + 1;
++              return 0; /* delayed, assuming it's successful */
++      }
++
++      /* we're alone, let's trigger */
++      return dpcm_fe_dai_do_trigger(substream, cmd);
++}
++
+ static int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
+ {
+       struct snd_soc_dpcm *dpcm;
+@@ -1634,7 +1674,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream 
*substream)
+ 
+       dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name);
+ 
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
+ 
+       /* there is no point preparing this FE if there are no BEs */
+       if (list_empty(&fe->dpcm[stream].be_clients)) {
+@@ -1661,7 +1701,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream 
*substream)
+       fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
+ 
+ out:
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
+       mutex_unlock(&fe->card->mutex);
+ 
+       return ret;
+@@ -1808,11 +1848,11 @@ static int dpcm_run_new_update(struct 
snd_soc_pcm_runtime *fe, int stream)
+ {
+       int ret;
+ 
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
+       ret = dpcm_run_update_startup(fe, stream);
+       if (ret < 0)
+               dev_err(fe->dev, "ASoC: failed to startup some BEs\n");
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
+ 
+       return ret;
+ }
+@@ -1821,11 +1861,11 @@ static int dpcm_run_old_update(struct 
snd_soc_pcm_runtime *fe, int stream)
+ {
+       int ret;
+ 
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
+       ret = dpcm_run_update_shutdown(fe, stream);
+       if (ret < 0)
+               dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n");
+-      fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
++      dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
+ 
+       return ret;
+ }
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
+index 0df9ede99dfd..3fbb4553ba40 100644
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -1127,6 +1127,20 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, 
unsigned int pipe,
+       if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) &&
+           (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
+               mdelay(20);
++
++      /* Marantz/Denon devices with USB DAC functionality need a delay
++       * after each class compliant request
++       */
++      if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) &&
++          (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) {
++
++              switch (le16_to_cpu(dev->descriptor.idProduct)) {
++              case 0x3005: /* Marantz HD-DAC1 */
++              case 0x3006: /* Marantz SA-14S1 */
++                      mdelay(20);
++                      break;
++              }
++      }
+ }
+ 
+ /*

Reply via email to