Magellan Linux

Contents of /trunk/kernel-alx/patches-3.14/0117-3.14.18-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2506 - (show annotations) (download)
Fri Oct 17 07:55:45 2014 UTC (9 years, 6 months ago) by niro
File size: 116667 byte(s)
-patches for 3.14
1 diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
2 index b8dd0df76952..0fd40b15e2d5 100644
3 --- a/Documentation/sound/alsa/ALSA-Configuration.txt
4 +++ b/Documentation/sound/alsa/ALSA-Configuration.txt
5 @@ -2026,8 +2026,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
6 -------------------
7
8 Module for sound cards based on the Asus AV66/AV100/AV200 chips,
9 - i.e., Xonar D1, DX, D2, D2X, DS, Essence ST (Deluxe), Essence STX,
10 - HDAV1.3 (Deluxe), and HDAV1.3 Slim.
11 + i.e., Xonar D1, DX, D2, D2X, DS, DSX, Essence ST (Deluxe),
12 + Essence STX (II), HDAV1.3 (Deluxe), and HDAV1.3 Slim.
13
14 This module supports autoprobe and multiple cards.
15
16 diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
17 index b0714d8f678a..8dfb6a5f427d 100644
18 --- a/Documentation/stable_kernel_rules.txt
19 +++ b/Documentation/stable_kernel_rules.txt
20 @@ -29,6 +29,9 @@ Rules on what kind of patches are accepted, and which ones are not, into the
21
22 Procedure for submitting patches to the -stable tree:
23
24 + - If the patch covers files in net/ or drivers/net please follow netdev stable
25 + submission guidelines as described in
26 + Documentation/networking/netdev-FAQ.txt
27 - Send the patch, after verifying that it follows the above rules, to
28 stable@vger.kernel.org. You must note the upstream commit ID in the
29 changelog of your submission, as well as the kernel version you wish
30 diff --git a/Makefile b/Makefile
31 index 12aac0325888..05279d4f44c9 100644
32 --- a/Makefile
33 +++ b/Makefile
34 @@ -1,6 +1,6 @@
35 VERSION = 3
36 PATCHLEVEL = 14
37 -SUBLEVEL = 17
38 +SUBLEVEL = 18
39 EXTRAVERSION =
40 NAME = Remembering Coco
41
42 diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
43 index c6bd4d986c29..8775681df7ed 100644
44 --- a/arch/arm/boot/dts/am4372.dtsi
45 +++ b/arch/arm/boot/dts/am4372.dtsi
46 @@ -161,9 +161,6 @@
47 ti,hwmods = "mailbox";
48 ti,mbox-num-users = <4>;
49 ti,mbox-num-fifos = <8>;
50 - ti,mbox-names = "wkup_m3";
51 - ti,mbox-data = <0 0 0 0>;
52 - status = "disabled";
53 };
54
55 timer1: timer@44e31000 {
56 diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
57 index 43876245fc57..21ca0cebcab0 100644
58 --- a/arch/arm/include/asm/unistd.h
59 +++ b/arch/arm/include/asm/unistd.h
60 @@ -15,7 +15,17 @@
61
62 #include <uapi/asm/unistd.h>
63
64 +/*
65 + * This may need to be greater than __NR_last_syscall+1 in order to
66 + * account for the padding in the syscall table
67 + */
68 #define __NR_syscalls (384)
69 +
70 +/*
71 + * *NOTE*: This is a ghost syscall private to the kernel. Only the
72 + * __kuser_cmpxchg code in entry-armv.S should be aware of its
73 + * existence. Don't ever use this from user code.
74 + */
75 #define __ARM_NR_cmpxchg (__ARM_NR_BASE+0x00fff0)
76
77 #define __ARCH_WANT_STAT64
78 diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h
79 index fb5584d0cc05..c3776331f407 100644
80 --- a/arch/arm/include/uapi/asm/unistd.h
81 +++ b/arch/arm/include/uapi/asm/unistd.h
82 @@ -410,11 +410,6 @@
83 #define __NR_sched_getattr (__NR_SYSCALL_BASE+381)
84
85 /*
86 - * This may need to be greater than __NR_last_syscall+1 in order to
87 - * account for the padding in the syscall table
88 - */
89 -
90 -/*
91 * The following SWIs are ARM private.
92 */
93 #define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
94 @@ -425,12 +420,6 @@
95 #define __ARM_NR_set_tls (__ARM_NR_BASE+5)
96
97 /*
98 - * *NOTE*: This is a ghost syscall private to the kernel. Only the
99 - * __kuser_cmpxchg code in entry-armv.S should be aware of its
100 - * existence. Don't ever use this from user code.
101 - */
102 -
103 -/*
104 * The following syscalls are obsolete and no longer available for EABI.
105 */
106 #if !defined(__KERNEL__)
107 diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
108 index 44bb4d544dcf..89cde0786d25 100644
109 --- a/arch/arm/mach-omap2/control.c
110 +++ b/arch/arm/mach-omap2/control.c
111 @@ -314,7 +314,8 @@ void omap3_save_scratchpad_contents(void)
112 scratchpad_contents.public_restore_ptr =
113 virt_to_phys(omap3_restore_3630);
114 else if (omap_rev() != OMAP3430_REV_ES3_0 &&
115 - omap_rev() != OMAP3430_REV_ES3_1)
116 + omap_rev() != OMAP3430_REV_ES3_1 &&
117 + omap_rev() != OMAP3430_REV_ES3_1_2)
118 scratchpad_contents.public_restore_ptr =
119 virt_to_phys(omap3_restore);
120 else
121 diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
122 index 66c60fe1104c..c914b0052fb9 100644
123 --- a/arch/arm/mach-omap2/omap_hwmod.c
124 +++ b/arch/arm/mach-omap2/omap_hwmod.c
125 @@ -2185,6 +2185,8 @@ static int _enable(struct omap_hwmod *oh)
126 oh->mux->pads_dynamic))) {
127 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
128 _reconfigure_io_chain();
129 + } else if (oh->flags & HWMOD_FORCE_MSTANDBY) {
130 + _reconfigure_io_chain();
131 }
132
133 _add_initiator_dep(oh, mpu_oh);
134 @@ -2291,6 +2293,8 @@ static int _idle(struct omap_hwmod *oh)
135 if (oh->mux && oh->mux->pads_dynamic) {
136 omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE);
137 _reconfigure_io_chain();
138 + } else if (oh->flags & HWMOD_FORCE_MSTANDBY) {
139 + _reconfigure_io_chain();
140 }
141
142 oh->_state = _HWMOD_STATE_IDLE;
143 diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
144 index 3b2b4fb3585b..beedaf0c5e75 100644
145 --- a/arch/powerpc/platforms/powernv/pci-ioda.c
146 +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
147 @@ -491,6 +491,7 @@ static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb,
148 set_dma_ops(&pdev->dev, &dma_iommu_ops);
149 set_iommu_table_base(&pdev->dev, &pe->tce32_table);
150 }
151 + *pdev->dev.dma_mask = dma_mask;
152 return 0;
153 }
154
155 diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
156 index efe61374f6ea..e68922b0d4f5 100644
157 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c
158 +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
159 @@ -118,10 +118,10 @@ int remove_phb_dynamic(struct pci_controller *phb)
160 }
161 }
162
163 - /* Unregister the bridge device from sysfs and remove the PCI bus */
164 - device_unregister(b->bridge);
165 + /* Remove the PCI bus and unregister the bridge device from sysfs */
166 phb->bus = NULL;
167 pci_remove_bus(b);
168 + device_unregister(b->bridge);
169
170 /* Now release the IO resource */
171 if (res->flags & IORESOURCE_IO)
172 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
173 index c718d9f25900..e4098912fef2 100644
174 --- a/arch/x86/Kconfig
175 +++ b/arch/x86/Kconfig
176 @@ -1597,6 +1597,7 @@ config EFI
177 config EFI_STUB
178 bool "EFI stub support"
179 depends on EFI
180 + select RELOCATABLE
181 ---help---
182 This kernel feature allows a bzImage to be loaded directly
183 by EFI firmware without the use of a bootloader.
184 diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
185 index 3092300a07cd..d71d5ac78e42 100644
186 --- a/arch/x86/include/asm/kvm_host.h
187 +++ b/arch/x86/include/asm/kvm_host.h
188 @@ -99,7 +99,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
189 #define KVM_REFILL_PAGES 25
190 #define KVM_MAX_CPUID_ENTRIES 80
191 #define KVM_NR_FIXED_MTRR_REGION 88
192 -#define KVM_NR_VAR_MTRR 10
193 +#define KVM_NR_VAR_MTRR 8
194
195 #define ASYNC_PF_PER_VCPU 64
196
197 diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c
198 index 2a26819bb6a8..80eab01c1a68 100644
199 --- a/arch/x86/kernel/resource.c
200 +++ b/arch/x86/kernel/resource.c
201 @@ -37,10 +37,12 @@ static void remove_e820_regions(struct resource *avail)
202
203 void arch_remove_reservations(struct resource *avail)
204 {
205 - /* Trim out BIOS areas (low 1MB and high 2MB) and E820 regions */
206 + /*
207 + * Trim out BIOS area (high 2MB) and E820 regions. We do not remove
208 + * the low 1MB unconditionally, as this area is needed for some ISA
209 + * cards requiring a memory range, e.g. the i82365 PCMCIA controller.
210 + */
211 if (avail->flags & IORESOURCE_MEM) {
212 - if (avail->start < BIOS_END)
213 - avail->start = BIOS_END;
214 resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END);
215
216 remove_e820_regions(avail);
217 diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
218 index 1f96f9347ed9..09ce23ae370c 100644
219 --- a/arch/x86/kernel/vsyscall_64.c
220 +++ b/arch/x86/kernel/vsyscall_64.c
221 @@ -125,10 +125,10 @@ static void warn_bad_vsyscall(const char *level, struct pt_regs *regs,
222 if (!show_unhandled_signals)
223 return;
224
225 - pr_notice_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n",
226 - level, current->comm, task_pid_nr(current),
227 - message, regs->ip, regs->cs,
228 - regs->sp, regs->ax, regs->si, regs->di);
229 + printk_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n",
230 + level, current->comm, task_pid_nr(current),
231 + message, regs->ip, regs->cs,
232 + regs->sp, regs->ax, regs->si, regs->di);
233 }
234
235 static int addr_to_vsyscall_nr(unsigned long addr)
236 diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
237 index 07ffca0a89e9..7bff3e2a7a11 100644
238 --- a/arch/x86/kvm/emulate.c
239 +++ b/arch/x86/kvm/emulate.c
240 @@ -2006,6 +2006,7 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)
241 {
242 int rc;
243 unsigned long cs;
244 + int cpl = ctxt->ops->cpl(ctxt);
245
246 rc = emulate_pop(ctxt, &ctxt->_eip, ctxt->op_bytes);
247 if (rc != X86EMUL_CONTINUE)
248 @@ -2015,6 +2016,9 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)
249 rc = emulate_pop(ctxt, &cs, ctxt->op_bytes);
250 if (rc != X86EMUL_CONTINUE)
251 return rc;
252 + /* Outer-privilege level return is not implemented */
253 + if (ctxt->mode >= X86EMUL_MODE_PROT16 && (cs & 3) > cpl)
254 + return X86EMUL_UNHANDLEABLE;
255 rc = load_segment_descriptor(ctxt, (u16)cs, VCPU_SREG_CS);
256 return rc;
257 }
258 diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
259 index 484bc874688b..3ec38cb56bd5 100644
260 --- a/arch/x86/kvm/irq.c
261 +++ b/arch/x86/kvm/irq.c
262 @@ -108,7 +108,7 @@ int kvm_cpu_get_interrupt(struct kvm_vcpu *v)
263
264 vector = kvm_cpu_get_extint(v);
265
266 - if (kvm_apic_vid_enabled(v->kvm) || vector != -1)
267 + if (vector != -1)
268 return vector; /* PIC */
269
270 return kvm_get_apic_interrupt(v); /* APIC */
271 diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
272 index 006911858174..453e5fbbb7ae 100644
273 --- a/arch/x86/kvm/lapic.c
274 +++ b/arch/x86/kvm/lapic.c
275 @@ -352,25 +352,46 @@ static inline int apic_find_highest_irr(struct kvm_lapic *apic)
276
277 static inline void apic_clear_irr(int vec, struct kvm_lapic *apic)
278 {
279 - apic->irr_pending = false;
280 + struct kvm_vcpu *vcpu;
281 +
282 + vcpu = apic->vcpu;
283 +
284 apic_clear_vector(vec, apic->regs + APIC_IRR);
285 - if (apic_search_irr(apic) != -1)
286 - apic->irr_pending = true;
287 + if (unlikely(kvm_apic_vid_enabled(vcpu->kvm)))
288 + /* try to update RVI */
289 + kvm_make_request(KVM_REQ_EVENT, vcpu);
290 + else {
291 + vec = apic_search_irr(apic);
292 + apic->irr_pending = (vec != -1);
293 + }
294 }
295
296 static inline void apic_set_isr(int vec, struct kvm_lapic *apic)
297 {
298 - /* Note that we never get here with APIC virtualization enabled. */
299 + struct kvm_vcpu *vcpu;
300 +
301 + if (__apic_test_and_set_vector(vec, apic->regs + APIC_ISR))
302 + return;
303 +
304 + vcpu = apic->vcpu;
305
306 - if (!__apic_test_and_set_vector(vec, apic->regs + APIC_ISR))
307 - ++apic->isr_count;
308 - BUG_ON(apic->isr_count > MAX_APIC_VECTOR);
309 /*
310 - * ISR (in service register) bit is set when injecting an interrupt.
311 - * The highest vector is injected. Thus the latest bit set matches
312 - * the highest bit in ISR.
313 + * With APIC virtualization enabled, all caching is disabled
314 + * because the processor can modify ISR under the hood. Instead
315 + * just set SVI.
316 */
317 - apic->highest_isr_cache = vec;
318 + if (unlikely(kvm_apic_vid_enabled(vcpu->kvm)))
319 + kvm_x86_ops->hwapic_isr_update(vcpu->kvm, vec);
320 + else {
321 + ++apic->isr_count;
322 + BUG_ON(apic->isr_count > MAX_APIC_VECTOR);
323 + /*
324 + * ISR (in service register) bit is set when injecting an interrupt.
325 + * The highest vector is injected. Thus the latest bit set matches
326 + * the highest bit in ISR.
327 + */
328 + apic->highest_isr_cache = vec;
329 + }
330 }
331
332 static inline int apic_find_highest_isr(struct kvm_lapic *apic)
333 @@ -1627,11 +1648,16 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
334 int vector = kvm_apic_has_interrupt(vcpu);
335 struct kvm_lapic *apic = vcpu->arch.apic;
336
337 - /* Note that we never get here with APIC virtualization enabled. */
338 -
339 if (vector == -1)
340 return -1;
341
342 + /*
343 + * We get here even with APIC virtualization enabled, if doing
344 + * nested virtualization and L1 runs with the "acknowledge interrupt
345 + * on exit" mode. Then we cannot inject the interrupt via RVI,
346 + * because the process would deliver it through the IDT.
347 + */
348 +
349 apic_set_isr(vector, apic);
350 apic_update_ppr(apic);
351 apic_clear_irr(vector, apic);
352 diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
353 index db6b1ab43255..96a159afe3c6 100644
354 --- a/arch/x86/pci/i386.c
355 +++ b/arch/x86/pci/i386.c
356 @@ -162,6 +162,10 @@ pcibios_align_resource(void *data, const struct resource *res,
357 return start;
358 if (start & 0x300)
359 start = (start + 0x3ff) & ~0x3ff;
360 + } else if (res->flags & IORESOURCE_MEM) {
361 + /* The low 1MB range is reserved for ISA cards */
362 + if (start < BIOS_END)
363 + start = BIOS_END;
364 }
365 return start;
366 }
367 diff --git a/arch/x86/xen/grant-table.c b/arch/x86/xen/grant-table.c
368 index c98583588580..5b406fc45674 100644
369 --- a/arch/x86/xen/grant-table.c
370 +++ b/arch/x86/xen/grant-table.c
371 @@ -134,6 +134,7 @@ static int __init xlated_setup_gnttab_pages(void)
372 {
373 struct page **pages;
374 xen_pfn_t *pfns;
375 + void *vaddr;
376 int rc;
377 unsigned int i;
378 unsigned long nr_grant_frames = gnttab_max_grant_frames();
379 @@ -159,21 +160,20 @@ static int __init xlated_setup_gnttab_pages(void)
380 for (i = 0; i < nr_grant_frames; i++)
381 pfns[i] = page_to_pfn(pages[i]);
382
383 - rc = arch_gnttab_map_shared(pfns, nr_grant_frames, nr_grant_frames,
384 - &xen_auto_xlat_grant_frames.vaddr);
385 -
386 - if (rc) {
387 + vaddr = vmap(pages, nr_grant_frames, 0, PAGE_KERNEL);
388 + if (!vaddr) {
389 pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__,
390 nr_grant_frames, rc);
391 free_xenballooned_pages(nr_grant_frames, pages);
392 kfree(pages);
393 kfree(pfns);
394 - return rc;
395 + return -ENOMEM;
396 }
397 kfree(pages);
398
399 xen_auto_xlat_grant_frames.pfn = pfns;
400 xen_auto_xlat_grant_frames.count = nr_grant_frames;
401 + xen_auto_xlat_grant_frames.vaddr = vaddr;
402
403 return 0;
404 }
405 diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
406 index 7b78f88c1707..5718b0b58b60 100644
407 --- a/arch/x86/xen/time.c
408 +++ b/arch/x86/xen/time.c
409 @@ -444,7 +444,7 @@ void xen_setup_timer(int cpu)
410
411 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
412 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
413 - IRQF_FORCE_RESUME,
414 + IRQF_FORCE_RESUME|IRQF_EARLY_RESUME,
415 name, NULL);
416 (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX);
417
418 diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
419 index 5b0dd8ef74c0..be9af2e6ca5a 100644
420 --- a/drivers/char/tpm/tpm_i2c_stm_st33.c
421 +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
422 @@ -715,6 +715,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
423 }
424
425 tpm_get_timeouts(chip);
426 + tpm_do_selftest(chip);
427
428 dev_info(chip->dev, "TPM I2C Initialized\n");
429 return 0;
430 diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c
431 index a999f537228f..92105f3dc8e0 100644
432 --- a/drivers/crypto/ux500/cryp/cryp_core.c
433 +++ b/drivers/crypto/ux500/cryp/cryp_core.c
434 @@ -190,7 +190,7 @@ static void add_session_id(struct cryp_ctx *ctx)
435 static irqreturn_t cryp_interrupt_handler(int irq, void *param)
436 {
437 struct cryp_ctx *ctx;
438 - int i;
439 + int count;
440 struct cryp_device_data *device_data;
441
442 if (param == NULL) {
443 @@ -215,12 +215,11 @@ static irqreturn_t cryp_interrupt_handler(int irq, void *param)
444 if (cryp_pending_irq_src(device_data,
445 CRYP_IRQ_SRC_OUTPUT_FIFO)) {
446 if (ctx->outlen / ctx->blocksize > 0) {
447 - for (i = 0; i < ctx->blocksize / 4; i++) {
448 - *(ctx->outdata) = readl_relaxed(
449 - &device_data->base->dout);
450 - ctx->outdata += 4;
451 - ctx->outlen -= 4;
452 - }
453 + count = ctx->blocksize / 4;
454 +
455 + readsl(&device_data->base->dout, ctx->outdata, count);
456 + ctx->outdata += count;
457 + ctx->outlen -= count;
458
459 if (ctx->outlen == 0) {
460 cryp_disable_irq_src(device_data,
461 @@ -230,12 +229,12 @@ static irqreturn_t cryp_interrupt_handler(int irq, void *param)
462 } else if (cryp_pending_irq_src(device_data,
463 CRYP_IRQ_SRC_INPUT_FIFO)) {
464 if (ctx->datalen / ctx->blocksize > 0) {
465 - for (i = 0 ; i < ctx->blocksize / 4; i++) {
466 - writel_relaxed(ctx->indata,
467 - &device_data->base->din);
468 - ctx->indata += 4;
469 - ctx->datalen -= 4;
470 - }
471 + count = ctx->blocksize / 4;
472 +
473 + writesl(&device_data->base->din, ctx->indata, count);
474 +
475 + ctx->indata += count;
476 + ctx->datalen -= count;
477
478 if (ctx->datalen == 0)
479 cryp_disable_irq_src(device_data,
480 diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
481 index f926b4caf449..56c60552abba 100644
482 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
483 +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
484 @@ -199,7 +199,7 @@ static struct dmm_txn *dmm_txn_init(struct dmm *dmm, struct tcm *tcm)
485 static void dmm_txn_append(struct dmm_txn *txn, struct pat_area *area,
486 struct page **pages, uint32_t npages, uint32_t roll)
487 {
488 - dma_addr_t pat_pa = 0;
489 + dma_addr_t pat_pa = 0, data_pa = 0;
490 uint32_t *data;
491 struct pat *pat;
492 struct refill_engine *engine = txn->engine_handle;
493 @@ -223,7 +223,9 @@ static void dmm_txn_append(struct dmm_txn *txn, struct pat_area *area,
494 .lut_id = engine->tcm->lut_id,
495 };
496
497 - data = alloc_dma(txn, 4*i, &pat->data_pa);
498 + data = alloc_dma(txn, 4*i, &data_pa);
499 + /* FIXME: what if data_pa is more than 32-bit ? */
500 + pat->data_pa = data_pa;
501
502 while (i--) {
503 int n = i + roll;
504 diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
505 index 5aec3e81fe24..5fd3bab8b803 100644
506 --- a/drivers/gpu/drm/omapdrm/omap_gem.c
507 +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
508 @@ -791,7 +791,7 @@ int omap_gem_get_paddr(struct drm_gem_object *obj,
509 omap_obj->paddr = tiler_ssptr(block);
510 omap_obj->block = block;
511
512 - DBG("got paddr: %08x", omap_obj->paddr);
513 + DBG("got paddr: %pad", &omap_obj->paddr);
514 }
515
516 omap_obj->paddr_cnt++;
517 @@ -988,9 +988,9 @@ void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
518
519 off = drm_vma_node_start(&obj->vma_node);
520
521 - seq_printf(m, "%08x: %2d (%2d) %08llx %08Zx (%2d) %p %4d",
522 + seq_printf(m, "%08x: %2d (%2d) %08llx %pad (%2d) %p %4d",
523 omap_obj->flags, obj->name, obj->refcount.refcount.counter,
524 - off, omap_obj->paddr, omap_obj->paddr_cnt,
525 + off, &omap_obj->paddr, omap_obj->paddr_cnt,
526 omap_obj->vaddr, omap_obj->roll);
527
528 if (omap_obj->flags & OMAP_BO_TILED) {
529 @@ -1468,8 +1468,8 @@ void omap_gem_init(struct drm_device *dev)
530 entry->paddr = tiler_ssptr(block);
531 entry->block = block;
532
533 - DBG("%d:%d: %dx%d: paddr=%08x stride=%d", i, j, w, h,
534 - entry->paddr,
535 + DBG("%d:%d: %dx%d: paddr=%pad stride=%d", i, j, w, h,
536 + &entry->paddr,
537 usergart[i].stride_pfn << PAGE_SHIFT);
538 }
539 }
540 diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
541 index 046d5e660c04..5b62e212cbe5 100644
542 --- a/drivers/gpu/drm/omapdrm/omap_plane.c
543 +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
544 @@ -142,8 +142,8 @@ static void omap_plane_pre_apply(struct omap_drm_apply *apply)
545 DBG("%dx%d -> %dx%d (%d)", info->width, info->height,
546 info->out_width, info->out_height,
547 info->screen_width);
548 - DBG("%d,%d %08x %08x", info->pos_x, info->pos_y,
549 - info->paddr, info->p_uv_addr);
550 + DBG("%d,%d %pad %pad", info->pos_x, info->pos_y,
551 + &info->paddr, &info->p_uv_addr);
552
553 /* TODO: */
554 ilace = false;
555 diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
556 index 7164045c06e4..bc9e56eb4e9c 100644
557 --- a/drivers/gpu/drm/radeon/cik.c
558 +++ b/drivers/gpu/drm/radeon/cik.c
559 @@ -3231,6 +3231,7 @@ static void cik_gpu_init(struct radeon_device *rdev)
560 (rdev->pdev->device == 0x130B) ||
561 (rdev->pdev->device == 0x130E) ||
562 (rdev->pdev->device == 0x1315) ||
563 + (rdev->pdev->device == 0x1318) ||
564 (rdev->pdev->device == 0x131B)) {
565 rdev->config.cik.max_cu_per_sh = 4;
566 rdev->config.cik.max_backends_per_se = 1;
567 diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c
568 index 1bdcccc54a1d..f745d2c1325e 100644
569 --- a/drivers/hid/hid-cherry.c
570 +++ b/drivers/hid/hid-cherry.c
571 @@ -28,7 +28,7 @@
572 static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
573 unsigned int *rsize)
574 {
575 - if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
576 + if (*rsize >= 18 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
577 hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n");
578 rdesc[11] = rdesc[16] = 0xff;
579 rdesc[12] = rdesc[17] = 0x03;
580 diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
581 index e77696367591..b92bf01a1ae8 100644
582 --- a/drivers/hid/hid-kye.c
583 +++ b/drivers/hid/hid-kye.c
584 @@ -300,7 +300,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
585 * - change the button usage range to 4-7 for the extra
586 * buttons
587 */
588 - if (*rsize >= 74 &&
589 + if (*rsize >= 75 &&
590 rdesc[61] == 0x05 && rdesc[62] == 0x08 &&
591 rdesc[63] == 0x19 && rdesc[64] == 0x08 &&
592 rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
593 diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
594 index 9fe9d4ac3114..b8207e0bfdc0 100644
595 --- a/drivers/hid/hid-lg.c
596 +++ b/drivers/hid/hid-lg.c
597 @@ -345,14 +345,14 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
598 struct usb_device_descriptor *udesc;
599 __u16 bcdDevice, rev_maj, rev_min;
600
601 - if ((drv_data->quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 &&
602 + if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 &&
603 rdesc[84] == 0x8c && rdesc[85] == 0x02) {
604 hid_info(hdev,
605 "fixing up Logitech keyboard report descriptor\n");
606 rdesc[84] = rdesc[89] = 0x4d;
607 rdesc[85] = rdesc[90] = 0x10;
608 }
609 - if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 50 &&
610 + if ((drv_data->quirks & LG_RDESC_REL_ABS) && *rsize >= 51 &&
611 rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
612 rdesc[49] == 0x81 && rdesc[50] == 0x06) {
613 hid_info(hdev,
614 diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
615 index f45279c3b11a..0b14d3261531 100644
616 --- a/drivers/hid/hid-logitech-dj.c
617 +++ b/drivers/hid/hid-logitech-dj.c
618 @@ -237,13 +237,6 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
619 return;
620 }
621
622 - if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
623 - (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
624 - dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n",
625 - __func__, dj_report->device_index);
626 - return;
627 - }
628 -
629 if (djrcv_dev->paired_dj_devices[dj_report->device_index]) {
630 /* The device is already known. No need to reallocate it. */
631 dbg_hid("%s: device is already known\n", __func__);
632 @@ -721,6 +714,12 @@ static int logi_dj_raw_event(struct hid_device *hdev,
633 * device (via hid_input_report() ) and return 1 so hid-core does not do
634 * anything else with it.
635 */
636 + if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
637 + (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
638 + dev_err(&hdev->dev, "%s: invalid device index:%d\n",
639 + __func__, dj_report->device_index);
640 + return false;
641 + }
642
643 spin_lock_irqsave(&djrcv_dev->lock, flags);
644 if (dj_report->report_id == REPORT_ID_DJ_SHORT) {
645 diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c
646 index 9e14c00eb1b6..25daf28b26bd 100644
647 --- a/drivers/hid/hid-monterey.c
648 +++ b/drivers/hid/hid-monterey.c
649 @@ -24,7 +24,7 @@
650 static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
651 unsigned int *rsize)
652 {
653 - if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
654 + if (*rsize >= 31 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
655 hid_info(hdev, "fixing up button/consumer in HID report descriptor\n");
656 rdesc[30] = 0x0c;
657 }
658 diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c
659 index 736b2502df4f..6aca4f2554bf 100644
660 --- a/drivers/hid/hid-petalynx.c
661 +++ b/drivers/hid/hid-petalynx.c
662 @@ -25,7 +25,7 @@
663 static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
664 unsigned int *rsize)
665 {
666 - if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&
667 + if (*rsize >= 62 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&
668 rdesc[41] == 0x00 && rdesc[59] == 0x26 &&
669 rdesc[60] == 0xf9 && rdesc[61] == 0x00) {
670 hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n");
671 diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c
672 index 87fc91e1c8de..91072fa54663 100644
673 --- a/drivers/hid/hid-sunplus.c
674 +++ b/drivers/hid/hid-sunplus.c
675 @@ -24,7 +24,7 @@
676 static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
677 unsigned int *rsize)
678 {
679 - if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
680 + if (*rsize >= 112 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
681 rdesc[106] == 0x03) {
682 hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n");
683 rdesc[105] = rdesc[110] = 0x03;
684 diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c
685 index 7f9dc2f86b63..126516414c11 100644
686 --- a/drivers/hwmon/ads1015.c
687 +++ b/drivers/hwmon/ads1015.c
688 @@ -198,7 +198,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
689 }
690
691 channel = be32_to_cpup(property);
692 - if (channel > ADS1015_CHANNELS) {
693 + if (channel >= ADS1015_CHANNELS) {
694 dev_err(&client->dev,
695 "invalid channel index %d on %s\n",
696 channel, node->full_name);
697 @@ -212,6 +212,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
698 dev_err(&client->dev,
699 "invalid gain on %s\n",
700 node->full_name);
701 + return -EINVAL;
702 }
703 }
704
705 @@ -222,6 +223,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
706 dev_err(&client->dev,
707 "invalid data_rate on %s\n",
708 node->full_name);
709 + return -EINVAL;
710 }
711 }
712
713 diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
714 index 9f2be3dd28f3..8a67ec6279a4 100644
715 --- a/drivers/hwmon/amc6821.c
716 +++ b/drivers/hwmon/amc6821.c
717 @@ -360,11 +360,13 @@ static ssize_t set_pwm1_enable(
718 if (config)
719 return config;
720
721 + mutex_lock(&data->update_lock);
722 config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF1);
723 if (config < 0) {
724 dev_err(&client->dev,
725 "Error reading configuration register, aborting.\n");
726 - return config;
727 + count = config;
728 + goto unlock;
729 }
730
731 switch (val) {
732 @@ -381,14 +383,15 @@ static ssize_t set_pwm1_enable(
733 config |= AMC6821_CONF1_FDRC1;
734 break;
735 default:
736 - return -EINVAL;
737 + count = -EINVAL;
738 + goto unlock;
739 }
740 - mutex_lock(&data->update_lock);
741 if (i2c_smbus_write_byte_data(client, AMC6821_REG_CONF1, config)) {
742 dev_err(&client->dev,
743 "Configuration register write error, aborting.\n");
744 count = -EIO;
745 }
746 +unlock:
747 mutex_unlock(&data->update_lock);
748 return count;
749 }
750 @@ -493,8 +496,9 @@ static ssize_t set_temp_auto_point_temp(
751 return -EINVAL;
752 }
753
754 - data->valid = 0;
755 mutex_lock(&data->update_lock);
756 + data->valid = 0;
757 +
758 switch (ix) {
759 case 0:
760 ptemp[0] = clamp_val(val / 1000, 0,
761 @@ -658,13 +662,14 @@ static ssize_t set_fan1_div(
762 if (config)
763 return config;
764
765 + mutex_lock(&data->update_lock);
766 config = i2c_smbus_read_byte_data(client, AMC6821_REG_CONF4);
767 if (config < 0) {
768 dev_err(&client->dev,
769 "Error reading configuration register, aborting.\n");
770 - return config;
771 + count = config;
772 + goto EXIT;
773 }
774 - mutex_lock(&data->update_lock);
775 switch (val) {
776 case 2:
777 config &= ~AMC6821_CONF4_PSPR;
778 diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
779 index 4ae3fff13f44..bea0a344fab5 100644
780 --- a/drivers/hwmon/dme1737.c
781 +++ b/drivers/hwmon/dme1737.c
782 @@ -247,8 +247,8 @@ struct dme1737_data {
783 u8 pwm_acz[3];
784 u8 pwm_freq[6];
785 u8 pwm_rr[2];
786 - u8 zone_low[3];
787 - u8 zone_abs[3];
788 + s8 zone_low[3];
789 + s8 zone_abs[3];
790 u8 zone_hyst[2];
791 u32 alarms;
792 };
793 @@ -277,7 +277,7 @@ static inline int IN_FROM_REG(int reg, int nominal, int res)
794 return (reg * nominal + (3 << (res - 3))) / (3 << (res - 2));
795 }
796
797 -static inline int IN_TO_REG(int val, int nominal)
798 +static inline int IN_TO_REG(long val, int nominal)
799 {
800 return clamp_val((val * 192 + nominal / 2) / nominal, 0, 255);
801 }
802 @@ -293,7 +293,7 @@ static inline int TEMP_FROM_REG(int reg, int res)
803 return (reg * 1000) >> (res - 8);
804 }
805
806 -static inline int TEMP_TO_REG(int val)
807 +static inline int TEMP_TO_REG(long val)
808 {
809 return clamp_val((val < 0 ? val - 500 : val + 500) / 1000, -128, 127);
810 }
811 @@ -308,7 +308,7 @@ static inline int TEMP_RANGE_FROM_REG(int reg)
812 return TEMP_RANGE[(reg >> 4) & 0x0f];
813 }
814
815 -static int TEMP_RANGE_TO_REG(int val, int reg)
816 +static int TEMP_RANGE_TO_REG(long val, int reg)
817 {
818 int i;
819
820 @@ -331,7 +331,7 @@ static inline int TEMP_HYST_FROM_REG(int reg, int ix)
821 return (((ix == 1) ? reg : reg >> 4) & 0x0f) * 1000;
822 }
823
824 -static inline int TEMP_HYST_TO_REG(int val, int ix, int reg)
825 +static inline int TEMP_HYST_TO_REG(long val, int ix, int reg)
826 {
827 int hyst = clamp_val((val + 500) / 1000, 0, 15);
828
829 @@ -347,7 +347,7 @@ static inline int FAN_FROM_REG(int reg, int tpc)
830 return (reg == 0 || reg == 0xffff) ? 0 : 90000 * 60 / reg;
831 }
832
833 -static inline int FAN_TO_REG(int val, int tpc)
834 +static inline int FAN_TO_REG(long val, int tpc)
835 {
836 if (tpc) {
837 return clamp_val(val / tpc, 0, 0xffff);
838 @@ -379,7 +379,7 @@ static inline int FAN_TYPE_FROM_REG(int reg)
839 return (edge > 0) ? 1 << (edge - 1) : 0;
840 }
841
842 -static inline int FAN_TYPE_TO_REG(int val, int reg)
843 +static inline int FAN_TYPE_TO_REG(long val, int reg)
844 {
845 int edge = (val == 4) ? 3 : val;
846
847 @@ -402,7 +402,7 @@ static int FAN_MAX_FROM_REG(int reg)
848 return 1000 + i * 500;
849 }
850
851 -static int FAN_MAX_TO_REG(int val)
852 +static int FAN_MAX_TO_REG(long val)
853 {
854 int i;
855
856 @@ -460,7 +460,7 @@ static inline int PWM_ACZ_FROM_REG(int reg)
857 return acz[(reg >> 5) & 0x07];
858 }
859
860 -static inline int PWM_ACZ_TO_REG(int val, int reg)
861 +static inline int PWM_ACZ_TO_REG(long val, int reg)
862 {
863 int acz = (val == 4) ? 2 : val - 1;
864
865 @@ -476,7 +476,7 @@ static inline int PWM_FREQ_FROM_REG(int reg)
866 return PWM_FREQ[reg & 0x0f];
867 }
868
869 -static int PWM_FREQ_TO_REG(int val, int reg)
870 +static int PWM_FREQ_TO_REG(long val, int reg)
871 {
872 int i;
873
874 @@ -510,7 +510,7 @@ static inline int PWM_RR_FROM_REG(int reg, int ix)
875 return (rr & 0x08) ? PWM_RR[rr & 0x07] : 0;
876 }
877
878 -static int PWM_RR_TO_REG(int val, int ix, int reg)
879 +static int PWM_RR_TO_REG(long val, int ix, int reg)
880 {
881 int i;
882
883 @@ -528,7 +528,7 @@ static inline int PWM_RR_EN_FROM_REG(int reg, int ix)
884 return PWM_RR_FROM_REG(reg, ix) ? 1 : 0;
885 }
886
887 -static inline int PWM_RR_EN_TO_REG(int val, int ix, int reg)
888 +static inline int PWM_RR_EN_TO_REG(long val, int ix, int reg)
889 {
890 int en = (ix == 1) ? 0x80 : 0x08;
891
892 @@ -1481,13 +1481,16 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
893 const char *buf, size_t count)
894 {
895 struct dme1737_data *data = dev_get_drvdata(dev);
896 - long val;
897 + unsigned long val;
898 int err;
899
900 - err = kstrtol(buf, 10, &val);
901 + err = kstrtoul(buf, 10, &val);
902 if (err)
903 return err;
904
905 + if (val > 255)
906 + return -EINVAL;
907 +
908 data->vrm = val;
909 return count;
910 }
911 diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
912 index 73181be5b30b..814f7ee9026b 100644
913 --- a/drivers/hwmon/gpio-fan.c
914 +++ b/drivers/hwmon/gpio-fan.c
915 @@ -173,7 +173,7 @@ static int get_fan_speed_index(struct gpio_fan_data *fan_data)
916 return -ENODEV;
917 }
918
919 -static int rpm_to_speed_index(struct gpio_fan_data *fan_data, int rpm)
920 +static int rpm_to_speed_index(struct gpio_fan_data *fan_data, unsigned long rpm)
921 {
922 struct gpio_fan_speed *speed = fan_data->speed;
923 int i;
924 diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
925 index 9efadfc851bc..c1eb464f0fd0 100644
926 --- a/drivers/hwmon/lm78.c
927 +++ b/drivers/hwmon/lm78.c
928 @@ -108,7 +108,7 @@ static inline int FAN_FROM_REG(u8 val, int div)
929 * TEMP: mC (-128C to +127C)
930 * REG: 1C/bit, two's complement
931 */
932 -static inline s8 TEMP_TO_REG(int val)
933 +static inline s8 TEMP_TO_REG(long val)
934 {
935 int nval = clamp_val(val, -128000, 127000) ;
936 return nval < 0 ? (nval - 500) / 1000 : (nval + 500) / 1000;
937 diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
938 index bed4af358308..21d6cc813a6d 100644
939 --- a/drivers/hwmon/lm85.c
940 +++ b/drivers/hwmon/lm85.c
941 @@ -158,7 +158,7 @@ static inline u16 FAN_TO_REG(unsigned long val)
942
943 /* Temperature is reported in .001 degC increments */
944 #define TEMP_TO_REG(val) \
945 - clamp_val(SCALE(val, 1000, 1), -127, 127)
946 + DIV_ROUND_CLOSEST(clamp_val((val), -127000, 127000), 1000)
947 #define TEMPEXT_FROM_REG(val, ext) \
948 SCALE(((val) << 4) + (ext), 16, 1000)
949 #define TEMP_FROM_REG(val) ((val) * 1000)
950 @@ -192,7 +192,7 @@ static const int lm85_range_map[] = {
951 13300, 16000, 20000, 26600, 32000, 40000, 53300, 80000
952 };
953
954 -static int RANGE_TO_REG(int range)
955 +static int RANGE_TO_REG(long range)
956 {
957 int i;
958
959 @@ -214,7 +214,7 @@ static const int adm1027_freq_map[8] = { /* 1 Hz */
960 11, 15, 22, 29, 35, 44, 59, 88
961 };
962
963 -static int FREQ_TO_REG(const int *map, int freq)
964 +static int FREQ_TO_REG(const int *map, unsigned long freq)
965 {
966 int i;
967
968 @@ -463,6 +463,9 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
969 if (err)
970 return err;
971
972 + if (val > 255)
973 + return -EINVAL;
974 +
975 data->vrm = val;
976 return count;
977 }
978 diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
979 index 3532026e25da..bf1d7893d51c 100644
980 --- a/drivers/hwmon/sis5595.c
981 +++ b/drivers/hwmon/sis5595.c
982 @@ -159,7 +159,7 @@ static inline int TEMP_FROM_REG(s8 val)
983 {
984 return val * 830 + 52120;
985 }
986 -static inline s8 TEMP_TO_REG(int val)
987 +static inline s8 TEMP_TO_REG(long val)
988 {
989 int nval = clamp_val(val, -54120, 157530) ;
990 return nval < 0 ? (nval - 5212 - 415) / 830 : (nval - 5212 + 415) / 830;
991 diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
992 index 843d01268ae9..c56be739006b 100644
993 --- a/drivers/i2c/busses/i2c-at91.c
994 +++ b/drivers/i2c/busses/i2c-at91.c
995 @@ -210,7 +210,7 @@ static void at91_twi_write_data_dma_callback(void *data)
996 struct at91_twi_dev *dev = (struct at91_twi_dev *)data;
997
998 dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg),
999 - dev->buf_len, DMA_MEM_TO_DEV);
1000 + dev->buf_len, DMA_TO_DEVICE);
1001
1002 at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP);
1003 }
1004 @@ -289,7 +289,7 @@ static void at91_twi_read_data_dma_callback(void *data)
1005 struct at91_twi_dev *dev = (struct at91_twi_dev *)data;
1006
1007 dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg),
1008 - dev->buf_len, DMA_DEV_TO_MEM);
1009 + dev->buf_len, DMA_FROM_DEVICE);
1010
1011 /* The last two bytes have to be read without using dma */
1012 dev->buf += dev->buf_len - 2;
1013 diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
1014 index 5a9bfa71df86..540fe114ec60 100644
1015 --- a/drivers/misc/mei/client.c
1016 +++ b/drivers/misc/mei/client.c
1017 @@ -459,6 +459,7 @@ int mei_cl_disconnect(struct mei_cl *cl)
1018 cl_err(dev, cl, "failed to disconnect.\n");
1019 goto free;
1020 }
1021 + cl->timer_count = MEI_CONNECT_TIMEOUT;
1022 mdelay(10); /* Wait for hardware disconnection ready */
1023 list_add_tail(&cb->list, &dev->ctrl_rd_list.list);
1024 } else {
1025 @@ -563,6 +564,7 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file)
1026 cl->timer_count = MEI_CONNECT_TIMEOUT;
1027 list_add_tail(&cb->list, &dev->ctrl_rd_list.list);
1028 } else {
1029 + cl->state = MEI_FILE_INITIALIZING;
1030 list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
1031 }
1032
1033 diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c
1034 index a58320c0c049..31149010224b 100644
1035 --- a/drivers/misc/mei/nfc.c
1036 +++ b/drivers/misc/mei/nfc.c
1037 @@ -342,9 +342,10 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
1038 ndev = (struct mei_nfc_dev *) cldev->priv_data;
1039 dev = ndev->cl->dev;
1040
1041 + err = -ENOMEM;
1042 mei_buf = kzalloc(length + MEI_NFC_HEADER_SIZE, GFP_KERNEL);
1043 if (!mei_buf)
1044 - return -ENOMEM;
1045 + goto out;
1046
1047 hdr = (struct mei_nfc_hci_hdr *) mei_buf;
1048 hdr->cmd = MEI_NFC_CMD_HCI_SEND;
1049 @@ -354,12 +355,9 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
1050 hdr->data_size = length;
1051
1052 memcpy(mei_buf + MEI_NFC_HEADER_SIZE, buf, length);
1053 -
1054 err = __mei_cl_send(ndev->cl, mei_buf, length + MEI_NFC_HEADER_SIZE);
1055 if (err < 0)
1056 - return err;
1057 -
1058 - kfree(mei_buf);
1059 + goto out;
1060
1061 if (!wait_event_interruptible_timeout(ndev->send_wq,
1062 ndev->recv_req_id == ndev->req_id, HZ)) {
1063 @@ -368,7 +366,8 @@ static int mei_nfc_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
1064 } else {
1065 ndev->req_id++;
1066 }
1067 -
1068 +out:
1069 + kfree(mei_buf);
1070 return err;
1071 }
1072
1073 diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
1074 index 45113daaa778..e27a3dc9f4e8 100644
1075 --- a/drivers/pci/pci-label.c
1076 +++ b/drivers/pci/pci-label.c
1077 @@ -168,8 +168,8 @@ enum acpi_attr_enum {
1078 static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
1079 {
1080 int len;
1081 - len = utf16s_to_utf8s((const wchar_t *)obj->string.pointer,
1082 - obj->string.length,
1083 + len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer,
1084 + obj->buffer.length,
1085 UTF16_LITTLE_ENDIAN,
1086 buf, PAGE_SIZE);
1087 buf[len] = '\n';
1088 @@ -194,16 +194,22 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
1089 tmp = obj->package.elements;
1090 if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 &&
1091 tmp[0].type == ACPI_TYPE_INTEGER &&
1092 - tmp[1].type == ACPI_TYPE_STRING) {
1093 + (tmp[1].type == ACPI_TYPE_STRING ||
1094 + tmp[1].type == ACPI_TYPE_BUFFER)) {
1095 /*
1096 * The second string element is optional even when
1097 * this _DSM is implemented; when not implemented,
1098 * this entry must return a null string.
1099 */
1100 - if (attr == ACPI_ATTR_INDEX_SHOW)
1101 + if (attr == ACPI_ATTR_INDEX_SHOW) {
1102 scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value);
1103 - else if (attr == ACPI_ATTR_LABEL_SHOW)
1104 - dsm_label_utf16s_to_utf8s(tmp + 1, buf);
1105 + } else if (attr == ACPI_ATTR_LABEL_SHOW) {
1106 + if (tmp[1].type == ACPI_TYPE_STRING)
1107 + scnprintf(buf, PAGE_SIZE, "%s\n",
1108 + tmp[1].string.pointer);
1109 + else if (tmp[1].type == ACPI_TYPE_BUFFER)
1110 + dsm_label_utf16s_to_utf8s(tmp + 1, buf);
1111 + }
1112 len = strlen(buf) > 0 ? strlen(buf) : -1;
1113 }
1114
1115 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1116 index be36adf33ab0..dae70d216762 100644
1117 --- a/drivers/pci/pci.c
1118 +++ b/drivers/pci/pci.c
1119 @@ -830,12 +830,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
1120
1121 if (!__pci_complete_power_transition(dev, state))
1122 error = 0;
1123 - /*
1124 - * When aspm_policy is "powersave" this call ensures
1125 - * that ASPM is configured.
1126 - */
1127 - if (!error && dev->bus->self)
1128 - pcie_aspm_powersave_config_link(dev->bus->self);
1129
1130 return error;
1131 }
1132 @@ -1181,12 +1175,18 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_saved_state);
1133 static int do_pci_enable_device(struct pci_dev *dev, int bars)
1134 {
1135 int err;
1136 + struct pci_dev *bridge;
1137 u16 cmd;
1138 u8 pin;
1139
1140 err = pci_set_power_state(dev, PCI_D0);
1141 if (err < 0 && err != -EIO)
1142 return err;
1143 +
1144 + bridge = pci_upstream_bridge(dev);
1145 + if (bridge)
1146 + pcie_aspm_powersave_config_link(bridge);
1147 +
1148 err = pcibios_enable_device(dev, bars);
1149 if (err < 0)
1150 return err;
1151 diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
1152 index 868318a7067c..528bff5ec91f 100644
1153 --- a/drivers/scsi/hpsa.c
1154 +++ b/drivers/scsi/hpsa.c
1155 @@ -3131,7 +3131,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
1156 }
1157 if (ioc->Request.Type.Direction == XFER_WRITE) {
1158 if (copy_from_user(buff[sg_used], data_ptr, sz)) {
1159 - status = -ENOMEM;
1160 + status = -EFAULT;
1161 goto cleanup1;
1162 }
1163 } else
1164 @@ -4367,9 +4367,9 @@ static inline void hpsa_set_driver_support_bits(struct ctlr_info *h)
1165 {
1166 u32 driver_support;
1167
1168 -#ifdef CONFIG_X86
1169 - /* Need to enable prefetch in the SCSI core for 6400 in x86 */
1170 driver_support = readl(&(h->cfgtable->driver_support));
1171 + /* Need to enable prefetch in the SCSI core for 6400 in x86 */
1172 +#ifdef CONFIG_X86
1173 driver_support |= ENABLE_SCSI_PREFETCH;
1174 #endif
1175 driver_support |= ENABLE_UNIT_ATTN;
1176 diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
1177 index e516bb69f3b4..907aa3078946 100644
1178 --- a/drivers/staging/et131x/et131x.c
1179 +++ b/drivers/staging/et131x/et131x.c
1180 @@ -1422,22 +1422,16 @@ static int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value)
1181 * @reg: the register to read
1182 * @value: 16-bit value to write
1183 */
1184 -static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value)
1185 +static int et131x_mii_write(struct et131x_adapter *adapter, u8 addr, u8 reg,
1186 + u16 value)
1187 {
1188 struct mac_regs __iomem *mac = &adapter->regs->mac;
1189 - struct phy_device *phydev = adapter->phydev;
1190 int status = 0;
1191 - u8 addr;
1192 u32 delay = 0;
1193 u32 mii_addr;
1194 u32 mii_cmd;
1195 u32 mii_indicator;
1196
1197 - if (!phydev)
1198 - return -EIO;
1199 -
1200 - addr = phydev->addr;
1201 -
1202 /* Save a local copy of the registers we are dealing with so we can
1203 * set them back
1204 */
1205 @@ -1632,17 +1626,7 @@ static int et131x_mdio_write(struct mii_bus *bus, int phy_addr,
1206 struct net_device *netdev = bus->priv;
1207 struct et131x_adapter *adapter = netdev_priv(netdev);
1208
1209 - return et131x_mii_write(adapter, reg, value);
1210 -}
1211 -
1212 -static int et131x_mdio_reset(struct mii_bus *bus)
1213 -{
1214 - struct net_device *netdev = bus->priv;
1215 - struct et131x_adapter *adapter = netdev_priv(netdev);
1216 -
1217 - et131x_mii_write(adapter, MII_BMCR, BMCR_RESET);
1218 -
1219 - return 0;
1220 + return et131x_mii_write(adapter, phy_addr, reg, value);
1221 }
1222
1223 /* et1310_phy_power_switch - PHY power control
1224 @@ -1657,18 +1641,20 @@ static int et131x_mdio_reset(struct mii_bus *bus)
1225 static void et1310_phy_power_switch(struct et131x_adapter *adapter, bool down)
1226 {
1227 u16 data;
1228 + struct phy_device *phydev = adapter->phydev;
1229
1230 et131x_mii_read(adapter, MII_BMCR, &data);
1231 data &= ~BMCR_PDOWN;
1232 if (down)
1233 data |= BMCR_PDOWN;
1234 - et131x_mii_write(adapter, MII_BMCR, data);
1235 + et131x_mii_write(adapter, phydev->addr, MII_BMCR, data);
1236 }
1237
1238 /* et131x_xcvr_init - Init the phy if we are setting it into force mode */
1239 static void et131x_xcvr_init(struct et131x_adapter *adapter)
1240 {
1241 u16 lcr2;
1242 + struct phy_device *phydev = adapter->phydev;
1243
1244 /* Set the LED behavior such that LED 1 indicates speed (off =
1245 * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates
1246 @@ -1689,7 +1675,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter)
1247 else
1248 lcr2 |= (LED_VAL_LINKON << LED_TXRX_SHIFT);
1249
1250 - et131x_mii_write(adapter, PHY_LED_2, lcr2);
1251 + et131x_mii_write(adapter, phydev->addr, PHY_LED_2, lcr2);
1252 }
1253 }
1254
1255 @@ -3638,14 +3624,14 @@ static void et131x_adjust_link(struct net_device *netdev)
1256
1257 et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG,
1258 &register18);
1259 - et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
1260 - register18 | 0x4);
1261 - et131x_mii_write(adapter, PHY_INDEX_REG,
1262 + et131x_mii_write(adapter, phydev->addr,
1263 + PHY_MPHY_CONTROL_REG, register18 | 0x4);
1264 + et131x_mii_write(adapter, phydev->addr, PHY_INDEX_REG,
1265 register18 | 0x8402);
1266 - et131x_mii_write(adapter, PHY_DATA_REG,
1267 + et131x_mii_write(adapter, phydev->addr, PHY_DATA_REG,
1268 register18 | 511);
1269 - et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
1270 - register18);
1271 + et131x_mii_write(adapter, phydev->addr,
1272 + PHY_MPHY_CONTROL_REG, register18);
1273 }
1274
1275 et1310_config_flow_control(adapter);
1276 @@ -3657,7 +3643,8 @@ static void et131x_adjust_link(struct net_device *netdev)
1277 et131x_mii_read(adapter, PHY_CONFIG, &reg);
1278 reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH;
1279 reg |= ET_PHY_CONFIG_FIFO_DEPTH_32;
1280 - et131x_mii_write(adapter, PHY_CONFIG, reg);
1281 + et131x_mii_write(adapter, phydev->addr, PHY_CONFIG,
1282 + reg);
1283 }
1284
1285 et131x_set_rx_dma_timer(adapter);
1286 @@ -3670,14 +3657,14 @@ static void et131x_adjust_link(struct net_device *netdev)
1287
1288 et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG,
1289 &register18);
1290 - et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
1291 - register18 | 0x4);
1292 - et131x_mii_write(adapter, PHY_INDEX_REG,
1293 - register18 | 0x8402);
1294 - et131x_mii_write(adapter, PHY_DATA_REG,
1295 - register18 | 511);
1296 - et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
1297 - register18);
1298 + et131x_mii_write(adapter, phydev->addr,
1299 + PHY_MPHY_CONTROL_REG, register18 | 0x4);
1300 + et131x_mii_write(adapter, phydev->addr,
1301 + PHY_INDEX_REG, register18 | 0x8402);
1302 + et131x_mii_write(adapter, phydev->addr,
1303 + PHY_DATA_REG, register18 | 511);
1304 + et131x_mii_write(adapter, phydev->addr,
1305 + PHY_MPHY_CONTROL_REG, register18);
1306 }
1307
1308 /* Free the packets being actively sent & stopped */
1309 @@ -4646,10 +4633,6 @@ static int et131x_pci_setup(struct pci_dev *pdev,
1310 /* Copy address into the net_device struct */
1311 memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN);
1312
1313 - /* Init variable for counting how long we do not have link status */
1314 - adapter->boot_coma = 0;
1315 - et1310_disable_phy_coma(adapter);
1316 -
1317 rc = -ENOMEM;
1318
1319 /* Setup the mii_bus struct */
1320 @@ -4665,7 +4648,6 @@ static int et131x_pci_setup(struct pci_dev *pdev,
1321 adapter->mii_bus->priv = netdev;
1322 adapter->mii_bus->read = et131x_mdio_read;
1323 adapter->mii_bus->write = et131x_mdio_write;
1324 - adapter->mii_bus->reset = et131x_mdio_reset;
1325 adapter->mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int),
1326 GFP_KERNEL);
1327 if (!adapter->mii_bus->irq)
1328 @@ -4689,6 +4671,10 @@ static int et131x_pci_setup(struct pci_dev *pdev,
1329 /* Setup et1310 as per the documentation */
1330 et131x_adapter_setup(adapter);
1331
1332 + /* Init variable for counting how long we do not have link status */
1333 + adapter->boot_coma = 0;
1334 + et1310_disable_phy_coma(adapter);
1335 +
1336 /* We can enable interrupts now
1337 *
1338 * NOTE - Because registration of interrupt handler is done in the
1339 diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1340 index 2f40ff5901d6..fed699fc5918 100644
1341 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1342 +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1343 @@ -53,9 +53,11 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
1344 {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */
1345 /*=== Customer ID ===*/
1346 /****** 8188EUS ********/
1347 + {USB_DEVICE(0x056e, 0x4008)}, /* Elecom WDC-150SU2M */
1348 {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */
1349 {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
1350 {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */
1351 + {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
1352 {} /* Terminating entry */
1353 };
1354
1355 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
1356 index ece2049bd270..25b8f6868788 100644
1357 --- a/drivers/tty/serial/serial_core.c
1358 +++ b/drivers/tty/serial/serial_core.c
1359 @@ -235,6 +235,9 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
1360 /*
1361 * Turn off DTR and RTS early.
1362 */
1363 + if (uart_console(uport) && tty)
1364 + uport->cons->cflag = tty->termios.c_cflag;
1365 +
1366 if (!tty || (tty->termios.c_cflag & HUPCL))
1367 uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS);
1368
1369 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
1370 index 90e18f6fa2bb..9ca77166d37e 100644
1371 --- a/drivers/usb/core/devio.c
1372 +++ b/drivers/usb/core/devio.c
1373 @@ -1411,7 +1411,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
1374 u = (is_in ? URB_DIR_IN : URB_DIR_OUT);
1375 if (uurb->flags & USBDEVFS_URB_ISO_ASAP)
1376 u |= URB_ISO_ASAP;
1377 - if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
1378 + if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK && is_in)
1379 u |= URB_SHORT_NOT_OK;
1380 if (uurb->flags & USBDEVFS_URB_NO_FSBR)
1381 u |= URB_NO_FSBR;
1382 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1383 index 36b1e856bd00..6650df70bb35 100644
1384 --- a/drivers/usb/core/hub.c
1385 +++ b/drivers/usb/core/hub.c
1386 @@ -1695,8 +1695,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
1387 * - Change autosuspend delay of hub can avoid unnecessary auto
1388 * suspend timer for hub, also may decrease power consumption
1389 * of USB bus.
1390 + *
1391 + * - If user has indicated to prevent autosuspend by passing
1392 + * usbcore.autosuspend = -1 then keep autosuspend disabled.
1393 */
1394 - pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
1395 +#ifdef CONFIG_PM_RUNTIME
1396 + if (hdev->dev.power.autosuspend_delay >= 0)
1397 + pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
1398 +#endif
1399
1400 /*
1401 * Hubs have proper suspend/resume support, except for root hubs
1402 @@ -3174,6 +3180,43 @@ static int finish_port_resume(struct usb_device *udev)
1403 }
1404
1405 /*
1406 + * There are some SS USB devices which take longer time for link training.
1407 + * XHCI specs 4.19.4 says that when Link training is successful, port
1408 + * sets CSC bit to 1. So if SW reads port status before successful link
1409 + * training, then it will not find device to be present.
1410 + * USB Analyzer log with such buggy devices show that in some cases
1411 + * device switch on the RX termination after long delay of host enabling
1412 + * the VBUS. In few other cases it has been seen that device fails to
1413 + * negotiate link training in first attempt. It has been
1414 + * reported till now that few devices take as long as 2000 ms to train
1415 + * the link after host enabling its VBUS and termination. Following
1416 + * routine implements a 2000 ms timeout for link training. If in a case
1417 + * link trains before timeout, loop will exit earlier.
1418 + *
1419 + * FIXME: If a device was connected before suspend, but was removed
1420 + * while system was asleep, then the loop in the following routine will
1421 + * only exit at timeout.
1422 + *
1423 + * This routine should only be called when persist is enabled for a SS
1424 + * device.
1425 + */
1426 +static int wait_for_ss_port_enable(struct usb_device *udev,
1427 + struct usb_hub *hub, int *port1,
1428 + u16 *portchange, u16 *portstatus)
1429 +{
1430 + int status = 0, delay_ms = 0;
1431 +
1432 + while (delay_ms < 2000) {
1433 + if (status || *portstatus & USB_PORT_STAT_CONNECTION)
1434 + break;
1435 + msleep(20);
1436 + delay_ms += 20;
1437 + status = hub_port_status(hub, *port1, portstatus, portchange);
1438 + }
1439 + return status;
1440 +}
1441 +
1442 +/*
1443 * usb_port_resume - re-activate a suspended usb device's upstream port
1444 * @udev: device to re-activate, not a root hub
1445 * Context: must be able to sleep; device not locked; pm locks held
1446 @@ -3275,6 +3318,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
1447
1448 clear_bit(port1, hub->busy_bits);
1449
1450 + if (udev->persist_enabled && hub_is_superspeed(hub->hdev))
1451 + status = wait_for_ss_port_enable(udev, hub, &port1, &portchange,
1452 + &portstatus);
1453 +
1454 status = check_port_resume_type(udev,
1455 hub, port1, status, portchange, portstatus);
1456 if (status == 0)
1457 diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
1458 index 7ae0c4d51741..7d6f64c447bf 100644
1459 --- a/drivers/usb/host/ehci-hub.c
1460 +++ b/drivers/usb/host/ehci-hub.c
1461 @@ -1239,7 +1239,7 @@ static int ehci_hub_control (
1462 if (selector == EHSET_TEST_SINGLE_STEP_SET_FEATURE) {
1463 spin_unlock_irqrestore(&ehci->lock, flags);
1464 retval = ehset_single_step_set_feature(hcd,
1465 - wIndex);
1466 + wIndex + 1);
1467 spin_lock_irqsave(&ehci->lock, flags);
1468 break;
1469 }
1470 diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
1471 index 3e86bf4371b3..ca7b964124af 100644
1472 --- a/drivers/usb/host/ehci-pci.c
1473 +++ b/drivers/usb/host/ehci-pci.c
1474 @@ -35,6 +35,21 @@ static const char hcd_name[] = "ehci-pci";
1475 #define PCI_DEVICE_ID_INTEL_CE4100_USB 0x2e70
1476
1477 /*-------------------------------------------------------------------------*/
1478 +#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939
1479 +static inline bool is_intel_quark_x1000(struct pci_dev *pdev)
1480 +{
1481 + return pdev->vendor == PCI_VENDOR_ID_INTEL &&
1482 + pdev->device == PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC;
1483 +}
1484 +
1485 +/*
1486 + * 0x84 is the offset of in/out threshold register,
1487 + * and it is the same offset as the register of 'hostpc'.
1488 + */
1489 +#define intel_quark_x1000_insnreg01 hostpc
1490 +
1491 +/* Maximum usable threshold value is 0x7f dwords for both IN and OUT */
1492 +#define INTEL_QUARK_X1000_EHCI_MAX_THRESHOLD 0x007f007f
1493
1494 /* called after powerup, by probe or system-pm "wakeup" */
1495 static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)
1496 @@ -50,6 +65,16 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)
1497 if (!retval)
1498 ehci_dbg(ehci, "MWI active\n");
1499
1500 + /* Reset the threshold limit */
1501 + if (is_intel_quark_x1000(pdev)) {
1502 + /*
1503 + * For the Intel QUARK X1000, raise the I/O threshold to the
1504 + * maximum usable value in order to improve performance.
1505 + */
1506 + ehci_writel(ehci, INTEL_QUARK_X1000_EHCI_MAX_THRESHOLD,
1507 + ehci->regs->intel_quark_x1000_insnreg01);
1508 + }
1509 +
1510 return 0;
1511 }
1512
1513 diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
1514 index 45032e933e18..04f2186939d2 100644
1515 --- a/drivers/usb/host/ohci-dbg.c
1516 +++ b/drivers/usb/host/ohci-dbg.c
1517 @@ -236,7 +236,7 @@ ohci_dump_roothub (
1518 }
1519 }
1520
1521 -static void ohci_dump (struct ohci_hcd *controller, int verbose)
1522 +static void ohci_dump(struct ohci_hcd *controller)
1523 {
1524 ohci_dbg (controller, "OHCI controller state\n");
1525
1526 @@ -464,15 +464,16 @@ show_list (struct ohci_hcd *ohci, char *buf, size_t count, struct ed *ed)
1527 static ssize_t fill_async_buffer(struct debug_buffer *buf)
1528 {
1529 struct ohci_hcd *ohci;
1530 - size_t temp;
1531 + size_t temp, size;
1532 unsigned long flags;
1533
1534 ohci = buf->ohci;
1535 + size = PAGE_SIZE;
1536
1537 /* display control and bulk lists together, for simplicity */
1538 spin_lock_irqsave (&ohci->lock, flags);
1539 - temp = show_list(ohci, buf->page, buf->count, ohci->ed_controltail);
1540 - temp += show_list(ohci, buf->page + temp, buf->count - temp,
1541 + temp = show_list(ohci, buf->page, size, ohci->ed_controltail);
1542 + temp += show_list(ohci, buf->page + temp, size - temp,
1543 ohci->ed_bulktail);
1544 spin_unlock_irqrestore (&ohci->lock, flags);
1545
1546 diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
1547 index 3586460fb2a1..34fc86ccb591 100644
1548 --- a/drivers/usb/host/ohci-hcd.c
1549 +++ b/drivers/usb/host/ohci-hcd.c
1550 @@ -76,8 +76,8 @@ static const char hcd_name [] = "ohci_hcd";
1551 #include "ohci.h"
1552 #include "pci-quirks.h"
1553
1554 -static void ohci_dump (struct ohci_hcd *ohci, int verbose);
1555 -static void ohci_stop (struct usb_hcd *hcd);
1556 +static void ohci_dump(struct ohci_hcd *ohci);
1557 +static void ohci_stop(struct usb_hcd *hcd);
1558
1559 #include "ohci-hub.c"
1560 #include "ohci-dbg.c"
1561 @@ -744,7 +744,7 @@ retry:
1562 ohci->ed_to_check = NULL;
1563 }
1564
1565 - ohci_dump (ohci, 1);
1566 + ohci_dump(ohci);
1567
1568 return 0;
1569 }
1570 @@ -825,7 +825,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
1571 usb_hc_died(hcd);
1572 }
1573
1574 - ohci_dump (ohci, 1);
1575 + ohci_dump(ohci);
1576 ohci_usb_reset (ohci);
1577 }
1578
1579 @@ -925,7 +925,7 @@ static void ohci_stop (struct usb_hcd *hcd)
1580 {
1581 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
1582
1583 - ohci_dump (ohci, 1);
1584 + ohci_dump(ohci);
1585
1586 if (quirk_nec(ohci))
1587 flush_work(&ohci->nec_work);
1588 diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
1589 index d4253e319428..a8bde5b8cbdd 100644
1590 --- a/drivers/usb/host/ohci-q.c
1591 +++ b/drivers/usb/host/ohci-q.c
1592 @@ -311,8 +311,7 @@ static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed)
1593 * - ED_OPER: when there's any request queued, the ED gets rescheduled
1594 * immediately. HC should be working on them.
1595 *
1596 - * - ED_IDLE: when there's no TD queue. there's no reason for the HC
1597 - * to care about this ED; safe to disable the endpoint.
1598 + * - ED_IDLE: when there's no TD queue or the HC isn't running.
1599 *
1600 * When finish_unlinks() runs later, after SOF interrupt, it will often
1601 * complete one or more URB unlinks before making that state change.
1602 @@ -926,6 +925,10 @@ rescan_all:
1603 int completed, modified;
1604 __hc32 *prev;
1605
1606 + /* Is this ED already invisible to the hardware? */
1607 + if (ed->state == ED_IDLE)
1608 + goto ed_idle;
1609 +
1610 /* only take off EDs that the HC isn't using, accounting for
1611 * frame counter wraps and EDs with partially retired TDs
1612 */
1613 @@ -955,12 +958,20 @@ skip_ed:
1614 }
1615 }
1616
1617 + /* ED's now officially unlinked, hc doesn't see */
1618 + ed->state = ED_IDLE;
1619 + if (quirk_zfmicro(ohci) && ed->type == PIPE_INTERRUPT)
1620 + ohci->eds_scheduled--;
1621 + ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H);
1622 + ed->hwNextED = 0;
1623 + wmb();
1624 + ed->hwINFO &= ~cpu_to_hc32(ohci, ED_SKIP | ED_DEQUEUE);
1625 +ed_idle:
1626 +
1627 /* reentrancy: if we drop the schedule lock, someone might
1628 * have modified this list. normally it's just prepending
1629 * entries (which we'd ignore), but paranoia won't hurt.
1630 */
1631 - *last = ed->ed_next;
1632 - ed->ed_next = NULL;
1633 modified = 0;
1634
1635 /* unlink urbs as requested, but rescan the list after
1636 @@ -1018,19 +1029,20 @@ rescan_this:
1637 if (completed && !list_empty (&ed->td_list))
1638 goto rescan_this;
1639
1640 - /* ED's now officially unlinked, hc doesn't see */
1641 - ed->state = ED_IDLE;
1642 - if (quirk_zfmicro(ohci) && ed->type == PIPE_INTERRUPT)
1643 - ohci->eds_scheduled--;
1644 - ed->hwHeadP &= ~cpu_to_hc32(ohci, ED_H);
1645 - ed->hwNextED = 0;
1646 - wmb ();
1647 - ed->hwINFO &= ~cpu_to_hc32 (ohci, ED_SKIP | ED_DEQUEUE);
1648 -
1649 - /* but if there's work queued, reschedule */
1650 - if (!list_empty (&ed->td_list)) {
1651 - if (ohci->rh_state == OHCI_RH_RUNNING)
1652 - ed_schedule (ohci, ed);
1653 + /*
1654 + * If no TDs are queued, take ED off the ed_rm_list.
1655 + * Otherwise, if the HC is running, reschedule.
1656 + * If not, leave it on the list for further dequeues.
1657 + */
1658 + if (list_empty(&ed->td_list)) {
1659 + *last = ed->ed_next;
1660 + ed->ed_next = NULL;
1661 + } else if (ohci->rh_state == OHCI_RH_RUNNING) {
1662 + *last = ed->ed_next;
1663 + ed->ed_next = NULL;
1664 + ed_schedule(ohci, ed);
1665 + } else {
1666 + last = &ed->ed_next;
1667 }
1668
1669 if (modified)
1670 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1671 index 08a5f92d6c54..75cb1ff9d26b 100644
1672 --- a/drivers/usb/host/xhci-pci.c
1673 +++ b/drivers/usb/host/xhci-pci.c
1674 @@ -101,6 +101,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
1675 /* AMD PLL quirk */
1676 if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info())
1677 xhci->quirks |= XHCI_AMD_PLL_FIX;
1678 +
1679 + if (pdev->vendor == PCI_VENDOR_ID_AMD)
1680 + xhci->quirks |= XHCI_TRUST_TX_LENGTH;
1681 +
1682 if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
1683 xhci->quirks |= XHCI_LPM_SUPPORT;
1684 xhci->quirks |= XHCI_INTEL_HOST;
1685 diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1686 index 65091d9aa997..0e6665a82e88 100644
1687 --- a/drivers/usb/host/xhci-ring.c
1688 +++ b/drivers/usb/host/xhci-ring.c
1689 @@ -2612,7 +2612,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
1690 * last TRB of the previous TD. The command completion handle
1691 * will take care the rest.
1692 */
1693 - if (!event_seg && trb_comp_code == COMP_STOP_INVAL) {
1694 + if (!event_seg && (trb_comp_code == COMP_STOP ||
1695 + trb_comp_code == COMP_STOP_INVAL)) {
1696 ret = 0;
1697 goto cleanup;
1698 }
1699 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1700 index 8a3813be1b28..8b0f517abb6b 100644
1701 --- a/drivers/usb/serial/ftdi_sio.c
1702 +++ b/drivers/usb/serial/ftdi_sio.c
1703 @@ -151,6 +151,7 @@ static const struct usb_device_id id_table_combined[] = {
1704 { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
1705 { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
1706 { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
1707 + { USB_DEVICE(FTDI_VID, FTDI_BM_ATOM_NANO_PID) },
1708 { USB_DEVICE(FTDI_VID, FTDI_NXTCAM_PID) },
1709 { USB_DEVICE(FTDI_VID, FTDI_EV3CON_PID) },
1710 { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_0_PID) },
1711 @@ -673,6 +674,8 @@ static const struct usb_device_id id_table_combined[] = {
1712 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) },
1713 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) },
1714 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) },
1715 + { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
1716 + { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
1717 { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
1718 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
1719 { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) },
1720 @@ -945,6 +948,8 @@ static const struct usb_device_id id_table_combined[] = {
1721 { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) },
1722 { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) },
1723 { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) },
1724 + /* ekey Devices */
1725 + { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) },
1726 /* Infineon Devices */
1727 { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) },
1728 { } /* Terminating entry */
1729 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1730 index c4777bc6aee0..70b0b1d88ae9 100644
1731 --- a/drivers/usb/serial/ftdi_sio_ids.h
1732 +++ b/drivers/usb/serial/ftdi_sio_ids.h
1733 @@ -42,6 +42,8 @@
1734 /* www.candapter.com Ewert Energy Systems CANdapter device */
1735 #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */
1736
1737 +#define FTDI_BM_ATOM_NANO_PID 0xa559 /* Basic Micro ATOM Nano USB2Serial */
1738 +
1739 /*
1740 * Texas Instruments XDS100v2 JTAG / BeagleBone A3
1741 * http://processors.wiki.ti.com/index.php/XDS100
1742 @@ -140,12 +142,15 @@
1743 /*
1744 * Xsens Technologies BV products (http://www.xsens.com).
1745 */
1746 -#define XSENS_CONVERTER_0_PID 0xD388
1747 -#define XSENS_CONVERTER_1_PID 0xD389
1748 +#define XSENS_VID 0x2639
1749 +#define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */
1750 +#define XSENS_MTW_PID 0x0200 /* Xsens MTw */
1751 +#define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */
1752 +#define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */
1753 #define XSENS_CONVERTER_2_PID 0xD38A
1754 -#define XSENS_CONVERTER_3_PID 0xD38B
1755 -#define XSENS_CONVERTER_4_PID 0xD38C
1756 -#define XSENS_CONVERTER_5_PID 0xD38D
1757 +#define XSENS_CONVERTER_3_PID 0xD38B /* Xsens USB-serial converter */
1758 +#define XSENS_CONVERTER_4_PID 0xD38C /* Xsens Wireless Receiver */
1759 +#define XSENS_CONVERTER_5_PID 0xD38D /* Xsens Awinda Station */
1760 #define XSENS_CONVERTER_6_PID 0xD38E
1761 #define XSENS_CONVERTER_7_PID 0xD38F
1762
1763 @@ -1375,3 +1380,8 @@
1764 #define BRAINBOXES_US_160_6_PID 0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */
1765 #define BRAINBOXES_US_160_7_PID 0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */
1766 #define BRAINBOXES_US_160_8_PID 0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */
1767 +
1768 +/*
1769 + * ekey biometric systems GmbH (http://ekey.net/)
1770 + */
1771 +#define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */
1772 diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
1773 index e62f2dff8b7d..6c3734d2b45a 100644
1774 --- a/drivers/usb/serial/whiteheat.c
1775 +++ b/drivers/usb/serial/whiteheat.c
1776 @@ -514,6 +514,10 @@ static void command_port_read_callback(struct urb *urb)
1777 dev_dbg(&urb->dev->dev, "%s - command_info is NULL, exiting.\n", __func__);
1778 return;
1779 }
1780 + if (!urb->actual_length) {
1781 + dev_dbg(&urb->dev->dev, "%s - empty response, exiting.\n", __func__);
1782 + return;
1783 + }
1784 if (status) {
1785 dev_dbg(&urb->dev->dev, "%s - nonzero urb status: %d\n", __func__, status);
1786 if (status != -ENOENT)
1787 @@ -534,7 +538,8 @@ static void command_port_read_callback(struct urb *urb)
1788 /* These are unsolicited reports from the firmware, hence no
1789 waiting command to wakeup */
1790 dev_dbg(&urb->dev->dev, "%s - event received\n", __func__);
1791 - } else if (data[0] == WHITEHEAT_GET_DTR_RTS) {
1792 + } else if ((data[0] == WHITEHEAT_GET_DTR_RTS) &&
1793 + (urb->actual_length - 1 <= sizeof(command_info->result_buffer))) {
1794 memcpy(command_info->result_buffer, &data[1],
1795 urb->actual_length - 1);
1796 command_info->command_finished = WHITEHEAT_CMD_COMPLETE;
1797 diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
1798 index 640b3cf1a338..172a8bc27abd 100644
1799 --- a/drivers/xen/events/events_fifo.c
1800 +++ b/drivers/xen/events/events_fifo.c
1801 @@ -67,10 +67,9 @@ static event_word_t *event_array[MAX_EVENT_ARRAY_PAGES] __read_mostly;
1802 static unsigned event_array_pages __read_mostly;
1803
1804 /*
1805 - * sync_set_bit() and friends must be unsigned long aligned on non-x86
1806 - * platforms.
1807 + * sync_set_bit() and friends must be unsigned long aligned.
1808 */
1809 -#if !defined(CONFIG_X86) && BITS_PER_LONG > 32
1810 +#if BITS_PER_LONG > 32
1811
1812 #define BM(w) (unsigned long *)((unsigned long)w & ~0x7UL)
1813 #define EVTCHN_FIFO_BIT(b, w) \
1814 diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
1815 index 14d29d02097d..6244f9cf8ae3 100644
1816 --- a/fs/btrfs/backref.c
1817 +++ b/fs/btrfs/backref.c
1818 @@ -275,9 +275,8 @@ static int add_all_parents(struct btrfs_root *root, struct btrfs_path *path,
1819 }
1820 if (ret > 0)
1821 goto next;
1822 - ret = ulist_add_merge(parents, eb->start,
1823 - (uintptr_t)eie,
1824 - (u64 *)&old, GFP_NOFS);
1825 + ret = ulist_add_merge_ptr(parents, eb->start,
1826 + eie, (void **)&old, GFP_NOFS);
1827 if (ret < 0)
1828 break;
1829 if (!ret && extent_item_pos) {
1830 @@ -985,16 +984,19 @@ again:
1831 ret = -EIO;
1832 goto out;
1833 }
1834 + btrfs_tree_read_lock(eb);
1835 + btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
1836 ret = find_extent_in_eb(eb, bytenr,
1837 *extent_item_pos, &eie);
1838 + btrfs_tree_read_unlock_blocking(eb);
1839 free_extent_buffer(eb);
1840 if (ret < 0)
1841 goto out;
1842 ref->inode_list = eie;
1843 }
1844 - ret = ulist_add_merge(refs, ref->parent,
1845 - (uintptr_t)ref->inode_list,
1846 - (u64 *)&eie, GFP_NOFS);
1847 + ret = ulist_add_merge_ptr(refs, ref->parent,
1848 + ref->inode_list,
1849 + (void **)&eie, GFP_NOFS);
1850 if (ret < 0)
1851 goto out;
1852 if (!ret && extent_item_pos) {
1853 diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
1854 index 2eea43f5067c..1a858947006e 100644
1855 --- a/fs/btrfs/extent_io.c
1856 +++ b/fs/btrfs/extent_io.c
1857 @@ -2525,6 +2525,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err)
1858 test_bit(BIO_UPTODATE, &bio->bi_flags);
1859 if (err)
1860 uptodate = 0;
1861 + offset += len;
1862 continue;
1863 }
1864 }
1865 diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
1866 index 127555b29f58..ca248b0687f4 100644
1867 --- a/fs/btrfs/file-item.c
1868 +++ b/fs/btrfs/file-item.c
1869 @@ -756,7 +756,7 @@ again:
1870 found_next = 1;
1871 if (ret != 0)
1872 goto insert;
1873 - slot = 0;
1874 + slot = path->slots[0];
1875 }
1876 btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot);
1877 if (found_key.objectid != BTRFS_EXTENT_CSUM_OBJECTID ||
1878 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1879 index d3d44486290b..c69c76351f12 100644
1880 --- a/fs/btrfs/inode.c
1881 +++ b/fs/btrfs/inode.c
1882 @@ -701,6 +701,18 @@ retry:
1883 unlock_extent(io_tree, async_extent->start,
1884 async_extent->start +
1885 async_extent->ram_size - 1);
1886 +
1887 + /*
1888 + * we need to redirty the pages if we decide to
1889 + * fallback to uncompressed IO, otherwise we
1890 + * will not submit these pages down to lower
1891 + * layers.
1892 + */
1893 + extent_range_redirty_for_io(inode,
1894 + async_extent->start,
1895 + async_extent->start +
1896 + async_extent->ram_size - 1);
1897 +
1898 goto retry;
1899 }
1900 goto out_free;
1901 diff --git a/fs/btrfs/ulist.h b/fs/btrfs/ulist.h
1902 index 7f78cbf5cf41..4c29db604bbe 100644
1903 --- a/fs/btrfs/ulist.h
1904 +++ b/fs/btrfs/ulist.h
1905 @@ -57,6 +57,21 @@ void ulist_free(struct ulist *ulist);
1906 int ulist_add(struct ulist *ulist, u64 val, u64 aux, gfp_t gfp_mask);
1907 int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux,
1908 u64 *old_aux, gfp_t gfp_mask);
1909 +
1910 +/* just like ulist_add_merge() but take a pointer for the aux data */
1911 +static inline int ulist_add_merge_ptr(struct ulist *ulist, u64 val, void *aux,
1912 + void **old_aux, gfp_t gfp_mask)
1913 +{
1914 +#if BITS_PER_LONG == 32
1915 + u64 old64 = (uintptr_t)*old_aux;
1916 + int ret = ulist_add_merge(ulist, val, (uintptr_t)aux, &old64, gfp_mask);
1917 + *old_aux = (void *)((uintptr_t)old64);
1918 + return ret;
1919 +#else
1920 + return ulist_add_merge(ulist, val, (u64)aux, (u64 *)old_aux, gfp_mask);
1921 +#endif
1922 +}
1923 +
1924 struct ulist_node *ulist_next(struct ulist *ulist,
1925 struct ulist_iterator *uiter);
1926
1927 diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
1928 index 9c0444cccbe1..15761957cc3f 100644
1929 --- a/fs/debugfs/inode.c
1930 +++ b/fs/debugfs/inode.c
1931 @@ -533,7 +533,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove);
1932 */
1933 void debugfs_remove_recursive(struct dentry *dentry)
1934 {
1935 - struct dentry *child, *next, *parent;
1936 + struct dentry *child, *parent;
1937
1938 if (IS_ERR_OR_NULL(dentry))
1939 return;
1940 @@ -545,30 +545,49 @@ void debugfs_remove_recursive(struct dentry *dentry)
1941 parent = dentry;
1942 down:
1943 mutex_lock(&parent->d_inode->i_mutex);
1944 - list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) {
1945 + loop:
1946 + /*
1947 + * The parent->d_subdirs is protected by the d_lock. Outside that
1948 + * lock, the child can be unlinked and set to be freed which can
1949 + * use the d_u.d_child as the rcu head and corrupt this list.
1950 + */
1951 + spin_lock(&parent->d_lock);
1952 + list_for_each_entry(child, &parent->d_subdirs, d_u.d_child) {
1953 if (!debugfs_positive(child))
1954 continue;
1955
1956 /* perhaps simple_empty(child) makes more sense */
1957 if (!list_empty(&child->d_subdirs)) {
1958 + spin_unlock(&parent->d_lock);
1959 mutex_unlock(&parent->d_inode->i_mutex);
1960 parent = child;
1961 goto down;
1962 }
1963 - up:
1964 +
1965 + spin_unlock(&parent->d_lock);
1966 +
1967 if (!__debugfs_remove(child, parent))
1968 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
1969 +
1970 + /*
1971 + * The parent->d_lock protects agaist child from unlinking
1972 + * from d_subdirs. When releasing the parent->d_lock we can
1973 + * no longer trust that the next pointer is valid.
1974 + * Restart the loop. We'll skip this one with the
1975 + * debugfs_positive() check.
1976 + */
1977 + goto loop;
1978 }
1979 + spin_unlock(&parent->d_lock);
1980
1981 mutex_unlock(&parent->d_inode->i_mutex);
1982 child = parent;
1983 parent = parent->d_parent;
1984 mutex_lock(&parent->d_inode->i_mutex);
1985
1986 - if (child != dentry) {
1987 - next = list_next_entry(child, d_u.d_child);
1988 - goto up;
1989 - }
1990 + if (child != dentry)
1991 + /* go up */
1992 + goto loop;
1993
1994 if (!__debugfs_remove(child, parent))
1995 simple_release_fs(&debugfs_mount, &debugfs_mount_count);
1996 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1997 index a7029f481b7b..b56062dc8b62 100644
1998 --- a/fs/ext4/inode.c
1999 +++ b/fs/ext4/inode.c
2000 @@ -2195,6 +2195,7 @@ static int mpage_map_and_submit_extent(handle_t *handle,
2001 struct ext4_map_blocks *map = &mpd->map;
2002 int err;
2003 loff_t disksize;
2004 + int progress = 0;
2005
2006 mpd->io_submit.io_end->offset =
2007 ((loff_t)map->m_lblk) << inode->i_blkbits;
2008 @@ -2211,8 +2212,11 @@ static int mpage_map_and_submit_extent(handle_t *handle,
2009 * is non-zero, a commit should free up blocks.
2010 */
2011 if ((err == -ENOMEM) ||
2012 - (err == -ENOSPC && ext4_count_free_clusters(sb)))
2013 + (err == -ENOSPC && ext4_count_free_clusters(sb))) {
2014 + if (progress)
2015 + goto update_disksize;
2016 return err;
2017 + }
2018 ext4_msg(sb, KERN_CRIT,
2019 "Delayed block allocation failed for "
2020 "inode %lu at logical offset %llu with"
2021 @@ -2229,15 +2233,17 @@ static int mpage_map_and_submit_extent(handle_t *handle,
2022 *give_up_on_write = true;
2023 return err;
2024 }
2025 + progress = 1;
2026 /*
2027 * Update buffer state, submit mapped pages, and get us new
2028 * extent to map
2029 */
2030 err = mpage_map_and_submit_buffers(mpd);
2031 if (err < 0)
2032 - return err;
2033 + goto update_disksize;
2034 } while (map->m_len);
2035
2036 +update_disksize:
2037 /*
2038 * Update on-disk size after IO is submitted. Races with
2039 * truncate are avoided by checking i_size under i_data_sem.
2040 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
2041 index 502f0fd71470..242226a87be7 100644
2042 --- a/fs/ext4/mballoc.c
2043 +++ b/fs/ext4/mballoc.c
2044 @@ -1398,6 +1398,8 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b,
2045 int last = first + count - 1;
2046 struct super_block *sb = e4b->bd_sb;
2047
2048 + if (WARN_ON(count == 0))
2049 + return;
2050 BUG_ON(last >= (sb->s_blocksize << 3));
2051 assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group));
2052 /* Don't bother if the block group is corrupt. */
2053 @@ -3196,8 +3198,30 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)
2054 static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac)
2055 {
2056 struct ext4_prealloc_space *pa = ac->ac_pa;
2057 + struct ext4_buddy e4b;
2058 + int err;
2059
2060 - if (pa && pa->pa_type == MB_INODE_PA)
2061 + if (pa == NULL) {
2062 + if (ac->ac_f_ex.fe_len == 0)
2063 + return;
2064 + err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b);
2065 + if (err) {
2066 + /*
2067 + * This should never happen since we pin the
2068 + * pages in the ext4_allocation_context so
2069 + * ext4_mb_load_buddy() should never fail.
2070 + */
2071 + WARN(1, "mb_load_buddy failed (%d)", err);
2072 + return;
2073 + }
2074 + ext4_lock_group(ac->ac_sb, ac->ac_f_ex.fe_group);
2075 + mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start,
2076 + ac->ac_f_ex.fe_len);
2077 + ext4_unlock_group(ac->ac_sb, ac->ac_f_ex.fe_group);
2078 + ext4_mb_unload_buddy(&e4b);
2079 + return;
2080 + }
2081 + if (pa->pa_type == MB_INODE_PA)
2082 pa->pa_free += ac->ac_b_ex.fe_len;
2083 }
2084
2085 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
2086 index 25b327e87318..a46030d6b4af 100644
2087 --- a/fs/ext4/super.c
2088 +++ b/fs/ext4/super.c
2089 @@ -3169,9 +3169,9 @@ static int set_journal_csum_feature_set(struct super_block *sb)
2090
2091 if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
2092 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
2093 - /* journal checksum v2 */
2094 + /* journal checksum v3 */
2095 compat = 0;
2096 - incompat = JBD2_FEATURE_INCOMPAT_CSUM_V2;
2097 + incompat = JBD2_FEATURE_INCOMPAT_CSUM_V3;
2098 } else {
2099 /* journal checksum v1 */
2100 compat = JBD2_FEATURE_COMPAT_CHECKSUM;
2101 @@ -3193,6 +3193,7 @@ static int set_journal_csum_feature_set(struct super_block *sb)
2102 jbd2_journal_clear_features(sbi->s_journal,
2103 JBD2_FEATURE_COMPAT_CHECKSUM, 0,
2104 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT |
2105 + JBD2_FEATURE_INCOMPAT_CSUM_V3 |
2106 JBD2_FEATURE_INCOMPAT_CSUM_V2);
2107 }
2108
2109 diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
2110 index 4a9e10ea13f2..a9daccbd8fe7 100644
2111 --- a/fs/isofs/inode.c
2112 +++ b/fs/isofs/inode.c
2113 @@ -61,7 +61,7 @@ static void isofs_put_super(struct super_block *sb)
2114 return;
2115 }
2116
2117 -static int isofs_read_inode(struct inode *);
2118 +static int isofs_read_inode(struct inode *, int relocated);
2119 static int isofs_statfs (struct dentry *, struct kstatfs *);
2120
2121 static struct kmem_cache *isofs_inode_cachep;
2122 @@ -1258,7 +1258,7 @@ out_toomany:
2123 goto out;
2124 }
2125
2126 -static int isofs_read_inode(struct inode *inode)
2127 +static int isofs_read_inode(struct inode *inode, int relocated)
2128 {
2129 struct super_block *sb = inode->i_sb;
2130 struct isofs_sb_info *sbi = ISOFS_SB(sb);
2131 @@ -1403,7 +1403,7 @@ static int isofs_read_inode(struct inode *inode)
2132 */
2133
2134 if (!high_sierra) {
2135 - parse_rock_ridge_inode(de, inode);
2136 + parse_rock_ridge_inode(de, inode, relocated);
2137 /* if we want uid/gid set, override the rock ridge setting */
2138 if (sbi->s_uid_set)
2139 inode->i_uid = sbi->s_uid;
2140 @@ -1482,9 +1482,10 @@ static int isofs_iget5_set(struct inode *ino, void *data)
2141 * offset that point to the underlying meta-data for the inode. The
2142 * code below is otherwise similar to the iget() code in
2143 * include/linux/fs.h */
2144 -struct inode *isofs_iget(struct super_block *sb,
2145 - unsigned long block,
2146 - unsigned long offset)
2147 +struct inode *__isofs_iget(struct super_block *sb,
2148 + unsigned long block,
2149 + unsigned long offset,
2150 + int relocated)
2151 {
2152 unsigned long hashval;
2153 struct inode *inode;
2154 @@ -1506,7 +1507,7 @@ struct inode *isofs_iget(struct super_block *sb,
2155 return ERR_PTR(-ENOMEM);
2156
2157 if (inode->i_state & I_NEW) {
2158 - ret = isofs_read_inode(inode);
2159 + ret = isofs_read_inode(inode, relocated);
2160 if (ret < 0) {
2161 iget_failed(inode);
2162 inode = ERR_PTR(ret);
2163 diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
2164 index 99167238518d..0ac4c1f73fbd 100644
2165 --- a/fs/isofs/isofs.h
2166 +++ b/fs/isofs/isofs.h
2167 @@ -107,7 +107,7 @@ extern int iso_date(char *, int);
2168
2169 struct inode; /* To make gcc happy */
2170
2171 -extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *);
2172 +extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *, int relocated);
2173 extern int get_rock_ridge_filename(struct iso_directory_record *, char *, struct inode *);
2174 extern int isofs_name_translate(struct iso_directory_record *, char *, struct inode *);
2175
2176 @@ -118,9 +118,24 @@ extern struct dentry *isofs_lookup(struct inode *, struct dentry *, unsigned int
2177 extern struct buffer_head *isofs_bread(struct inode *, sector_t);
2178 extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long);
2179
2180 -extern struct inode *isofs_iget(struct super_block *sb,
2181 - unsigned long block,
2182 - unsigned long offset);
2183 +struct inode *__isofs_iget(struct super_block *sb,
2184 + unsigned long block,
2185 + unsigned long offset,
2186 + int relocated);
2187 +
2188 +static inline struct inode *isofs_iget(struct super_block *sb,
2189 + unsigned long block,
2190 + unsigned long offset)
2191 +{
2192 + return __isofs_iget(sb, block, offset, 0);
2193 +}
2194 +
2195 +static inline struct inode *isofs_iget_reloc(struct super_block *sb,
2196 + unsigned long block,
2197 + unsigned long offset)
2198 +{
2199 + return __isofs_iget(sb, block, offset, 1);
2200 +}
2201
2202 /* Because the inode number is no longer relevant to finding the
2203 * underlying meta-data for an inode, we are free to choose a more
2204 diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
2205 index c0bf42472e40..f488bbae541a 100644
2206 --- a/fs/isofs/rock.c
2207 +++ b/fs/isofs/rock.c
2208 @@ -288,12 +288,16 @@ eio:
2209 goto out;
2210 }
2211
2212 +#define RR_REGARD_XA 1
2213 +#define RR_RELOC_DE 2
2214 +
2215 static int
2216 parse_rock_ridge_inode_internal(struct iso_directory_record *de,
2217 - struct inode *inode, int regard_xa)
2218 + struct inode *inode, int flags)
2219 {
2220 int symlink_len = 0;
2221 int cnt, sig;
2222 + unsigned int reloc_block;
2223 struct inode *reloc;
2224 struct rock_ridge *rr;
2225 int rootflag;
2226 @@ -305,7 +309,7 @@ parse_rock_ridge_inode_internal(struct iso_directory_record *de,
2227
2228 init_rock_state(&rs, inode);
2229 setup_rock_ridge(de, inode, &rs);
2230 - if (regard_xa) {
2231 + if (flags & RR_REGARD_XA) {
2232 rs.chr += 14;
2233 rs.len -= 14;
2234 if (rs.len < 0)
2235 @@ -485,12 +489,22 @@ repeat:
2236 "relocated directory\n");
2237 goto out;
2238 case SIG('C', 'L'):
2239 - ISOFS_I(inode)->i_first_extent =
2240 - isonum_733(rr->u.CL.location);
2241 - reloc =
2242 - isofs_iget(inode->i_sb,
2243 - ISOFS_I(inode)->i_first_extent,
2244 - 0);
2245 + if (flags & RR_RELOC_DE) {
2246 + printk(KERN_ERR
2247 + "ISOFS: Recursive directory relocation "
2248 + "is not supported\n");
2249 + goto eio;
2250 + }
2251 + reloc_block = isonum_733(rr->u.CL.location);
2252 + if (reloc_block == ISOFS_I(inode)->i_iget5_block &&
2253 + ISOFS_I(inode)->i_iget5_offset == 0) {
2254 + printk(KERN_ERR
2255 + "ISOFS: Directory relocation points to "
2256 + "itself\n");
2257 + goto eio;
2258 + }
2259 + ISOFS_I(inode)->i_first_extent = reloc_block;
2260 + reloc = isofs_iget_reloc(inode->i_sb, reloc_block, 0);
2261 if (IS_ERR(reloc)) {
2262 ret = PTR_ERR(reloc);
2263 goto out;
2264 @@ -637,9 +651,11 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit)
2265 return rpnt;
2266 }
2267
2268 -int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
2269 +int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode,
2270 + int relocated)
2271 {
2272 - int result = parse_rock_ridge_inode_internal(de, inode, 0);
2273 + int flags = relocated ? RR_RELOC_DE : 0;
2274 + int result = parse_rock_ridge_inode_internal(de, inode, flags);
2275
2276 /*
2277 * if rockridge flag was reset and we didn't look for attributes
2278 @@ -647,7 +663,8 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode)
2279 */
2280 if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1)
2281 && (ISOFS_SB(inode->i_sb)->s_rock == 2)) {
2282 - result = parse_rock_ridge_inode_internal(de, inode, 14);
2283 + result = parse_rock_ridge_inode_internal(de, inode,
2284 + flags | RR_REGARD_XA);
2285 }
2286 return result;
2287 }
2288 diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
2289 index cf2fc0594063..9181c2b22b3c 100644
2290 --- a/fs/jbd2/commit.c
2291 +++ b/fs/jbd2/commit.c
2292 @@ -97,7 +97,7 @@ static void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh)
2293 struct commit_header *h;
2294 __u32 csum;
2295
2296 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2297 + if (!jbd2_journal_has_csum_v2or3(j))
2298 return;
2299
2300 h = (struct commit_header *)(bh->b_data);
2301 @@ -313,11 +313,11 @@ static __u32 jbd2_checksum_data(__u32 crc32_sum, struct buffer_head *bh)
2302 return checksum;
2303 }
2304
2305 -static void write_tag_block(int tag_bytes, journal_block_tag_t *tag,
2306 +static void write_tag_block(journal_t *j, journal_block_tag_t *tag,
2307 unsigned long long block)
2308 {
2309 tag->t_blocknr = cpu_to_be32(block & (u32)~0);
2310 - if (tag_bytes > JBD2_TAG_SIZE32)
2311 + if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_64BIT))
2312 tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1);
2313 }
2314
2315 @@ -327,7 +327,7 @@ static void jbd2_descr_block_csum_set(journal_t *j,
2316 struct jbd2_journal_block_tail *tail;
2317 __u32 csum;
2318
2319 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2320 + if (!jbd2_journal_has_csum_v2or3(j))
2321 return;
2322
2323 tail = (struct jbd2_journal_block_tail *)(bh->b_data + j->j_blocksize -
2324 @@ -340,12 +340,13 @@ static void jbd2_descr_block_csum_set(journal_t *j,
2325 static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
2326 struct buffer_head *bh, __u32 sequence)
2327 {
2328 + journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag;
2329 struct page *page = bh->b_page;
2330 __u8 *addr;
2331 __u32 csum32;
2332 __be32 seq;
2333
2334 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2335 + if (!jbd2_journal_has_csum_v2or3(j))
2336 return;
2337
2338 seq = cpu_to_be32(sequence);
2339 @@ -355,8 +356,10 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag,
2340 bh->b_size);
2341 kunmap_atomic(addr);
2342
2343 - /* We only have space to store the lower 16 bits of the crc32c. */
2344 - tag->t_checksum = cpu_to_be16(csum32);
2345 + if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3))
2346 + tag3->t_checksum = cpu_to_be32(csum32);
2347 + else
2348 + tag->t_checksum = cpu_to_be16(csum32);
2349 }
2350 /*
2351 * jbd2_journal_commit_transaction
2352 @@ -396,7 +399,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
2353 LIST_HEAD(io_bufs);
2354 LIST_HEAD(log_bufs);
2355
2356 - if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2357 + if (jbd2_journal_has_csum_v2or3(journal))
2358 csum_size = sizeof(struct jbd2_journal_block_tail);
2359
2360 /*
2361 @@ -692,7 +695,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
2362 tag_flag |= JBD2_FLAG_SAME_UUID;
2363
2364 tag = (journal_block_tag_t *) tagp;
2365 - write_tag_block(tag_bytes, tag, jh2bh(jh)->b_blocknr);
2366 + write_tag_block(journal, tag, jh2bh(jh)->b_blocknr);
2367 tag->t_flags = cpu_to_be16(tag_flag);
2368 jbd2_block_tag_csum_set(journal, tag, wbuf[bufs],
2369 commit_transaction->t_tid);
2370 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
2371 index 5fa344afb49a..f2d78a3dae43 100644
2372 --- a/fs/jbd2/journal.c
2373 +++ b/fs/jbd2/journal.c
2374 @@ -124,7 +124,7 @@ EXPORT_SYMBOL(__jbd2_debug);
2375 /* Checksumming functions */
2376 int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb)
2377 {
2378 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2379 + if (!jbd2_journal_has_csum_v2or3(j))
2380 return 1;
2381
2382 return sb->s_checksum_type == JBD2_CRC32C_CHKSUM;
2383 @@ -145,7 +145,7 @@ static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb)
2384
2385 int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb)
2386 {
2387 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2388 + if (!jbd2_journal_has_csum_v2or3(j))
2389 return 1;
2390
2391 return sb->s_checksum == jbd2_superblock_csum(j, sb);
2392 @@ -153,7 +153,7 @@ int jbd2_superblock_csum_verify(journal_t *j, journal_superblock_t *sb)
2393
2394 void jbd2_superblock_csum_set(journal_t *j, journal_superblock_t *sb)
2395 {
2396 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2397 + if (!jbd2_journal_has_csum_v2or3(j))
2398 return;
2399
2400 sb->s_checksum = jbd2_superblock_csum(j, sb);
2401 @@ -1522,21 +1522,29 @@ static int journal_get_superblock(journal_t *journal)
2402 goto out;
2403 }
2404
2405 - if (JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM) &&
2406 - JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
2407 + if (jbd2_journal_has_csum_v2or3(journal) &&
2408 + JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM)) {
2409 /* Can't have checksum v1 and v2 on at the same time! */
2410 printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2 "
2411 "at the same time!\n");
2412 goto out;
2413 }
2414
2415 + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) &&
2416 + JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3)) {
2417 + /* Can't have checksum v2 and v3 at the same time! */
2418 + printk(KERN_ERR "JBD2: Can't enable checksumming v2 and v3 "
2419 + "at the same time!\n");
2420 + goto out;
2421 + }
2422 +
2423 if (!jbd2_verify_csum_type(journal, sb)) {
2424 printk(KERN_ERR "JBD2: Unknown checksum type\n");
2425 goto out;
2426 }
2427
2428 /* Load the checksum driver */
2429 - if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
2430 + if (jbd2_journal_has_csum_v2or3(journal)) {
2431 journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
2432 if (IS_ERR(journal->j_chksum_driver)) {
2433 printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n");
2434 @@ -1553,7 +1561,7 @@ static int journal_get_superblock(journal_t *journal)
2435 }
2436
2437 /* Precompute checksum seed for all metadata */
2438 - if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2439 + if (jbd2_journal_has_csum_v2or3(journal))
2440 journal->j_csum_seed = jbd2_chksum(journal, ~0, sb->s_uuid,
2441 sizeof(sb->s_uuid));
2442
2443 @@ -1813,8 +1821,14 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat,
2444 if (!jbd2_journal_check_available_features(journal, compat, ro, incompat))
2445 return 0;
2446
2447 - /* Asking for checksumming v2 and v1? Only give them v2. */
2448 - if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2 &&
2449 + /* If enabling v2 checksums, turn on v3 instead */
2450 + if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V2) {
2451 + incompat &= ~JBD2_FEATURE_INCOMPAT_CSUM_V2;
2452 + incompat |= JBD2_FEATURE_INCOMPAT_CSUM_V3;
2453 + }
2454 +
2455 + /* Asking for checksumming v3 and v1? Only give them v3. */
2456 + if (incompat & JBD2_FEATURE_INCOMPAT_CSUM_V3 &&
2457 compat & JBD2_FEATURE_COMPAT_CHECKSUM)
2458 compat &= ~JBD2_FEATURE_COMPAT_CHECKSUM;
2459
2460 @@ -1823,8 +1837,8 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat,
2461
2462 sb = journal->j_superblock;
2463
2464 - /* If enabling v2 checksums, update superblock */
2465 - if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
2466 + /* If enabling v3 checksums, update superblock */
2467 + if (INCOMPAT_FEATURE_ON(JBD2_FEATURE_INCOMPAT_CSUM_V3)) {
2468 sb->s_checksum_type = JBD2_CRC32C_CHKSUM;
2469 sb->s_feature_compat &=
2470 ~cpu_to_be32(JBD2_FEATURE_COMPAT_CHECKSUM);
2471 @@ -1842,8 +1856,7 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat,
2472 }
2473
2474 /* Precompute checksum seed for all metadata */
2475 - if (JBD2_HAS_INCOMPAT_FEATURE(journal,
2476 - JBD2_FEATURE_INCOMPAT_CSUM_V2))
2477 + if (jbd2_journal_has_csum_v2or3(journal))
2478 journal->j_csum_seed = jbd2_chksum(journal, ~0,
2479 sb->s_uuid,
2480 sizeof(sb->s_uuid));
2481 @@ -1852,7 +1865,8 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat,
2482 /* If enabling v1 checksums, downgrade superblock */
2483 if (COMPAT_FEATURE_ON(JBD2_FEATURE_COMPAT_CHECKSUM))
2484 sb->s_feature_incompat &=
2485 - ~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2);
2486 + ~cpu_to_be32(JBD2_FEATURE_INCOMPAT_CSUM_V2 |
2487 + JBD2_FEATURE_INCOMPAT_CSUM_V3);
2488
2489 sb->s_feature_compat |= cpu_to_be32(compat);
2490 sb->s_feature_ro_compat |= cpu_to_be32(ro);
2491 @@ -2165,16 +2179,20 @@ int jbd2_journal_blocks_per_page(struct inode *inode)
2492 */
2493 size_t journal_tag_bytes(journal_t *journal)
2494 {
2495 - journal_block_tag_t tag;
2496 - size_t x = 0;
2497 + size_t sz;
2498 +
2499 + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3))
2500 + return sizeof(journal_block_tag3_t);
2501 +
2502 + sz = sizeof(journal_block_tag_t);
2503
2504 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2505 - x += sizeof(tag.t_checksum);
2506 + sz += sizeof(__u16);
2507
2508 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT))
2509 - return x + JBD2_TAG_SIZE64;
2510 + return sz;
2511 else
2512 - return x + JBD2_TAG_SIZE32;
2513 + return sz - sizeof(__u32);
2514 }
2515
2516 /*
2517 diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
2518 index 3b6bb19d60b1..9b329b55ffe3 100644
2519 --- a/fs/jbd2/recovery.c
2520 +++ b/fs/jbd2/recovery.c
2521 @@ -181,7 +181,7 @@ static int jbd2_descr_block_csum_verify(journal_t *j,
2522 __be32 provided;
2523 __u32 calculated;
2524
2525 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2526 + if (!jbd2_journal_has_csum_v2or3(j))
2527 return 1;
2528
2529 tail = (struct jbd2_journal_block_tail *)(buf + j->j_blocksize -
2530 @@ -205,7 +205,7 @@ static int count_tags(journal_t *journal, struct buffer_head *bh)
2531 int nr = 0, size = journal->j_blocksize;
2532 int tag_bytes = journal_tag_bytes(journal);
2533
2534 - if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2535 + if (jbd2_journal_has_csum_v2or3(journal))
2536 size -= sizeof(struct jbd2_journal_block_tail);
2537
2538 tagp = &bh->b_data[sizeof(journal_header_t)];
2539 @@ -338,10 +338,11 @@ int jbd2_journal_skip_recovery(journal_t *journal)
2540 return err;
2541 }
2542
2543 -static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag_t *tag)
2544 +static inline unsigned long long read_tag_block(journal_t *journal,
2545 + journal_block_tag_t *tag)
2546 {
2547 unsigned long long block = be32_to_cpu(tag->t_blocknr);
2548 - if (tag_bytes > JBD2_TAG_SIZE32)
2549 + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT))
2550 block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32;
2551 return block;
2552 }
2553 @@ -384,7 +385,7 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf)
2554 __be32 provided;
2555 __u32 calculated;
2556
2557 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2558 + if (!jbd2_journal_has_csum_v2or3(j))
2559 return 1;
2560
2561 h = buf;
2562 @@ -399,17 +400,21 @@ static int jbd2_commit_block_csum_verify(journal_t *j, void *buf)
2563 static int jbd2_block_tag_csum_verify(journal_t *j, journal_block_tag_t *tag,
2564 void *buf, __u32 sequence)
2565 {
2566 + journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag;
2567 __u32 csum32;
2568 __be32 seq;
2569
2570 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2571 + if (!jbd2_journal_has_csum_v2or3(j))
2572 return 1;
2573
2574 seq = cpu_to_be32(sequence);
2575 csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
2576 csum32 = jbd2_chksum(j, csum32, buf, j->j_blocksize);
2577
2578 - return tag->t_checksum == cpu_to_be16(csum32);
2579 + if (JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V3))
2580 + return tag3->t_checksum == cpu_to_be32(csum32);
2581 + else
2582 + return tag->t_checksum == cpu_to_be16(csum32);
2583 }
2584
2585 static int do_one_pass(journal_t *journal,
2586 @@ -426,6 +431,7 @@ static int do_one_pass(journal_t *journal,
2587 int tag_bytes = journal_tag_bytes(journal);
2588 __u32 crc32_sum = ~0; /* Transactional Checksums */
2589 int descr_csum_size = 0;
2590 + int block_error = 0;
2591
2592 /*
2593 * First thing is to establish what we expect to find in the log
2594 @@ -512,8 +518,7 @@ static int do_one_pass(journal_t *journal,
2595 switch(blocktype) {
2596 case JBD2_DESCRIPTOR_BLOCK:
2597 /* Verify checksum first */
2598 - if (JBD2_HAS_INCOMPAT_FEATURE(journal,
2599 - JBD2_FEATURE_INCOMPAT_CSUM_V2))
2600 + if (jbd2_journal_has_csum_v2or3(journal))
2601 descr_csum_size =
2602 sizeof(struct jbd2_journal_block_tail);
2603 if (descr_csum_size > 0 &&
2604 @@ -574,7 +579,7 @@ static int do_one_pass(journal_t *journal,
2605 unsigned long long blocknr;
2606
2607 J_ASSERT(obh != NULL);
2608 - blocknr = read_tag_block(tag_bytes,
2609 + blocknr = read_tag_block(journal,
2610 tag);
2611
2612 /* If the block has been
2613 @@ -598,7 +603,8 @@ static int do_one_pass(journal_t *journal,
2614 "checksum recovering "
2615 "block %llu in log\n",
2616 blocknr);
2617 - continue;
2618 + block_error = 1;
2619 + goto skip_write;
2620 }
2621
2622 /* Find a buffer for the new
2623 @@ -797,7 +803,8 @@ static int do_one_pass(journal_t *journal,
2624 success = -EIO;
2625 }
2626 }
2627 -
2628 + if (block_error && success == 0)
2629 + success = -EIO;
2630 return success;
2631
2632 failed:
2633 @@ -811,7 +818,7 @@ static int jbd2_revoke_block_csum_verify(journal_t *j,
2634 __be32 provided;
2635 __u32 calculated;
2636
2637 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2638 + if (!jbd2_journal_has_csum_v2or3(j))
2639 return 1;
2640
2641 tail = (struct jbd2_journal_revoke_tail *)(buf + j->j_blocksize -
2642 diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
2643 index 198c9c10276d..d5e95a175c92 100644
2644 --- a/fs/jbd2/revoke.c
2645 +++ b/fs/jbd2/revoke.c
2646 @@ -91,8 +91,8 @@
2647 #include <linux/list.h>
2648 #include <linux/init.h>
2649 #include <linux/bio.h>
2650 -#endif
2651 #include <linux/log2.h>
2652 +#endif
2653
2654 static struct kmem_cache *jbd2_revoke_record_cache;
2655 static struct kmem_cache *jbd2_revoke_table_cache;
2656 @@ -597,7 +597,7 @@ static void write_one_revoke_record(journal_t *journal,
2657 offset = *offsetp;
2658
2659 /* Do we need to leave space at the end for a checksum? */
2660 - if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2661 + if (jbd2_journal_has_csum_v2or3(journal))
2662 csum_size = sizeof(struct jbd2_journal_revoke_tail);
2663
2664 /* Make sure we have a descriptor with space left for the record */
2665 @@ -644,7 +644,7 @@ static void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh)
2666 struct jbd2_journal_revoke_tail *tail;
2667 __u32 csum;
2668
2669 - if (!JBD2_HAS_INCOMPAT_FEATURE(j, JBD2_FEATURE_INCOMPAT_CSUM_V2))
2670 + if (!jbd2_journal_has_csum_v2or3(j))
2671 return;
2672
2673 tail = (struct jbd2_journal_revoke_tail *)(bh->b_data + j->j_blocksize -
2674 diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
2675 index 8f854dde4150..24c6898159cc 100644
2676 --- a/fs/nfs/nfs3acl.c
2677 +++ b/fs/nfs/nfs3acl.c
2678 @@ -129,7 +129,10 @@ static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
2679 .rpc_argp = &args,
2680 .rpc_resp = &fattr,
2681 };
2682 - int status;
2683 + int status = 0;
2684 +
2685 + if (acl == NULL && (!S_ISDIR(inode->i_mode) || dfacl == NULL))
2686 + goto out;
2687
2688 status = -EOPNOTSUPP;
2689 if (!nfs_server_capable(inode, NFS_CAP_ACLS))
2690 @@ -256,7 +259,7 @@ nfs3_list_one_acl(struct inode *inode, int type, const char *name, void *data,
2691 char *p = data + *result;
2692
2693 acl = get_acl(inode, type);
2694 - if (!acl)
2695 + if (IS_ERR_OR_NULL(acl))
2696 return 0;
2697
2698 posix_acl_release(acl);
2699 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
2700 index d5d06e868841..17f91a72840b 100644
2701 --- a/fs/nfs/nfs4proc.c
2702 +++ b/fs/nfs/nfs4proc.c
2703 @@ -2546,6 +2546,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
2704 struct nfs4_closedata *calldata = data;
2705 struct nfs4_state *state = calldata->state;
2706 struct inode *inode = calldata->inode;
2707 + bool is_rdonly, is_wronly, is_rdwr;
2708 int call_close = 0;
2709
2710 dprintk("%s: begin!\n", __func__);
2711 @@ -2553,18 +2554,24 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
2712 goto out_wait;
2713
2714 task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE];
2715 - calldata->arg.fmode = FMODE_READ|FMODE_WRITE;
2716 spin_lock(&state->owner->so_lock);
2717 + is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags);
2718 + is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags);
2719 + is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags);
2720 + /* Calculate the current open share mode */
2721 + calldata->arg.fmode = 0;
2722 + if (is_rdonly || is_rdwr)
2723 + calldata->arg.fmode |= FMODE_READ;
2724 + if (is_wronly || is_rdwr)
2725 + calldata->arg.fmode |= FMODE_WRITE;
2726 /* Calculate the change in open mode */
2727 if (state->n_rdwr == 0) {
2728 if (state->n_rdonly == 0) {
2729 - call_close |= test_bit(NFS_O_RDONLY_STATE, &state->flags);
2730 - call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags);
2731 + call_close |= is_rdonly || is_rdwr;
2732 calldata->arg.fmode &= ~FMODE_READ;
2733 }
2734 if (state->n_wronly == 0) {
2735 - call_close |= test_bit(NFS_O_WRONLY_STATE, &state->flags);
2736 - call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags);
2737 + call_close |= is_wronly || is_rdwr;
2738 calldata->arg.fmode &= ~FMODE_WRITE;
2739 }
2740 }
2741 diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
2742 index 3eaa6e30a2dc..cc8c5b32043c 100644
2743 --- a/fs/nfsd/nfs4callback.c
2744 +++ b/fs/nfsd/nfs4callback.c
2745 @@ -672,7 +672,8 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
2746 clp->cl_cb_session = ses;
2747 args.bc_xprt = conn->cb_xprt;
2748 args.prognumber = clp->cl_cb_session->se_cb_prog;
2749 - args.protocol = XPRT_TRANSPORT_BC_TCP;
2750 + args.protocol = conn->cb_xprt->xpt_class->xcl_ident |
2751 + XPRT_TRANSPORT_BC;
2752 args.authflavor = ses->se_cb_sec.flavor;
2753 }
2754 /* Create RPC client */
2755 diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
2756 index 9a4a5f9e7468..c34e45d1539b 100644
2757 --- a/fs/nfsd/nfssvc.c
2758 +++ b/fs/nfsd/nfssvc.c
2759 @@ -221,7 +221,8 @@ static int nfsd_startup_generic(int nrservs)
2760 */
2761 ret = nfsd_racache_init(2*nrservs);
2762 if (ret)
2763 - return ret;
2764 + goto dec_users;
2765 +
2766 ret = nfs4_state_start();
2767 if (ret)
2768 goto out_racache;
2769 @@ -229,6 +230,8 @@ static int nfsd_startup_generic(int nrservs)
2770
2771 out_racache:
2772 nfsd_racache_shutdown();
2773 +dec_users:
2774 + nfsd_users--;
2775 return ret;
2776 }
2777
2778 diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
2779 index 49376aec2fbb..bcec4c46cc2e 100644
2780 --- a/include/drm/drm_pciids.h
2781 +++ b/include/drm/drm_pciids.h
2782 @@ -17,6 +17,7 @@
2783 {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
2784 {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
2785 {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
2786 + {0x1002, 0x1318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
2787 {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
2788 {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
2789 {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
2790 @@ -164,8 +165,11 @@
2791 {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2792 {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2793 {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2794 + {0x1002, 0x6604, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2795 + {0x1002, 0x6605, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2796 {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2797 {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2798 + {0x1002, 0x6608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
2799 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
2800 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
2801 {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
2802 @@ -175,6 +179,8 @@
2803 {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
2804 {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2805 {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2806 + {0x1002, 0x6646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2807 + {0x1002, 0x6647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2808 {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
2809 {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
2810 {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \
2811 @@ -297,6 +303,7 @@
2812 {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
2813 {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2814 {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2815 + {0x1002, 0x682C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
2816 {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2817 {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2818 {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
2819 diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
2820 index d5b50a19463c..0dae71e9971c 100644
2821 --- a/include/linux/jbd2.h
2822 +++ b/include/linux/jbd2.h
2823 @@ -159,7 +159,11 @@ typedef struct journal_header_s
2824 * journal_block_tag (in the descriptor). The other h_chksum* fields are
2825 * not used.
2826 *
2827 - * Checksum v1 and v2 are mutually exclusive features.
2828 + * If FEATURE_INCOMPAT_CSUM_V3 is set, the descriptor block uses
2829 + * journal_block_tag3_t to store a full 32-bit checksum. Everything else
2830 + * is the same as v2.
2831 + *
2832 + * Checksum v1, v2, and v3 are mutually exclusive features.
2833 */
2834 struct commit_header {
2835 __be32 h_magic;
2836 @@ -179,6 +183,14 @@ struct commit_header {
2837 * raw struct shouldn't be used for pointer math or sizeof() - use
2838 * journal_tag_bytes(journal) instead to compute this.
2839 */
2840 +typedef struct journal_block_tag3_s
2841 +{
2842 + __be32 t_blocknr; /* The on-disk block number */
2843 + __be32 t_flags; /* See below */
2844 + __be32 t_blocknr_high; /* most-significant high 32bits. */
2845 + __be32 t_checksum; /* crc32c(uuid+seq+block) */
2846 +} journal_block_tag3_t;
2847 +
2848 typedef struct journal_block_tag_s
2849 {
2850 __be32 t_blocknr; /* The on-disk block number */
2851 @@ -187,9 +199,6 @@ typedef struct journal_block_tag_s
2852 __be32 t_blocknr_high; /* most-significant high 32bits. */
2853 } journal_block_tag_t;
2854
2855 -#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
2856 -#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))
2857 -
2858 /* Tail of descriptor block, for checksumming */
2859 struct jbd2_journal_block_tail {
2860 __be32 t_checksum; /* crc32c(uuid+descr_block) */
2861 @@ -284,6 +293,7 @@ typedef struct journal_superblock_s
2862 #define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
2863 #define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
2864 #define JBD2_FEATURE_INCOMPAT_CSUM_V2 0x00000008
2865 +#define JBD2_FEATURE_INCOMPAT_CSUM_V3 0x00000010
2866
2867 /* Features known to this kernel version: */
2868 #define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
2869 @@ -291,7 +301,8 @@ typedef struct journal_superblock_s
2870 #define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
2871 JBD2_FEATURE_INCOMPAT_64BIT | \
2872 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | \
2873 - JBD2_FEATURE_INCOMPAT_CSUM_V2)
2874 + JBD2_FEATURE_INCOMPAT_CSUM_V2 | \
2875 + JBD2_FEATURE_INCOMPAT_CSUM_V3)
2876
2877 #ifdef __KERNEL__
2878
2879 @@ -1296,6 +1307,15 @@ static inline int tid_geq(tid_t x, tid_t y)
2880 extern int jbd2_journal_blocks_per_page(struct inode *inode);
2881 extern size_t journal_tag_bytes(journal_t *journal);
2882
2883 +static inline int jbd2_journal_has_csum_v2or3(journal_t *journal)
2884 +{
2885 + if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2) ||
2886 + JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V3))
2887 + return 1;
2888 +
2889 + return 0;
2890 +}
2891 +
2892 /*
2893 * We reserve t_outstanding_credits >> JBD2_CONTROL_BLOCKS_SHIFT for
2894 * transaction control blocks.
2895 diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
2896 index b05963f09ebf..f5bfb1a80abe 100644
2897 --- a/include/linux/sunrpc/svc_xprt.h
2898 +++ b/include/linux/sunrpc/svc_xprt.h
2899 @@ -32,6 +32,7 @@ struct svc_xprt_class {
2900 struct svc_xprt_ops *xcl_ops;
2901 struct list_head xcl_list;
2902 u32 xcl_max_payload;
2903 + int xcl_ident;
2904 };
2905
2906 /*
2907 diff --git a/kernel/sched/core.c b/kernel/sched/core.c
2908 index 515e212421c0..677ebad70ce1 100644
2909 --- a/kernel/sched/core.c
2910 +++ b/kernel/sched/core.c
2911 @@ -3511,9 +3511,10 @@ static int _sched_setscheduler(struct task_struct *p, int policy,
2912 };
2913
2914 /*
2915 - * Fixup the legacy SCHED_RESET_ON_FORK hack
2916 + * Fixup the legacy SCHED_RESET_ON_FORK hack, except if
2917 + * the policy=-1 was passed by sched_setparam().
2918 */
2919 - if (policy & SCHED_RESET_ON_FORK) {
2920 + if ((policy != -1) && (policy & SCHED_RESET_ON_FORK)) {
2921 attr.sched_flags |= SCHED_FLAG_RESET_ON_FORK;
2922 policy &= ~SCHED_RESET_ON_FORK;
2923 attr.sched_policy = policy;
2924 diff --git a/mm/util.c b/mm/util.c
2925 index a24aa22f2473..c1010cb7ca0c 100644
2926 --- a/mm/util.c
2927 +++ b/mm/util.c
2928 @@ -275,17 +275,14 @@ pid_t vm_is_stack(struct task_struct *task,
2929
2930 if (in_group) {
2931 struct task_struct *t;
2932 - rcu_read_lock();
2933 - if (!pid_alive(task))
2934 - goto done;
2935
2936 - t = task;
2937 - do {
2938 + rcu_read_lock();
2939 + for_each_thread(task, t) {
2940 if (vm_is_stack_for_task(t, vma)) {
2941 ret = t->pid;
2942 goto done;
2943 }
2944 - } while_each_thread(task, t);
2945 + }
2946 done:
2947 rcu_read_unlock();
2948 }
2949 diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
2950 index d06cb8752dcd..5e8fe777772b 100644
2951 --- a/net/sunrpc/svcsock.c
2952 +++ b/net/sunrpc/svcsock.c
2953 @@ -685,6 +685,7 @@ static struct svc_xprt_class svc_udp_class = {
2954 .xcl_owner = THIS_MODULE,
2955 .xcl_ops = &svc_udp_ops,
2956 .xcl_max_payload = RPCSVC_MAXPAYLOAD_UDP,
2957 + .xcl_ident = XPRT_TRANSPORT_UDP,
2958 };
2959
2960 static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
2961 @@ -1279,6 +1280,7 @@ static struct svc_xprt_class svc_tcp_class = {
2962 .xcl_owner = THIS_MODULE,
2963 .xcl_ops = &svc_tcp_ops,
2964 .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP,
2965 + .xcl_ident = XPRT_TRANSPORT_TCP,
2966 };
2967
2968 void svc_init_xprt_sock(void)
2969 diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
2970 index 7d4df99f761f..03ac88431984 100644
2971 --- a/net/sunrpc/xprt.c
2972 +++ b/net/sunrpc/xprt.c
2973 @@ -1316,7 +1316,7 @@ struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
2974 }
2975 }
2976 spin_unlock(&xprt_list_lock);
2977 - printk(KERN_ERR "RPC: transport (%d) not supported\n", args->ident);
2978 + dprintk("RPC: transport (%d) not supported\n", args->ident);
2979 return ERR_PTR(-EIO);
2980
2981 found:
2982 diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
2983 index 62e4f9bcc387..ed36cb52cd86 100644
2984 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
2985 +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
2986 @@ -89,6 +89,7 @@ struct svc_xprt_class svc_rdma_class = {
2987 .xcl_owner = THIS_MODULE,
2988 .xcl_ops = &svc_rdma_ops,
2989 .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP,
2990 + .xcl_ident = XPRT_TRANSPORT_RDMA,
2991 };
2992
2993 struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
2994 diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
2995 index 8756c8e32922..46e563046bfb 100644
2996 --- a/sound/pci/Kconfig
2997 +++ b/sound/pci/Kconfig
2998 @@ -859,8 +859,8 @@ config SND_VIRTUOSO
2999 select SND_JACK if INPUT=y || INPUT=SND
3000 help
3001 Say Y here to include support for sound cards based on the
3002 - Asus AV66/AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, DS,
3003 - Essence ST (Deluxe), and Essence STX.
3004 + Asus AV66/AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, DS, DSX,
3005 + Essence ST (Deluxe), and Essence STX (II).
3006 Support for the HDAV1.3 (Deluxe) and HDAV1.3 Slim is experimental;
3007 for the Xense, missing.
3008
3009 diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
3010 index 46ecdbb9053f..d5843da4ae19 100644
3011 --- a/sound/pci/hda/patch_ca0132.c
3012 +++ b/sound/pci/hda/patch_ca0132.c
3013 @@ -4379,6 +4379,9 @@ static void ca0132_download_dsp(struct hda_codec *codec)
3014 return; /* NOP */
3015 #endif
3016
3017 + if (spec->dsp_state == DSP_DOWNLOAD_FAILED)
3018 + return; /* don't retry failures */
3019 +
3020 chipio_enable_clocks(codec);
3021 spec->dsp_state = DSP_DOWNLOADING;
3022 if (!ca0132_download_dsp_images(codec))
3023 @@ -4555,7 +4558,8 @@ static int ca0132_init(struct hda_codec *codec)
3024 struct auto_pin_cfg *cfg = &spec->autocfg;
3025 int i;
3026
3027 - spec->dsp_state = DSP_DOWNLOAD_INIT;
3028 + if (spec->dsp_state != DSP_DOWNLOAD_FAILED)
3029 + spec->dsp_state = DSP_DOWNLOAD_INIT;
3030 spec->curr_chip_addx = INVALID_CHIP_ADDRESS;
3031
3032 snd_hda_power_up(codec);
3033 @@ -4666,6 +4670,7 @@ static int patch_ca0132(struct hda_codec *codec)
3034 codec->spec = spec;
3035 spec->codec = codec;
3036
3037 + spec->dsp_state = DSP_DOWNLOAD_INIT;
3038 spec->num_mixers = 1;
3039 spec->mixers[0] = ca0132_mixer;
3040
3041 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3042 index 2a16a90fd952..b35dbe25a6e3 100644
3043 --- a/sound/pci/hda/patch_realtek.c
3044 +++ b/sound/pci/hda/patch_realtek.c
3045 @@ -180,6 +180,8 @@ static void alc_fix_pll(struct hda_codec *codec)
3046 spec->pll_coef_idx);
3047 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
3048 AC_VERB_GET_PROC_COEF, 0);
3049 + if (val == -1)
3050 + return;
3051 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
3052 spec->pll_coef_idx);
3053 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
3054 @@ -2765,6 +2767,8 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
3055 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3056 {
3057 int val = alc_read_coef_idx(codec, 0x04);
3058 + if (val == -1)
3059 + return;
3060 if (power_up)
3061 val |= 1 << 11;
3062 else
3063 @@ -3064,6 +3068,15 @@ static int alc269_resume(struct hda_codec *codec)
3064 snd_hda_codec_resume_cache(codec);
3065 alc_inv_dmic_sync(codec, true);
3066 hda_call_check_power_status(codec, 0x01);
3067 +
3068 + /* on some machine, the BIOS will clear the codec gpio data when enter
3069 + * suspend, and won't restore the data after resume, so we restore it
3070 + * in the driver.
3071 + */
3072 + if (spec->gpio_led)
3073 + snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA,
3074 + spec->gpio_led);
3075 +
3076 if (spec->has_alc5505_dsp)
3077 alc5505_dsp_resume(codec);
3078
3079 @@ -4435,6 +4448,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3080 SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1),
3081 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
3082 /* ALC282 */
3083 + SND_PCI_QUIRK(0x103c, 0x2191, "HP Touchsmart 14", ALC269_FIXUP_HP_MUTE_LED_MIC1),
3084 + SND_PCI_QUIRK(0x103c, 0x2192, "HP Touchsmart 15", ALC269_FIXUP_HP_MUTE_LED_MIC1),
3085 SND_PCI_QUIRK(0x103c, 0x220d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
3086 SND_PCI_QUIRK(0x103c, 0x220e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
3087 SND_PCI_QUIRK(0x103c, 0x220f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
3088 @@ -4633,27 +4648,30 @@ static void alc269_fill_coef(struct hda_codec *codec)
3089 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
3090 val = alc_read_coef_idx(codec, 0x04);
3091 /* Power up output pin */
3092 - alc_write_coef_idx(codec, 0x04, val | (1<<11));
3093 + if (val != -1)
3094 + alc_write_coef_idx(codec, 0x04, val | (1<<11));
3095 }
3096
3097 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
3098 val = alc_read_coef_idx(codec, 0xd);
3099 - if ((val & 0x0c00) >> 10 != 0x1) {
3100 + if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
3101 /* Capless ramp up clock control */
3102 alc_write_coef_idx(codec, 0xd, val | (1<<10));
3103 }
3104 val = alc_read_coef_idx(codec, 0x17);
3105 - if ((val & 0x01c0) >> 6 != 0x4) {
3106 + if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
3107 /* Class D power on reset */
3108 alc_write_coef_idx(codec, 0x17, val | (1<<7));
3109 }
3110 }
3111
3112 val = alc_read_coef_idx(codec, 0xd); /* Class D */
3113 - alc_write_coef_idx(codec, 0xd, val | (1<<14));
3114 + if (val != -1)
3115 + alc_write_coef_idx(codec, 0xd, val | (1<<14));
3116
3117 val = alc_read_coef_idx(codec, 0x4); /* HP */
3118 - alc_write_coef_idx(codec, 0x4, val | (1<<11));
3119 + if (val != -1)
3120 + alc_write_coef_idx(codec, 0x4, val | (1<<11));
3121 }
3122
3123 /*
3124 diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
3125 index 3bc29c9b2529..978df990f27c 100644
3126 --- a/sound/pci/hda/patch_sigmatel.c
3127 +++ b/sound/pci/hda/patch_sigmatel.c
3128 @@ -84,6 +84,7 @@ enum {
3129 STAC_DELL_EQ,
3130 STAC_ALIENWARE_M17X,
3131 STAC_92HD89XX_HP_FRONT_JACK,
3132 + STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK,
3133 STAC_92HD73XX_MODELS
3134 };
3135
3136 @@ -1803,6 +1804,11 @@ static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = {
3137 {}
3138 };
3139
3140 +static const struct hda_pintbl stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs[] = {
3141 + { 0x0e, 0x400000f0 },
3142 + {}
3143 +};
3144 +
3145 static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
3146 const struct hda_fixup *fix, int action)
3147 {
3148 @@ -1925,6 +1931,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = {
3149 [STAC_92HD89XX_HP_FRONT_JACK] = {
3150 .type = HDA_FIXUP_PINS,
3151 .v.pins = stac92hd89xx_hp_front_jack_pin_configs,
3152 + },
3153 + [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = {
3154 + .type = HDA_FIXUP_PINS,
3155 + .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs,
3156 }
3157 };
3158
3159 @@ -1985,6 +1995,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
3160 "Alienware M17x", STAC_ALIENWARE_M17X),
3161 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
3162 "Alienware M17x R3", STAC_DELL_EQ),
3163 + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927,
3164 + "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK),
3165 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
3166 "unknown HP", STAC_92HD89XX_HP_FRONT_JACK),
3167 {} /* terminator */
3168 diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
3169 index 64b9fda5f04a..dbbbacfd535e 100644
3170 --- a/sound/pci/oxygen/virtuoso.c
3171 +++ b/sound/pci/oxygen/virtuoso.c
3172 @@ -53,6 +53,7 @@ static DEFINE_PCI_DEVICE_TABLE(xonar_ids) = {
3173 { OXYGEN_PCI_SUBID(0x1043, 0x835e) },
3174 { OXYGEN_PCI_SUBID(0x1043, 0x838e) },
3175 { OXYGEN_PCI_SUBID(0x1043, 0x8522) },
3176 + { OXYGEN_PCI_SUBID(0x1043, 0x85f4) },
3177 { OXYGEN_PCI_SUBID_BROKEN_EEPROM },
3178 { }
3179 };
3180 diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c
3181 index c8c7f2c9b355..e02605931669 100644
3182 --- a/sound/pci/oxygen/xonar_pcm179x.c
3183 +++ b/sound/pci/oxygen/xonar_pcm179x.c
3184 @@ -100,8 +100,8 @@
3185 */
3186
3187 /*
3188 - * Xonar Essence ST (Deluxe)/STX
3189 - * -----------------------------
3190 + * Xonar Essence ST (Deluxe)/STX (II)
3191 + * ----------------------------------
3192 *
3193 * CMI8788:
3194 *
3195 @@ -1138,6 +1138,14 @@ int get_xonar_pcm179x_model(struct oxygen *chip,
3196 chip->model.resume = xonar_stx_resume;
3197 chip->model.set_dac_params = set_pcm1796_params;
3198 break;
3199 + case 0x85f4:
3200 + chip->model = model_xonar_st;
3201 + /* TODO: daughterboard support */
3202 + chip->model.shortname = "Xonar STX II";
3203 + chip->model.init = xonar_stx_init;
3204 + chip->model.resume = xonar_stx_resume;
3205 + chip->model.set_dac_params = set_pcm1796_params;
3206 + break;
3207 default:
3208 return -EINVAL;
3209 }
3210 diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
3211 index f652b10ce905..223c47b33ba3 100644
3212 --- a/sound/usb/quirks-table.h
3213 +++ b/sound/usb/quirks-table.h
3214 @@ -1581,6 +1581,35 @@ YAMAHA_DEVICE(0x7010, "UB99"),
3215 }
3216 },
3217 {
3218 + /* BOSS ME-25 */
3219 + USB_DEVICE(0x0582, 0x0113),
3220 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
3221 + .ifnum = QUIRK_ANY_INTERFACE,
3222 + .type = QUIRK_COMPOSITE,
3223 + .data = (const struct snd_usb_audio_quirk[]) {
3224 + {
3225 + .ifnum = 0,
3226 + .type = QUIRK_AUDIO_STANDARD_INTERFACE
3227 + },
3228 + {
3229 + .ifnum = 1,
3230 + .type = QUIRK_AUDIO_STANDARD_INTERFACE
3231 + },
3232 + {
3233 + .ifnum = 2,
3234 + .type = QUIRK_MIDI_FIXED_ENDPOINT,
3235 + .data = & (const struct snd_usb_midi_endpoint_info) {
3236 + .out_cables = 0x0001,
3237 + .in_cables = 0x0001
3238 + }
3239 + },
3240 + {
3241 + .ifnum = -1
3242 + }
3243 + }
3244 + }
3245 +},
3246 +{
3247 /* only 44.1 kHz works at the moment */
3248 USB_DEVICE(0x0582, 0x0120),
3249 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
3250 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
3251 index 89730707614c..c64a3d96db22 100644
3252 --- a/sound/usb/quirks.c
3253 +++ b/sound/usb/quirks.c
3254 @@ -666,7 +666,7 @@ static int snd_usb_gamecon780_boot_quirk(struct usb_device *dev)
3255 /* set the initial volume and don't change; other values are either
3256 * too loud or silent due to firmware bug (bko#65251)
3257 */
3258 - u8 buf[2] = { 0x74, 0xdc };
3259 + u8 buf[2] = { 0x74, 0xe3 };
3260 return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
3261 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
3262 UAC_FU_VOLUME << 8, 9 << 8, buf, 2);
3263 diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
3264 index 8c805a071507..b47541dd798f 100644
3265 --- a/virt/kvm/ioapic.c
3266 +++ b/virt/kvm/ioapic.c
3267 @@ -203,10 +203,9 @@ void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap,
3268 spin_lock(&ioapic->lock);
3269 for (index = 0; index < IOAPIC_NUM_PINS; index++) {
3270 e = &ioapic->redirtbl[index];
3271 - if (!e->fields.mask &&
3272 - (e->fields.trig_mode == IOAPIC_LEVEL_TRIG ||
3273 - kvm_irq_has_notifier(ioapic->kvm, KVM_IRQCHIP_IOAPIC,
3274 - index) || index == RTC_GSI)) {
3275 + if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG ||
3276 + kvm_irq_has_notifier(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index) ||
3277 + index == RTC_GSI) {
3278 if (kvm_apic_match_dest(vcpu, NULL, 0,
3279 e->fields.dest_id, e->fields.dest_mode)) {
3280 __set_bit(e->fields.vector,
3281 diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
3282 index 0df7d4b34dfe..714b94932312 100644
3283 --- a/virt/kvm/iommu.c
3284 +++ b/virt/kvm/iommu.c
3285 @@ -61,6 +61,14 @@ static pfn_t kvm_pin_pages(struct kvm_memory_slot *slot, gfn_t gfn,
3286 return pfn;
3287 }
3288
3289 +static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages)
3290 +{
3291 + unsigned long i;
3292 +
3293 + for (i = 0; i < npages; ++i)
3294 + kvm_release_pfn_clean(pfn + i);
3295 +}
3296 +
3297 int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
3298 {
3299 gfn_t gfn, end_gfn;
3300 @@ -123,6 +131,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
3301 if (r) {
3302 printk(KERN_ERR "kvm_iommu_map_address:"
3303 "iommu failed to map pfn=%llx\n", pfn);
3304 + kvm_unpin_pages(kvm, pfn, page_size);
3305 goto unmap_pages;
3306 }
3307
3308 @@ -134,7 +143,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
3309 return 0;
3310
3311 unmap_pages:
3312 - kvm_iommu_put_pages(kvm, slot->base_gfn, gfn);
3313 + kvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn);
3314 return r;
3315 }
3316
3317 @@ -266,14 +275,6 @@ out_unlock:
3318 return r;
3319 }
3320
3321 -static void kvm_unpin_pages(struct kvm *kvm, pfn_t pfn, unsigned long npages)
3322 -{
3323 - unsigned long i;
3324 -
3325 - for (i = 0; i < npages; ++i)
3326 - kvm_release_pfn_clean(pfn + i);
3327 -}
3328 -
3329 static void kvm_iommu_put_pages(struct kvm *kvm,
3330 gfn_t base_gfn, unsigned long npages)
3331 {