Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2017 - genpatches-2.6/trunk/3.1
Date: Sat, 26 Nov 2011 20:26:13
Message-Id: 20111126202601.159A92004B@flycatcher.gentoo.org
1 Author: mpagano
2 Date: 2011-11-26 20:26:00 +0000 (Sat, 26 Nov 2011)
3 New Revision: 2017
4
5 Added:
6 genpatches-2.6/trunk/3.1/1002_linux-3.1.3.patch
7 Modified:
8 genpatches-2.6/trunk/3.1/0000_README
9 Log:
10 Linux patch 3.1.3
11
12 Modified: genpatches-2.6/trunk/3.1/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/3.1/0000_README 2011-11-25 23:55:06 UTC (rev 2016)
15 +++ genpatches-2.6/trunk/3.1/0000_README 2011-11-26 20:26:00 UTC (rev 2017)
16 @@ -47,6 +47,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 3.1.2
19
20 +Patch: 1002_linux-3.1.3.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 3.1.3
23 +
24 Patch: 2400_pci-enable-msi-failure-fix.patch
25 From: http://bugs.gentoo.org/show_bug.cgi?id=389215
26 Desc: Continue the init process after pci_enable_msi failure
27
28 Added: genpatches-2.6/trunk/3.1/1002_linux-3.1.3.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/3.1/1002_linux-3.1.3.patch (rev 0)
31 +++ genpatches-2.6/trunk/3.1/1002_linux-3.1.3.patch 2011-11-26 20:26:00 UTC (rev 2017)
32 @@ -0,0 +1,1965 @@
33 +diff --git a/Makefile b/Makefile
34 +index c992cca..d614254 100644
35 +--- a/Makefile
36 ++++ b/Makefile
37 +@@ -1,6 +1,6 @@
38 + VERSION = 3
39 + PATCHLEVEL = 1
40 +-SUBLEVEL = 2
41 ++SUBLEVEL = 3
42 + EXTRAVERSION =
43 + NAME = "Divemaster Edition"
44 +
45 +diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
46 +index 742b610..fed957a 100644
47 +--- a/arch/arm/kernel/head.S
48 ++++ b/arch/arm/kernel/head.S
49 +@@ -356,7 +356,7 @@ __secondary_data:
50 + * r13 = *virtual* address to jump to upon completion
51 + */
52 + __enable_mmu:
53 +-#ifdef CONFIG_ALIGNMENT_TRAP
54 ++#if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6
55 + orr r0, r0, #CR_A
56 + #else
57 + bic r0, r0, #CR_A
58 +diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
59 +index 00ff00d..123d72a 100644
60 +--- a/arch/s390/include/asm/kvm_host.h
61 ++++ b/arch/s390/include/asm/kvm_host.h
62 +@@ -47,7 +47,7 @@ struct sca_block {
63 + #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
64 + #define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
65 +
66 +-#define CPUSTAT_HOST 0x80000000
67 ++#define CPUSTAT_STOPPED 0x80000000
68 + #define CPUSTAT_WAIT 0x10000000
69 + #define CPUSTAT_ECALL_PEND 0x08000000
70 + #define CPUSTAT_STOP_INT 0x04000000
71 +diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
72 +index 9e4c841..5a5c084 100644
73 +--- a/arch/s390/kvm/diag.c
74 ++++ b/arch/s390/kvm/diag.c
75 +@@ -42,7 +42,7 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu)
76 + return -EOPNOTSUPP;
77 + }
78 +
79 +- atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
80 ++ atomic_set_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
81 + vcpu->run->s390_reset_flags |= KVM_S390_RESET_SUBSYSTEM;
82 + vcpu->run->s390_reset_flags |= KVM_S390_RESET_IPL;
83 + vcpu->run->s390_reset_flags |= KVM_S390_RESET_CPU_INIT;
84 +diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
85 +index c7c5189..0243454 100644
86 +--- a/arch/s390/kvm/intercept.c
87 ++++ b/arch/s390/kvm/intercept.c
88 +@@ -132,7 +132,6 @@ static int handle_stop(struct kvm_vcpu *vcpu)
89 + int rc = 0;
90 +
91 + vcpu->stat.exit_stop_request++;
92 +- atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
93 + spin_lock_bh(&vcpu->arch.local_int.lock);
94 + if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) {
95 + vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP;
96 +@@ -149,6 +148,8 @@ static int handle_stop(struct kvm_vcpu *vcpu)
97 + }
98 +
99 + if (vcpu->arch.local_int.action_bits & ACTION_STOP_ON_STOP) {
100 ++ atomic_set_mask(CPUSTAT_STOPPED,
101 ++ &vcpu->arch.sie_block->cpuflags);
102 + vcpu->arch.local_int.action_bits &= ~ACTION_STOP_ON_STOP;
103 + VCPU_EVENT(vcpu, 3, "%s", "cpu stopped");
104 + rc = -EOPNOTSUPP;
105 +diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
106 +index c9aeb4b..d4bd4c7 100644
107 +--- a/arch/s390/kvm/interrupt.c
108 ++++ b/arch/s390/kvm/interrupt.c
109 +@@ -224,6 +224,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
110 + offsetof(struct _lowcore, restart_psw), sizeof(psw_t));
111 + if (rc == -EFAULT)
112 + exception = 1;
113 ++ atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
114 + break;
115 +
116 + case KVM_S390_PROGRAM_INT:
117 +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
118 +index 0cba935..8cdb1bd 100644
119 +--- a/arch/s390/kvm/kvm-s390.c
120 ++++ b/arch/s390/kvm/kvm-s390.c
121 +@@ -265,10 +265,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
122 + restore_fp_regs(&vcpu->arch.guest_fpregs);
123 + restore_access_regs(vcpu->arch.guest_acrs);
124 + gmap_enable(vcpu->arch.gmap);
125 ++ atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
126 + }
127 +
128 + void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
129 + {
130 ++ atomic_clear_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
131 + gmap_disable(vcpu->arch.gmap);
132 + save_fp_regs(&vcpu->arch.guest_fpregs);
133 + save_access_regs(vcpu->arch.guest_acrs);
134 +@@ -296,7 +298,9 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
135 +
136 + int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
137 + {
138 +- atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | CPUSTAT_SM);
139 ++ atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH |
140 ++ CPUSTAT_SM |
141 ++ CPUSTAT_STOPPED);
142 + vcpu->arch.sie_block->ecb = 6;
143 + vcpu->arch.sie_block->eca = 0xC1002001U;
144 + vcpu->arch.sie_block->fac = (int) (long) facilities;
145 +@@ -421,7 +425,7 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
146 + {
147 + int rc = 0;
148 +
149 +- if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
150 ++ if (!(atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_STOPPED))
151 + rc = -EBUSY;
152 + else {
153 + vcpu->run->psw_mask = psw.mask;
154 +@@ -494,7 +498,7 @@ rerun_vcpu:
155 + if (vcpu->sigset_active)
156 + sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
157 +
158 +- atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
159 ++ atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
160 +
161 + BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL);
162 +
163 +diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
164 +index d6a50c1..2a129bf 100644
165 +--- a/arch/s390/kvm/sigp.c
166 ++++ b/arch/s390/kvm/sigp.c
167 +@@ -57,8 +57,8 @@ static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr,
168 + spin_lock(&fi->lock);
169 + if (fi->local_int[cpu_addr] == NULL)
170 + rc = 3; /* not operational */
171 +- else if (atomic_read(fi->local_int[cpu_addr]->cpuflags)
172 +- & CPUSTAT_RUNNING) {
173 ++ else if (!(atomic_read(fi->local_int[cpu_addr]->cpuflags)
174 ++ & CPUSTAT_STOPPED)) {
175 + *reg &= 0xffffffff00000000UL;
176 + rc = 1; /* status stored */
177 + } else {
178 +@@ -212,7 +212,7 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
179 +
180 + spin_lock_bh(&li->lock);
181 + /* cpu must be in stopped state */
182 +- if (atomic_read(li->cpuflags) & CPUSTAT_RUNNING) {
183 ++ if (!(atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) {
184 + rc = 1; /* incorrect state */
185 + *reg &= SIGP_STAT_INCORRECT_STATE;
186 + kfree(inti);
187 +diff --git a/drivers/base/core.c b/drivers/base/core.c
188 +index bc8729d..78445f4 100644
189 +--- a/drivers/base/core.c
190 ++++ b/drivers/base/core.c
191 +@@ -22,6 +22,7 @@
192 + #include <linux/kallsyms.h>
193 + #include <linux/mutex.h>
194 + #include <linux/async.h>
195 ++#include <linux/pm_runtime.h>
196 +
197 + #include "base.h"
198 + #include "power/power.h"
199 +@@ -1742,6 +1743,8 @@ void device_shutdown(void)
200 + */
201 + list_del_init(&dev->kobj.entry);
202 + spin_unlock(&devices_kset->list_lock);
203 ++ /* Disable all device's runtime power management */
204 ++ pm_runtime_disable(dev);
205 +
206 + if (dev->bus && dev->bus->shutdown) {
207 + dev_dbg(dev, "shutdown\n");
208 +diff --git a/drivers/base/node.c b/drivers/base/node.c
209 +index 793f796..5693ece 100644
210 +--- a/drivers/base/node.c
211 ++++ b/drivers/base/node.c
212 +@@ -127,12 +127,13 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
213 + nid, K(node_page_state(nid, NR_WRITEBACK)),
214 + nid, K(node_page_state(nid, NR_FILE_PAGES)),
215 + nid, K(node_page_state(nid, NR_FILE_MAPPED)),
216 +- nid, K(node_page_state(nid, NR_ANON_PAGES)
217 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE
218 ++ nid, K(node_page_state(nid, NR_ANON_PAGES)
219 + + node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
220 +- HPAGE_PMD_NR
221 ++ HPAGE_PMD_NR),
222 ++#else
223 ++ nid, K(node_page_state(nid, NR_ANON_PAGES)),
224 + #endif
225 +- ),
226 + nid, K(node_page_state(nid, NR_SHMEM)),
227 + nid, node_page_state(nid, NR_KERNEL_STACK) *
228 + THREAD_SIZE / 1024,
229 +@@ -143,13 +144,14 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
230 + nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) +
231 + node_page_state(nid, NR_SLAB_UNRECLAIMABLE)),
232 + nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)),
233 +- nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
234 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE
235 ++ nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))
236 + , nid,
237 + K(node_page_state(nid, NR_ANON_TRANSPARENT_HUGEPAGES) *
238 +- HPAGE_PMD_NR)
239 ++ HPAGE_PMD_NR));
240 ++#else
241 ++ nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));
242 + #endif
243 +- );
244 + n += hugetlb_report_node_meminfo(nid, buf + n);
245 + return n;
246 + }
247 +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
248 +index 542453f..90587de 100644
249 +--- a/drivers/gpu/drm/i915/i915_reg.h
250 ++++ b/drivers/gpu/drm/i915/i915_reg.h
251 +@@ -2554,10 +2554,18 @@
252 + #define _CURBBASE 0x700c4
253 + #define _CURBPOS 0x700c8
254 +
255 ++#define _CURBCNTR_IVB 0x71080
256 ++#define _CURBBASE_IVB 0x71084
257 ++#define _CURBPOS_IVB 0x71088
258 ++
259 + #define CURCNTR(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR)
260 + #define CURBASE(pipe) _PIPE(pipe, _CURABASE, _CURBBASE)
261 + #define CURPOS(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS)
262 +
263 ++#define CURCNTR_IVB(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR_IVB)
264 ++#define CURBASE_IVB(pipe) _PIPE(pipe, _CURABASE, _CURBBASE_IVB)
265 ++#define CURPOS_IVB(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS_IVB)
266 ++
267 + /* Display A control */
268 + #define _DSPACNTR 0x70180
269 + #define DISPLAY_PLANE_ENABLE (1<<31)
270 +@@ -3167,6 +3175,7 @@
271 + #define FDI_LINK_TRAIN_NONE_IVB (3<<8)
272 +
273 + /* both Tx and Rx */
274 ++#define FDI_COMPOSITE_SYNC (1<<11)
275 + #define FDI_LINK_TRAIN_AUTO (1<<10)
276 + #define FDI_SCRAMBLING_ENABLE (0<<7)
277 + #define FDI_SCRAMBLING_DISABLE (1<<7)
278 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
279 +index 04411ad..e1340a2 100644
280 +--- a/drivers/gpu/drm/i915/intel_display.c
281 ++++ b/drivers/gpu/drm/i915/intel_display.c
282 +@@ -2600,6 +2600,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
283 + temp |= FDI_LINK_TRAIN_PATTERN_1_IVB;
284 + temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;
285 + temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B;
286 ++ temp |= FDI_COMPOSITE_SYNC;
287 + I915_WRITE(reg, temp | FDI_TX_ENABLE);
288 +
289 + reg = FDI_RX_CTL(pipe);
290 +@@ -2607,6 +2608,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
291 + temp &= ~FDI_LINK_TRAIN_AUTO;
292 + temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT;
293 + temp |= FDI_LINK_TRAIN_PATTERN_1_CPT;
294 ++ temp |= FDI_COMPOSITE_SYNC;
295 + I915_WRITE(reg, temp | FDI_RX_ENABLE);
296 +
297 + POSTING_READ(reg);
298 +@@ -5758,6 +5760,31 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
299 + I915_WRITE(CURBASE(pipe), base);
300 + }
301 +
302 ++static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
303 ++{
304 ++ struct drm_device *dev = crtc->dev;
305 ++ struct drm_i915_private *dev_priv = dev->dev_private;
306 ++ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
307 ++ int pipe = intel_crtc->pipe;
308 ++ bool visible = base != 0;
309 ++
310 ++ if (intel_crtc->cursor_visible != visible) {
311 ++ uint32_t cntl = I915_READ(CURCNTR_IVB(pipe));
312 ++ if (base) {
313 ++ cntl &= ~CURSOR_MODE;
314 ++ cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
315 ++ } else {
316 ++ cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
317 ++ cntl |= CURSOR_MODE_DISABLE;
318 ++ }
319 ++ I915_WRITE(CURCNTR_IVB(pipe), cntl);
320 ++
321 ++ intel_crtc->cursor_visible = visible;
322 ++ }
323 ++ /* and commit changes on next vblank */
324 ++ I915_WRITE(CURBASE_IVB(pipe), base);
325 ++}
326 ++
327 + /* If no-part of the cursor is visible on the framebuffer, then the GPU may hang... */
328 + static void intel_crtc_update_cursor(struct drm_crtc *crtc,
329 + bool on)
330 +@@ -5805,11 +5832,16 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
331 + if (!visible && !intel_crtc->cursor_visible)
332 + return;
333 +
334 +- I915_WRITE(CURPOS(pipe), pos);
335 +- if (IS_845G(dev) || IS_I865G(dev))
336 +- i845_update_cursor(crtc, base);
337 +- else
338 +- i9xx_update_cursor(crtc, base);
339 ++ if (IS_IVYBRIDGE(dev)) {
340 ++ I915_WRITE(CURPOS_IVB(pipe), pos);
341 ++ ivb_update_cursor(crtc, base);
342 ++ } else {
343 ++ I915_WRITE(CURPOS(pipe), pos);
344 ++ if (IS_845G(dev) || IS_I865G(dev))
345 ++ i845_update_cursor(crtc, base);
346 ++ else
347 ++ i9xx_update_cursor(crtc, base);
348 ++ }
349 +
350 + if (visible)
351 + intel_mark_busy(dev, to_intel_framebuffer(crtc->fb)->obj);
352 +diff --git a/drivers/media/video/saa7164/saa7164-cards.c b/drivers/media/video/saa7164/saa7164-cards.c
353 +index 69822a4..c713691 100644
354 +--- a/drivers/media/video/saa7164/saa7164-cards.c
355 ++++ b/drivers/media/video/saa7164/saa7164-cards.c
356 +@@ -203,6 +203,66 @@ struct saa7164_board saa7164_boards[] = {
357 + .i2c_reg_len = REGLEN_8bit,
358 + } },
359 + },
360 ++ [SAA7164_BOARD_HAUPPAUGE_HVR2200_4] = {
361 ++ .name = "Hauppauge WinTV-HVR2200",
362 ++ .porta = SAA7164_MPEG_DVB,
363 ++ .portb = SAA7164_MPEG_DVB,
364 ++ .portc = SAA7164_MPEG_ENCODER,
365 ++ .portd = SAA7164_MPEG_ENCODER,
366 ++ .porte = SAA7164_MPEG_VBI,
367 ++ .portf = SAA7164_MPEG_VBI,
368 ++ .chiprev = SAA7164_CHIP_REV3,
369 ++ .unit = {{
370 ++ .id = 0x1d,
371 ++ .type = SAA7164_UNIT_EEPROM,
372 ++ .name = "4K EEPROM",
373 ++ .i2c_bus_nr = SAA7164_I2C_BUS_0,
374 ++ .i2c_bus_addr = 0xa0 >> 1,
375 ++ .i2c_reg_len = REGLEN_8bit,
376 ++ }, {
377 ++ .id = 0x04,
378 ++ .type = SAA7164_UNIT_TUNER,
379 ++ .name = "TDA18271-1",
380 ++ .i2c_bus_nr = SAA7164_I2C_BUS_1,
381 ++ .i2c_bus_addr = 0xc0 >> 1,
382 ++ .i2c_reg_len = REGLEN_8bit,
383 ++ }, {
384 ++ .id = 0x05,
385 ++ .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
386 ++ .name = "TDA8290-1",
387 ++ .i2c_bus_nr = SAA7164_I2C_BUS_1,
388 ++ .i2c_bus_addr = 0x84 >> 1,
389 ++ .i2c_reg_len = REGLEN_8bit,
390 ++ }, {
391 ++ .id = 0x1b,
392 ++ .type = SAA7164_UNIT_TUNER,
393 ++ .name = "TDA18271-2",
394 ++ .i2c_bus_nr = SAA7164_I2C_BUS_2,
395 ++ .i2c_bus_addr = 0xc0 >> 1,
396 ++ .i2c_reg_len = REGLEN_8bit,
397 ++ }, {
398 ++ .id = 0x1c,
399 ++ .type = SAA7164_UNIT_ANALOG_DEMODULATOR,
400 ++ .name = "TDA8290-2",
401 ++ .i2c_bus_nr = SAA7164_I2C_BUS_2,
402 ++ .i2c_bus_addr = 0x84 >> 1,
403 ++ .i2c_reg_len = REGLEN_8bit,
404 ++ }, {
405 ++ .id = 0x1e,
406 ++ .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
407 ++ .name = "TDA10048-1",
408 ++ .i2c_bus_nr = SAA7164_I2C_BUS_1,
409 ++ .i2c_bus_addr = 0x10 >> 1,
410 ++ .i2c_reg_len = REGLEN_8bit,
411 ++ }, {
412 ++ .id = 0x1f,
413 ++ .type = SAA7164_UNIT_DIGITAL_DEMODULATOR,
414 ++ .name = "TDA10048-2",
415 ++ .i2c_bus_nr = SAA7164_I2C_BUS_2,
416 ++ .i2c_bus_addr = 0x12 >> 1,
417 ++ .i2c_reg_len = REGLEN_8bit,
418 ++ } },
419 ++ },
420 + [SAA7164_BOARD_HAUPPAUGE_HVR2250] = {
421 + .name = "Hauppauge WinTV-HVR2250",
422 + .porta = SAA7164_MPEG_DVB,
423 +@@ -426,6 +486,10 @@ struct saa7164_subid saa7164_subids[] = {
424 + .subvendor = 0x0070,
425 + .subdevice = 0x8851,
426 + .card = SAA7164_BOARD_HAUPPAUGE_HVR2250_2,
427 ++ }, {
428 ++ .subvendor = 0x0070,
429 ++ .subdevice = 0x8940,
430 ++ .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_4,
431 + },
432 + };
433 + const unsigned int saa7164_idcount = ARRAY_SIZE(saa7164_subids);
434 +@@ -469,6 +533,7 @@ void saa7164_gpio_setup(struct saa7164_dev *dev)
435 + case SAA7164_BOARD_HAUPPAUGE_HVR2200:
436 + case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
437 + case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
438 ++ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
439 + case SAA7164_BOARD_HAUPPAUGE_HVR2250:
440 + case SAA7164_BOARD_HAUPPAUGE_HVR2250_2:
441 + case SAA7164_BOARD_HAUPPAUGE_HVR2250_3:
442 +@@ -549,6 +614,7 @@ void saa7164_card_setup(struct saa7164_dev *dev)
443 + case SAA7164_BOARD_HAUPPAUGE_HVR2200:
444 + case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
445 + case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
446 ++ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
447 + case SAA7164_BOARD_HAUPPAUGE_HVR2250:
448 + case SAA7164_BOARD_HAUPPAUGE_HVR2250_2:
449 + case SAA7164_BOARD_HAUPPAUGE_HVR2250_3:
450 +diff --git a/drivers/media/video/saa7164/saa7164-dvb.c b/drivers/media/video/saa7164/saa7164-dvb.c
451 +index f65eab6..d377937 100644
452 +--- a/drivers/media/video/saa7164/saa7164-dvb.c
453 ++++ b/drivers/media/video/saa7164/saa7164-dvb.c
454 +@@ -475,6 +475,7 @@ int saa7164_dvb_register(struct saa7164_port *port)
455 + case SAA7164_BOARD_HAUPPAUGE_HVR2200:
456 + case SAA7164_BOARD_HAUPPAUGE_HVR2200_2:
457 + case SAA7164_BOARD_HAUPPAUGE_HVR2200_3:
458 ++ case SAA7164_BOARD_HAUPPAUGE_HVR2200_4:
459 + i2c_bus = &dev->i2c_bus[port->nr + 1];
460 + switch (port->nr) {
461 + case 0:
462 +diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
463 +index 6678bf1..35b6430 100644
464 +--- a/drivers/media/video/saa7164/saa7164.h
465 ++++ b/drivers/media/video/saa7164/saa7164.h
466 +@@ -82,6 +82,7 @@
467 + #define SAA7164_BOARD_HAUPPAUGE_HVR2200_3 6
468 + #define SAA7164_BOARD_HAUPPAUGE_HVR2250_2 7
469 + #define SAA7164_BOARD_HAUPPAUGE_HVR2250_3 8
470 ++#define SAA7164_BOARD_HAUPPAUGE_HVR2200_4 9
471 +
472 + #define SAA7164_MAX_UNITS 8
473 + #define SAA7164_TS_NUMBER_OF_LINES 312
474 +diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
475 +index 2d6423c..8563e9a 100644
476 +--- a/drivers/misc/Kconfig
477 ++++ b/drivers/misc/Kconfig
478 +@@ -472,7 +472,7 @@ config BMP085
479 + module will be called bmp085.
480 +
481 + config PCH_PHUB
482 +- tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) PHUB"
483 ++ tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB"
484 + depends on PCI
485 + help
486 + This driver is for PCH(Platform controller Hub) PHUB(Packet Hub) of
487 +@@ -480,12 +480,13 @@ config PCH_PHUB
488 + processor. The Topcliff has MAC address and Option ROM data in SROM.
489 + This driver can access MAC address and Option ROM data in SROM.
490 +
491 +- This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
492 +- Output Hub), ML7213 and ML7223.
493 +- ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is
494 +- for MP(Media Phone) use.
495 +- ML7213/ML7223 is companion chip for Intel Atom E6xx series.
496 +- ML7213/ML7223 is completely compatible for Intel EG20T PCH.
497 ++ This driver also can be used for LAPIS Semiconductor's IOH,
498 ++ ML7213/ML7223/ML7831.
499 ++ ML7213 which is for IVI(In-Vehicle Infotainment) use.
500 ++ ML7223 IOH is for MP(Media Phone) use.
501 ++ ML7831 IOH is for general purpose use.
502 ++ ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
503 ++ ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.
504 +
505 + To compile this driver as a module, choose M here: the module will
506 + be called pch_phub.
507 +diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
508 +index 0fd7e77..ba276ba 100644
509 +--- a/drivers/misc/pch_phub.c
510 ++++ b/drivers/misc/pch_phub.c
511 +@@ -73,6 +73,9 @@
512 + #define PCI_DEVICE_ID_ROHM_ML7223_mPHUB 0x8012 /* for Bus-m */
513 + #define PCI_DEVICE_ID_ROHM_ML7223_nPHUB 0x8002 /* for Bus-n */
514 +
515 ++/* Macros for ML7831 */
516 ++#define PCI_DEVICE_ID_ROHM_ML7831_PHUB 0x8801
517 ++
518 + /* SROM ACCESS Macro */
519 + #define PCH_WORD_ADDR_MASK (~((1 << 2) - 1))
520 +
521 +@@ -464,7 +467,7 @@ static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data)
522 + int retval;
523 + int i;
524 +
525 +- if (chip->ioh_type == 1) /* EG20T */
526 ++ if ((chip->ioh_type == 1) || (chip->ioh_type == 5)) /* EG20T or ML7831*/
527 + retval = pch_phub_gbe_serial_rom_conf(chip);
528 + else /* ML7223 */
529 + retval = pch_phub_gbe_serial_rom_conf_mp(chip);
530 +@@ -757,6 +760,22 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
531 + chip->pch_opt_rom_start_address =\
532 + PCH_PHUB_ROM_START_ADDR_ML7223;
533 + chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223;
534 ++ } else if (id->driver_data == 5) { /* ML7831 */
535 ++ retval = sysfs_create_file(&pdev->dev.kobj,
536 ++ &dev_attr_pch_mac.attr);
537 ++ if (retval)
538 ++ goto err_sysfs_create;
539 ++
540 ++ retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr);
541 ++ if (retval)
542 ++ goto exit_bin_attr;
543 ++
544 ++ /* set the prefech value */
545 ++ iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14);
546 ++ /* set the interrupt delay value */
547 ++ iowrite32(0x25, chip->pch_phub_base_address + 0x44);
548 ++ chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T;
549 ++ chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T;
550 + }
551 +
552 + chip->ioh_type = id->driver_data;
553 +@@ -841,6 +860,7 @@ static struct pci_device_id pch_phub_pcidev_id[] = {
554 + { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), 2, },
555 + { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_mPHUB), 3, },
556 + { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_nPHUB), 4, },
557 ++ { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7831_PHUB), 5, },
558 + { }
559 + };
560 + MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id);
561 +diff --git a/drivers/misc/spear13xx_pcie_gadget.c b/drivers/misc/spear13xx_pcie_gadget.c
562 +index cfbddbe..43d073b 100644
563 +--- a/drivers/misc/spear13xx_pcie_gadget.c
564 ++++ b/drivers/misc/spear13xx_pcie_gadget.c
565 +@@ -903,6 +903,6 @@ static void __exit spear_pcie_gadget_exit(void)
566 + }
567 + module_exit(spear_pcie_gadget_exit);
568 +
569 +-MODULE_ALIAS("pcie-gadget-spear");
570 ++MODULE_ALIAS("platform:pcie-gadget-spear");
571 + MODULE_AUTHOR("Pratyush Anand");
572 + MODULE_LICENSE("GPL");
573 +diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
574 +index e0286cf..7be8b05 100644
575 +--- a/drivers/net/wireless/libertas/if_spi.c
576 ++++ b/drivers/net/wireless/libertas/if_spi.c
577 +@@ -999,6 +999,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
578 + spin_unlock_irqrestore(&card->buffer_lock, flags);
579 + break;
580 + default:
581 ++ kfree(packet);
582 + netdev_err(priv->dev, "can't transfer buffer of type %d\n",
583 + type);
584 + err = -EINVAL;
585 +diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
586 +index f82bfeb..0415e47 100644
587 +--- a/drivers/net/wireless/rt2x00/rt2x00.h
588 ++++ b/drivers/net/wireless/rt2x00/rt2x00.h
589 +@@ -923,6 +923,7 @@ struct rt2x00_dev {
590 + * Powersaving work
591 + */
592 + struct delayed_work autowakeup_work;
593 ++ struct work_struct sleep_work;
594 +
595 + /*
596 + * Data queue arrays for RX, TX, Beacon and ATIM.
597 +diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
598 +index 0955c94..9d05f87 100644
599 +--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
600 ++++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
601 +@@ -449,6 +449,23 @@ static u8 *rt2x00lib_find_ie(u8 *data, unsigned int len, u8 ie)
602 + return NULL;
603 + }
604 +
605 ++static void rt2x00lib_sleep(struct work_struct *work)
606 ++{
607 ++ struct rt2x00_dev *rt2x00dev =
608 ++ container_of(work, struct rt2x00_dev, sleep_work);
609 ++
610 ++ if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
611 ++ return;
612 ++
613 ++ /*
614 ++ * Check again is powersaving is enabled, to prevent races from delayed
615 ++ * work execution.
616 ++ */
617 ++ if (!test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags))
618 ++ rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf,
619 ++ IEEE80211_CONF_CHANGE_PS);
620 ++}
621 ++
622 + static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev,
623 + struct sk_buff *skb,
624 + struct rxdone_entry_desc *rxdesc)
625 +@@ -496,8 +513,7 @@ static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev,
626 + cam |= (tim_ie->bitmap_ctrl & 0x01);
627 +
628 + if (!cam && !test_bit(CONFIG_POWERSAVING, &rt2x00dev->flags))
629 +- rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf,
630 +- IEEE80211_CONF_CHANGE_PS);
631 ++ queue_work(rt2x00dev->workqueue, &rt2x00dev->sleep_work);
632 + }
633 +
634 + static int rt2x00lib_rxdone_read_signal(struct rt2x00_dev *rt2x00dev,
635 +@@ -1121,6 +1137,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
636 +
637 + INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
638 + INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
639 ++ INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
640 +
641 + /*
642 + * Let the driver probe the device to detect the capabilities.
643 +@@ -1177,6 +1194,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
644 + */
645 + cancel_work_sync(&rt2x00dev->intf_work);
646 + cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
647 ++ cancel_work_sync(&rt2x00dev->sleep_work);
648 + if (rt2x00_is_usb(rt2x00dev)) {
649 + del_timer_sync(&rt2x00dev->txstatus_timer);
650 + cancel_work_sync(&rt2x00dev->rxdone_work);
651 +diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
652 +index 3382475..c7b6fed 100644
653 +--- a/drivers/scsi/aacraid/linit.c
654 ++++ b/drivers/scsi/aacraid/linit.c
655 +@@ -38,6 +38,7 @@
656 + #include <linux/module.h>
657 + #include <linux/moduleparam.h>
658 + #include <linux/pci.h>
659 ++#include <linux/pci-aspm.h>
660 + #include <linux/slab.h>
661 + #include <linux/mutex.h>
662 + #include <linux/spinlock.h>
663 +@@ -1108,6 +1109,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
664 + unique_id++;
665 + }
666 +
667 ++ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
668 ++ PCIE_LINK_STATE_CLKPM);
669 ++
670 + error = pci_enable_device(pdev);
671 + if (error)
672 + goto out;
673 +diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
674 +index 8c713d3..418ce83 100644
675 +--- a/drivers/scsi/hpsa.c
676 ++++ b/drivers/scsi/hpsa.c
677 +@@ -23,6 +23,7 @@
678 + #include <linux/interrupt.h>
679 + #include <linux/types.h>
680 + #include <linux/pci.h>
681 ++#include <linux/pci-aspm.h>
682 + #include <linux/kernel.h>
683 + #include <linux/slab.h>
684 + #include <linux/delay.h>
685 +@@ -3887,6 +3888,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
686 + dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
687 + return -ENODEV;
688 + }
689 ++
690 ++ pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
691 ++ PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
692 ++
693 + err = pci_enable_device(h->pdev);
694 + if (err) {
695 + dev_warn(&h->pdev->dev, "unable to enable PCI device\n");
696 +diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
697 +index 72273a0..b3c6d95 100644
698 +--- a/drivers/scsi/scsi_scan.c
699 ++++ b/drivers/scsi/scsi_scan.c
700 +@@ -319,11 +319,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
701 + return sdev;
702 +
703 + out_device_destroy:
704 +- scsi_device_set_state(sdev, SDEV_DEL);
705 +- transport_destroy_device(&sdev->sdev_gendev);
706 +- put_device(&sdev->sdev_dev);
707 +- scsi_free_queue(sdev->request_queue);
708 +- put_device(&sdev->sdev_gendev);
709 ++ __scsi_remove_device(sdev);
710 + out:
711 + if (display_failure_msg)
712 + printk(ALLOC_FAILURE_MSG, __func__);
713 +diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c
714 +index 435f6fa..44fbeba 100644
715 +--- a/drivers/tty/hvc/hvc_dcc.c
716 ++++ b/drivers/tty/hvc/hvc_dcc.c
717 +@@ -46,6 +46,7 @@ static inline char __dcc_getchar(void)
718 +
719 + asm volatile("mrc p14, 0, %0, c0, c5, 0 @ read comms data reg"
720 + : "=r" (__c));
721 ++ isb();
722 +
723 + return __c;
724 + }
725 +@@ -55,6 +56,7 @@ static inline void __dcc_putchar(char c)
726 + asm volatile("mcr p14, 0, %0, c0, c5, 0 @ write a char"
727 + : /* no output register */
728 + : "r" (c));
729 ++ isb();
730 + }
731 +
732 + static int hvc_dcc_put_chars(uint32_t vt, const char *buf, int count)
733 +diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
734 +index 4dcb37b..abf6fa4 100644
735 +--- a/drivers/tty/serial/Kconfig
736 ++++ b/drivers/tty/serial/Kconfig
737 +@@ -1570,7 +1570,7 @@ config SERIAL_IFX6X60
738 + Support for the IFX6x60 modem devices on Intel MID platforms.
739 +
740 + config SERIAL_PCH_UART
741 +- tristate "Intel EG20T PCH / OKI SEMICONDUCTOR IOH(ML7213/ML7223) UART"
742 ++ tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) UART"
743 + depends on PCI
744 + select SERIAL_CORE
745 + help
746 +@@ -1578,12 +1578,12 @@ config SERIAL_PCH_UART
747 + which is an IOH(Input/Output Hub) for x86 embedded processor.
748 + Enabling PCH_DMA, this PCH UART works as DMA mode.
749 +
750 +- This driver also can be used for OKI SEMICONDUCTOR IOH(Input/
751 +- Output Hub), ML7213 and ML7223.
752 +- ML7213 IOH is for IVI(In-Vehicle Infotainment) use and ML7223 IOH is
753 +- for MP(Media Phone) use.
754 +- ML7213/ML7223 is companion chip for Intel Atom E6xx series.
755 +- ML7213/ML7223 is completely compatible for Intel EG20T PCH.
756 ++ This driver also can be used for LAPIS Semiconductor IOH(Input/
757 ++ Output Hub), ML7213, ML7223 and ML7831.
758 ++ ML7213 IOH is for IVI(In-Vehicle Infotainment) use, ML7223 IOH is
759 ++ for MP(Media Phone) use and ML7831 IOH is for general purpose use.
760 ++ ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
761 ++ ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.
762 +
763 + config SERIAL_MSM_SMD
764 + bool "Enable tty device interface for some SMD ports"
765 +diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
766 +index b46218d..f913ed0 100644
767 +--- a/drivers/tty/serial/pch_uart.c
768 ++++ b/drivers/tty/serial/pch_uart.c
769 +@@ -256,6 +256,8 @@ enum pch_uart_num_t {
770 + pch_ml7213_uart2,
771 + pch_ml7223_uart0,
772 + pch_ml7223_uart1,
773 ++ pch_ml7831_uart0,
774 ++ pch_ml7831_uart1,
775 + };
776 +
777 + static struct pch_uart_driver_data drv_dat[] = {
778 +@@ -268,6 +270,8 @@ static struct pch_uart_driver_data drv_dat[] = {
779 + [pch_ml7213_uart2] = {PCH_UART_2LINE, 2},
780 + [pch_ml7223_uart0] = {PCH_UART_8LINE, 0},
781 + [pch_ml7223_uart1] = {PCH_UART_2LINE, 1},
782 ++ [pch_ml7831_uart0] = {PCH_UART_8LINE, 0},
783 ++ [pch_ml7831_uart1] = {PCH_UART_2LINE, 1},
784 + };
785 +
786 + static unsigned int default_baud = 9600;
787 +@@ -626,6 +630,7 @@ static void pch_request_dma(struct uart_port *port)
788 + dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n",
789 + __func__);
790 + dma_release_channel(priv->chan_tx);
791 ++ priv->chan_tx = NULL;
792 + return;
793 + }
794 +
795 +@@ -1213,8 +1218,7 @@ static void pch_uart_shutdown(struct uart_port *port)
796 + dev_err(priv->port.dev,
797 + "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret);
798 +
799 +- if (priv->use_dma_flag)
800 +- pch_free_dma(port);
801 ++ pch_free_dma(port);
802 +
803 + free_irq(priv->port.irq, priv);
804 + }
805 +@@ -1278,6 +1282,7 @@ static void pch_uart_set_termios(struct uart_port *port,
806 + if (rtn)
807 + goto out;
808 +
809 ++ pch_uart_set_mctrl(&priv->port, priv->port.mctrl);
810 + /* Don't rewrite B0 */
811 + if (tty_termios_baud_rate(termios))
812 + tty_termios_encode_baud_rate(termios, baud, baud);
813 +@@ -1550,6 +1555,10 @@ static DEFINE_PCI_DEVICE_TABLE(pch_uart_pci_id) = {
814 + .driver_data = pch_ml7223_uart0},
815 + {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x800D),
816 + .driver_data = pch_ml7223_uart1},
817 ++ {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8811),
818 ++ .driver_data = pch_ml7831_uart0},
819 ++ {PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8812),
820 ++ .driver_data = pch_ml7831_uart1},
821 + {0,},
822 + };
823 +
824 +diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
825 +index ef925d5..a76c808 100644
826 +--- a/drivers/tty/tty_ldisc.c
827 ++++ b/drivers/tty/tty_ldisc.c
828 +@@ -36,6 +36,7 @@
829 +
830 + #include <linux/kmod.h>
831 + #include <linux/nsproxy.h>
832 ++#include <linux/ratelimit.h>
833 +
834 + /*
835 + * This guards the refcounted line discipline lists. The lock
836 +@@ -548,15 +549,16 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
837 + /**
838 + * tty_ldisc_wait_idle - wait for the ldisc to become idle
839 + * @tty: tty to wait for
840 ++ * @timeout: for how long to wait at most
841 + *
842 + * Wait for the line discipline to become idle. The discipline must
843 + * have been halted for this to guarantee it remains idle.
844 + */
845 +-static int tty_ldisc_wait_idle(struct tty_struct *tty)
846 ++static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout)
847 + {
848 +- int ret;
849 ++ long ret;
850 + ret = wait_event_timeout(tty_ldisc_idle,
851 +- atomic_read(&tty->ldisc->users) == 1, 5 * HZ);
852 ++ atomic_read(&tty->ldisc->users) == 1, timeout);
853 + if (ret < 0)
854 + return ret;
855 + return ret > 0 ? 0 : -EBUSY;
856 +@@ -666,7 +668,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
857 +
858 + tty_ldisc_flush_works(tty);
859 +
860 +- retval = tty_ldisc_wait_idle(tty);
861 ++ retval = tty_ldisc_wait_idle(tty, 5 * HZ);
862 +
863 + tty_lock();
864 + mutex_lock(&tty->ldisc_mutex);
865 +@@ -763,8 +765,6 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
866 + if (IS_ERR(ld))
867 + return -1;
868 +
869 +- WARN_ON_ONCE(tty_ldisc_wait_idle(tty));
870 +-
871 + tty_ldisc_close(tty, tty->ldisc);
872 + tty_ldisc_put(tty->ldisc);
873 + tty->ldisc = NULL;
874 +@@ -839,7 +839,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
875 + tty_unlock();
876 + cancel_work_sync(&tty->buf.work);
877 + mutex_unlock(&tty->ldisc_mutex);
878 +-
879 ++retry:
880 + tty_lock();
881 + mutex_lock(&tty->ldisc_mutex);
882 +
883 +@@ -848,6 +848,22 @@ void tty_ldisc_hangup(struct tty_struct *tty)
884 + it means auditing a lot of other paths so this is
885 + a FIXME */
886 + if (tty->ldisc) { /* Not yet closed */
887 ++ if (atomic_read(&tty->ldisc->users) != 1) {
888 ++ char cur_n[TASK_COMM_LEN], tty_n[64];
889 ++ long timeout = 3 * HZ;
890 ++ tty_unlock();
891 ++
892 ++ while (tty_ldisc_wait_idle(tty, timeout) == -EBUSY) {
893 ++ timeout = MAX_SCHEDULE_TIMEOUT;
894 ++ printk_ratelimited(KERN_WARNING
895 ++ "%s: waiting (%s) for %s took too long, but we keep waiting...\n",
896 ++ __func__, get_task_comm(cur_n, current),
897 ++ tty_name(tty, tty_n));
898 ++ }
899 ++ mutex_unlock(&tty->ldisc_mutex);
900 ++ goto retry;
901 ++ }
902 ++
903 + if (reset == 0) {
904 +
905 + if (!tty_ldisc_reinit(tty, tty->termios->c_line))
906 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
907 +index 5112f57..2ffcaa0 100644
908 +--- a/drivers/usb/class/cdc-acm.c
909 ++++ b/drivers/usb/class/cdc-acm.c
910 +@@ -539,7 +539,6 @@ static void acm_port_down(struct acm *acm)
911 + {
912 + int i;
913 +
914 +- mutex_lock(&open_mutex);
915 + if (acm->dev) {
916 + usb_autopm_get_interface(acm->control);
917 + acm_set_control(acm, acm->ctrlout = 0);
918 +@@ -551,14 +550,15 @@ static void acm_port_down(struct acm *acm)
919 + acm->control->needs_remote_wakeup = 0;
920 + usb_autopm_put_interface(acm->control);
921 + }
922 +- mutex_unlock(&open_mutex);
923 + }
924 +
925 + static void acm_tty_hangup(struct tty_struct *tty)
926 + {
927 + struct acm *acm = tty->driver_data;
928 + tty_port_hangup(&acm->port);
929 ++ mutex_lock(&open_mutex);
930 + acm_port_down(acm);
931 ++ mutex_unlock(&open_mutex);
932 + }
933 +
934 + static void acm_tty_close(struct tty_struct *tty, struct file *filp)
935 +@@ -569,8 +569,9 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
936 + shutdown */
937 + if (!acm)
938 + return;
939 ++
940 ++ mutex_lock(&open_mutex);
941 + if (tty_port_close_start(&acm->port, tty, filp) == 0) {
942 +- mutex_lock(&open_mutex);
943 + if (!acm->dev) {
944 + tty_port_tty_set(&acm->port, NULL);
945 + acm_tty_unregister(acm);
946 +@@ -582,6 +583,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
947 + acm_port_down(acm);
948 + tty_port_close_end(&acm->port, tty);
949 + tty_port_tty_set(&acm->port, NULL);
950 ++ mutex_unlock(&open_mutex);
951 + }
952 +
953 + static int acm_tty_write(struct tty_struct *tty,
954 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
955 +index a428aa0..210e359 100644
956 +--- a/drivers/usb/core/hub.c
957 ++++ b/drivers/usb/core/hub.c
958 +@@ -813,6 +813,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
959 + USB_PORT_FEAT_C_PORT_LINK_STATE);
960 + }
961 +
962 ++ if ((portchange & USB_PORT_STAT_C_BH_RESET) &&
963 ++ hub_is_superspeed(hub->hdev)) {
964 ++ need_debounce_delay = true;
965 ++ clear_port_feature(hub->hdev, port1,
966 ++ USB_PORT_FEAT_C_BH_PORT_RESET);
967 ++ }
968 + /* We can forget about a "removed" device when there's a
969 + * physical disconnect or the connect status changes.
970 + */
971 +diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
972 +index d6a8d82..ecf12e1 100644
973 +--- a/drivers/usb/core/quirks.c
974 ++++ b/drivers/usb/core/quirks.c
975 +@@ -50,15 +50,42 @@ static const struct usb_device_id usb_quirk_list[] = {
976 + /* Logitech Webcam B/C500 */
977 + { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME },
978 +
979 ++ /* Logitech Webcam C600 */
980 ++ { USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME },
981 ++
982 + /* Logitech Webcam Pro 9000 */
983 + { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME },
984 +
985 ++ /* Logitech Webcam C905 */
986 ++ { USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME },
987 ++
988 ++ /* Logitech Webcam C210 */
989 ++ { USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME },
990 ++
991 ++ /* Logitech Webcam C260 */
992 ++ { USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME },
993 ++
994 + /* Logitech Webcam C310 */
995 + { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME },
996 +
997 ++ /* Logitech Webcam C910 */
998 ++ { USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME },
999 ++
1000 ++ /* Logitech Webcam C160 */
1001 ++ { USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME },
1002 ++
1003 + /* Logitech Webcam C270 */
1004 + { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
1005 +
1006 ++ /* Logitech Quickcam Pro 9000 */
1007 ++ { USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME },
1008 ++
1009 ++ /* Logitech Quickcam E3500 */
1010 ++ { USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME },
1011 ++
1012 ++ /* Logitech Quickcam Vision Pro */
1013 ++ { USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME },
1014 ++
1015 + /* Logitech Harmony 700-series */
1016 + { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
1017 +
1018 +diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
1019 +index 5a084b9..6f50491 100644
1020 +--- a/drivers/usb/gadget/Kconfig
1021 ++++ b/drivers/usb/gadget/Kconfig
1022 +@@ -442,7 +442,7 @@ config USB_LANGWELL
1023 + gadget drivers to also be dynamically linked.
1024 +
1025 + config USB_EG20T
1026 +- tristate "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH UDC"
1027 ++ tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7831) UDC"
1028 + depends on PCI
1029 + select USB_GADGET_DUALSPEED
1030 + help
1031 +@@ -458,10 +458,11 @@ config USB_EG20T
1032 + This driver dose not support interrupt transfer or isochronous
1033 + transfer modes.
1034 +
1035 +- This driver also can be used for OKI SEMICONDUCTOR's ML7213 which is
1036 ++ This driver also can be used for LAPIS Semiconductor's ML7213 which is
1037 + for IVI(In-Vehicle Infotainment) use.
1038 +- ML7213 is companion chip for Intel Atom E6xx series.
1039 +- ML7213 is completely compatible for Intel EG20T PCH.
1040 ++ ML7831 is for general purpose use.
1041 ++ ML7213/ML7831 is companion chip for Intel Atom E6xx series.
1042 ++ ML7213/ML7831 is completely compatible for Intel EG20T PCH.
1043 +
1044 + config USB_CI13XXX_MSM
1045 + tristate "MIPS USB CI13xxx for MSM"
1046 +diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
1047 +index f96615a..06c40b1 100644
1048 +--- a/drivers/usb/gadget/pch_udc.c
1049 ++++ b/drivers/usb/gadget/pch_udc.c
1050 +@@ -363,6 +363,7 @@ struct pch_udc_dev {
1051 + #define PCI_DEVICE_ID_INTEL_EG20T_UDC 0x8808
1052 + #define PCI_VENDOR_ID_ROHM 0x10DB
1053 + #define PCI_DEVICE_ID_ML7213_IOH_UDC 0x801D
1054 ++#define PCI_DEVICE_ID_ML7831_IOH_UDC 0x8808
1055 +
1056 + static const char ep0_string[] = "ep0in";
1057 + static DEFINE_SPINLOCK(udc_stall_spinlock); /* stall spin lock */
1058 +@@ -2979,6 +2980,11 @@ static DEFINE_PCI_DEVICE_TABLE(pch_udc_pcidev_id) = {
1059 + .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
1060 + .class_mask = 0xffffffff,
1061 + },
1062 ++ {
1063 ++ PCI_DEVICE(PCI_VENDOR_ID_ROHM, PCI_DEVICE_ID_ML7831_IOH_UDC),
1064 ++ .class = (PCI_CLASS_SERIAL_USB << 8) | 0xfe,
1065 ++ .class_mask = 0xffffffff,
1066 ++ },
1067 + { 0 },
1068 + };
1069 +
1070 +diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
1071 +index 29bec34..afef3df 100644
1072 +--- a/drivers/usb/host/ehci-sched.c
1073 ++++ b/drivers/usb/host/ehci-sched.c
1074 +@@ -1480,10 +1480,15 @@ iso_stream_schedule (
1075 +
1076 + /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */
1077 +
1078 +- /* find a uframe slot with enough bandwidth */
1079 +- next = start + period;
1080 +- for (; start < next; start++) {
1081 +-
1082 ++ /* find a uframe slot with enough bandwidth.
1083 ++ * Early uframes are more precious because full-speed
1084 ++ * iso IN transfers can't use late uframes,
1085 ++ * and therefore they should be allocated last.
1086 ++ */
1087 ++ next = start;
1088 ++ start += period;
1089 ++ do {
1090 ++ start--;
1091 + /* check schedule: enough space? */
1092 + if (stream->highspeed) {
1093 + if (itd_slot_ok(ehci, mod, start,
1094 +@@ -1496,7 +1501,7 @@ iso_stream_schedule (
1095 + start, sched, period))
1096 + break;
1097 + }
1098 +- }
1099 ++ } while (start > next);
1100 +
1101 + /* no room in the schedule */
1102 + if (start == next) {
1103 +diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
1104 +index 629a968..a495d48 100644
1105 +--- a/drivers/usb/host/pci-quirks.c
1106 ++++ b/drivers/usb/host/pci-quirks.c
1107 +@@ -626,7 +626,7 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
1108 + void __iomem *base, *op_reg_base;
1109 + u32 hcc_params, cap, val;
1110 + u8 offset, cap_length;
1111 +- int wait_time, delta, count = 256/4;
1112 ++ int wait_time, count = 256/4;
1113 +
1114 + if (!mmio_resource_enabled(pdev, 0))
1115 + return;
1116 +@@ -672,11 +672,10 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev)
1117 + writel(val, op_reg_base + EHCI_USBCMD);
1118 +
1119 + wait_time = 2000;
1120 +- delta = 100;
1121 + do {
1122 + writel(0x3f, op_reg_base + EHCI_USBSTS);
1123 +- udelay(delta);
1124 +- wait_time -= delta;
1125 ++ udelay(100);
1126 ++ wait_time -= 100;
1127 + val = readl(op_reg_base + EHCI_USBSTS);
1128 + if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) {
1129 + break;
1130 +diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
1131 +index 3428528..d718033 100644
1132 +--- a/drivers/usb/host/xhci-mem.c
1133 ++++ b/drivers/usb/host/xhci-mem.c
1134 +@@ -875,7 +875,6 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
1135 + struct xhci_virt_device *dev;
1136 + struct xhci_ep_ctx *ep0_ctx;
1137 + struct xhci_slot_ctx *slot_ctx;
1138 +- struct xhci_input_control_ctx *ctrl_ctx;
1139 + u32 port_num;
1140 + struct usb_device *top_dev;
1141 +
1142 +@@ -887,12 +886,8 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
1143 + return -EINVAL;
1144 + }
1145 + ep0_ctx = xhci_get_ep_ctx(xhci, dev->in_ctx, 0);
1146 +- ctrl_ctx = xhci_get_input_control_ctx(xhci, dev->in_ctx);
1147 + slot_ctx = xhci_get_slot_ctx(xhci, dev->in_ctx);
1148 +
1149 +- /* 2) New slot context and endpoint 0 context are valid*/
1150 +- ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
1151 +-
1152 + /* 3) Only the control endpoint is valid - one endpoint context */
1153 + slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route);
1154 + switch (udev->speed) {
1155 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1156 +index dd3eb6f..2c07fff 100644
1157 +--- a/drivers/usb/host/xhci-ring.c
1158 ++++ b/drivers/usb/host/xhci-ring.c
1159 +@@ -816,23 +816,24 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
1160 + struct xhci_ring *ring;
1161 + struct xhci_td *cur_td;
1162 + int ret, i, j;
1163 ++ unsigned long flags;
1164 +
1165 + ep = (struct xhci_virt_ep *) arg;
1166 + xhci = ep->xhci;
1167 +
1168 +- spin_lock(&xhci->lock);
1169 ++ spin_lock_irqsave(&xhci->lock, flags);
1170 +
1171 + ep->stop_cmds_pending--;
1172 + if (xhci->xhc_state & XHCI_STATE_DYING) {
1173 + xhci_dbg(xhci, "Stop EP timer ran, but another timer marked "
1174 + "xHCI as DYING, exiting.\n");
1175 +- spin_unlock(&xhci->lock);
1176 ++ spin_unlock_irqrestore(&xhci->lock, flags);
1177 + return;
1178 + }
1179 + if (!(ep->stop_cmds_pending == 0 && (ep->ep_state & EP_HALT_PENDING))) {
1180 + xhci_dbg(xhci, "Stop EP timer ran, but no command pending, "
1181 + "exiting.\n");
1182 +- spin_unlock(&xhci->lock);
1183 ++ spin_unlock_irqrestore(&xhci->lock, flags);
1184 + return;
1185 + }
1186 +
1187 +@@ -844,11 +845,11 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
1188 + xhci->xhc_state |= XHCI_STATE_DYING;
1189 + /* Disable interrupts from the host controller and start halting it */
1190 + xhci_quiesce(xhci);
1191 +- spin_unlock(&xhci->lock);
1192 ++ spin_unlock_irqrestore(&xhci->lock, flags);
1193 +
1194 + ret = xhci_halt(xhci);
1195 +
1196 +- spin_lock(&xhci->lock);
1197 ++ spin_lock_irqsave(&xhci->lock, flags);
1198 + if (ret < 0) {
1199 + /* This is bad; the host is not responding to commands and it's
1200 + * not allowing itself to be halted. At least interrupts are
1201 +@@ -896,7 +897,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
1202 + }
1203 + }
1204 + }
1205 +- spin_unlock(&xhci->lock);
1206 ++ spin_unlock_irqrestore(&xhci->lock, flags);
1207 + xhci_dbg(xhci, "Calling usb_hc_died()\n");
1208 + usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
1209 + xhci_dbg(xhci, "xHCI host controller is dead.\n");
1210 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1211 +index 3770004..67900ff 100644
1212 +--- a/drivers/usb/host/xhci.c
1213 ++++ b/drivers/usb/host/xhci.c
1214 +@@ -749,7 +749,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1215 + u32 command, temp = 0;
1216 + struct usb_hcd *hcd = xhci_to_hcd(xhci);
1217 + struct usb_hcd *secondary_hcd;
1218 +- int retval;
1219 ++ int retval = 0;
1220 +
1221 + /* Wait a bit if either of the roothubs need to settle from the
1222 + * transition into bus suspend.
1223 +@@ -759,6 +759,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1224 + xhci->bus_state[1].next_statechange))
1225 + msleep(100);
1226 +
1227 ++ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
1228 ++ set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
1229 ++
1230 + spin_lock_irq(&xhci->lock);
1231 + if (xhci->quirks & XHCI_RESET_ON_RESUME)
1232 + hibernated = true;
1233 +@@ -828,20 +831,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1234 + return retval;
1235 + xhci_dbg(xhci, "Start the primary HCD\n");
1236 + retval = xhci_run(hcd->primary_hcd);
1237 +- if (retval)
1238 +- goto failed_restart;
1239 +-
1240 +- xhci_dbg(xhci, "Start the secondary HCD\n");
1241 +- retval = xhci_run(secondary_hcd);
1242 + if (!retval) {
1243 +- set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
1244 +- set_bit(HCD_FLAG_HW_ACCESSIBLE,
1245 +- &xhci->shared_hcd->flags);
1246 ++ xhci_dbg(xhci, "Start the secondary HCD\n");
1247 ++ retval = xhci_run(secondary_hcd);
1248 + }
1249 +-failed_restart:
1250 + hcd->state = HC_STATE_SUSPENDED;
1251 + xhci->shared_hcd->state = HC_STATE_SUSPENDED;
1252 +- return retval;
1253 ++ goto done;
1254 + }
1255 +
1256 + /* step 4: set Run/Stop bit */
1257 +@@ -860,11 +856,14 @@ failed_restart:
1258 + * Running endpoints by ringing their doorbells
1259 + */
1260 +
1261 +- set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
1262 +- set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
1263 +-
1264 + spin_unlock_irq(&xhci->lock);
1265 +- return 0;
1266 ++
1267 ++ done:
1268 ++ if (retval == 0) {
1269 ++ usb_hcd_resume_root_hub(hcd);
1270 ++ usb_hcd_resume_root_hub(xhci->shared_hcd);
1271 ++ }
1272 ++ return retval;
1273 + }
1274 + #endif /* CONFIG_PM */
1275 +
1276 +@@ -2873,6 +2872,10 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
1277 + /* Otherwise, update the control endpoint ring enqueue pointer. */
1278 + else
1279 + xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev);
1280 ++ ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
1281 ++ ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
1282 ++ ctrl_ctx->drop_flags = 0;
1283 ++
1284 + xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
1285 + xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);
1286 +
1287 +@@ -2954,7 +2957,6 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
1288 + virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK)
1289 + + 1;
1290 + /* Zero the input context control for later use */
1291 +- ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
1292 + ctrl_ctx->add_flags = 0;
1293 + ctrl_ctx->drop_flags = 0;
1294 +
1295 +diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
1296 +index 5cdb9d9..18e875b 100644
1297 +--- a/drivers/usb/serial/ark3116.c
1298 ++++ b/drivers/usb/serial/ark3116.c
1299 +@@ -42,7 +42,7 @@ static int debug;
1300 + * Version information
1301 + */
1302 +
1303 +-#define DRIVER_VERSION "v0.6"
1304 ++#define DRIVER_VERSION "v0.7"
1305 + #define DRIVER_AUTHOR "Bart Hartgers <bart.hartgers+ark3116@×××××.com>"
1306 + #define DRIVER_DESC "USB ARK3116 serial/IrDA driver"
1307 + #define DRIVER_DEV_DESC "ARK3116 RS232/IrDA"
1308 +@@ -380,10 +380,6 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
1309 + goto err_out;
1310 + }
1311 +
1312 +- /* setup termios */
1313 +- if (tty)
1314 +- ark3116_set_termios(tty, port, NULL);
1315 +-
1316 + /* remove any data still left: also clears error state */
1317 + ark3116_read_reg(serial, UART_RX, buf);
1318 +
1319 +@@ -406,6 +402,10 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
1320 + /* enable DMA */
1321 + ark3116_write_reg(port->serial, UART_FCR, UART_FCR_DMA_SELECT);
1322 +
1323 ++ /* setup termios */
1324 ++ if (tty)
1325 ++ ark3116_set_termios(tty, port, NULL);
1326 ++
1327 + err_out:
1328 + kfree(buf);
1329 + return result;
1330 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1331 +index f34f6ed..e16394c 100644
1332 +--- a/drivers/usb/serial/ftdi_sio.c
1333 ++++ b/drivers/usb/serial/ftdi_sio.c
1334 +@@ -2083,13 +2083,19 @@ static void ftdi_set_termios(struct tty_struct *tty,
1335 +
1336 + cflag = termios->c_cflag;
1337 +
1338 +- /* FIXME -For this cut I don't care if the line is really changing or
1339 +- not - so just do the change regardless - should be able to
1340 +- compare old_termios and tty->termios */
1341 ++ if (old_termios->c_cflag == termios->c_cflag
1342 ++ && old_termios->c_ispeed == termios->c_ispeed
1343 ++ && old_termios->c_ospeed == termios->c_ospeed)
1344 ++ goto no_c_cflag_changes;
1345 ++
1346 + /* NOTE These routines can get interrupted by
1347 + ftdi_sio_read_bulk_callback - need to examine what this means -
1348 + don't see any problems yet */
1349 +
1350 ++ if ((old_termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)) ==
1351 ++ (termios->c_cflag & (CSIZE|PARODD|PARENB|CMSPAR|CSTOPB)))
1352 ++ goto no_data_parity_stop_changes;
1353 ++
1354 + /* Set number of data bits, parity, stop bits */
1355 +
1356 + urb_value = 0;
1357 +@@ -2130,6 +2136,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
1358 + }
1359 +
1360 + /* Now do the baudrate */
1361 ++no_data_parity_stop_changes:
1362 + if ((cflag & CBAUD) == B0) {
1363 + /* Disable flow control */
1364 + if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1365 +@@ -2157,6 +2164,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
1366 +
1367 + /* Set flow control */
1368 + /* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
1369 ++no_c_cflag_changes:
1370 + if (cflag & CRTSCTS) {
1371 + dbg("%s Setting to CRTSCTS flow control", __func__);
1372 + if (usb_control_msg(dev,
1373 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1374 +index 89ae1f6..3a47cbe 100644
1375 +--- a/drivers/usb/serial/option.c
1376 ++++ b/drivers/usb/serial/option.c
1377 +@@ -156,6 +156,7 @@ static void option_instat_callback(struct urb *urb);
1378 + #define HUAWEI_PRODUCT_K4511 0x14CC
1379 + #define HUAWEI_PRODUCT_ETS1220 0x1803
1380 + #define HUAWEI_PRODUCT_E353 0x1506
1381 ++#define HUAWEI_PRODUCT_E173S 0x1C05
1382 +
1383 + #define QUANTA_VENDOR_ID 0x0408
1384 + #define QUANTA_PRODUCT_Q101 0xEA02
1385 +@@ -316,6 +317,9 @@ static void option_instat_callback(struct urb *urb);
1386 + #define ZTE_PRODUCT_AC8710 0xfff1
1387 + #define ZTE_PRODUCT_AC2726 0xfff5
1388 + #define ZTE_PRODUCT_AC8710T 0xffff
1389 ++#define ZTE_PRODUCT_MC2718 0xffe8
1390 ++#define ZTE_PRODUCT_AD3812 0xffeb
1391 ++#define ZTE_PRODUCT_MC2716 0xffed
1392 +
1393 + #define BENQ_VENDOR_ID 0x04a5
1394 + #define BENQ_PRODUCT_H10 0x4068
1395 +@@ -500,6 +504,18 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = {
1396 + .reserved = BIT(4),
1397 + };
1398 +
1399 ++static const struct option_blacklist_info zte_ad3812_z_blacklist = {
1400 ++ .sendsetup = BIT(0) | BIT(1) | BIT(2),
1401 ++};
1402 ++
1403 ++static const struct option_blacklist_info zte_mc2718_z_blacklist = {
1404 ++ .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4),
1405 ++};
1406 ++
1407 ++static const struct option_blacklist_info zte_mc2716_z_blacklist = {
1408 ++ .sendsetup = BIT(1) | BIT(2) | BIT(3),
1409 ++};
1410 ++
1411 + static const struct option_blacklist_info huawei_cdc12_blacklist = {
1412 + .reserved = BIT(1) | BIT(2),
1413 + };
1414 +@@ -622,6 +638,7 @@ static const struct usb_device_id option_ids[] = {
1415 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
1416 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
1417 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
1418 ++ { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S, 0xff, 0xff, 0xff) },
1419 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
1420 + .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
1421 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
1422 +@@ -1043,6 +1060,12 @@ static const struct usb_device_id option_ids[] = {
1423 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
1424 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
1425 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
1426 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff),
1427 ++ .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist },
1428 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff),
1429 ++ .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
1430 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
1431 ++ .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
1432 + { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
1433 + { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
1434 + { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
1435 +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1436 +index 614fabc..d44c669 100644
1437 +--- a/drivers/usb/serial/pl2303.c
1438 ++++ b/drivers/usb/serial/pl2303.c
1439 +@@ -91,7 +91,6 @@ static const struct usb_device_id id_table[] = {
1440 + { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
1441 + { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
1442 + { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
1443 +- { USB_DEVICE(WINCHIPHEAD_VENDOR_ID, WINCHIPHEAD_USBSER_PRODUCT_ID) },
1444 + { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) },
1445 + { } /* Terminating entry */
1446 + };
1447 +diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
1448 +index 3d10d7f..c38b8c0 100644
1449 +--- a/drivers/usb/serial/pl2303.h
1450 ++++ b/drivers/usb/serial/pl2303.h
1451 +@@ -145,10 +145,6 @@
1452 + #define ADLINK_VENDOR_ID 0x0b63
1453 + #define ADLINK_ND6530_PRODUCT_ID 0x6530
1454 +
1455 +-/* WinChipHead USB->RS 232 adapter */
1456 +-#define WINCHIPHEAD_VENDOR_ID 0x4348
1457 +-#define WINCHIPHEAD_USBSER_PRODUCT_ID 0x5523
1458 +-
1459 + /* SMART USB Serial Adapter */
1460 + #define SMART_VENDOR_ID 0x0b8c
1461 + #define SMART_PRODUCT_ID 0x2303
1462 +diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
1463 +index fc310f7..0fded39 100644
1464 +--- a/drivers/usb/storage/protocol.c
1465 ++++ b/drivers/usb/storage/protocol.c
1466 +@@ -58,7 +58,9 @@
1467 +
1468 + void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
1469 + {
1470 +- /* Pad the SCSI command with zeros out to 12 bytes
1471 ++ /*
1472 ++ * Pad the SCSI command with zeros out to 12 bytes. If the
1473 ++ * command already is 12 bytes or longer, leave it alone.
1474 + *
1475 + * NOTE: This only works because a scsi_cmnd struct field contains
1476 + * a unsigned char cmnd[16], so we know we have storage available
1477 +@@ -66,9 +68,6 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
1478 + for (; srb->cmd_len<12; srb->cmd_len++)
1479 + srb->cmnd[srb->cmd_len] = 0;
1480 +
1481 +- /* set command length to 12 bytes */
1482 +- srb->cmd_len = 12;
1483 +-
1484 + /* send the command to the transport layer */
1485 + usb_stor_invoke_transport(srb, us);
1486 + }
1487 +diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
1488 +index b238d95..ac28990 100644
1489 +--- a/fs/nfs/dir.c
1490 ++++ b/fs/nfs/dir.c
1491 +@@ -1468,12 +1468,12 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
1492 + res = NULL;
1493 + goto out;
1494 + /* This turned out not to be a regular file */
1495 ++ case -EISDIR:
1496 + case -ENOTDIR:
1497 + goto no_open;
1498 + case -ELOOP:
1499 + if (!(nd->intent.open.flags & O_NOFOLLOW))
1500 + goto no_open;
1501 +- /* case -EISDIR: */
1502 + /* case -EINVAL: */
1503 + default:
1504 + res = ERR_CAST(inode);
1505 +diff --git a/fs/nfs/file.c b/fs/nfs/file.c
1506 +index 28b8c3f..5b3d984 100644
1507 +--- a/fs/nfs/file.c
1508 ++++ b/fs/nfs/file.c
1509 +@@ -895,3 +895,35 @@ static int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
1510 + file->f_path.dentry->d_name.name, arg);
1511 + return -EINVAL;
1512 + }
1513 ++
1514 ++#ifdef CONFIG_NFS_V4
1515 ++static int
1516 ++nfs4_file_open(struct inode *inode, struct file *filp)
1517 ++{
1518 ++ /*
1519 ++ * NFSv4 opens are handled in d_lookup and d_revalidate. If we get to
1520 ++ * this point, then something is very wrong
1521 ++ */
1522 ++ dprintk("NFS: %s called! inode=%p filp=%p\n", __func__, inode, filp);
1523 ++ return -ENOTDIR;
1524 ++}
1525 ++
1526 ++const struct file_operations nfs4_file_operations = {
1527 ++ .llseek = nfs_file_llseek,
1528 ++ .read = do_sync_read,
1529 ++ .write = do_sync_write,
1530 ++ .aio_read = nfs_file_read,
1531 ++ .aio_write = nfs_file_write,
1532 ++ .mmap = nfs_file_mmap,
1533 ++ .open = nfs4_file_open,
1534 ++ .flush = nfs_file_flush,
1535 ++ .release = nfs_file_release,
1536 ++ .fsync = nfs_file_fsync,
1537 ++ .lock = nfs_lock,
1538 ++ .flock = nfs_flock,
1539 ++ .splice_read = nfs_file_splice_read,
1540 ++ .splice_write = nfs_file_splice_write,
1541 ++ .check_flags = nfs_check_flags,
1542 ++ .setlease = nfs_setlease,
1543 ++};
1544 ++#endif /* CONFIG_NFS_V4 */
1545 +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
1546 +index fe12037..679d2f5 100644
1547 +--- a/fs/nfs/inode.c
1548 ++++ b/fs/nfs/inode.c
1549 +@@ -291,7 +291,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
1550 + */
1551 + inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->file_inode_ops;
1552 + if (S_ISREG(inode->i_mode)) {
1553 +- inode->i_fop = &nfs_file_operations;
1554 ++ inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops;
1555 + inode->i_data.a_ops = &nfs_file_aops;
1556 + inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info;
1557 + } else if (S_ISDIR(inode->i_mode)) {
1558 +diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
1559 +index 85f1690..d4bc9ed9 100644
1560 +--- a/fs/nfs/nfs3proc.c
1561 ++++ b/fs/nfs/nfs3proc.c
1562 +@@ -853,6 +853,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
1563 + .dentry_ops = &nfs_dentry_operations,
1564 + .dir_inode_ops = &nfs3_dir_inode_operations,
1565 + .file_inode_ops = &nfs3_file_inode_operations,
1566 ++ .file_ops = &nfs_file_operations,
1567 + .getroot = nfs3_proc_get_root,
1568 + .getattr = nfs3_proc_getattr,
1569 + .setattr = nfs3_proc_setattr,
1570 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
1571 +index 4700fae..2d8a169 100644
1572 +--- a/fs/nfs/nfs4proc.c
1573 ++++ b/fs/nfs/nfs4proc.c
1574 +@@ -6267,6 +6267,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
1575 + .dentry_ops = &nfs4_dentry_operations,
1576 + .dir_inode_ops = &nfs4_dir_inode_operations,
1577 + .file_inode_ops = &nfs4_file_inode_operations,
1578 ++ .file_ops = &nfs4_file_operations,
1579 + .getroot = nfs4_proc_get_root,
1580 + .getattr = nfs4_proc_getattr,
1581 + .setattr = nfs4_proc_setattr,
1582 +diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
1583 +index ac40b85..f48125d 100644
1584 +--- a/fs/nfs/proc.c
1585 ++++ b/fs/nfs/proc.c
1586 +@@ -710,6 +710,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
1587 + .dentry_ops = &nfs_dentry_operations,
1588 + .dir_inode_ops = &nfs_dir_inode_operations,
1589 + .file_inode_ops = &nfs_file_inode_operations,
1590 ++ .file_ops = &nfs_file_operations,
1591 + .getroot = nfs_proc_get_root,
1592 + .getattr = nfs_proc_getattr,
1593 + .setattr = nfs_proc_setattr,
1594 +diff --git a/fs/super.c b/fs/super.c
1595 +index 3f56a26..32a81f3 100644
1596 +--- a/fs/super.c
1597 ++++ b/fs/super.c
1598 +@@ -61,7 +61,7 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc)
1599 + return -1;
1600 +
1601 + if (!grab_super_passive(sb))
1602 +- return -1;
1603 ++ return !sc->nr_to_scan ? 0 : -1;
1604 +
1605 + if (sb->s_op && sb->s_op->nr_cached_objects)
1606 + fs_objects = sb->s_op->nr_cached_objects(sb);
1607 +diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
1608 +index eaac770..fc0fd15 100644
1609 +--- a/include/linux/nfs_fs.h
1610 ++++ b/include/linux/nfs_fs.h
1611 +@@ -410,6 +410,9 @@ extern const struct inode_operations nfs_file_inode_operations;
1612 + extern const struct inode_operations nfs3_file_inode_operations;
1613 + #endif /* CONFIG_NFS_V3 */
1614 + extern const struct file_operations nfs_file_operations;
1615 ++#ifdef CONFIG_NFS_V4
1616 ++extern const struct file_operations nfs4_file_operations;
1617 ++#endif /* CONFIG_NFS_V4 */
1618 + extern const struct address_space_operations nfs_file_aops;
1619 + extern const struct address_space_operations nfs_dir_aops;
1620 +
1621 +diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
1622 +index abd615d..8475f34 100644
1623 +--- a/include/linux/nfs_xdr.h
1624 ++++ b/include/linux/nfs_xdr.h
1625 +@@ -1194,6 +1194,7 @@ struct nfs_rpc_ops {
1626 + const struct dentry_operations *dentry_ops;
1627 + const struct inode_operations *dir_inode_ops;
1628 + const struct inode_operations *file_inode_ops;
1629 ++ const struct file_operations *file_ops;
1630 +
1631 + int (*getroot) (struct nfs_server *, struct nfs_fh *,
1632 + struct nfs_fsinfo *);
1633 +diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
1634 +index 790651b..a83833a 100644
1635 +--- a/include/linux/shrinker.h
1636 ++++ b/include/linux/shrinker.h
1637 +@@ -20,6 +20,7 @@ struct shrink_control {
1638 + * 'nr_to_scan' entries and attempt to free them up. It should return
1639 + * the number of objects which remain in the cache. If it returns -1, it means
1640 + * it cannot do any scanning at this time (eg. there is a risk of deadlock).
1641 ++ * The callback must not return -1 if nr_to_scan is zero.
1642 + *
1643 + * The 'gfpmask' refers to the allocation we are currently trying to
1644 + * fulfil.
1645 +diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
1646 +index aa57d5d..b5f4742 100644
1647 +--- a/kernel/irq/spurious.c
1648 ++++ b/kernel/irq/spurious.c
1649 +@@ -115,7 +115,7 @@ static int misrouted_irq(int irq)
1650 + struct irq_desc *desc;
1651 + int i, ok = 0;
1652 +
1653 +- if (atomic_inc_return(&irq_poll_active) == 1)
1654 ++ if (atomic_inc_return(&irq_poll_active) != 1)
1655 + goto out;
1656 +
1657 + irq_poll_cpu = smp_processor_id();
1658 +diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
1659 +index fb6931d..d58fd8b 100644
1660 +--- a/net/batman-adv/translation-table.c
1661 ++++ b/net/batman-adv/translation-table.c
1662 +@@ -137,10 +137,22 @@ static void tt_local_entry_free_ref(struct tt_local_entry *tt_local_entry)
1663 + kfree_rcu(tt_local_entry, rcu);
1664 + }
1665 +
1666 ++static void tt_global_entry_free_rcu(struct rcu_head *rcu)
1667 ++{
1668 ++ struct tt_global_entry *tt_global_entry;
1669 ++
1670 ++ tt_global_entry = container_of(rcu, struct tt_global_entry, rcu);
1671 ++
1672 ++ if (tt_global_entry->orig_node)
1673 ++ orig_node_free_ref(tt_global_entry->orig_node);
1674 ++
1675 ++ kfree(tt_global_entry);
1676 ++}
1677 ++
1678 + static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
1679 + {
1680 + if (atomic_dec_and_test(&tt_global_entry->refcount))
1681 +- kfree_rcu(tt_global_entry, rcu);
1682 ++ call_rcu(&tt_global_entry->rcu, tt_global_entry_free_rcu);
1683 + }
1684 +
1685 + static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
1686 +@@ -686,6 +698,9 @@ void tt_global_del_orig(struct bat_priv *bat_priv,
1687 + struct hlist_head *head;
1688 + spinlock_t *list_lock; /* protects write access to the hash lists */
1689 +
1690 ++ if (!hash)
1691 ++ return;
1692 ++
1693 + for (i = 0; i < hash->size; i++) {
1694 + head = &hash->table[i];
1695 + list_lock = &hash->list_locks[i];
1696 +@@ -999,7 +1014,6 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
1697 + tt_response = (struct tt_query_packet *)skb_put(skb,
1698 + tt_query_size + tt_len);
1699 + tt_response->ttvn = ttvn;
1700 +- tt_response->tt_data = htons(tt_tot);
1701 +
1702 + tt_change = (struct tt_change *)(skb->data + tt_query_size);
1703 + tt_count = 0;
1704 +@@ -1025,6 +1039,10 @@ static struct sk_buff *tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
1705 + }
1706 + rcu_read_unlock();
1707 +
1708 ++ /* store in the message the number of entries we have successfully
1709 ++ * copied */
1710 ++ tt_response->tt_data = htons(tt_count);
1711 ++
1712 + out:
1713 + return skb;
1714 + }
1715 +@@ -1668,6 +1686,8 @@ static void tt_local_reset_flags(struct bat_priv *bat_priv, uint16_t flags)
1716 + rcu_read_lock();
1717 + hlist_for_each_entry_rcu(tt_local_entry, node,
1718 + head, hash_entry) {
1719 ++ if (!(tt_local_entry->flags & flags))
1720 ++ continue;
1721 + tt_local_entry->flags &= ~flags;
1722 + atomic_inc(&bat_priv->num_local_tt);
1723 + }
1724 +diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
1725 +index 25bd1db..51a0db7 100644
1726 +--- a/net/batman-adv/types.h
1727 ++++ b/net/batman-adv/types.h
1728 +@@ -223,22 +223,22 @@ struct socket_packet {
1729 +
1730 + struct tt_local_entry {
1731 + uint8_t addr[ETH_ALEN];
1732 ++ struct hlist_node hash_entry;
1733 + unsigned long last_seen;
1734 + uint16_t flags;
1735 + atomic_t refcount;
1736 + struct rcu_head rcu;
1737 +- struct hlist_node hash_entry;
1738 + };
1739 +
1740 + struct tt_global_entry {
1741 + uint8_t addr[ETH_ALEN];
1742 ++ struct hlist_node hash_entry; /* entry in the global table */
1743 + struct orig_node *orig_node;
1744 + uint8_t ttvn;
1745 + uint16_t flags; /* only TT_GLOBAL_ROAM is used */
1746 + unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */
1747 + atomic_t refcount;
1748 + struct rcu_head rcu;
1749 +- struct hlist_node hash_entry; /* entry in the global table */
1750 + };
1751 +
1752 + struct tt_change_node {
1753 +diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
1754 +index 0bc9888..4e6922f 100644
1755 +--- a/net/ipv6/ip6_tunnel.c
1756 ++++ b/net/ipv6/ip6_tunnel.c
1757 +@@ -289,6 +289,8 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p)
1758 + if ((err = register_netdevice(dev)) < 0)
1759 + goto failed_free;
1760 +
1761 ++ strcpy(t->parms.name, dev->name);
1762 ++
1763 + dev_hold(dev);
1764 + ip6_tnl_link(ip6n, t);
1765 + return t;
1766 +@@ -1397,7 +1399,6 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
1767 + struct ip6_tnl *t = netdev_priv(dev);
1768 +
1769 + t->dev = dev;
1770 +- strcpy(t->parms.name, dev->name);
1771 + dev->tstats = alloc_percpu(struct pcpu_tstats);
1772 + if (!dev->tstats)
1773 + return -ENOMEM;
1774 +@@ -1477,6 +1478,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n)
1775 + static int __net_init ip6_tnl_init_net(struct net *net)
1776 + {
1777 + struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
1778 ++ struct ip6_tnl *t = NULL;
1779 + int err;
1780 +
1781 + ip6n->tnls[0] = ip6n->tnls_wc;
1782 +@@ -1497,6 +1499,10 @@ static int __net_init ip6_tnl_init_net(struct net *net)
1783 + err = register_netdev(ip6n->fb_tnl_dev);
1784 + if (err < 0)
1785 + goto err_register;
1786 ++
1787 ++ t = netdev_priv(ip6n->fb_tnl_dev);
1788 ++
1789 ++ strcpy(t->parms.name, ip6n->fb_tnl_dev->name);
1790 + return 0;
1791 +
1792 + err_register:
1793 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
1794 +index fe2c2a7..a961003 100644
1795 +--- a/net/mac80211/rx.c
1796 ++++ b/net/mac80211/rx.c
1797 +@@ -140,8 +140,9 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
1798 + pos++;
1799 +
1800 + /* IEEE80211_RADIOTAP_RATE */
1801 +- if (status->flag & RX_FLAG_HT) {
1802 ++ if (!rate || status->flag & RX_FLAG_HT) {
1803 + /*
1804 ++ * Without rate information don't add it. If we have,
1805 + * MCS information is a separate field in radiotap,
1806 + * added below. The byte here is needed as padding
1807 + * for the channel though, so initialise it to 0.
1808 +@@ -162,12 +163,14 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
1809 + else if (status->flag & RX_FLAG_HT)
1810 + put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ,
1811 + pos);
1812 +- else if (rate->flags & IEEE80211_RATE_ERP_G)
1813 ++ else if (rate && rate->flags & IEEE80211_RATE_ERP_G)
1814 + put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ,
1815 + pos);
1816 +- else
1817 ++ else if (rate)
1818 + put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ,
1819 + pos);
1820 ++ else
1821 ++ put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos);
1822 + pos += 2;
1823 +
1824 + /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
1825 +diff --git a/net/mac80211/util.c b/net/mac80211/util.c
1826 +index ddeb1b9..fd031e8 100644
1827 +--- a/net/mac80211/util.c
1828 ++++ b/net/mac80211/util.c
1829 +@@ -1055,6 +1055,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1830 + skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
1831 + ssid, ssid_len,
1832 + buf, buf_len);
1833 ++ if (!skb)
1834 ++ goto out;
1835 +
1836 + if (dst) {
1837 + mgmt = (struct ieee80211_mgmt *) skb->data;
1838 +@@ -1063,6 +1065,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1839 + }
1840 +
1841 + IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
1842 ++
1843 ++ out:
1844 + kfree(buf);
1845 +
1846 + return skb;
1847 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
1848 +index ea40d54..1308050 100644
1849 +--- a/net/wireless/nl80211.c
1850 ++++ b/net/wireless/nl80211.c
1851 +@@ -126,8 +126,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
1852 + [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED },
1853 + [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG },
1854 +
1855 +- [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY,
1856 +- .len = NL80211_HT_CAPABILITY_LEN },
1857 ++ [NL80211_ATTR_HT_CAPABILITY] = { .len = NL80211_HT_CAPABILITY_LEN },
1858 +
1859 + [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 },
1860 + [NL80211_ATTR_IE] = { .type = NLA_BINARY,
1861 +diff --git a/net/wireless/reg.c b/net/wireless/reg.c
1862 +index 68a471b..1658eff 100644
1863 +--- a/net/wireless/reg.c
1864 ++++ b/net/wireless/reg.c
1865 +@@ -2254,6 +2254,9 @@ void /* __init_or_exit */ regulatory_exit(void)
1866 +
1867 + kfree(last_request);
1868 +
1869 ++ last_request = NULL;
1870 ++ dev_set_uevent_suppress(&reg_pdev->dev, true);
1871 ++
1872 + platform_device_unregister(reg_pdev);
1873 +
1874 + spin_lock_bh(&reg_pending_beacons_lock);
1875 +diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
1876 +index c34f730..44f199c 100644
1877 +--- a/sound/pci/hda/hda_eld.c
1878 ++++ b/sound/pci/hda/hda_eld.c
1879 +@@ -297,10 +297,10 @@ static int hdmi_update_eld(struct hdmi_eld *e,
1880 + buf + ELD_FIXED_BYTES + mnl + 3 * i);
1881 + }
1882 +
1883 ++ e->eld_valid = true;
1884 + return 0;
1885 +
1886 + out_fail:
1887 +- e->eld_ver = 0;
1888 + return -EINVAL;
1889 + }
1890 +
1891 +@@ -318,9 +318,6 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
1892 + int size;
1893 + unsigned char *buf;
1894 +
1895 +- if (!eld->eld_valid)
1896 +- return -ENOENT;
1897 +-
1898 + size = snd_hdmi_get_eld_size(codec, nid);
1899 + if (size == 0) {
1900 + /* wfg: workaround for ASUS P5E-VM HDMI board */
1901 +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
1902 +index c45f3e6..4346ad2 100644
1903 +--- a/sound/pci/hda/patch_cirrus.c
1904 ++++ b/sound/pci/hda/patch_cirrus.c
1905 +@@ -236,6 +236,15 @@ static int cs_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
1906 + return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
1907 + }
1908 +
1909 ++static void cs_update_input_select(struct hda_codec *codec)
1910 ++{
1911 ++ struct cs_spec *spec = codec->spec;
1912 ++ if (spec->cur_adc)
1913 ++ snd_hda_codec_write(codec, spec->cur_adc, 0,
1914 ++ AC_VERB_SET_CONNECT_SEL,
1915 ++ spec->adc_idx[spec->cur_input]);
1916 ++}
1917 ++
1918 + /*
1919 + * Analog capture
1920 + */
1921 +@@ -249,6 +258,7 @@ static int cs_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
1922 + spec->cur_adc = spec->adc_nid[spec->cur_input];
1923 + spec->cur_adc_stream_tag = stream_tag;
1924 + spec->cur_adc_format = format;
1925 ++ cs_update_input_select(codec);
1926 + snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
1927 + return 0;
1928 + }
1929 +@@ -688,10 +698,8 @@ static int change_cur_input(struct hda_codec *codec, unsigned int idx,
1930 + spec->cur_adc_stream_tag, 0,
1931 + spec->cur_adc_format);
1932 + }
1933 +- snd_hda_codec_write(codec, spec->cur_adc, 0,
1934 +- AC_VERB_SET_CONNECT_SEL,
1935 +- spec->adc_idx[idx]);
1936 + spec->cur_input = idx;
1937 ++ cs_update_input_select(codec);
1938 + return 1;
1939 + }
1940 +
1941 +@@ -972,10 +980,7 @@ static void cs_automic(struct hda_codec *codec)
1942 + } else {
1943 + spec->cur_input = spec->last_input;
1944 + }
1945 +-
1946 +- snd_hda_codec_write_cache(codec, spec->cur_adc, 0,
1947 +- AC_VERB_SET_CONNECT_SEL,
1948 +- spec->adc_idx[spec->cur_input]);
1949 ++ cs_update_input_select(codec);
1950 + } else {
1951 + if (present)
1952 + change_cur_input(codec, spec->automic_idx, 0);
1953 +@@ -1072,9 +1077,7 @@ static void init_input(struct hda_codec *codec)
1954 + cs_automic(codec);
1955 + else {
1956 + spec->cur_adc = spec->adc_nid[spec->cur_input];
1957 +- snd_hda_codec_write(codec, spec->cur_adc, 0,
1958 +- AC_VERB_SET_CONNECT_SEL,
1959 +- spec->adc_idx[spec->cur_input]);
1960 ++ cs_update_input_select(codec);
1961 + }
1962 + } else {
1963 + change_cur_input(codec, spec->cur_input, 1);
1964 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
1965 +index 19cb72d..e287015 100644
1966 +--- a/sound/pci/hda/patch_hdmi.c
1967 ++++ b/sound/pci/hda/patch_hdmi.c
1968 +@@ -920,20 +920,23 @@ static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid,
1969 + * the unsolicited response to avoid custom WARs.
1970 + */
1971 + int present = snd_hda_pin_sense(codec, pin_nid);
1972 ++ bool eld_valid = false;
1973 +
1974 +- memset(eld, 0, sizeof(*eld));
1975 ++#ifdef CONFIG_PROC_FS
1976 ++ memset(eld, 0, offsetof(struct hdmi_eld, proc_entry));
1977 ++#else
1978 ++ memset(eld, 0, sizeof(struct hdmi_eld));
1979 ++#endif
1980 +
1981 + eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
1982 + if (eld->monitor_present)
1983 +- eld->eld_valid = !!(present & AC_PINSENSE_ELDV);
1984 +- else
1985 +- eld->eld_valid = 0;
1986 ++ eld_valid = !!(present & AC_PINSENSE_ELDV);
1987 +
1988 + printk(KERN_INFO
1989 + "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
1990 +- codec->addr, pin_nid, eld->monitor_present, eld->eld_valid);
1991 ++ codec->addr, pin_nid, eld->monitor_present, eld_valid);
1992 +
1993 +- if (eld->eld_valid)
1994 ++ if (eld_valid)
1995 + if (!snd_hdmi_get_eld(eld, codec, pin_nid))
1996 + snd_hdmi_show_eld(eld);
1997 +