summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '3.1.3/1002_linux-3.1.3.patch')
-rw-r--r--3.1.3/1002_linux-3.1.3.patch1953
1 files changed, 1953 insertions, 0 deletions
diff --git a/3.1.3/1002_linux-3.1.3.patch b/3.1.3/1002_linux-3.1.3.patch
new file mode 100644
index 0000000..d87ecaf
--- /dev/null
+++ b/3.1.3/1002_linux-3.1.3.patch
@@ -0,0 +1,1953 @@
+diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
+index 742b610..fed957a 100644
+--- a/arch/arm/kernel/head.S
++++ b/arch/arm/kernel/head.S
+@@ -356,7 +356,7 @@ __secondary_data:
+ * r13 = *virtual* address to jump to upon completion
+ */
+ __enable_mmu:
+-#ifdef CONFIG_ALIGNMENT_TRAP
++#if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6
+ orr r0, r0, #CR_A
+ #else
+ bic r0, r0, #CR_A
+diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
+index 00ff00d..123d72a 100644
+--- a/arch/s390/include/asm/kvm_host.h
++++ b/arch/s390/include/asm/kvm_host.h
+@@ -47,7 +47,7 @@ struct sca_block {
+ #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
+ #define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
+
+-#define CPUSTAT_HOST 0x80000000
++#define CPUSTAT_STOPPED 0x80000000
+ #define CPUSTAT_WAIT 0x10000000
+ #define CPUSTAT_ECALL_PEND 0x08000000
+ #define CPUSTAT_STOP_INT 0x04000000
+diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
+index 9e4c841..5a5c084 100644
+--- a/arch/s390/kvm/diag.c
++++ b/arch/s390/kvm/diag.c
+@@ -42,7 +42,7 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu)
+ return -EOPNOTSUPP;
+ }
+
+- atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
++ atomic_set_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
+ vcpu->run->s390_reset_flags |= KVM_S390_RESET_SUBSYSTEM;
+ vcpu->run->s390_reset_flags |= KVM_S390_RESET_IPL;
+ vcpu->run->s390_reset_flags |= KVM_S390_RESET_CPU_INIT;
+diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
+index c7c5189..0243454 100644
+--- a/arch/s390/kvm/intercept.c
++++ b/arch/s390/kvm/intercept.c
+@@ -132,7 +132,6 @@ static int handle_stop(struct kvm_vcpu *vcpu)
+ int rc = 0;
+
+ vcpu->stat.exit_stop_request++;
+- atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
+ spin_lock_bh(&vcpu->arch.local_int.lock);
+ if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) {
+ vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP;
+@@ -149,6 +148,8 @@ static int handle_stop(struct kvm_vcpu *vcpu)
+ }
+
+ if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) {
++ atomic_set_mask(CPUSTAT_STOPPED,
++ &vcpu->arch.sie_block->cpuflags);
+ vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP;
+ VCPU_EVENT(vcpu, 3, "%s", "cpu stopped");
+ rc = -EOPNOTSUPP;
+diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
+index c9aeb4b..d4bd4c7 100644
+--- a/arch/s390/kvm/interrupt.c
++++ b/arch/s390/kvm/interrupt.c
+@@ -224,6 +224,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
+ offsetof(struct _lowcore, restart_psw), sizeof(psw_t));
+ if (rc == -EFAULT)
+ exception = 1;
++ atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
+ break;
+
+ case KVM_S390_PROGRAM_INT:
+diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
+index 0cba935..8cdb1bd 100644
+--- a/arch/s390/kvm/kvm-s390.c
++++ b/arch/s390/kvm/kvm-s390.c
+@@ -265,10 +265,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
+ restore_fp_regs(&vcpu->arch.guest_fpregs);
+ restore_access_regs(vcpu->arch.guest_acrs);
+ gmap_enable(vcpu->arch.gmap);
++ atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
+ }
+
+ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
+ {
++ atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
+ gmap_disable(vcpu->arch.gmap);
+ save_fp_regs(&vcpu->arch.guest_fpregs);
+ save_access_regs(vcpu->arch.guest_acrs);
+@@ -296,7 +298,9 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
+
+ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
+ {
+- atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | CPUSTAT_SM);
++ atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH |
++ CPUSTAT_SM |
++ CPUSTAT_STOPPED);
+ vcpu->arch.sie_block->ecb = 6;
+ vcpu->arch.sie_block->eca = 0xC1002001U;
+ vcpu->arch.sie_block->fac = (int) (long) facilities;
+@@ -421,7 +425,7 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
+ {
+ int rc = 0;
+
+- if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
++ if (!(atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_STOPPED))
+ rc = -EBUSY;
+ else {
+ vcpu->run->psw_mask = psw.mask;
+@@ -494,7 +498,7 @@ rerun_vcpu:
+ if (vcpu->sigset_active)
+ sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
+
+- atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
++ atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
+
+ BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL);
+
+diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
+index d6a50c1..2a129bf 100644
+--- a/arch/s390/kvm/sigp.c
++++ b/arch/s390/kvm/sigp.c
+@@ -57,8 +57,8 @@ static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr,
+ spin_lock(&fi->lock);
+ if (fi->local_int[cpu_addr] == NULL)
+ rc = 3; /* not operational */
+- else if (atomic_read(fi->local_int[cpu_addr]->cpuflags)
+- & CPUSTAT_RUNNING) {
++ else if (!(atomic_read(fi->local_int[cpu_addr]->cpuflags)
++ & CPUSTAT_STOPPED)) {
+ *reg &= 0xffffffff00000000UL;
+ rc = 1; /* status stored */
+ } else {
+@@ -212,7 +212,7 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
+
+ spin_lock_bh(&li->lock);
+ /* cpu must be in stopped state */
+- if (atomic_read(li->cpuflags) & CPUSTAT_RUNNING) {
++ if (!(atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) {
+ rc = 1; /* incorrect state */
+ *reg &= SIGP_STAT_INCORRECT_STATE;
+ kfree(inti);
+diff --git a/drivers/base/core.c b/drivers/base/core.c
+index bc8729d..78445f4 100644
+--- a/drivers/base/core.c
++++ b/drivers/base/core.c
+@@ -22,6 +22,7 @@
+ #include <linux/kallsyms.h>
+ #include <linux/mutex.h>
+ #include <linux/async.h>
++#include <linux/pm_runtime.h>
+
+ #include "base.h"
+ #include "power/power.h"
+@@ -1742,6 +1743,8 @@ void device_shutdown(void)
+ */
+ list_del_init(&dev->kobj.entry);
+ spin_unlock(&devices_kset->list_lock);
++ /* Disable all device's runtime power management */
++ pm_runtime_disable(dev);
+
+ if (dev->bus && dev->bus->shutdown) {
+ dev_dbg(dev, "shutdown\n");
+diff --git a/drivers/base/node.c b/drivers/base/node.c
+index 793f796..5693ece 100644
+--- a/drivers/base/node.c
++++ b/drivers/base/node.c
+@@ -127,12 +127,13 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
+ nid, K(node_page_state(nid, NR_WRITEBACK)),
+ nid, K(node_page_state(nid, NR_FILE_PAGES)),
+ nid, K(node_page_state(nid, NR_FILE_MAPPED)),
+- nid, K(node_page_state(nid, NR_ANON_PAGES)
+ #ifdef CONFIG_TRANSPARENT_HUGEPAGE
++ nid, K(node_page_state(nid, NR_ANON_PAGES)
+ + node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
+- HPAGE_PMD_NR
++ HPAGE_PMD_NR),
++#else
++ nid, K(node_page_state(nid, NR_ANON_PAGES)),
+ #endif
+- ),
+ nid, K(node_page_state(nid, NR_SHMEM)),
+ nid, node_page_state(nid, NR_KERNEL_STACK) *
+ THREAD_SIZE / 1024,
+@@ -143,13 +144,14 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
+ nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) +
+ node_page_state(nid, NR_SLAB_UNRECLAIMABLE)),
+ nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)),
+- nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
+ #ifdef CONFIG_TRANSPARENT_HUGEPAGE
++ nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
+ , nid,
+ K(node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
+- HPAGE_PMD_NR)
++ HPAGE_PMD_NR));
++#else
++ nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));
+ #endif
+- );
+ n += hugetlb_report_node_meminfo(nid, buf + n);
+ return n;
+ }
+diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
+index 542453f..90587de 100644
+--- a/drivers/gpu/drm/i915/i915_reg.h
++++ b/drivers/gpu/drm/i915/i915_reg.h
+@@ -2554,10 +2554,18 @@
+ #define _CURBBASE 0x700c4
+ #define _CURBPOS 0x700c8
+
++#define _CURBCNTR_IVB 0x71080
++#define _CURBBASE_IVB 0x71084
++#define _CURBPOS_IVB 0x71088
++
+ #define CURCNTR(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR)
+ #define CURBASE(pipe) _PIPE(pipe, _CURABASE, _CURBBASE)
+ #define CURPOS(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS)
+
++#define CURCNTR_IVB(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR_IVB)
++#define CURBASE_IVB(pipe) _PIPE(pipe, _CURABASE, _CURBBASE_IVB)
++#define CURPOS_IVB(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS_IVB)
++
+ /* Display A control */
+ #define _DSPACNTR 0x70180
+ #define DISPLAY_PLANE_ENABLE (1<<31)
+@@ -3167,6 +3175,7 @@
+ #define FDI_LINK_TRAIN_NONE_IVB (3<<8)
+
+ /* both Tx and Rx */
++#define FDI_COMPOSITE_SYNC (1<<11)
+ #define FDI_LINK_TRAIN_AUTO (1<<10)
+ #define FDI_SCRAMBLING_ENABLE (0<<7)
+ #define FDI_SCRAMBLING_DISABLE (1<<7)
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
+index 04411ad..e1340a2 100644
+--- a/drivers/gpu/drm/i915/intel_display.c
++++ b/drivers/gpu/drm/i915/intel_display.c
+@@ -2600,6 +2600,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
+ temp |= FDI_LINK_TRAIN_PATTERN_1_IVB;
+ temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;
+ temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B;
++ temp |= FDI_COMPOSITE_SYNC;
+ I915_WRITE(reg, temp | FDI_TX_ENABLE);
+
+ reg = FDI_RX_CTL(pipe);
+@@ -2607,6 +2608,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
+ temp &= ~FDI_LINK_TRAIN_AUTO;
+ temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT;
+ temp |= FDI_LINK_TRAIN_PATTERN_1_CPT;
++ temp |= FDI_COMPOSITE_SYNC;
+ I915_WRITE(reg, temp | FDI_RX_ENABLE);
+
+ POSTING_READ(reg);
+@@ -5758,6 +5760,31 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
+ I915_WRITE(CURBASE(pipe), base);
+ }
+
++static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
++{
++ struct drm_device *dev = crtc->dev;
++ struct drm_i915_private *dev_priv = dev->dev_private;
++ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
++ int pipe = intel_crtc->pipe;
++ bool visible = base != 0;
++
++ if (intel_crtc->cursor_visible != visible) {
++ uint32_t cntl = I915_READ(CURCNTR_IVB(pipe));
++ if (base) {
++ cntl &= ~CURSOR_MODE;
++ cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
++ } else {
++ cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
++ cntl |= CURSOR_MODE_DISABLE;
++ }
++ I915_WRITE(CURCNTR_IVB(pipe), cntl);
++
++ intel_crtc->cursor_visible = visible;
++ }
++ /* and commit changes on next vblank */
++ I915_WRITE(CURBASE_IVB(pipe), base);
++}
++
+ /* If no-part of the cursor is visible on the framebuffer, then the GPU may hang... */
+ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
+ bool on)
+@@ -5805,11 +5832,16 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
+ if (!visible && !intel_crtc->cursor_visible)
+ return;
+
+- I915_WRITE(CURPOS(pipe), pos);
+- if (IS_845G(dev) || IS_I865G(dev))
+- i845_update_cursor(crtc, base);
+- else
+- i9xx_update_cursor(crtc, base);
++ if (IS_IVYBRIDGE(dev)) {
++ I915_WRITE(CURPOS_IVB(pipe), pos);
++ ivb_update_cursor(crtc, base);
++ } else {
++ I915_WRITE(CURPOS(pipe), pos);
++ if (IS_845G(dev) || IS_I865G(dev))
++ i845_update_cursor(crtc, base);
++ else
++ i9xx_update_cursor(crtc, base);
++ }
+
+ if (visible)
+ intel_mark_busy(dev, to_intel_framebuffer(crtc->fb)->obj);
+diff --git a/drivers/media/video/saa7164/saa7164-cards.c b/drivers/media/video/saa7164/saa7164-cards.c
+index 69822a4..c713691 100644
+--- a/drivers/media/video/saa7164/saa7164-cards.c
++++ b/drivers/media/video/saa7164/saa7164-cards.c
+@@ -203,6 +203,66 @@ struct saa7164_board saa7164_boards[] = {
+ .i2c_reg_len = REGLEN_8bit,
+ } },
+ },
++ [SAA7164_BOARD_HAUPPAUGE_HVR2200_4] = {
++ .name = "Hauppauge WinTV-HVR2200",
++ .porta = SAA7164_MPEG_DVB,
++ .portb = SAA7164_MPEG_DVB,
++ .portc = SAA7164_MPEG_ENCODER,
++ .portd = SAA7164_MPEG_ENCODER,
++ .porte = SAA7164_MPEG_VBI,
++ .portf = SAA7164_MPEG_VBI,
++ .chiprev = SAA7164_CHIP_REV3,
++ .unit = {{
++ .id = 0x1d,
++ .type = SAA7164_UNIT_EEPROM,
++ .name = "4K EEPROM",
++ .i2c_bus_nr = SAA7164_I2C_BUS_0,
++ .i2c_bus_addr = 0xa0 >> 1,
++ .i2c_reg_len = REGLEN_8bit,
++ }, {
++ .id = 0x04,
++ .type = SAA7164_UNIT_TUNER,
++ .name = "TDA18271-1",
++ .i2c_bus_nr = SAA7164_I2C_BUS_1,
++ .i2c_bus_addr = 0xc0 >> 1,
++ .i2c_reg_len = REGLEN_8bit,
++ }, {
++ .id = 0x05,
++ .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
++ .name = "TDA8290-1",
++ .i2c_bus_nr = SAA7164_I2C_BUS_1,
++ .i2c_bus_addr = 0x84 >> 1,
++ .i2c_reg_len = REGLEN_8bit,
++ }, {
++ .id = 0x1b,
++ .type = SAA7164_UNIT_TUNER,
++ .name = "TDA18271-2",
++ .i2c_bus_nr = SAA7164_I2C_BUS_2,
++ .i2c_bus_addr = 0xc0 >> 1,
++ .i2c_reg_len = REGLEN_8bit,
++ }, {
++ .id = 0x1c,
++ .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
++ .name = "TDA8290-2",
++ .i2c_bus_nr = SAA7164_I2C_BUS_2,
++ .i2c_bus_addr = 0x84 >> 1,
++ .i2c_reg_len = REGLEN_8bit,
++ }, {
++ .id = 0x1e,
++ .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
++ .name = "TDA10048-1",
++ .i2c_bus_nr = SAA7164_I2C_BUS_1,
++ .i2c_bus_addr = 0x10 >> 1,
++ .i2c_reg_len = REGLEN_8bit,
++ }, {
++ .id = 0x1f,
++ .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
++ .name = "TDA10048-2",
++ .i2c_bus_nr = SAA7164_I2C_BUS_2,
++ .i2c_bus_addr = 0x12 >> 1,
++ .i2c_reg_len = REGLEN_8bit,
++ } },
++ },
+ [SAA7164_BOARD_HAUPPAUGE_HVR2250] = {
+ .name = "Hauppauge WinTV-HVR2250",
+ .porta = SAA7164_MPEG_DVB,
+@@ -426,6 +486,10 @@ struct saa7164_subid saa7164_subids[] = {
+ .subvendor = 0x0070,
+ .subdevice = 0x8851,
+ .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_2,
++ }, {
++ .subvendor = 0x0070,
++ .subdevice = 0x8940,
++ .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_4,
+ },
+ };
+ const unsigned int saa7164_idcount = ARRAY_SIZE(saa7164_subids);
+@@ -469,6 +533,7 @@ void saa7164_gpio_setup(struct saa7164_dev *dev)
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
++ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2250:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2250_2:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2250_3:
+@@ -549,6 +614,7 @@ void saa7164_card_setup(struct saa7164_dev *dev)
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
++ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2250:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2250_2:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2250_3:
+diff --git a/drivers/media/video/saa7164/saa7164-dvb.c b/drivers/media/video/saa7164/saa7164-dvb.c
+index f65eab6..d377937 100644
+--- a/drivers/media/video/saa7164/saa7164-dvb.c
++++ b/drivers/media/video/saa7164/saa7164-dvb.c
+@@ -475,6 +475,7 @@ int saa7164_dvb_register(struct saa7164_port *port)
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
+ case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
++ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
+ i2c_bus = &dev->i2c_bus[port->nr + 1];
+ switch (port->nr) {
+ case 0:
+diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
+index 6678bf1..35b6430 100644
+--- a/drivers/media/video/saa7164/saa7164.h
++++ b/drivers/media/video/saa7164/saa7164.h
+@@ -82,6 +82,7 @@
+ #define SAA7164_BOARD_HAUPPAUGE_HVR2200_3 6
+ #define SAA7164_BOARD_HAUPPAUGE_HVR2250_2 7
+ #define SAA7164_BOARD_HAUPPAUGE_HVR2250_3 8
++#define SAA7164_BOARD_HAUPPAUGE_HVR2200_4 9
+
+ #define SAA7164_MAX_UNITS 8
+ #define SAA7164_TS_NUMBER_OF_LINES 312
+diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
+index 2d6423c..8563e9a 100644
+--- a/drivers/misc/Kconfig
++++ b/drivers/misc/Kconfig
+@@ -472,7 +472,7 @@ config BMP085
+ module will be called bmp085.
+
+ config PCH_PHUB
+- tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) PHUB"
++ tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB"
+ depends on PCI
+ help
+ This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of
+@@ -480,12 +480,13 @@ config PCH_PHUB
+ processor. The Topcliff has MAC address and Option ROM data in SROM.
+ This driver can access MAC address and Option ROM data in SROM.
+
+- This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
+- Output Hub), ML7213 and ML7223.
+- ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is
+- for MP(Media Phone) use.
+- ML7213/ML7223 is companion chip for Intel Atom E6xx series.
+- ML7213/ML7223 is completely compatible for Intel EG20T PCH.
++ This driver also can be used for LAPIS Semiconductor's IOH,
++ ML7213/ML7223/ML7831.
++ ML7213 which is for IVI(In-Vehicle Infotainment) use.
++ ML7223 IOH is for MP(Media Phone) use.
++ ML7831 IOH is for general purpose use.
++ ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
++ ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.
+
+ To compile this driver as a module, choose M here: the module will
+ be called pch_phub.
+diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
+index 0fd7e77..ba276ba 100644
+--- a/drivers/misc/pch_phub.c
++++ b/drivers/misc/pch_phub.c
+@@ -73,6 +73,9 @@
+ #define PCI_DEVICE_ID_ROHM_ML7223_mPHUB 0x8012 /* for Bus-m */
+ #define PCI_DEVICE_ID_ROHM_ML7223_nPHUB 0x8002 /* for Bus-n */
+
++/* Macros for ML7831 */
++#define PCI_DEVICE_ID_ROHM_ML7831_PHUB 0x8801
++
+ /* SROM ACCESS Macro */
+ #define PCH_WORD_ADDR_MASK (~((1 << 2) - 1))
+
+@@ -464,7 +467,7 @@ static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data)
+ int retval;
+ int i;
+
+- if (chip->ioh_type == 1) /* EG20T */
++ if ((chip->ioh_type == 1) || (chip->ioh_type == 5)) /* EG20T or ML7831*/
+ retval = pch_phub_gbe_serial_rom_conf(chip);
+ else /* ML7223 */
+ retval = pch_phub_gbe_serial_rom_conf_mp(chip);
+@@ -757,6 +760,22 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
+ chip->pch_opt_rom_start_address =\
+ PCH_PHUB_ROM_START_ADDR_ML7223;
+ chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
++ } else if (id->driver_data == 5) { /* ML7831 */
++ retval = sysfs_create_file(&pdev->dev.kobj,
++ &dev_attr_pch_mac.attr);
++ if (retval)
++ goto err_sysfs_create;
++
++ retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
++ if (retval)
++ goto exit_bin_attr;
++
++ /* set the prefech value */
++ iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14);
++ /* set the interrupt delay value */
++ iowrite32(0x25, chip->pch_phub_base_address + 0x44);
++ chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T;
++ chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T;
+ }
+
+ chip->ioh_type = id->driver_data;
+@@ -841,6 +860,7 @@ static struct pci_device_id pch_phub_pcidev_id[] = {
+ { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), 2, },
+ { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_mPHUB), 3, },
+ { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_nPHUB), 4, },
++ { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7831_PHUB), 5, },
+ { }
+ };
+ MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id);
+diff --git a/drivers/misc/spear13xx_pcie_gadget.c b/drivers/misc/spear13xx_pcie_gadget.c
+index cfbddbe..43d073b 100644
+--- a/drivers/misc/spear13xx_pcie_gadget.c
++++ b/drivers/misc/spear13xx_pcie_gadget.c
+@@ -903,6 +903,6 @@ static void __exit spear_pcie_gadget_exit(void)
+ }
+ module_exit(spear_pcie_gadget_exit);
+
+-MODULE_ALIAS("pcie-gadget-spear");
++MODULE_ALIAS("platform:pcie-gadget-spear");
+ MODULE_AUTHOR("Pratyush Anand");
+ MODULE_LICENSE("GPL");
+diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
+index e0286cf..7be8b05 100644
+--- a/drivers/net/wireless/libertas/if_spi.c
++++ b/drivers/net/wireless/libertas/if_spi.c
+@@ -999,6 +999,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
+ spin_unlock_irqrestore(&card->buffer_lock, flags);
+ break;
+ default:
++ kfree(packet);
+ netdev_err(priv->dev, "can't transfer buffer of type %d\n",
+ type);
+ err = -EINVAL;
+diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
+index f82bfeb..0415e47 100644
+--- a/drivers/net/wireless/rt2x00/rt2x00.h
++++ b/drivers/net/wireless/rt2x00/rt2x00.h
+@@ -923,6 +923,7 @@ struct rt2x00_dev {
+ * Powersaving work
+ */
+ struct delayed_work autowakeup_work;
++ struct work_struct sleep_work;
+
+ /*
+ * Data queue arrays for RX, TX, Beacon and ATIM.
+diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
+index 0955c94..9d05f87 100644
+--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
++++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
+@@ -449,6 +449,23 @@ static u8 *rt2x00lib_find_ie(u8 *data, unsigned int len, u8 ie)
+ return NULL;
+ }
+
++static void rt2x00lib_sleep(struct work_struct *work)
++{
++ struct rt2x00_dev *rt2x00dev =
++ container_of(work, struct rt2x00_dev, sleep_work);
++
++ if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
++ return;
++
++ /*
++ * Check again is powersaving is enabled, to prevent races from delayed
++ * work execution.
++ */
++ if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags))
++ rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf,
++ IEEE80211_CONF_CHANGE_PS);
++}
++
+ static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev,
+ struct sk_buff *skb,
+ struct rxdone_entry_desc *rxdesc)
+@@ -496,8 +513,7 @@ static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev,
+ cam |= (tim_ie->bitmap_ctrl & 0x01);
+
+ if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags))
+- rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf,
+- IEEE80211_CONF_CHANGE_PS);
++ queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work);
+ }
+
+ static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev,
+@@ -1121,6 +1137,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
+
+ INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
+ INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
++ INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
+
+ /*
+ * Let the driver probe the device to detect the capabilities.
+@@ -1177,6 +1194,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
+ */
+ cancel_work_sync(&rt2x00dev->intf_work);
+ cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
++ cancel_work_sync(&rt2x00dev->sleep_work);
+ if (rt2x00_is_usb(rt2x00dev)) {
+ del_timer_sync(&rt2x00dev->txstatus_timer);
+ cancel_work_sync(&rt2x00dev->rxdone_work);
+diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
+index 3382475..c7b6fed 100644
+--- a/drivers/scsi/aacraid/linit.c
++++ b/drivers/scsi/aacraid/linit.c
+@@ -38,6 +38,7 @@
+ #include <linux/module.h>
+ #include <linux/moduleparam.h>
+ #include <linux/pci.h>
++#include <linux/pci-aspm.h>
+ #include <linux/slab.h>
+ #include <linux/mutex.h>
+ #include <linux/spinlock.h>
+@@ -1108,6 +1109,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
+ unique_id++;
+ }
+
++ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
++ PCIE_LINK_STATE_CLKPM);
++
+ error = pci_enable_device(pdev);
+ if (error)
+ goto out;
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 8c713d3..418ce83 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -23,6 +23,7 @@
+ #include <linux/interrupt.h>
+ #include <linux/types.h>
+ #include <linux/pci.h>
++#include <linux/pci-aspm.h>
+ #include <linux/kernel.h>
+ #include <linux/slab.h>
+ #include <linux/delay.h>
+@@ -3887,6 +3888,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
+ dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
+ return -ENODEV;
+ }
++
++ pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
++ PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
++
+ err = pci_enable_device(h->pdev);
+ if (err) {
+ dev_warn(&h->pdev->dev, "unable to enable PCI device\n");
+diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
+index 72273a0..b3c6d95 100644
+--- a/drivers/scsi/scsi_scan.c
++++ b/drivers/scsi/scsi_scan.c
+@@ -319,11 +319,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
+ return sdev;
+
+ out_device_destroy:
+- scsi_device_set_state(sdev, SDEV_DEL);
+- transport_destroy_device(&sdev->sdev_gendev);
+- put_device(&sdev->sdev_dev);
+- scsi_free_queue(sdev->request_queue);
+- put_device(&sdev->sdev_gendev);
++ __scsi_remove_device(sdev);
+ out:
+ if (display_failure_msg)
+ printk(ALLOC_FAILURE_MSG, __func__);
+diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c
+index 435f6fa..44fbeba 100644
+--- a/drivers/tty/hvc/hvc_dcc.c
++++ b/drivers/tty/hvc/hvc_dcc.c
+@@ -46,6 +46,7 @@ static inline char __dcc_getchar(void)
+
+ asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
+ : "=r" (__c));
++ isb();
+
+ return __c;
+ }
+@@ -55,6 +56,7 @@ static inline void __dcc_putchar(char c)
+ asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char"
+ : /* no output register */
+ : "r" (c));
++ isb();
+ }
+
+ static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
+diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
+index 4dcb37b..abf6fa4 100644
+--- a/drivers/tty/serial/Kconfig
++++ b/drivers/tty/serial/Kconfig
+@@ -1570,7 +1570,7 @@ config SERIAL_IFX6X60
+ Support for the IFX6x60 modem devices on Intel MID platforms.
+
+ config SERIAL_PCH_UART
+- tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) UART"
++ tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) UART"
+ depends on PCI
+ select SERIAL_CORE
+ help
+@@ -1578,12 +1578,12 @@ config SERIAL_PCH_UART
+ which is an IOH(Input/Output Hub) for x86 embedded processor.
+ Enabling PCH_DMA, this PCH UART works as DMA mode.
+
+- This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
+- Output Hub), ML7213 and ML7223.
+- ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is
+- for MP(Media Phone) use.
+- ML7213/ML7223 is companion chip for Intel Atom E6xx series.
+- ML7213/ML7223 is completely compatible for Intel EG20T PCH.
++ This driver also can be used for LAPIS Semiconductor IOH(Input/
++ Output Hub), ML7213, ML7223 and ML7831.
++ ML7213 IOH is for IVI(In-Vehicle Infotainment) use, ML7223 IOH is
++ for MP(Media Phone) use and ML7831 IOH is for general purpose use.
++ ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
++ ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.
+
+ config SERIAL_MSM_SMD
+ bool "Enable tty device interface for some SMD ports"
+diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
+index b46218d..f913ed0 100644
+--- a/drivers/tty/serial/pch_uart.c
++++ b/drivers/tty/serial/pch_uart.c
+@@ -256,6 +256,8 @@ enum pch_uart_num_t {
+ pch_ml7213_uart2,
+ pch_ml7223_uart0,
+ pch_ml7223_uart1,
++ pch_ml7831_uart0,
++ pch_ml7831_uart1,
+ };
+
+ static struct pch_uart_driver_data drv_dat[] = {
+@@ -268,6 +270,8 @@ static struct pch_uart_driver_data drv_dat[] = {
+ [pch_ml7213_uart2] = {PCH_UART_2LINE, 2},
+ [pch_ml7223_uart0] = {PCH_UART_8LINE, 0},
+ [pch_ml7223_uart1] = {PCH_UART_2LINE, 1},
++ [pch_ml7831_uart0] = {PCH_UART_8LINE, 0},
++ [pch_ml7831_uart1] = {PCH_UART_2LINE, 1},
+ };
+
+ static unsigned int default_baud = 9600;
+@@ -626,6 +630,7 @@ static void pch_request_dma(struct uart_port *port)
+ dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n",
+ __func__);
+ dma_release_channel(priv->chan_tx);
++ priv->chan_tx = NULL;
+ return;
+ }
+
+@@ -1213,8 +1218,7 @@ static void pch_uart_shutdown(struct uart_port *port)
+ dev_err(priv->port.dev,
+ "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret);
+
+- if (priv->use_dma_flag)
+- pch_free_dma(port);
++ pch_free_dma(port);
+
+ free_irq(priv->port.irq, priv);
+ }
+@@ -1278,6 +1282,7 @@ static void pch_uart_set_termios(struct uart_port *port,
+ if (rtn)
+ goto out;
+
++ pch_uart_set_mctrl(&priv->port, priv->port.mctrl);
+ /* Don't rewrite B0 */
+ if (tty_termios_baud_rate(termios))
+ tty_termios_encode_baud_rate(termios, baud, baud);
+@@ -1550,6 +1555,10 @@ static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = {
+ .driver_data = pch_ml7223_uart0},
+ {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x800D),
+ .driver_data = pch_ml7223_uart1},
++ {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8811),
++ .driver_data = pch_ml7831_uart0},
++ {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8812),
++ .driver_data = pch_ml7831_uart1},
+ {0,},
+ };
+
+diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
+index ef925d5..a76c808 100644
+--- a/drivers/tty/tty_ldisc.c
++++ b/drivers/tty/tty_ldisc.c
+@@ -36,6 +36,7 @@
+
+ #include <linux/kmod.h>
+ #include <linux/nsproxy.h>
++#include <linux/ratelimit.h>
+
+ /*
+ * This guards the refcounted line discipline lists. The lock
+@@ -548,15 +549,16 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
+ /**
+ * tty_ldisc_wait_idle - wait for the ldisc to become idle
+ * @tty: tty to wait for
++ * @timeout: for how long to wait at most
+ *
+ * Wait for the line discipline to become idle. The discipline must
+ * have been halted for this to guarantee it remains idle.
+ */
+-static int tty_ldisc_wait_idle(struct tty_struct *tty)
++static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout)
+ {
+- int ret;
++ long ret;
+ ret = wait_event_timeout(tty_ldisc_idle,
+- atomic_read(&tty->ldisc->users) == 1, 5 * HZ);
++ atomic_read(&tty->ldisc->users) == 1, timeout);
+ if (ret < 0)
+ return ret;
+ return ret > 0 ? 0 : -EBUSY;
+@@ -666,7 +668,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
+
+ tty_ldisc_flush_works(tty);
+
+- retval = tty_ldisc_wait_idle(tty);
++ retval = tty_ldisc_wait_idle(tty, 5 * HZ);
+
+ tty_lock();
+ mutex_lock(&tty->ldisc_mutex);
+@@ -763,8 +765,6 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
+ if (IS_ERR(ld))
+ return -1;
+
+- WARN_ON_ONCE(tty_ldisc_wait_idle(tty));
+-
+ tty_ldisc_close(tty, tty->ldisc);
+ tty_ldisc_put(tty->ldisc);
+ tty->ldisc = NULL;
+@@ -839,7 +839,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
+ tty_unlock();
+ cancel_work_sync(&tty->buf.work);
+ mutex_unlock(&tty->ldisc_mutex);
+-
++retry:
+ tty_lock();
+ mutex_lock(&tty->ldisc_mutex);
+
+@@ -848,6 +848,22 @@ void tty_ldisc_hangup(struct tty_struct *tty)
+ it means auditing a lot of other paths so this is
+ a FIXME */
+ if (tty->ldisc) { /* Not yet closed */
++ if (atomic_read(&tty->ldisc->users) != 1) {
++ char cur_n[TASK_COMM_LEN], tty_n[64];
++ long timeout = 3 * HZ;
++ tty_unlock();
++
++ while (tty_ldisc_wait_idle(tty, timeout) == -EBUSY) {
++ timeout = MAX_SCHEDULE_TIMEOUT;
++ printk_ratelimited(KERN_WARNING
++ "%s: waiting (%s) for %s took too long, but we keep waiting...\n",
++ __func__, get_task_comm(cur_n, current),
++ tty_name(tty, tty_n));
++ }
++ mutex_unlock(&tty->ldisc_mutex);
++ goto retry;
++ }
++
+ if (reset == 0) {
+
+ if (!tty_ldisc_reinit(tty, tty->termios->c_line))
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
+index 5112f57..2ffcaa0 100644
+--- a/drivers/usb/class/cdc-acm.c
++++ b/drivers/usb/class/cdc-acm.c
+@@ -539,7 +539,6 @@ static void acm_port_down(struct acm *acm)
+ {
+ int i;
+
+- mutex_lock(&open_mutex);
+ if (acm->dev) {
+ usb_autopm_get_interface(acm->control);
+ acm_set_control(acm, acm->ctrlout = 0);
+@@ -551,14 +550,15 @@ static void acm_port_down(struct acm *acm)
+ acm->control->needs_remote_wakeup = 0;
+ usb_autopm_put_interface(acm->control);
+ }
+- mutex_unlock(&open_mutex);
+ }
+
+ static void acm_tty_hangup(struct tty_struct *tty)
+ {
+ struct acm *acm = tty->driver_data;
+ tty_port_hangup(&acm->port);
++ mutex_lock(&open_mutex);
+ acm_port_down(acm);
++ mutex_unlock(&open_mutex);
+ }
+
+ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
+@@ -569,8 +569,9 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
+ shutdown */
+ if (!acm)
+ return;
++
++ mutex_lock(&open_mutex);
+ if (tty_port_close_start(&acm->port, tty, filp) == 0) {
+- mutex_lock(&open_mutex);
+ if (!acm->dev) {
+ tty_port_tty_set(&acm->port, NULL);
+ acm_tty_unregister(acm);
+@@ -582,6 +583,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
+ acm_port_down(acm);
+ tty_port_close_end(&acm->port, tty);
+ tty_port_tty_set(&acm->port, NULL);
++ mutex_unlock(&open_mutex);
+ }
+
+ static int acm_tty_write(struct tty_struct *tty,
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
+index a428aa0..210e359 100644
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -813,6 +813,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
+ USB_PORT_FEAT_C_PORT_LINK_STATE);
+ }
+
++ if ((portchange & USB_PORT_STAT_C_BH_RESET) &&
++ hub_is_superspeed(hub->hdev)) {
++ need_debounce_delay = true;
++ clear_port_feature(hub->hdev, port1,
++ USB_PORT_FEAT_C_BH_PORT_RESET);
++ }
+ /* We can forget about a "removed" device when there's a
+ * physical disconnect or the connect status changes.
+ */
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
+index d6a8d82..ecf12e1 100644
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -50,15 +50,42 @@ static const struct usb_device_id usb_quirk_list[] = {
+ /* Logitech Webcam B/C500 */
+ { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME },
+
++ /* Logitech Webcam C600 */
++ { USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME },
++
+ /* Logitech Webcam Pro 9000 */
+ { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME },
+
++ /* Logitech Webcam C905 */
++ { USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME },
++
++ /* Logitech Webcam C210 */
++ { USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME },
++
++ /* Logitech Webcam C260 */
++ { USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME },
++
+ /* Logitech Webcam C310 */
+ { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME },
+
++ /* Logitech Webcam C910 */
++ { USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME },
++
++ /* Logitech Webcam C160 */
++ { USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME },
++
+ /* Logitech Webcam C270 */
+ { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
+
++ /* Logitech Quickcam Pro 9000 */
++ { USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME },
++
++ /* Logitech Quickcam E3500 */
++ { USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME },
++
++ /* Logitech Quickcam Vision Pro */
++ { USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME },
++
+ /* Logitech Harmony 700-series */
+ { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
+
+diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
+index 5a084b9..6f50491 100644
+--- a/drivers/usb/gadget/Kconfig
++++ b/drivers/usb/gadget/Kconfig
+@@ -442,7 +442,7 @@ config USB_LANGWELL
+ gadget drivers to also be dynamically linked.
+
+ config USB_EG20T
+- tristate "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC"
++ tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC"
+ depends on PCI
+ select USB_GADGET_DUALSPEED
+ help
+@@ -458,10 +458,11 @@ config USB_EG20T
+ This driver dose not support interrupt transfer or isochronous
+ transfer modes.
+
+- This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is
++ This driver also can be used for LAPIS Semiconductor's ML7213 which is
+ for IVI(In-Vehicle Infotainment) use.
+- ML7213 is companion chip for Intel Atom E6xx series.
+- ML7213 is completely compatible for Intel EG20T PCH.
++ ML7831 is for general purpose use.
++ ML7213/ML7831 is companion chip for Intel Atom E6xx series.
++ ML7213/ML7831 is completely compatible for Intel EG20T PCH.
+
+ config USB_CI13XXX_MSM
+ tristate "MIPS USB CI13xxx for MSM"
+diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
+index f96615a..06c40b1 100644
+--- a/drivers/usb/gadget/pch_udc.c
++++ b/drivers/usb/gadget/pch_udc.c
+@@ -363,6 +363,7 @@ struct pch_udc_dev {
+ #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808
+ #define PCI_VENDOR_ID_ROHM 0x10DB
+ #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D
++#define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808
+
+ static const char ep0_string[] = "ep0in";
+ static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */
+@@ -2979,6 +2980,11 @@ static DEFINE_PCI_DEVICE_TABLE(pch_udc_pcidev_id) = {
+ .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
+ .class_mask = 0xffffffff,
+ },
++ {
++ PCI_DEVICE(PCI_VENDOR_ID_ROHM, PCI_DEVICE_ID_ML7831_IOH_UDC),
++ .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
++ .class_mask = 0xffffffff,
++ },
+ { 0 },
+ };
+
+diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
+index 29bec34..afef3df 100644
+--- a/drivers/usb/host/ehci-sched.c
++++ b/drivers/usb/host/ehci-sched.c
+@@ -1480,10 +1480,15 @@ iso_stream_schedule (
+
+ /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */
+
+- /* find a uframe slot with enough bandwidth */
+- next = start + period;
+- for (; start < next; start++) {
+-
++ /* find a uframe slot with enough bandwidth.
++ * Early uframes are more precious because full-speed
++ * iso IN transfers can't use late uframes,
++ * and therefore they should be allocated last.
++ */
++ next = start;
++ start += period;
++ do {
++ start--;
+ /* check schedule: enough space? */
+ if (stream->highspeed) {
+ if (itd_slot_ok(ehci, mod, start,
+@@ -1496,7 +1501,7 @@ iso_stream_schedule (
+ start, sched, period))
+ break;
+ }
+- }
++ } while (start > next);
+
+ /* no room in the schedule */
+ if (start == next) {
+diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
+index 629a968..a495d48 100644
+--- a/drivers/usb/host/pci-quirks.c
++++ b/drivers/usb/host/pci-quirks.c
+@@ -626,7 +626,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
+ void __iomem *base, *op_reg_base;
+ u32 hcc_params, cap, val;
+ u8 offset, cap_length;
+- int wait_time, delta, count = 256/4;
++ int wait_time, count = 256/4;
+
+ if (!mmio_resource_enabled(pdev, 0))
+ return;
+@@ -672,11 +672,10 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
+ writel(val, op_reg_base + EHCI_USBCMD);
+
+ wait_time = 2000;
+- delta = 100;
+ do {
+ writel(0x3f, op_reg_base + EHCI_USBSTS);
+- udelay(delta);
+- wait_time -= delta;
++ udelay(100);
++ wait_time -= 100;
+ val = readl(op_reg_base + EHCI_USBSTS);
+ if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) {
+ break;
+diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
+index 3428528..d718033 100644
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -875,7 +875,6 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
+ struct xhci_virt_device *dev;
+ struct xhci_ep_ctx *ep0_ctx;
+ struct xhci_slot_ctx *slot_ctx;
+- struct xhci_input_control_ctx *ctrl_ctx;
+ u32 port_num;
+ struct usb_device *top_dev;
+
+@@ -887,12 +886,8 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
+ return -EINVAL;
+ }
+ ep0_ctx = xhci_get_ep_ctx(xhci, dev->in_ctx, 0);
+- ctrl_ctx = xhci_get_input_control_ctx(xhci, dev->in_ctx);
+ slot_ctx = xhci_get_slot_ctx(xhci, dev->in_ctx);
+
+- /* 2) New slot context and endpoint 0 context are valid*/
+- ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
+-
+ /* 3) Only the control endpoint is valid - one endpoint context */
+ slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route);
+ switch (udev->speed) {
+diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
+index dd3eb6f..2c07fff 100644
+--- a/drivers/usb/host/xhci-ring.c
++++ b/drivers/usb/host/xhci-ring.c
+@@ -816,23 +816,24 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
+ struct xhci_ring *ring;
+ struct xhci_td *cur_td;
+ int ret, i, j;
++ unsigned long flags;
+
+ ep = (struct xhci_virt_ep *) arg;
+ xhci = ep->xhci;
+
+- spin_lock(&xhci->lock);
++ spin_lock_irqsave(&xhci->lock, flags);
+
+ ep->stop_cmds_pending--;
+ if (xhci->xhc_state & XHCI_STATE_DYING) {
+ xhci_dbg(xhci, "Stop EP timer ran, but another timer marked "
+ "xHCI as DYING, exiting.\n");
+- spin_unlock(&xhci->lock);
++ spin_unlock_irqrestore(&xhci->lock, flags);
+ return;
+ }
+ if (!(ep->stop_cmds_pending == 0 && (ep->ep_state & EP_HALT_PENDING))) {
+ xhci_dbg(xhci, "Stop EP timer ran, but no command pending, "
+ "exiting.\n");
+- spin_unlock(&xhci->lock);
++ spin_unlock_irqrestore(&xhci->lock, flags);
+ return;
+ }
+
+@@ -844,11 +845,11 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
+ xhci->xhc_state |= XHCI_STATE_DYING;
+ /* Disable interrupts from the host controller and start halting it */
+ xhci_quiesce(xhci);
+- spin_unlock(&xhci->lock);
++ spin_unlock_irqrestore(&xhci->lock, flags);
+
+ ret = xhci_halt(xhci);
+
+- spin_lock(&xhci->lock);
++ spin_lock_irqsave(&xhci->lock, flags);
+ if (ret < 0) {
+ /* This is bad; the host is not responding to commands and it's
+ * not allowing itself to be halted. At least interrupts are
+@@ -896,7 +897,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
+ }
+ }
+ }
+- spin_unlock(&xhci->lock);
++ spin_unlock_irqrestore(&xhci->lock, flags);
+ xhci_dbg(xhci, "Calling usb_hc_died()\n");
+ usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
+ xhci_dbg(xhci, "xHCI host controller is dead.\n");
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
+index 3770004..67900ff 100644
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -749,7 +749,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
+ u32 command, temp = 0;
+ struct usb_hcd *hcd = xhci_to_hcd(xhci);
+ struct usb_hcd *secondary_hcd;
+- int retval;
++ int retval = 0;
+
+ /* Wait a bit if either of the roothubs need to settle from the
+ * transition into bus suspend.
+@@ -759,6 +759,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
+ xhci->bus_state[1].next_statechange))
+ msleep(100);
+
++ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
++ set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
++
+ spin_lock_irq(&xhci->lock);
+ if (xhci->quirks & XHCI_RESET_ON_RESUME)
+ hibernated = true;
+@@ -828,20 +831,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
+ return retval;
+ xhci_dbg(xhci, "Start the primary HCD\n");
+ retval = xhci_run(hcd->primary_hcd);
+- if (retval)
+- goto failed_restart;
+-
+- xhci_dbg(xhci, "Start the secondary HCD\n");
+- retval = xhci_run(secondary_hcd);
+ if (!retval) {
+- set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+- set_bit(HCD_FLAG_HW_ACCESSIBLE,
+- &xhci->shared_hcd->flags);
++ xhci_dbg(xhci, "Start the secondary HCD\n");
++ retval = xhci_run(secondary_hcd);
+ }
+-failed_restart:
+ hcd->state = HC_STATE_SUSPENDED;
+ xhci->shared_hcd->state = HC_STATE_SUSPENDED;
+- return retval;
++ goto done;
+ }
+
+ /* step 4: set Run/Stop bit */
+@@ -860,11 +856,14 @@ failed_restart:
+ * Running endpoints by ringing their doorbells
+ */
+
+- set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+- set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
+-
+ spin_unlock_irq(&xhci->lock);
+- return 0;
++
++ done:
++ if (retval == 0) {
++ usb_hcd_resume_root_hub(hcd);
++ usb_hcd_resume_root_hub(xhci->shared_hcd);
++ }
++ return retval;
+ }
+ #endif /* CONFIG_PM */
+
+@@ -2873,6 +2872,10 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
+ /* Otherwise, update the control endpoint ring enqueue pointer. */
+ else
+ xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev);
++ ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
++ ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
++ ctrl_ctx->drop_flags = 0;
++
+ xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
+ xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);
+
+@@ -2954,7 +2957,6 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
+ virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK)
+ + 1;
+ /* Zero the input context control for later use */
+- ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
+ ctrl_ctx->add_flags = 0;
+ ctrl_ctx->drop_flags = 0;
+
+diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
+index 5cdb9d9..18e875b 100644
+--- a/drivers/usb/serial/ark3116.c
++++ b/drivers/usb/serial/ark3116.c
+@@ -42,7 +42,7 @@ static int debug;
+ * Version information
+ */
+
+-#define DRIVER_VERSION "v0.6"
++#define DRIVER_VERSION "v0.7"
+ #define DRIVER_AUTHOR "Bart Hartgers <bart.hartgers+ark3116@gmail.com>"
+ #define DRIVER_DESC "USB ARK3116 serial/IrDA driver"
+ #define DRIVER_DEV_DESC "ARK3116 RS232/IrDA"
+@@ -380,10 +380,6 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
+ goto err_out;
+ }
+
+- /* setup termios */
+- if (tty)
+- ark3116_set_termios(tty, port, NULL);
+-
+ /* remove any data still left: also clears error state */
+ ark3116_read_reg(serial, UART_RX, buf);
+
+@@ -406,6 +402,10 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
+ /* enable DMA */
+ ark3116_write_reg(port->serial, UART_FCR, UART_FCR_DMA_SELECT);
+
++ /* setup termios */
++ if (tty)
++ ark3116_set_termios(tty, port, NULL);
++
+ err_out:
+ kfree(buf);
+ return result;
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
+index f34f6ed..e16394c 100644
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -2083,13 +2083,19 @@ static void ftdi_set_termios(struct tty_struct *tty,
+
+ cflag = termios->c_cflag;
+
+- /* FIXME -For this cut I don't care if the line is really changing or
+- not - so just do the change regardless - should be able to
+- compare old_termios and tty->termios */
++ if (old_termios->c_cflag == termios->c_cflag
++ && old_termios->c_ispeed == termios->c_ispeed
++ && old_termios->c_ospeed == termios->c_ospeed)
++ goto no_c_cflag_changes;
++
+ /* NOTE These routines can get interrupted by
+ ftdi_sio_read_bulk_callback - need to examine what this means -
+ don't see any problems yet */
+
++ if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
++ (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
++ goto no_data_parity_stop_changes;
++
+ /* Set number of data bits, parity, stop bits */
+
+ urb_value = 0;
+@@ -2130,6 +2136,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
+ }
+
+ /* Now do the baudrate */
++no_data_parity_stop_changes:
+ if ((cflag & CBAUD) == B0) {
+ /* Disable flow control */
+ if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+@@ -2157,6 +2164,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
+
+ /* Set flow control */
+ /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
++no_c_cflag_changes:
+ if (cflag & CRTSCTS) {
+ dbg("%s Setting to CRTSCTS flow control", __func__);
+ if (usb_control_msg(dev,
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
+index 89ae1f6..3a47cbe 100644
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -156,6 +156,7 @@ static void option_instat_callback(struct urb *urb);
+ #define HUAWEI_PRODUCT_K4511 0x14CC
+ #define HUAWEI_PRODUCT_ETS1220 0x1803
+ #define HUAWEI_PRODUCT_E353 0x1506
++#define HUAWEI_PRODUCT_E173S 0x1C05
+
+ #define QUANTA_VENDOR_ID 0x0408
+ #define QUANTA_PRODUCT_Q101 0xEA02
+@@ -316,6 +317,9 @@ static void option_instat_callback(struct urb *urb);
+ #define ZTE_PRODUCT_AC8710 0xfff1
+ #define ZTE_PRODUCT_AC2726 0xfff5
+ #define ZTE_PRODUCT_AC8710T 0xffff
++#define ZTE_PRODUCT_MC2718 0xffe8
++#define ZTE_PRODUCT_AD3812 0xffeb
++#define ZTE_PRODUCT_MC2716 0xffed
+
+ #define BENQ_VENDOR_ID 0x04a5
+ #define BENQ_PRODUCT_H10 0x4068
+@@ -500,6 +504,18 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = {
+ .reserved = BIT(4),
+ };
+
++static const struct option_blacklist_info zte_ad3812_z_blacklist = {
++ .sendsetup = BIT(0) | BIT(1) | BIT(2),
++};
++
++static const struct option_blacklist_info zte_mc2718_z_blacklist = {
++ .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4),
++};
++
++static const struct option_blacklist_info zte_mc2716_z_blacklist = {
++ .sendsetup = BIT(1) | BIT(2) | BIT(3),
++};
++
+ static const struct option_blacklist_info huawei_cdc12_blacklist = {
+ .reserved = BIT(1) | BIT(2),
+ };
+@@ -622,6 +638,7 @@ static const struct usb_device_id option_ids[] = {
+ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
+ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
+ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S, 0xff, 0xff, 0xff) },
+ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
+ .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
+ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
+@@ -1043,6 +1060,12 @@ static const struct usb_device_id option_ids[] = {
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff),
++ .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist },
++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff),
++ .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
++ .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
+ { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
+ { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
+ { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
+diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
+index 614fabc..d44c669 100644
+--- a/drivers/usb/serial/pl2303.c
++++ b/drivers/usb/serial/pl2303.c
+@@ -91,7 +91,6 @@ static const struct usb_device_id id_table[] = {
+ { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
+ { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
+ { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
+- { USB_DEVICE(WINCHIPHEAD_VENDOR_ID, WINCHIPHEAD_USBSER_PRODUCT_ID) },
+ { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) },
+ { } /* Terminating entry */
+ };
+diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
+index 3d10d7f..c38b8c0 100644
+--- a/drivers/usb/serial/pl2303.h
++++ b/drivers/usb/serial/pl2303.h
+@@ -145,10 +145,6 @@
+ #define ADLINK_VENDOR_ID 0x0b63
+ #define ADLINK_ND6530_PRODUCT_ID 0x6530
+
+-/* WinChipHead USB->RS 232 adapter */
+-#define WINCHIPHEAD_VENDOR_ID 0x4348
+-#define WINCHIPHEAD_USBSER_PRODUCT_ID 0x5523
+-
+ /* SMART USB Serial Adapter */
+ #define SMART_VENDOR_ID 0x0b8c
+ #define SMART_PRODUCT_ID 0x2303
+diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
+index fc310f7..0fded39 100644
+--- a/drivers/usb/storage/protocol.c
++++ b/drivers/usb/storage/protocol.c
+@@ -58,7 +58,9 @@
+
+ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
+ {
+- /* Pad the SCSI command with zeros out to 12 bytes
++ /*
++ * Pad the SCSI command with zeros out to 12 bytes. If the
++ * command already is 12 bytes or longer, leave it alone.
+ *
+ * NOTE: This only works because a scsi_cmnd struct field contains
+ * a unsigned char cmnd[16], so we know we have storage available
+@@ -66,9 +68,6 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
+ for (; srb->cmd_len<12; srb->cmd_len++)
+ srb->cmnd[srb->cmd_len] = 0;
+
+- /* set command length to 12 bytes */
+- srb->cmd_len = 12;
+-
+ /* send the command to the transport layer */
+ usb_stor_invoke_transport(srb, us);
+ }
+diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
+index b238d95..ac28990 100644
+--- a/fs/nfs/dir.c
++++ b/fs/nfs/dir.c
+@@ -1468,12 +1468,12 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
+ res = NULL;
+ goto out;
+ /* This turned out not to be a regular file */
++ case -EISDIR:
+ case -ENOTDIR:
+ goto no_open;
+ case -ELOOP:
+ if (!(nd->intent.open.flags & O_NOFOLLOW))
+ goto no_open;
+- /* case -EISDIR: */
+ /* case -EINVAL: */
+ default:
+ res = ERR_CAST(inode);
+diff --git a/fs/nfs/file.c b/fs/nfs/file.c
+index 28b8c3f..5b3d984 100644
+--- a/fs/nfs/file.c
++++ b/fs/nfs/file.c
+@@ -895,3 +895,35 @@ static int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
+ file->f_path.dentry->d_name.name, arg);
+ return -EINVAL;
+ }
++
++#ifdef CONFIG_NFS_V4
++static int
++nfs4_file_open(struct inode *inode, struct file *filp)
++{
++ /*
++ * NFSv4 opens are handled in d_lookup and d_revalidate. If we get to
++ * this point, then something is very wrong
++ */
++ dprintk("NFS: %s called! inode=%p filp=%p\n", __func__, inode, filp);
++ return -ENOTDIR;
++}
++
++const struct file_operations nfs4_file_operations = {
++ .llseek = nfs_file_llseek,
++ .read = do_sync_read,
++ .write = do_sync_write,
++ .aio_read = nfs_file_read,
++ .aio_write = nfs_file_write,
++ .mmap = nfs_file_mmap,
++ .open = nfs4_file_open,
++ .flush = nfs_file_flush,
++ .release = nfs_file_release,
++ .fsync = nfs_file_fsync,
++ .lock = nfs_lock,
++ .flock = nfs_flock,
++ .splice_read = nfs_file_splice_read,
++ .splice_write = nfs_file_splice_write,
++ .check_flags = nfs_check_flags,
++ .setlease = nfs_setlease,
++};
++#endif /* CONFIG_NFS_V4 */
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
+index fe12037..679d2f5 100644
+--- a/fs/nfs/inode.c
++++ b/fs/nfs/inode.c
+@@ -291,7 +291,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
+ */
+ inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->file_inode_ops;
+ if (S_ISREG(inode->i_mode)) {
+- inode->i_fop = &nfs_file_operations;
++ inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops;
+ inode->i_data.a_ops = &nfs_file_aops;
+ inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info;
+ } else if (S_ISDIR(inode->i_mode)) {
+diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
+index 85f1690..d4bc9ed9 100644
+--- a/fs/nfs/nfs3proc.c
++++ b/fs/nfs/nfs3proc.c
+@@ -853,6 +853,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
+ .dentry_ops = &nfs_dentry_operations,
+ .dir_inode_ops = &nfs3_dir_inode_operations,
+ .file_inode_ops = &nfs3_file_inode_operations,
++ .file_ops = &nfs_file_operations,
+ .getroot = nfs3_proc_get_root,
+ .getattr = nfs3_proc_getattr,
+ .setattr = nfs3_proc_setattr,
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+index 4700fae..2d8a169 100644
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -6267,6 +6267,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
+ .dentry_ops = &nfs4_dentry_operations,
+ .dir_inode_ops = &nfs4_dir_inode_operations,
+ .file_inode_ops = &nfs4_file_inode_operations,
++ .file_ops = &nfs4_file_operations,
+ .getroot = nfs4_proc_get_root,
+ .getattr = nfs4_proc_getattr,
+ .setattr = nfs4_proc_setattr,
+diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
+index ac40b85..f48125d 100644
+--- a/fs/nfs/proc.c
++++ b/fs/nfs/proc.c
+@@ -710,6 +710,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
+ .dentry_ops = &nfs_dentry_operations,
+ .dir_inode_ops = &nfs_dir_inode_operations,
+ .file_inode_ops = &nfs_file_inode_operations,
++ .file_ops = &nfs_file_operations,
+ .getroot = nfs_proc_get_root,
+ .getattr = nfs_proc_getattr,
+ .setattr = nfs_proc_setattr,
+diff --git a/fs/super.c b/fs/super.c
+index 3f56a26..32a81f3 100644
+--- a/fs/super.c
++++ b/fs/super.c
+@@ -61,7 +61,7 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc)
+ return -1;
+
+ if (!grab_super_passive(sb))
+- return -1;
++ return !sc->nr_to_scan ? 0 : -1;
+
+ if (sb->s_op && sb->s_op->nr_cached_objects)
+ fs_objects = sb->s_op->nr_cached_objects(sb);
+diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
+index eaac770..fc0fd15 100644
+--- a/include/linux/nfs_fs.h
++++ b/include/linux/nfs_fs.h
+@@ -410,6 +410,9 @@ extern const struct inode_operations nfs_file_inode_operations;
+ extern const struct inode_operations nfs3_file_inode_operations;
+ #endif /* CONFIG_NFS_V3 */
+ extern const struct file_operations nfs_file_operations;
++#ifdef CONFIG_NFS_V4
++extern const struct file_operations nfs4_file_operations;
++#endif /* CONFIG_NFS_V4 */
+ extern const struct address_space_operations nfs_file_aops;
+ extern const struct address_space_operations nfs_dir_aops;
+
+diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
+index abd615d..8475f34 100644
+--- a/include/linux/nfs_xdr.h
++++ b/include/linux/nfs_xdr.h
+@@ -1194,6 +1194,7 @@ struct nfs_rpc_ops {
+ const struct dentry_operations *dentry_ops;
+ const struct inode_operations *dir_inode_ops;
+ const struct inode_operations *file_inode_ops;
++ const struct file_operations *file_ops;
+
+ int (*getroot) (struct nfs_server *, struct nfs_fh *,
+ struct nfs_fsinfo *);
+diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
+index 790651b..a83833a 100644
+--- a/include/linux/shrinker.h
++++ b/include/linux/shrinker.h
+@@ -20,6 +20,7 @@ struct shrink_control {
+ * 'nr_to_scan' entries and attempt to free them up. It should return
+ * the number of objects which remain in the cache. If it returns -1, it means
+ * it cannot do any scanning at this time (eg. there is a risk of deadlock).
++ * The callback must not return -1 if nr_to_scan is zero.
+ *
+ * The 'gfpmask' refers to the allocation we are currently trying to
+ * fulfil.
+diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
+index aa57d5d..b5f4742 100644
+--- a/kernel/irq/spurious.c
++++ b/kernel/irq/spurious.c
+@@ -115,7 +115,7 @@ static int misrouted_irq(int irq)
+ struct irq_desc *desc;
+ int i, ok = 0;
+
+- if (atomic_inc_return(&irq_poll_active) == 1)
++ if (atomic_inc_return(&irq_poll_active) != 1)
+ goto out;
+
+ irq_poll_cpu = smp_processor_id();
+diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
+index fb6931d..d58fd8b 100644
+--- a/net/batman-adv/translation-table.c
++++ b/net/batman-adv/translation-table.c
+@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
+ kfree_rcu(tt_local_entry, rcu);
+ }
+
++static void tt_global_entry_free_rcu(struct rcu_head *rcu)
++{
++ struct tt_global_entry *tt_global_entry;
++
++ tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
++
++ if (tt_global_entry->orig_node)
++ orig_node_free_ref(tt_global_entry->orig_node);
++
++ kfree(tt_global_entry);
++}
++
+ static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
+ {
+ if (atomic_dec_and_test(&tt_global_entry->refcount))
+- kfree_rcu(tt_global_entry, rcu);
++ call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
+ }
+
+ static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
+@@ -686,6 +698,9 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
+ struct hlist_head *head;
+ spinlock_t *list_lock; /* protects write access to the hash lists */
+
++ if (!hash)
++ return;
++
+ for (i = 0; i < hash->size; i++) {
+ head = &hash->table[i];
+ list_lock = &hash->list_locks[i];
+@@ -999,7 +1014,6 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
+ tt_response = (struct tt_query_packet *)skb_put(skb,
+ tt_query_size + tt_len);
+ tt_response->ttvn = ttvn;
+- tt_response->tt_data = htons(tt_tot);
+
+ tt_change = (struct tt_change *)(skb->data + tt_query_size);
+ tt_count = 0;
+@@ -1025,6 +1039,10 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
+ }
+ rcu_read_unlock();
+
++ /* store in the message the number of entries we have successfully
++ * copied */
++ tt_response->tt_data = htons(tt_count);
++
+ out:
+ return skb;
+ }
+@@ -1668,6 +1686,8 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags)
+ rcu_read_lock();
+ hlist_for_each_entry_rcu(tt_local_entry, node,
+ head, hash_entry) {
++ if (!(tt_local_entry->flags & flags))
++ continue;
+ tt_local_entry->flags &= ~flags;
+ atomic_inc(&bat_priv->num_local_tt);
+ }
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
+index 25bd1db..51a0db7 100644
+--- a/net/batman-adv/types.h
++++ b/net/batman-adv/types.h
+@@ -223,22 +223,22 @@ struct socket_packet {
+
+ struct tt_local_entry {
+ uint8_t addr[ETH_ALEN];
++ struct hlist_node hash_entry;
+ unsigned long last_seen;
+ uint16_t flags;
+ atomic_t refcount;
+ struct rcu_head rcu;
+- struct hlist_node hash_entry;
+ };
+
+ struct tt_global_entry {
+ uint8_t addr[ETH_ALEN];
++ struct hlist_node hash_entry; /* entry in the global table */
+ struct orig_node *orig_node;
+ uint8_t ttvn;
+ uint16_t flags; /* only TT_GLOBAL_ROAM is used */
+ unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */
+ atomic_t refcount;
+ struct rcu_head rcu;
+- struct hlist_node hash_entry; /* entry in the global table */
+ };
+
+ struct tt_change_node {
+diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
+index 0bc9888..4e6922f 100644
+--- a/net/ipv6/ip6_tunnel.c
++++ b/net/ipv6/ip6_tunnel.c
+@@ -289,6 +289,8 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p)
+ if ((err = register_netdevice(dev)) < 0)
+ goto failed_free;
+
++ strcpy(t->parms.name, dev->name);
++
+ dev_hold(dev);
+ ip6_tnl_link(ip6n, t);
+ return t;
+@@ -1397,7 +1399,6 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
+ struct ip6_tnl *t = netdev_priv(dev);
+
+ t->dev = dev;
+- strcpy(t->parms.name, dev->name);
+ dev->tstats = alloc_percpu(struct pcpu_tstats);
+ if (!dev->tstats)
+ return -ENOMEM;
+@@ -1477,6 +1478,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n)
+ static int __net_init ip6_tnl_init_net(struct net *net)
+ {
+ struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
++ struct ip6_tnl *t = NULL;
+ int err;
+
+ ip6n->tnls[0] = ip6n->tnls_wc;
+@@ -1497,6 +1499,10 @@ static int __net_init ip6_tnl_init_net(struct net *net)
+ err = register_netdev(ip6n->fb_tnl_dev);
+ if (err < 0)
+ goto err_register;
++
++ t = netdev_priv(ip6n->fb_tnl_dev);
++
++ strcpy(t->parms.name, ip6n->fb_tnl_dev->name);
+ return 0;
+
+ err_register:
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
+index fe2c2a7..a961003 100644
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -140,8 +140,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
+ pos++;
+
+ /* IEEE80211_RADIOTAP_RATE */
+- if (status->flag & RX_FLAG_HT) {
++ if (!rate || status->flag & RX_FLAG_HT) {
+ /*
++ * Without rate information don't add it. If we have,
+ * MCS information is a separate field in radiotap,
+ * added below. The byte here is needed as padding
+ * for the channel though, so initialise it to 0.
+@@ -162,12 +163,14 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
+ else if (status->flag & RX_FLAG_HT)
+ put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ,
+ pos);
+- else if (rate->flags & IEEE80211_RATE_ERP_G)
++ else if (rate && rate->flags & IEEE80211_RATE_ERP_G)
+ put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ,
+ pos);
+- else
++ else if (rate)
+ put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ,
+ pos);
++ else
++ put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos);
+ pos += 2;
+
+ /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
+diff --git a/net/mac80211/util.c b/net/mac80211/util.c
+index ddeb1b9..fd031e8 100644
+--- a/net/mac80211/util.c
++++ b/net/mac80211/util.c
+@@ -1055,6 +1055,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
+ skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
+ ssid, ssid_len,
+ buf, buf_len);
++ if (!skb)
++ goto out;
+
+ if (dst) {
+ mgmt = (struct ieee80211_mgmt *) skb->data;
+@@ -1063,6 +1065,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
+ }
+
+ IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
++
++ out:
+ kfree(buf);
+
+ return skb;
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
+index ea40d54..1308050 100644
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -126,8 +126,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
+ [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED },
+ [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG },
+
+- [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY,
+- .len = NL80211_HT_CAPABILITY_LEN },
++ [NL80211_ATTR_HT_CAPABILITY] = { .len = NL80211_HT_CAPABILITY_LEN },
+
+ [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 },
+ [NL80211_ATTR_IE] = { .type = NLA_BINARY,
+diff --git a/net/wireless/reg.c b/net/wireless/reg.c
+index 68a471b..1658eff 100644
+--- a/net/wireless/reg.c
++++ b/net/wireless/reg.c
+@@ -2254,6 +2254,9 @@ void /* __init_or_exit */ regulatory_exit(void)
+
+ kfree(last_request);
+
++ last_request = NULL;
++ dev_set_uevent_suppress(&reg_pdev->dev, true);
++
+ platform_device_unregister(reg_pdev);
+
+ spin_lock_bh(&reg_pending_beacons_lock);
+diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
+index c34f730..44f199c 100644
+--- a/sound/pci/hda/hda_eld.c
++++ b/sound/pci/hda/hda_eld.c
+@@ -297,10 +297,10 @@ static int hdmi_update_eld(struct hdmi_eld *e,
+ buf + ELD_FIXED_BYTES + mnl + 3 * i);
+ }
+
++ e->eld_valid = true;
+ return 0;
+
+ out_fail:
+- e->eld_ver = 0;
+ return -EINVAL;
+ }
+
+@@ -318,9 +318,6 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
+ int size;
+ unsigned char *buf;
+
+- if (!eld->eld_valid)
+- return -ENOENT;
+-
+ size = snd_hdmi_get_eld_size(codec, nid);
+ if (size == 0) {
+ /* wfg: workaround for ASUS P5E-VM HDMI board */
+diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
+index c45f3e6..4346ad2 100644
+--- a/sound/pci/hda/patch_cirrus.c
++++ b/sound/pci/hda/patch_cirrus.c
+@@ -236,6 +236,15 @@ static int cs_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
+ return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
+ }
+
++static void cs_update_input_select(struct hda_codec *codec)
++{
++ struct cs_spec *spec = codec->spec;
++ if (spec->cur_adc)
++ snd_hda_codec_write(codec, spec->cur_adc, 0,
++ AC_VERB_SET_CONNECT_SEL,
++ spec->adc_idx[spec->cur_input]);
++}
++
+ /*
+ * Analog capture
+ */
+@@ -249,6 +258,7 @@ static int cs_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
+ spec->cur_adc = spec->adc_nid[spec->cur_input];
+ spec->cur_adc_stream_tag = stream_tag;
+ spec->cur_adc_format = format;
++ cs_update_input_select(codec);
+ snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
+ return 0;
+ }
+@@ -688,10 +698,8 @@ static int change_cur_input(struct hda_codec *codec, unsigned int idx,
+ spec->cur_adc_stream_tag, 0,
+ spec->cur_adc_format);
+ }
+- snd_hda_codec_write(codec, spec->cur_adc, 0,
+- AC_VERB_SET_CONNECT_SEL,
+- spec->adc_idx[idx]);
+ spec->cur_input = idx;
++ cs_update_input_select(codec);
+ return 1;
+ }
+
+@@ -972,10 +980,7 @@ static void cs_automic(struct hda_codec *codec)
+ } else {
+ spec->cur_input = spec->last_input;
+ }
+-
+- snd_hda_codec_write_cache(codec, spec->cur_adc, 0,
+- AC_VERB_SET_CONNECT_SEL,
+- spec->adc_idx[spec->cur_input]);
++ cs_update_input_select(codec);
+ } else {
+ if (present)
+ change_cur_input(codec, spec->automic_idx, 0);
+@@ -1072,9 +1077,7 @@ static void init_input(struct hda_codec *codec)
+ cs_automic(codec);
+ else {
+ spec->cur_adc = spec->adc_nid[spec->cur_input];
+- snd_hda_codec_write(codec, spec->cur_adc, 0,
+- AC_VERB_SET_CONNECT_SEL,
+- spec->adc_idx[spec->cur_input]);
++ cs_update_input_select(codec);
+ }
+ } else {
+ change_cur_input(codec, spec->cur_input, 1);
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
+index 19cb72d..e287015 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -920,20 +920,23 @@ static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid,
+ * the unsolicited response to avoid custom WARs.
+ */
+ int present = snd_hda_pin_sense(codec, pin_nid);
++ bool eld_valid = false;
+
+- memset(eld, 0, sizeof(*eld));
++#ifdef CONFIG_PROC_FS
++ memset(eld, 0, offsetof(struct hdmi_eld, proc_entry));
++#else
++ memset(eld, 0, sizeof(struct hdmi_eld));
++#endif
+
+ eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
+ if (eld->monitor_present)
+- eld->eld_valid = !!(present & AC_PINSENSE_ELDV);
+- else
+- eld->eld_valid = 0;
++ eld_valid = !!(present & AC_PINSENSE_ELDV);
+
+ printk(KERN_INFO
+ "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
+- codec->addr, pin_nid, eld->monitor_present, eld->eld_valid);
++ codec->addr, pin_nid, eld->monitor_present, eld_valid);
+
+- if (eld->eld_valid)
++ if (eld_valid)
+ if (!snd_hdmi_get_eld(eld, codec, pin_nid))
+ snd_hdmi_show_eld(eld);
+