Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Sat, 03 Feb 2018 21:22:28
Message-Id: 1517692935.e42ba89e229f13dcf6d2c76301b94f4b18b7ddbf.mpagano@gentoo
1 commit: e42ba89e229f13dcf6d2c76301b94f4b18b7ddbf
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 3 21:22:15 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 3 21:22:15 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e42ba89e
7
8 Linux patch 4.9.80
9
10 0000_README | 4 +
11 1079_linux-4.9.80.patch | 2366 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 2370 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index d0865d5..0abed7c 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -359,6 +359,10 @@ Patch: 1078_linux-4.9.79.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.79
21
22 +Patch: 1079_linux-4.9.80.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.80
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1079_linux-4.9.80.patch b/1079_linux-4.9.80.patch
31 new file mode 100644
32 index 0000000..26370c4
33 --- /dev/null
34 +++ b/1079_linux-4.9.80.patch
35 @@ -0,0 +1,2366 @@
36 +diff --git a/Makefile b/Makefile
37 +index 4a7e6dff1c2e..9550b6939076 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,6 +1,6 @@
41 + VERSION = 4
42 + PATCHLEVEL = 9
43 +-SUBLEVEL = 79
44 ++SUBLEVEL = 80
45 + EXTRAVERSION =
46 + NAME = Roaring Lionus
47 +
48 +diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
49 +index 7c9e0fae9bb9..65e0db1d3bd7 100644
50 +--- a/arch/arm/boot/dts/bcm-nsp.dtsi
51 ++++ b/arch/arm/boot/dts/bcm-nsp.dtsi
52 +@@ -85,7 +85,7 @@
53 + timer@20200 {
54 + compatible = "arm,cortex-a9-global-timer";
55 + reg = <0x20200 0x100>;
56 +- interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
57 ++ interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>;
58 + clocks = <&periph_clk>;
59 + };
60 +
61 +@@ -93,7 +93,7 @@
62 + compatible = "arm,cortex-a9-twd-timer";
63 + reg = <0x20600 0x20>;
64 + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) |
65 +- IRQ_TYPE_LEVEL_HIGH)>;
66 ++ IRQ_TYPE_EDGE_RISING)>;
67 + clocks = <&periph_clk>;
68 + };
69 +
70 +diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
71 +index aa8b0672f87a..d9ae404f08c9 100644
72 +--- a/arch/x86/crypto/aesni-intel_glue.c
73 ++++ b/arch/x86/crypto/aesni-intel_glue.c
74 +@@ -906,7 +906,7 @@ static int helper_rfc4106_encrypt(struct aead_request *req)
75 +
76 + if (sg_is_last(req->src) &&
77 + req->src->offset + req->src->length <= PAGE_SIZE &&
78 +- sg_is_last(req->dst) &&
79 +++ sg_is_last(req->dst) && req->dst->length &&
80 + req->dst->offset + req->dst->length <= PAGE_SIZE) {
81 + one_entry_in_sg = 1;
82 + scatterwalk_start(&src_sg_walk, req->src);
83 +diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
84 +index cbd1d44da2d3..20cfeeb681c6 100644
85 +--- a/arch/x86/include/asm/kvm_host.h
86 ++++ b/arch/x86/include/asm/kvm_host.h
87 +@@ -1113,7 +1113,8 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, unsigned long cr2,
88 + static inline int emulate_instruction(struct kvm_vcpu *vcpu,
89 + int emulation_type)
90 + {
91 +- return x86_emulate_instruction(vcpu, 0, emulation_type, NULL, 0);
92 ++ return x86_emulate_instruction(vcpu, 0,
93 ++ emulation_type | EMULTYPE_NO_REEXECUTE, NULL, 0);
94 + }
95 +
96 + void kvm_enable_efer_bits(u64);
97 +diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
98 +index c8f8dd8ca0a1..6f5a3b076341 100644
99 +--- a/arch/x86/kvm/emulate.c
100 ++++ b/arch/x86/kvm/emulate.c
101 +@@ -4990,6 +4990,8 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
102 + bool op_prefix = false;
103 + bool has_seg_override = false;
104 + struct opcode opcode;
105 ++ u16 dummy;
106 ++ struct desc_struct desc;
107 +
108 + ctxt->memop.type = OP_NONE;
109 + ctxt->memopp = NULL;
110 +@@ -5008,6 +5010,11 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
111 + switch (mode) {
112 + case X86EMUL_MODE_REAL:
113 + case X86EMUL_MODE_VM86:
114 ++ def_op_bytes = def_ad_bytes = 2;
115 ++ ctxt->ops->get_segment(ctxt, &dummy, &desc, NULL, VCPU_SREG_CS);
116 ++ if (desc.d)
117 ++ def_op_bytes = def_ad_bytes = 4;
118 ++ break;
119 + case X86EMUL_MODE_PROT16:
120 + def_op_bytes = def_ad_bytes = 2;
121 + break;
122 +diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
123 +index 6e219e5c07d2..5f810bb80802 100644
124 +--- a/arch/x86/kvm/ioapic.c
125 ++++ b/arch/x86/kvm/ioapic.c
126 +@@ -257,8 +257,7 @@ void kvm_ioapic_scan_entry(struct kvm_vcpu *vcpu, ulong *ioapic_handled_vectors)
127 + index == RTC_GSI) {
128 + if (kvm_apic_match_dest(vcpu, NULL, 0,
129 + e->fields.dest_id, e->fields.dest_mode) ||
130 +- (e->fields.trig_mode == IOAPIC_EDGE_TRIG &&
131 +- kvm_apic_pending_eoi(vcpu, e->fields.vector)))
132 ++ kvm_apic_pending_eoi(vcpu, e->fields.vector))
133 + __set_bit(e->fields.vector,
134 + ioapic_handled_vectors);
135 + }
136 +@@ -279,6 +278,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
137 + {
138 + unsigned index;
139 + bool mask_before, mask_after;
140 ++ int old_remote_irr, old_delivery_status;
141 + union kvm_ioapic_redirect_entry *e;
142 +
143 + switch (ioapic->ioregsel) {
144 +@@ -301,14 +301,28 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
145 + return;
146 + e = &ioapic->redirtbl[index];
147 + mask_before = e->fields.mask;
148 ++ /* Preserve read-only fields */
149 ++ old_remote_irr = e->fields.remote_irr;
150 ++ old_delivery_status = e->fields.delivery_status;
151 + if (ioapic->ioregsel & 1) {
152 + e->bits &= 0xffffffff;
153 + e->bits |= (u64) val << 32;
154 + } else {
155 + e->bits &= ~0xffffffffULL;
156 + e->bits |= (u32) val;
157 +- e->fields.remote_irr = 0;
158 + }
159 ++ e->fields.remote_irr = old_remote_irr;
160 ++ e->fields.delivery_status = old_delivery_status;
161 ++
162 ++ /*
163 ++ * Some OSes (Linux, Xen) assume that Remote IRR bit will
164 ++ * be cleared by IOAPIC hardware when the entry is configured
165 ++ * as edge-triggered. This behavior is used to simulate an
166 ++ * explicit EOI on IOAPICs that don't have the EOI register.
167 ++ */
168 ++ if (e->fields.trig_mode == IOAPIC_EDGE_TRIG)
169 ++ e->fields.remote_irr = 0;
170 ++
171 + mask_after = e->fields.mask;
172 + if (mask_before != mask_after)
173 + kvm_fire_mask_notifiers(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index, mask_after);
174 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
175 +index 3ca6d15994e4..178a344f55f8 100644
176 +--- a/arch/x86/kvm/vmx.c
177 ++++ b/arch/x86/kvm/vmx.c
178 +@@ -5194,7 +5194,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
179 + vmcs_write64(GUEST_IA32_DEBUGCTL, 0);
180 + }
181 +
182 +- vmcs_writel(GUEST_RFLAGS, 0x02);
183 ++ kvm_set_rflags(vcpu, X86_EFLAGS_FIXED);
184 + kvm_rip_write(vcpu, 0xfff0);
185 +
186 + vmcs_writel(GUEST_GDTR_BASE, 0);
187 +@@ -6257,7 +6257,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
188 + if (test_bit(KVM_REQ_EVENT, &vcpu->requests))
189 + return 1;
190 +
191 +- err = emulate_instruction(vcpu, EMULTYPE_NO_REEXECUTE);
192 ++ err = emulate_instruction(vcpu, 0);
193 +
194 + if (err == EMULATE_USER_EXIT) {
195 + ++vcpu->stat.mmio_exits;
196 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
197 +index d3f80cccb9aa..e023ef981feb 100644
198 +--- a/arch/x86/kvm/x86.c
199 ++++ b/arch/x86/kvm/x86.c
200 +@@ -1751,10 +1751,13 @@ static u64 __get_kvmclock_ns(struct kvm *kvm)
201 + /* both __this_cpu_read() and rdtsc() should be on the same cpu */
202 + get_cpu();
203 +
204 +- kvm_get_time_scale(NSEC_PER_SEC, __this_cpu_read(cpu_tsc_khz) * 1000LL,
205 +- &hv_clock.tsc_shift,
206 +- &hv_clock.tsc_to_system_mul);
207 +- ret = __pvclock_read_cycles(&hv_clock, rdtsc());
208 ++ if (__this_cpu_read(cpu_tsc_khz)) {
209 ++ kvm_get_time_scale(NSEC_PER_SEC, __this_cpu_read(cpu_tsc_khz) * 1000LL,
210 ++ &hv_clock.tsc_shift,
211 ++ &hv_clock.tsc_to_system_mul);
212 ++ ret = __pvclock_read_cycles(&hv_clock, rdtsc());
213 ++ } else
214 ++ ret = ktime_get_boot_ns() + ka->kvmclock_offset;
215 +
216 + put_cpu();
217 +
218 +@@ -5308,7 +5311,7 @@ static int handle_emulation_failure(struct kvm_vcpu *vcpu)
219 + vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
220 + vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
221 + vcpu->run->internal.ndata = 0;
222 +- r = EMULATE_FAIL;
223 ++ r = EMULATE_USER_EXIT;
224 + }
225 + kvm_queue_exception(vcpu, UD_VECTOR);
226 +
227 +diff --git a/crypto/Kconfig b/crypto/Kconfig
228 +index 84d71482bf08..ab0d93ab5695 100644
229 +--- a/crypto/Kconfig
230 ++++ b/crypto/Kconfig
231 +@@ -120,7 +120,7 @@ config CRYPTO_DH
232 +
233 + config CRYPTO_ECDH
234 + tristate "ECDH algorithm"
235 +- select CRYTPO_KPP
236 ++ select CRYPTO_KPP
237 + help
238 + Generic implementation of the ECDH algorithm
239 +
240 +diff --git a/crypto/af_alg.c b/crypto/af_alg.c
241 +index f5e18c2a4852..ca50eeb13097 100644
242 +--- a/crypto/af_alg.c
243 ++++ b/crypto/af_alg.c
244 +@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(af_alg_release_parent);
245 +
246 + static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
247 + {
248 +- const u32 forbidden = CRYPTO_ALG_INTERNAL;
249 ++ const u32 allowed = CRYPTO_ALG_KERN_DRIVER_ONLY;
250 + struct sock *sk = sock->sk;
251 + struct alg_sock *ask = alg_sk(sk);
252 + struct sockaddr_alg *sa = (void *)uaddr;
253 +@@ -157,6 +157,10 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
254 + void *private;
255 + int err;
256 +
257 ++ /* If caller uses non-allowed flag, return error. */
258 ++ if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
259 ++ return -EINVAL;
260 ++
261 + if (sock->state == SS_CONNECTED)
262 + return -EINVAL;
263 +
264 +@@ -175,9 +179,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
265 + if (IS_ERR(type))
266 + return PTR_ERR(type);
267 +
268 +- private = type->bind(sa->salg_name,
269 +- sa->salg_feat & ~forbidden,
270 +- sa->salg_mask & ~forbidden);
271 ++ private = type->bind(sa->salg_name, sa->salg_feat, sa->salg_mask);
272 + if (IS_ERR(private)) {
273 + module_put(type->owner);
274 + return PTR_ERR(private);
275 +diff --git a/crypto/sha3_generic.c b/crypto/sha3_generic.c
276 +index 7e8ed96236ce..a68be626017c 100644
277 +--- a/crypto/sha3_generic.c
278 ++++ b/crypto/sha3_generic.c
279 +@@ -18,6 +18,7 @@
280 + #include <linux/types.h>
281 + #include <crypto/sha3.h>
282 + #include <asm/byteorder.h>
283 ++#include <asm/unaligned.h>
284 +
285 + #define KECCAK_ROUNDS 24
286 +
287 +@@ -149,7 +150,7 @@ static int sha3_update(struct shash_desc *desc, const u8 *data,
288 + unsigned int i;
289 +
290 + for (i = 0; i < sctx->rsizw; i++)
291 +- sctx->st[i] ^= ((u64 *) src)[i];
292 ++ sctx->st[i] ^= get_unaligned_le64(src + 8 * i);
293 + keccakf(sctx->st);
294 +
295 + done += sctx->rsiz;
296 +@@ -174,7 +175,7 @@ static int sha3_final(struct shash_desc *desc, u8 *out)
297 + sctx->buf[sctx->rsiz - 1] |= 0x80;
298 +
299 + for (i = 0; i < sctx->rsizw; i++)
300 +- sctx->st[i] ^= ((u64 *) sctx->buf)[i];
301 ++ sctx->st[i] ^= get_unaligned_le64(sctx->buf + 8 * i);
302 +
303 + keccakf(sctx->st);
304 +
305 +diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
306 +index 7b2c48fde4e2..201c7ceb7052 100644
307 +--- a/drivers/acpi/device_sysfs.c
308 ++++ b/drivers/acpi/device_sysfs.c
309 +@@ -146,6 +146,10 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,
310 + int count;
311 + struct acpi_hardware_id *id;
312 +
313 ++ /* Avoid unnecessarily loading modules for non present devices. */
314 ++ if (!acpi_device_is_present(acpi_dev))
315 ++ return 0;
316 ++
317 + /*
318 + * Since we skip ACPI_DT_NAMESPACE_HID from the modalias below, 0 should
319 + * be returned if ACPI_DT_NAMESPACE_HID is the only ACPI/PNP ID in the
320 +diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
321 +index 10e1b9eee10e..f03cf1df8d6b 100644
322 +--- a/drivers/auxdisplay/Kconfig
323 ++++ b/drivers/auxdisplay/Kconfig
324 +@@ -121,6 +121,7 @@ config CFAG12864B_RATE
325 +
326 + config IMG_ASCII_LCD
327 + tristate "Imagination Technologies ASCII LCD Display"
328 ++ depends on HAS_IOMEM
329 + default y if MIPS_MALTA || MIPS_SEAD3
330 + select SYSCON
331 + help
332 +diff --git a/drivers/block/loop.c b/drivers/block/loop.c
333 +index 24d6cefceb32..402254d26247 100644
334 +--- a/drivers/block/loop.c
335 ++++ b/drivers/block/loop.c
336 +@@ -1558,9 +1558,8 @@ static int lo_open(struct block_device *bdev, fmode_t mode)
337 + return err;
338 + }
339 +
340 +-static void lo_release(struct gendisk *disk, fmode_t mode)
341 ++static void __lo_release(struct loop_device *lo)
342 + {
343 +- struct loop_device *lo = disk->private_data;
344 + int err;
345 +
346 + if (atomic_dec_return(&lo->lo_refcnt))
347 +@@ -1586,6 +1585,13 @@ static void lo_release(struct gendisk *disk, fmode_t mode)
348 + mutex_unlock(&lo->lo_ctl_mutex);
349 + }
350 +
351 ++static void lo_release(struct gendisk *disk, fmode_t mode)
352 ++{
353 ++ mutex_lock(&loop_index_mutex);
354 ++ __lo_release(disk->private_data);
355 ++ mutex_unlock(&loop_index_mutex);
356 ++}
357 ++
358 + static const struct block_device_operations lo_fops = {
359 + .owner = THIS_MODULE,
360 + .open = lo_open,
361 +diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
362 +index d8b164a7c4e5..cac26fb22891 100644
363 +--- a/drivers/cpufreq/Kconfig
364 ++++ b/drivers/cpufreq/Kconfig
365 +@@ -273,6 +273,7 @@ endif
366 + if MIPS
367 + config LOONGSON2_CPUFREQ
368 + tristate "Loongson2 CPUFreq Driver"
369 ++ depends on LEMOTE_MACH2F
370 + help
371 + This option adds a CPUFreq driver for loongson processors which
372 + support software configurable cpu frequency.
373 +@@ -285,6 +286,7 @@ config LOONGSON2_CPUFREQ
374 +
375 + config LOONGSON1_CPUFREQ
376 + tristate "Loongson1 CPUFreq Driver"
377 ++ depends on LOONGSON1_LS1B
378 + help
379 + This option adds a CPUFreq driver for loongson1 processors which
380 + support software configurable cpu frequency.
381 +diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c
382 +index dc37dbe4b46d..a83e97e15c14 100644
383 +--- a/drivers/gpio/gpio-ath79.c
384 ++++ b/drivers/gpio/gpio-ath79.c
385 +@@ -323,3 +323,6 @@ static struct platform_driver ath79_gpio_driver = {
386 + };
387 +
388 + module_platform_driver(ath79_gpio_driver);
389 ++
390 ++MODULE_DESCRIPTION("Atheros AR71XX/AR724X/AR913X GPIO API support");
391 ++MODULE_LICENSE("GPL v2");
392 +diff --git a/drivers/gpio/gpio-iop.c b/drivers/gpio/gpio-iop.c
393 +index 98c7ff2a76e7..8d62db447ec1 100644
394 +--- a/drivers/gpio/gpio-iop.c
395 ++++ b/drivers/gpio/gpio-iop.c
396 +@@ -58,3 +58,7 @@ static int __init iop3xx_gpio_init(void)
397 + return platform_driver_register(&iop3xx_gpio_driver);
398 + }
399 + arch_initcall(iop3xx_gpio_init);
400 ++
401 ++MODULE_DESCRIPTION("GPIO handling for Intel IOP3xx processors");
402 ++MODULE_AUTHOR("Lennert Buytenhek <buytenh@××××××××××.org>");
403 ++MODULE_LICENSE("GPL");
404 +diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
405 +index adba614b3965..abb5a2752511 100644
406 +--- a/drivers/gpio/gpio-stmpe.c
407 ++++ b/drivers/gpio/gpio-stmpe.c
408 +@@ -190,6 +190,16 @@ static void stmpe_gpio_irq_sync_unlock(struct irq_data *d)
409 + };
410 + int i, j;
411 +
412 ++ /*
413 ++ * STMPE1600: to be able to get IRQ from pins,
414 ++ * a read must be done on GPMR register, or a write in
415 ++ * GPSR or GPCR registers
416 ++ */
417 ++ if (stmpe->partnum == STMPE1600) {
418 ++ stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB]);
419 ++ stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB]);
420 ++ }
421 ++
422 + for (i = 0; i < CACHE_NR_REGS; i++) {
423 + /* STMPE801 and STMPE1600 don't have RE and FE registers */
424 + if ((stmpe->partnum == STMPE801 ||
425 +@@ -227,21 +237,11 @@ static void stmpe_gpio_irq_unmask(struct irq_data *d)
426 + {
427 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
428 + struct stmpe_gpio *stmpe_gpio = gpiochip_get_data(gc);
429 +- struct stmpe *stmpe = stmpe_gpio->stmpe;
430 + int offset = d->hwirq;
431 + int regoffset = offset / 8;
432 + int mask = BIT(offset % 8);
433 +
434 + stmpe_gpio->regs[REG_IE][regoffset] |= mask;
435 +-
436 +- /*
437 +- * STMPE1600 workaround: to be able to get IRQ from pins,
438 +- * a read must be done on GPMR register, or a write in
439 +- * GPSR or GPCR registers
440 +- */
441 +- if (stmpe->partnum == STMPE1600)
442 +- stmpe_reg_read(stmpe,
443 +- stmpe->regs[STMPE_IDX_GPMR_LSB + regoffset]);
444 + }
445 +
446 + static void stmpe_dbg_show_one(struct seq_file *s,
447 +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
448 +index 063d176baa24..f3c3680963b9 100644
449 +--- a/drivers/gpio/gpiolib.c
450 ++++ b/drivers/gpio/gpiolib.c
451 +@@ -705,6 +705,9 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p)
452 + struct gpioevent_data ge;
453 + int ret, level;
454 +
455 ++ /* Do not leak kernel stack to userspace */
456 ++ memset(&ge, 0, sizeof(ge));
457 ++
458 + ge.timestamp = ktime_get_real_ns();
459 + level = gpiod_get_value_cansleep(le->desc);
460 +
461 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
462 +index 1a0a5f7cccbc..47951f4775b9 100644
463 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
464 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
465 +@@ -367,29 +367,50 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd)
466 + {
467 + struct amdgpu_device *adev = get_amdgpu_device(kgd);
468 + struct cik_sdma_rlc_registers *m;
469 ++ unsigned long end_jiffies;
470 + uint32_t sdma_base_addr;
471 ++ uint32_t data;
472 +
473 + m = get_sdma_mqd(mqd);
474 + sdma_base_addr = get_sdma_base_addr(m);
475 +
476 +- WREG32(sdma_base_addr + mmSDMA0_RLC0_VIRTUAL_ADDR,
477 +- m->sdma_rlc_virtual_addr);
478 ++ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,
479 ++ m->sdma_rlc_rb_cntl & (~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK));
480 +
481 +- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE,
482 +- m->sdma_rlc_rb_base);
483 ++ end_jiffies = msecs_to_jiffies(2000) + jiffies;
484 ++ while (true) {
485 ++ data = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);
486 ++ if (data & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)
487 ++ break;
488 ++ if (time_after(jiffies, end_jiffies))
489 ++ return -ETIME;
490 ++ usleep_range(500, 1000);
491 ++ }
492 ++ if (m->sdma_engine_id) {
493 ++ data = RREG32(mmSDMA1_GFX_CONTEXT_CNTL);
494 ++ data = REG_SET_FIELD(data, SDMA1_GFX_CONTEXT_CNTL,
495 ++ RESUME_CTX, 0);
496 ++ WREG32(mmSDMA1_GFX_CONTEXT_CNTL, data);
497 ++ } else {
498 ++ data = RREG32(mmSDMA0_GFX_CONTEXT_CNTL);
499 ++ data = REG_SET_FIELD(data, SDMA0_GFX_CONTEXT_CNTL,
500 ++ RESUME_CTX, 0);
501 ++ WREG32(mmSDMA0_GFX_CONTEXT_CNTL, data);
502 ++ }
503 +
504 ++ WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL,
505 ++ m->sdma_rlc_doorbell);
506 ++ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR, 0);
507 ++ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR, 0);
508 ++ WREG32(sdma_base_addr + mmSDMA0_RLC0_VIRTUAL_ADDR,
509 ++ m->sdma_rlc_virtual_addr);
510 ++ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE, m->sdma_rlc_rb_base);
511 + WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE_HI,
512 + m->sdma_rlc_rb_base_hi);
513 +-
514 + WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_LO,
515 + m->sdma_rlc_rb_rptr_addr_lo);
516 +-
517 + WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_HI,
518 + m->sdma_rlc_rb_rptr_addr_hi);
519 +-
520 +- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL,
521 +- m->sdma_rlc_doorbell);
522 +-
523 + WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,
524 + m->sdma_rlc_rb_cntl);
525 +
526 +@@ -493,9 +514,9 @@ static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd,
527 + }
528 +
529 + WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL, 0);
530 +- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR, 0);
531 +- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR, 0);
532 +- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE, 0);
533 ++ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,
534 ++ RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL) |
535 ++ SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK);
536 +
537 + return 0;
538 + }
539 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
540 +index f26d1fd53bef..cb505f66d3aa 100644
541 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
542 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
543 +@@ -416,6 +416,10 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
544 + if (candidate == lobj)
545 + break;
546 +
547 ++ /* We can't move pinned BOs here */
548 ++ if (bo->pin_count)
549 ++ continue;
550 ++
551 + other = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
552 +
553 + /* Check if this BO is in one of the domains we need space for */
554 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
555 +index d83de985e88c..8577a563600f 100644
556 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
557 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c
558 +@@ -215,8 +215,8 @@ static int update_mqd_sdma(struct mqd_manager *mm, void *mqd,
559 + BUG_ON(!mm || !mqd || !q);
560 +
561 + m = get_sdma_mqd(mqd);
562 +- m->sdma_rlc_rb_cntl = ffs(q->queue_size / sizeof(unsigned int)) <<
563 +- SDMA0_RLC0_RB_CNTL__RB_SIZE__SHIFT |
564 ++ m->sdma_rlc_rb_cntl = (ffs(q->queue_size / sizeof(unsigned int)) - 1)
565 ++ << SDMA0_RLC0_RB_CNTL__RB_SIZE__SHIFT |
566 + q->vmid << SDMA0_RLC0_RB_CNTL__RB_VMID__SHIFT |
567 + 1 << SDMA0_RLC0_RB_CNTL__RPTR_WRITEBACK_ENABLE__SHIFT |
568 + 6 << SDMA0_RLC0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT;
569 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
570 +index e1fb40b84c72..5425c68d0287 100644
571 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
572 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
573 +@@ -205,6 +205,24 @@ int pqm_create_queue(struct process_queue_manager *pqm,
574 +
575 + switch (type) {
576 + case KFD_QUEUE_TYPE_SDMA:
577 ++ if (dev->dqm->queue_count >=
578 ++ CIK_SDMA_QUEUES_PER_ENGINE * CIK_SDMA_ENGINE_NUM) {
579 ++ pr_err("Over-subscription is not allowed for SDMA.\n");
580 ++ retval = -EPERM;
581 ++ goto err_create_queue;
582 ++ }
583 ++
584 ++ retval = create_cp_queue(pqm, dev, &q, properties, f, *qid);
585 ++ if (retval != 0)
586 ++ goto err_create_queue;
587 ++ pqn->q = q;
588 ++ pqn->kq = NULL;
589 ++ retval = dev->dqm->ops.create_queue(dev->dqm, q, &pdd->qpd,
590 ++ &q->properties.vmid);
591 ++ pr_debug("DQM returned %d for create_queue\n", retval);
592 ++ print_queue(q);
593 ++ break;
594 ++
595 + case KFD_QUEUE_TYPE_COMPUTE:
596 + /* check if there is over subscription */
597 + if ((sched_policy == KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION) &&
598 +diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
599 +index 44d476ea6d2e..f64f35cdc2ff 100644
600 +--- a/drivers/gpu/drm/bridge/tc358767.c
601 ++++ b/drivers/gpu/drm/bridge/tc358767.c
602 +@@ -97,7 +97,7 @@
603 + #define DP0_ACTIVEVAL 0x0650
604 + #define DP0_SYNCVAL 0x0654
605 + #define DP0_MISC 0x0658
606 +-#define TU_SIZE_RECOMMENDED (0x3f << 16) /* LSCLK cycles per TU */
607 ++#define TU_SIZE_RECOMMENDED (63) /* LSCLK cycles per TU */
608 + #define BPC_6 (0 << 5)
609 + #define BPC_8 (1 << 5)
610 +
611 +@@ -318,7 +318,7 @@ static ssize_t tc_aux_transfer(struct drm_dp_aux *aux,
612 + tmp = (tmp << 8) | buf[i];
613 + i++;
614 + if (((i % 4) == 0) || (i == size)) {
615 +- tc_write(DP0_AUXWDATA(i >> 2), tmp);
616 ++ tc_write(DP0_AUXWDATA((i - 1) >> 2), tmp);
617 + tmp = 0;
618 + }
619 + }
620 +@@ -603,8 +603,15 @@ static int tc_get_display_props(struct tc_data *tc)
621 + ret = drm_dp_link_probe(&tc->aux, &tc->link.base);
622 + if (ret < 0)
623 + goto err_dpcd_read;
624 +- if ((tc->link.base.rate != 162000) && (tc->link.base.rate != 270000))
625 +- goto err_dpcd_inval;
626 ++ if (tc->link.base.rate != 162000 && tc->link.base.rate != 270000) {
627 ++ dev_dbg(tc->dev, "Falling to 2.7 Gbps rate\n");
628 ++ tc->link.base.rate = 270000;
629 ++ }
630 ++
631 ++ if (tc->link.base.num_lanes > 2) {
632 ++ dev_dbg(tc->dev, "Falling to 2 lanes\n");
633 ++ tc->link.base.num_lanes = 2;
634 ++ }
635 +
636 + ret = drm_dp_dpcd_readb(&tc->aux, DP_MAX_DOWNSPREAD, tmp);
637 + if (ret < 0)
638 +@@ -637,9 +644,6 @@ static int tc_get_display_props(struct tc_data *tc)
639 + err_dpcd_read:
640 + dev_err(tc->dev, "failed to read DPCD: %d\n", ret);
641 + return ret;
642 +-err_dpcd_inval:
643 +- dev_err(tc->dev, "invalid DPCD\n");
644 +- return -EINVAL;
645 + }
646 +
647 + static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
648 +@@ -655,6 +659,14 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
649 + int lower_margin = mode->vsync_start - mode->vdisplay;
650 + int vsync_len = mode->vsync_end - mode->vsync_start;
651 +
652 ++ /*
653 ++ * Recommended maximum number of symbols transferred in a transfer unit:
654 ++ * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size,
655 ++ * (output active video bandwidth in bytes))
656 ++ * Must be less than tu_size.
657 ++ */
658 ++ max_tu_symbol = TU_SIZE_RECOMMENDED - 1;
659 ++
660 + dev_dbg(tc->dev, "set mode %dx%d\n",
661 + mode->hdisplay, mode->vdisplay);
662 + dev_dbg(tc->dev, "H margin %d,%d sync %d\n",
663 +@@ -664,13 +676,18 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
664 + dev_dbg(tc->dev, "total: %dx%d\n", mode->htotal, mode->vtotal);
665 +
666 +
667 +- /* LCD Ctl Frame Size */
668 +- tc_write(VPCTRL0, (0x40 << 20) /* VSDELAY */ |
669 ++ /*
670 ++ * LCD Ctl Frame Size
671 ++ * datasheet is not clear of vsdelay in case of DPI
672 ++ * assume we do not need any delay when DPI is a source of
673 ++ * sync signals
674 ++ */
675 ++ tc_write(VPCTRL0, (0 << 20) /* VSDELAY */ |
676 + OPXLFMT_RGB888 | FRMSYNC_DISABLED | MSF_DISABLED);
677 +- tc_write(HTIM01, (left_margin << 16) | /* H back porch */
678 +- (hsync_len << 0)); /* Hsync */
679 +- tc_write(HTIM02, (right_margin << 16) | /* H front porch */
680 +- (mode->hdisplay << 0)); /* width */
681 ++ tc_write(HTIM01, (ALIGN(left_margin, 2) << 16) | /* H back porch */
682 ++ (ALIGN(hsync_len, 2) << 0)); /* Hsync */
683 ++ tc_write(HTIM02, (ALIGN(right_margin, 2) << 16) | /* H front porch */
684 ++ (ALIGN(mode->hdisplay, 2) << 0)); /* width */
685 + tc_write(VTIM01, (upper_margin << 16) | /* V back porch */
686 + (vsync_len << 0)); /* Vsync */
687 + tc_write(VTIM02, (lower_margin << 16) | /* V front porch */
688 +@@ -689,7 +706,7 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
689 + /* DP Main Stream Attributes */
690 + vid_sync_dly = hsync_len + left_margin + mode->hdisplay;
691 + tc_write(DP0_VIDSYNCDELAY,
692 +- (0x003e << 16) | /* thresh_dly */
693 ++ (max_tu_symbol << 16) | /* thresh_dly */
694 + (vid_sync_dly << 0));
695 +
696 + tc_write(DP0_TOTALVAL, (mode->vtotal << 16) | (mode->htotal));
697 +@@ -705,14 +722,8 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
698 + tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW |
699 + DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888);
700 +
701 +- /*
702 +- * Recommended maximum number of symbols transferred in a transfer unit:
703 +- * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size,
704 +- * (output active video bandwidth in bytes))
705 +- * Must be less than tu_size.
706 +- */
707 +- max_tu_symbol = TU_SIZE_RECOMMENDED - 1;
708 +- tc_write(DP0_MISC, (max_tu_symbol << 23) | TU_SIZE_RECOMMENDED | BPC_8);
709 ++ tc_write(DP0_MISC, (max_tu_symbol << 23) | (TU_SIZE_RECOMMENDED << 16) |
710 ++ BPC_8);
711 +
712 + return 0;
713 + err:
714 +@@ -808,8 +819,6 @@ static int tc_main_link_setup(struct tc_data *tc)
715 + unsigned int rate;
716 + u32 dp_phy_ctrl;
717 + int timeout;
718 +- bool aligned;
719 +- bool ready;
720 + u32 value;
721 + int ret;
722 + u8 tmp[8];
723 +@@ -954,16 +963,15 @@ static int tc_main_link_setup(struct tc_data *tc)
724 + ret = drm_dp_dpcd_read_link_status(aux, tmp + 2);
725 + if (ret < 0)
726 + goto err_dpcd_read;
727 +- ready = (tmp[2] == ((DP_CHANNEL_EQ_BITS << 4) | /* Lane1 */
728 +- DP_CHANNEL_EQ_BITS)); /* Lane0 */
729 +- aligned = tmp[4] & DP_INTERLANE_ALIGN_DONE;
730 +- } while ((--timeout) && !(ready && aligned));
731 ++ } while ((--timeout) &&
732 ++ !(drm_dp_channel_eq_ok(tmp + 2, tc->link.base.num_lanes)));
733 +
734 + if (timeout == 0) {
735 + /* Read DPCD 0x200-0x201 */
736 + ret = drm_dp_dpcd_read(aux, DP_SINK_COUNT, tmp, 2);
737 + if (ret < 0)
738 + goto err_dpcd_read;
739 ++ dev_err(dev, "channel(s) EQ not ok\n");
740 + dev_info(dev, "0x0200 SINK_COUNT: 0x%02x\n", tmp[0]);
741 + dev_info(dev, "0x0201 DEVICE_SERVICE_IRQ_VECTOR: 0x%02x\n",
742 + tmp[1]);
743 +@@ -974,10 +982,6 @@ static int tc_main_link_setup(struct tc_data *tc)
744 + dev_info(dev, "0x0206 ADJUST_REQUEST_LANE0_1: 0x%02x\n",
745 + tmp[6]);
746 +
747 +- if (!ready)
748 +- dev_err(dev, "Lane0/1 not ready\n");
749 +- if (!aligned)
750 +- dev_err(dev, "Lane0/1 not aligned\n");
751 + return -EAGAIN;
752 + }
753 +
754 +@@ -1105,7 +1109,10 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge,
755 + static int tc_connector_mode_valid(struct drm_connector *connector,
756 + struct drm_display_mode *mode)
757 + {
758 +- /* Accept any mode */
759 ++ /* DPI interface clock limitation: upto 154 MHz */
760 ++ if (mode->clock > 154000)
761 ++ return MODE_CLOCK_HIGH;
762 ++
763 + return MODE_OK;
764 + }
765 +
766 +diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
767 +index 4ceed7a9762f..4b83e9eeab06 100644
768 +--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
769 ++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
770 +@@ -638,7 +638,8 @@ static int omap_dmm_probe(struct platform_device *dev)
771 + match = of_match_node(dmm_of_match, dev->dev.of_node);
772 + if (!match) {
773 + dev_err(&dev->dev, "failed to find matching device node\n");
774 +- return -ENODEV;
775 ++ ret = -ENODEV;
776 ++ goto fail;
777 + }
778 +
779 + omap_dmm->plat_data = match->data;
780 +diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
781 +index 094bc6a475c1..d96c084d3a76 100644
782 +--- a/drivers/gpu/drm/vc4/vc4_irq.c
783 ++++ b/drivers/gpu/drm/vc4/vc4_irq.c
784 +@@ -225,6 +225,9 @@ vc4_irq_uninstall(struct drm_device *dev)
785 + /* Clear any pending interrupts we might have left. */
786 + V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
787 +
788 ++ /* Finish any interrupt handler still in flight. */
789 ++ disable_irq(dev->irq);
790 ++
791 + cancel_work_sync(&vc4->overflow_mem_work);
792 + }
793 +
794 +diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
795 +index 7cc346ad9b0b..ce7c21d250cf 100644
796 +--- a/drivers/gpu/drm/vc4/vc4_v3d.c
797 ++++ b/drivers/gpu/drm/vc4/vc4_v3d.c
798 +@@ -173,6 +173,9 @@ static int vc4_v3d_runtime_resume(struct device *dev)
799 + struct vc4_dev *vc4 = v3d->vc4;
800 +
801 + vc4_v3d_init_hw(vc4->dev);
802 ++
803 ++ /* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */
804 ++ enable_irq(vc4->dev->irq);
805 + vc4_irq_postinstall(vc4->dev);
806 +
807 + return 0;
808 +diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
809 +index d72dfb2bbdb8..7a4d39ce51d9 100644
810 +--- a/drivers/hid/wacom_sys.c
811 ++++ b/drivers/hid/wacom_sys.c
812 +@@ -2192,23 +2192,23 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index)
813 + int i;
814 + unsigned long flags;
815 +
816 +- spin_lock_irqsave(&remote->remote_lock, flags);
817 +- remote->remotes[index].registered = false;
818 +- spin_unlock_irqrestore(&remote->remote_lock, flags);
819 ++ for (i = 0; i < WACOM_MAX_REMOTES; i++) {
820 ++ if (remote->remotes[i].serial == serial) {
821 +
822 +- if (remote->remotes[index].battery.battery)
823 +- devres_release_group(&wacom->hdev->dev,
824 +- &remote->remotes[index].battery.bat_desc);
825 ++ spin_lock_irqsave(&remote->remote_lock, flags);
826 ++ remote->remotes[i].registered = false;
827 ++ spin_unlock_irqrestore(&remote->remote_lock, flags);
828 +
829 +- if (remote->remotes[index].group.name)
830 +- devres_release_group(&wacom->hdev->dev,
831 +- &remote->remotes[index]);
832 ++ if (remote->remotes[i].battery.battery)
833 ++ devres_release_group(&wacom->hdev->dev,
834 ++ &remote->remotes[i].battery.bat_desc);
835 ++
836 ++ if (remote->remotes[i].group.name)
837 ++ devres_release_group(&wacom->hdev->dev,
838 ++ &remote->remotes[i]);
839 +
840 +- for (i = 0; i < WACOM_MAX_REMOTES; i++) {
841 +- if (remote->remotes[i].serial == serial) {
842 + remote->remotes[i].serial = 0;
843 + remote->remotes[i].group.name = NULL;
844 +- remote->remotes[i].registered = false;
845 + remote->remotes[i].battery.battery = NULL;
846 + wacom->led.groups[i].select = WACOM_STATUS_UNKNOWN;
847 + }
848 +diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
849 +index ba59eaef2e07..d013acf3f83a 100644
850 +--- a/drivers/hwmon/pmbus/pmbus_core.c
851 ++++ b/drivers/hwmon/pmbus/pmbus_core.c
852 +@@ -20,6 +20,7 @@
853 + */
854 +
855 + #include <linux/kernel.h>
856 ++#include <linux/math64.h>
857 + #include <linux/module.h>
858 + #include <linux/init.h>
859 + #include <linux/err.h>
860 +@@ -476,8 +477,8 @@ static long pmbus_reg2data_linear(struct pmbus_data *data,
861 + static long pmbus_reg2data_direct(struct pmbus_data *data,
862 + struct pmbus_sensor *sensor)
863 + {
864 +- long val = (s16) sensor->data;
865 +- long m, b, R;
866 ++ s64 b, val = (s16)sensor->data;
867 ++ s32 m, R;
868 +
869 + m = data->info->m[sensor->class];
870 + b = data->info->b[sensor->class];
871 +@@ -505,11 +506,12 @@ static long pmbus_reg2data_direct(struct pmbus_data *data,
872 + R--;
873 + }
874 + while (R < 0) {
875 +- val = DIV_ROUND_CLOSEST(val, 10);
876 ++ val = div_s64(val + 5LL, 10L); /* round closest */
877 + R++;
878 + }
879 +
880 +- return (val - b) / m;
881 ++ val = div_s64(val - b, m);
882 ++ return clamp_val(val, LONG_MIN, LONG_MAX);
883 + }
884 +
885 + /*
886 +@@ -629,7 +631,8 @@ static u16 pmbus_data2reg_linear(struct pmbus_data *data,
887 + static u16 pmbus_data2reg_direct(struct pmbus_data *data,
888 + struct pmbus_sensor *sensor, long val)
889 + {
890 +- long m, b, R;
891 ++ s64 b, val64 = val;
892 ++ s32 m, R;
893 +
894 + m = data->info->m[sensor->class];
895 + b = data->info->b[sensor->class];
896 +@@ -646,18 +649,18 @@ static u16 pmbus_data2reg_direct(struct pmbus_data *data,
897 + R -= 3; /* Adjust R and b for data in milli-units */
898 + b *= 1000;
899 + }
900 +- val = val * m + b;
901 ++ val64 = val64 * m + b;
902 +
903 + while (R > 0) {
904 +- val *= 10;
905 ++ val64 *= 10;
906 + R--;
907 + }
908 + while (R < 0) {
909 +- val = DIV_ROUND_CLOSEST(val, 10);
910 ++ val64 = div_s64(val64 + 5LL, 10L); /* round closest */
911 + R++;
912 + }
913 +
914 +- return val;
915 ++ return (u16)clamp_val(val64, S16_MIN, S16_MAX);
916 + }
917 +
918 + static u16 pmbus_data2reg_vid(struct pmbus_data *data,
919 +diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
920 +index a2120ff0ef4c..5e29fbd3a5a0 100644
921 +--- a/drivers/infiniband/hw/mlx5/main.c
922 ++++ b/drivers/infiniband/hw/mlx5/main.c
923 +@@ -2575,6 +2575,18 @@ static int create_umr_res(struct mlx5_ib_dev *dev)
924 + return ret;
925 + }
926 +
927 ++static u8 mlx5_get_umr_fence(u8 umr_fence_cap)
928 ++{
929 ++ switch (umr_fence_cap) {
930 ++ case MLX5_CAP_UMR_FENCE_NONE:
931 ++ return MLX5_FENCE_MODE_NONE;
932 ++ case MLX5_CAP_UMR_FENCE_SMALL:
933 ++ return MLX5_FENCE_MODE_INITIATOR_SMALL;
934 ++ default:
935 ++ return MLX5_FENCE_MODE_STRONG_ORDERING;
936 ++ }
937 ++}
938 ++
939 + static int create_dev_resources(struct mlx5_ib_resources *devr)
940 + {
941 + struct ib_srq_init_attr attr;
942 +@@ -3101,6 +3113,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
943 +
944 + mlx5_ib_internal_fill_odp_caps(dev);
945 +
946 ++ dev->umr_fence = mlx5_get_umr_fence(MLX5_CAP_GEN(mdev, umr_fence));
947 ++
948 + if (MLX5_CAP_GEN(mdev, imaicl)) {
949 + dev->ib_dev.alloc_mw = mlx5_ib_alloc_mw;
950 + dev->ib_dev.dealloc_mw = mlx5_ib_dealloc_mw;
951 +diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
952 +index 86e1e08125ff..d5cc954e8ac2 100644
953 +--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
954 ++++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
955 +@@ -345,7 +345,7 @@ struct mlx5_ib_qp {
956 + struct mlx5_ib_wq rq;
957 +
958 + u8 sq_signal_bits;
959 +- u8 fm_cache;
960 ++ u8 next_fence;
961 + struct mlx5_ib_wq sq;
962 +
963 + /* serialize qp state modifications
964 +@@ -643,6 +643,7 @@ struct mlx5_ib_dev {
965 + struct list_head qp_list;
966 + /* Array with num_ports elements */
967 + struct mlx5_ib_port *port;
968 ++ u8 umr_fence;
969 + };
970 +
971 + static inline struct mlx5_ib_cq *to_mibcq(struct mlx5_core_cq *mcq)
972 +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
973 +index 2665414b4875..fdd156101a72 100644
974 +--- a/drivers/infiniband/hw/mlx5/qp.c
975 ++++ b/drivers/infiniband/hw/mlx5/qp.c
976 +@@ -3755,24 +3755,6 @@ static void mlx5_bf_copy(u64 __iomem *dst, u64 *src,
977 + }
978 + }
979 +
980 +-static u8 get_fence(u8 fence, struct ib_send_wr *wr)
981 +-{
982 +- if (unlikely(wr->opcode == IB_WR_LOCAL_INV &&
983 +- wr->send_flags & IB_SEND_FENCE))
984 +- return MLX5_FENCE_MODE_STRONG_ORDERING;
985 +-
986 +- if (unlikely(fence)) {
987 +- if (wr->send_flags & IB_SEND_FENCE)
988 +- return MLX5_FENCE_MODE_SMALL_AND_FENCE;
989 +- else
990 +- return fence;
991 +- } else if (unlikely(wr->send_flags & IB_SEND_FENCE)) {
992 +- return MLX5_FENCE_MODE_FENCE;
993 +- }
994 +-
995 +- return 0;
996 +-}
997 +-
998 + static int begin_wqe(struct mlx5_ib_qp *qp, void **seg,
999 + struct mlx5_wqe_ctrl_seg **ctrl,
1000 + struct ib_send_wr *wr, unsigned *idx,
1001 +@@ -3801,8 +3783,7 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg,
1002 + static void finish_wqe(struct mlx5_ib_qp *qp,
1003 + struct mlx5_wqe_ctrl_seg *ctrl,
1004 + u8 size, unsigned idx, u64 wr_id,
1005 +- int nreq, u8 fence, u8 next_fence,
1006 +- u32 mlx5_opcode)
1007 ++ int nreq, u8 fence, u32 mlx5_opcode)
1008 + {
1009 + u8 opmod = 0;
1010 +
1011 +@@ -3810,7 +3791,6 @@ static void finish_wqe(struct mlx5_ib_qp *qp,
1012 + mlx5_opcode | ((u32)opmod << 24));
1013 + ctrl->qpn_ds = cpu_to_be32(size | (qp->trans_qp.base.mqp.qpn << 8));
1014 + ctrl->fm_ce_se |= fence;
1015 +- qp->fm_cache = next_fence;
1016 + if (unlikely(qp->wq_sig))
1017 + ctrl->signature = wq_sig(ctrl);
1018 +
1019 +@@ -3870,7 +3850,6 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1020 + goto out;
1021 + }
1022 +
1023 +- fence = qp->fm_cache;
1024 + num_sge = wr->num_sge;
1025 + if (unlikely(num_sge > qp->sq.max_gs)) {
1026 + mlx5_ib_warn(dev, "\n");
1027 +@@ -3887,6 +3866,19 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1028 + goto out;
1029 + }
1030 +
1031 ++ if (wr->opcode == IB_WR_LOCAL_INV ||
1032 ++ wr->opcode == IB_WR_REG_MR) {
1033 ++ fence = dev->umr_fence;
1034 ++ next_fence = MLX5_FENCE_MODE_INITIATOR_SMALL;
1035 ++ } else if (wr->send_flags & IB_SEND_FENCE) {
1036 ++ if (qp->next_fence)
1037 ++ fence = MLX5_FENCE_MODE_SMALL_AND_FENCE;
1038 ++ else
1039 ++ fence = MLX5_FENCE_MODE_FENCE;
1040 ++ } else {
1041 ++ fence = qp->next_fence;
1042 ++ }
1043 ++
1044 + switch (ibqp->qp_type) {
1045 + case IB_QPT_XRC_INI:
1046 + xrc = seg;
1047 +@@ -3913,7 +3905,6 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1048 + goto out;
1049 +
1050 + case IB_WR_LOCAL_INV:
1051 +- next_fence = MLX5_FENCE_MODE_INITIATOR_SMALL;
1052 + qp->sq.wr_data[idx] = IB_WR_LOCAL_INV;
1053 + ctrl->imm = cpu_to_be32(wr->ex.invalidate_rkey);
1054 + set_linv_wr(qp, &seg, &size);
1055 +@@ -3921,7 +3912,6 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1056 + break;
1057 +
1058 + case IB_WR_REG_MR:
1059 +- next_fence = MLX5_FENCE_MODE_INITIATOR_SMALL;
1060 + qp->sq.wr_data[idx] = IB_WR_REG_MR;
1061 + ctrl->imm = cpu_to_be32(reg_wr(wr)->key);
1062 + err = set_reg_wr(qp, reg_wr(wr), &seg, &size);
1063 +@@ -3944,9 +3934,8 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1064 + goto out;
1065 + }
1066 +
1067 +- finish_wqe(qp, ctrl, size, idx, wr->wr_id,
1068 +- nreq, get_fence(fence, wr),
1069 +- next_fence, MLX5_OPCODE_UMR);
1070 ++ finish_wqe(qp, ctrl, size, idx, wr->wr_id, nreq,
1071 ++ fence, MLX5_OPCODE_UMR);
1072 + /*
1073 + * SET_PSV WQEs are not signaled and solicited
1074 + * on error
1075 +@@ -3971,9 +3960,8 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1076 + goto out;
1077 + }
1078 +
1079 +- finish_wqe(qp, ctrl, size, idx, wr->wr_id,
1080 +- nreq, get_fence(fence, wr),
1081 +- next_fence, MLX5_OPCODE_SET_PSV);
1082 ++ finish_wqe(qp, ctrl, size, idx, wr->wr_id, nreq,
1083 ++ fence, MLX5_OPCODE_SET_PSV);
1084 + err = begin_wqe(qp, &seg, &ctrl, wr,
1085 + &idx, &size, nreq);
1086 + if (err) {
1087 +@@ -3983,7 +3971,6 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1088 + goto out;
1089 + }
1090 +
1091 +- next_fence = MLX5_FENCE_MODE_INITIATOR_SMALL;
1092 + err = set_psv_wr(&sig_handover_wr(wr)->sig_attrs->wire,
1093 + mr->sig->psv_wire.psv_idx, &seg,
1094 + &size);
1095 +@@ -3993,9 +3980,9 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1096 + goto out;
1097 + }
1098 +
1099 +- finish_wqe(qp, ctrl, size, idx, wr->wr_id,
1100 +- nreq, get_fence(fence, wr),
1101 +- next_fence, MLX5_OPCODE_SET_PSV);
1102 ++ finish_wqe(qp, ctrl, size, idx, wr->wr_id, nreq,
1103 ++ fence, MLX5_OPCODE_SET_PSV);
1104 ++ qp->next_fence = MLX5_FENCE_MODE_INITIATOR_SMALL;
1105 + num_sge = 0;
1106 + goto skip_psv;
1107 +
1108 +@@ -4100,8 +4087,8 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1109 + }
1110 + }
1111 +
1112 +- finish_wqe(qp, ctrl, size, idx, wr->wr_id, nreq,
1113 +- get_fence(fence, wr), next_fence,
1114 ++ qp->next_fence = next_fence;
1115 ++ finish_wqe(qp, ctrl, size, idx, wr->wr_id, nreq, fence,
1116 + mlx5_ib_opcode[wr->opcode]);
1117 + skip_psv:
1118 + if (0)
1119 +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
1120 +index 2efdce07247c..cac297f8170e 100644
1121 +--- a/drivers/md/bcache/btree.c
1122 ++++ b/drivers/md/bcache/btree.c
1123 +@@ -803,7 +803,10 @@ int bch_btree_cache_alloc(struct cache_set *c)
1124 + c->shrink.scan_objects = bch_mca_scan;
1125 + c->shrink.seeks = 4;
1126 + c->shrink.batch = c->btree_pages * 2;
1127 +- register_shrinker(&c->shrink);
1128 ++
1129 ++ if (register_shrinker(&c->shrink))
1130 ++ pr_warn("bcache: %s: could not register shrinker",
1131 ++ __func__);
1132 +
1133 + return 0;
1134 + }
1135 +diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c
1136 +index dc76fd41e00f..0324633ede42 100644
1137 +--- a/drivers/media/usb/usbtv/usbtv-core.c
1138 ++++ b/drivers/media/usb/usbtv/usbtv-core.c
1139 +@@ -141,6 +141,7 @@ static void usbtv_disconnect(struct usb_interface *intf)
1140 +
1141 + static struct usb_device_id usbtv_id_table[] = {
1142 + { USB_DEVICE(0x1b71, 0x3002) },
1143 ++ { USB_DEVICE(0x1f71, 0x3301) },
1144 + {}
1145 + };
1146 + MODULE_DEVICE_TABLE(usb, usbtv_id_table);
1147 +diff --git a/drivers/mtd/nand/denali_pci.c b/drivers/mtd/nand/denali_pci.c
1148 +index de31514df282..d38527e0a2f2 100644
1149 +--- a/drivers/mtd/nand/denali_pci.c
1150 ++++ b/drivers/mtd/nand/denali_pci.c
1151 +@@ -119,3 +119,7 @@ static struct pci_driver denali_pci_driver = {
1152 + };
1153 +
1154 + module_pci_driver(denali_pci_driver);
1155 ++
1156 ++MODULE_DESCRIPTION("PCI driver for Denali NAND controller");
1157 ++MODULE_AUTHOR("Intel Corporation and its suppliers");
1158 ++MODULE_LICENSE("GPL v2");
1159 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
1160 +index a7e04ff4eaed..cde4b96f3153 100644
1161 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
1162 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
1163 +@@ -1843,8 +1843,8 @@ static int bnxt_get_module_eeprom(struct net_device *dev,
1164 + /* Read A2 portion of the EEPROM */
1165 + if (length) {
1166 + start -= ETH_MODULE_SFF_8436_LEN;
1167 +- bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 1, start,
1168 +- length, data);
1169 ++ rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 1,
1170 ++ start, length, data);
1171 + }
1172 + return rc;
1173 + }
1174 +diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
1175 +index ca54f7684668..3a61491421b1 100644
1176 +--- a/drivers/net/ethernet/intel/igb/igb_main.c
1177 ++++ b/drivers/net/ethernet/intel/igb/igb_main.c
1178 +@@ -3273,7 +3273,7 @@ static int __igb_close(struct net_device *netdev, bool suspending)
1179 +
1180 + int igb_close(struct net_device *netdev)
1181 + {
1182 +- if (netif_device_present(netdev))
1183 ++ if (netif_device_present(netdev) || netdev->dismantle)
1184 + return __igb_close(netdev, false);
1185 + return 0;
1186 + }
1187 +diff --git a/drivers/net/ethernet/xilinx/Kconfig b/drivers/net/ethernet/xilinx/Kconfig
1188 +index 6d68c8a8f4f2..da4ec575ccf9 100644
1189 +--- a/drivers/net/ethernet/xilinx/Kconfig
1190 ++++ b/drivers/net/ethernet/xilinx/Kconfig
1191 +@@ -34,6 +34,7 @@ config XILINX_AXI_EMAC
1192 + config XILINX_LL_TEMAC
1193 + tristate "Xilinx LL TEMAC (LocalLink Tri-mode Ethernet MAC) driver"
1194 + depends on (PPC || MICROBLAZE)
1195 ++ depends on !64BIT || BROKEN
1196 + select PHYLIB
1197 + ---help---
1198 + This driver supports the Xilinx 10/100/1000 LocalLink TEMAC
1199 +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
1200 +index d04babd99b53..ff5ce1ed03c4 100644
1201 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
1202 ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
1203 +@@ -1040,6 +1040,8 @@ unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
1204 + return le32_to_cpu(txq_timer->p2p_go);
1205 + case NL80211_IFTYPE_P2P_DEVICE:
1206 + return le32_to_cpu(txq_timer->p2p_device);
1207 ++ case NL80211_IFTYPE_MONITOR:
1208 ++ return default_timeout;
1209 + default:
1210 + WARN_ON(1);
1211 + return mvm->cfg->base_params->wd_timeout;
1212 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
1213 +index 8d498a997e25..1a9dadf7b3cc 100644
1214 +--- a/drivers/net/xen-netfront.c
1215 ++++ b/drivers/net/xen-netfront.c
1216 +@@ -86,6 +86,8 @@ struct netfront_cb {
1217 + /* IRQ name is queue name with "-tx" or "-rx" appended */
1218 + #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3)
1219 +
1220 ++static DECLARE_WAIT_QUEUE_HEAD(module_unload_q);
1221 ++
1222 + struct netfront_stats {
1223 + u64 packets;
1224 + u64 bytes;
1225 +@@ -2051,10 +2053,12 @@ static void netback_changed(struct xenbus_device *dev,
1226 + break;
1227 +
1228 + case XenbusStateClosed:
1229 ++ wake_up_all(&module_unload_q);
1230 + if (dev->state == XenbusStateClosed)
1231 + break;
1232 + /* Missed the backend's CLOSING state -- fallthrough */
1233 + case XenbusStateClosing:
1234 ++ wake_up_all(&module_unload_q);
1235 + xenbus_frontend_closed(dev);
1236 + break;
1237 + }
1238 +@@ -2160,6 +2164,20 @@ static int xennet_remove(struct xenbus_device *dev)
1239 +
1240 + dev_dbg(&dev->dev, "%s\n", dev->nodename);
1241 +
1242 ++ if (xenbus_read_driver_state(dev->otherend) != XenbusStateClosed) {
1243 ++ xenbus_switch_state(dev, XenbusStateClosing);
1244 ++ wait_event(module_unload_q,
1245 ++ xenbus_read_driver_state(dev->otherend) ==
1246 ++ XenbusStateClosing);
1247 ++
1248 ++ xenbus_switch_state(dev, XenbusStateClosed);
1249 ++ wait_event(module_unload_q,
1250 ++ xenbus_read_driver_state(dev->otherend) ==
1251 ++ XenbusStateClosed ||
1252 ++ xenbus_read_driver_state(dev->otherend) ==
1253 ++ XenbusStateUnknown);
1254 ++ }
1255 ++
1256 + xennet_disconnect_backend(info);
1257 +
1258 + unregister_netdev(info->netdev);
1259 +diff --git a/drivers/power/reset/zx-reboot.c b/drivers/power/reset/zx-reboot.c
1260 +index b0b1eb3a78c2..76153ac0706c 100644
1261 +--- a/drivers/power/reset/zx-reboot.c
1262 ++++ b/drivers/power/reset/zx-reboot.c
1263 +@@ -81,3 +81,7 @@ static struct platform_driver zx_reboot_driver = {
1264 + },
1265 + };
1266 + module_platform_driver(zx_reboot_driver);
1267 ++
1268 ++MODULE_DESCRIPTION("ZTE SoCs reset driver");
1269 ++MODULE_AUTHOR("Jun Nie <jun.nie@××××××.org>");
1270 ++MODULE_LICENSE("GPL v2");
1271 +diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
1272 +index 0aeecec1f5ea..e2962f15c189 100644
1273 +--- a/drivers/scsi/aacraid/commsup.c
1274 ++++ b/drivers/scsi/aacraid/commsup.c
1275 +@@ -1416,13 +1416,13 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced)
1276 + * will ensure that i/o is queisced and the card is flushed in that
1277 + * case.
1278 + */
1279 ++ aac_free_irq(aac);
1280 + aac_fib_map_free(aac);
1281 + pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys);
1282 + aac->comm_addr = NULL;
1283 + aac->comm_phys = 0;
1284 + kfree(aac->queues);
1285 + aac->queues = NULL;
1286 +- aac_free_irq(aac);
1287 + kfree(aac->fsa_dev);
1288 + aac->fsa_dev = NULL;
1289 + quirks = aac_get_driver_ident(index)->quirks;
1290 +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
1291 +index 530034bc2d13..2e9341233f66 100644
1292 +--- a/drivers/scsi/ufs/ufshcd.c
1293 ++++ b/drivers/scsi/ufs/ufshcd.c
1294 +@@ -5327,12 +5327,15 @@ static int ufshcd_config_vreg(struct device *dev,
1295 + struct ufs_vreg *vreg, bool on)
1296 + {
1297 + int ret = 0;
1298 +- struct regulator *reg = vreg->reg;
1299 +- const char *name = vreg->name;
1300 ++ struct regulator *reg;
1301 ++ const char *name;
1302 + int min_uV, uA_load;
1303 +
1304 + BUG_ON(!vreg);
1305 +
1306 ++ reg = vreg->reg;
1307 ++ name = vreg->name;
1308 ++
1309 + if (regulator_count_voltages(reg) > 0) {
1310 + min_uV = on ? vreg->min_uV : 0;
1311 + ret = regulator_set_voltage(reg, min_uV, vreg->max_uV);
1312 +diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
1313 +index deb782f6556c..a6e34f05d44d 100644
1314 +--- a/drivers/spi/spi-imx.c
1315 ++++ b/drivers/spi/spi-imx.c
1316 +@@ -1307,12 +1307,23 @@ static int spi_imx_remove(struct platform_device *pdev)
1317 + {
1318 + struct spi_master *master = platform_get_drvdata(pdev);
1319 + struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
1320 ++ int ret;
1321 +
1322 + spi_bitbang_stop(&spi_imx->bitbang);
1323 +
1324 ++ ret = clk_enable(spi_imx->clk_per);
1325 ++ if (ret)
1326 ++ return ret;
1327 ++
1328 ++ ret = clk_enable(spi_imx->clk_ipg);
1329 ++ if (ret) {
1330 ++ clk_disable(spi_imx->clk_per);
1331 ++ return ret;
1332 ++ }
1333 ++
1334 + writel(0, spi_imx->base + MXC_CSPICTRL);
1335 +- clk_unprepare(spi_imx->clk_ipg);
1336 +- clk_unprepare(spi_imx->clk_per);
1337 ++ clk_disable_unprepare(spi_imx->clk_ipg);
1338 ++ clk_disable_unprepare(spi_imx->clk_per);
1339 + spi_imx_sdma_exit(spi_imx);
1340 + spi_master_put(master);
1341 +
1342 +diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
1343 +index 9e8802181452..e8d9db4d8179 100644
1344 +--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
1345 ++++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
1346 +@@ -824,14 +824,15 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer *peer, struct rdma_cm_id *cm
1347 + return conn;
1348 +
1349 + failed_2:
1350 +- kiblnd_destroy_conn(conn, true);
1351 ++ kiblnd_destroy_conn(conn);
1352 ++ LIBCFS_FREE(conn, sizeof(*conn));
1353 + failed_1:
1354 + LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr));
1355 + failed_0:
1356 + return NULL;
1357 + }
1358 +
1359 +-void kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn)
1360 ++void kiblnd_destroy_conn(struct kib_conn *conn)
1361 + {
1362 + struct rdma_cm_id *cmid = conn->ibc_cmid;
1363 + struct kib_peer *peer = conn->ibc_peer;
1364 +@@ -894,8 +895,6 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn)
1365 + rdma_destroy_id(cmid);
1366 + atomic_dec(&net->ibn_nconns);
1367 + }
1368 +-
1369 +- LIBCFS_FREE(conn, sizeof(*conn));
1370 + }
1371 +
1372 + int kiblnd_close_peer_conns_locked(struct kib_peer *peer, int why)
1373 +diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
1374 +index 14576977200f..30cb2f5b3c15 100644
1375 +--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
1376 ++++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
1377 +@@ -1018,7 +1018,7 @@ int kiblnd_close_peer_conns_locked(struct kib_peer *peer, int why);
1378 + struct kib_conn *kiblnd_create_conn(struct kib_peer *peer,
1379 + struct rdma_cm_id *cmid,
1380 + int state, int version);
1381 +-void kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn);
1382 ++void kiblnd_destroy_conn(struct kib_conn *conn);
1383 + void kiblnd_close_conn(struct kib_conn *conn, int error);
1384 + void kiblnd_close_conn_locked(struct kib_conn *conn, int error);
1385 +
1386 +diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
1387 +index 995f2dac7f26..ea9a0c21d29d 100644
1388 +--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
1389 ++++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
1390 +@@ -3323,11 +3323,13 @@ kiblnd_connd(void *arg)
1391 + spin_unlock_irqrestore(lock, flags);
1392 + dropped_lock = 1;
1393 +
1394 +- kiblnd_destroy_conn(conn, !peer);
1395 ++ kiblnd_destroy_conn(conn);
1396 +
1397 + spin_lock_irqsave(lock, flags);
1398 +- if (!peer)
1399 ++ if (!peer) {
1400 ++ kfree(conn);
1401 + continue;
1402 ++ }
1403 +
1404 + conn->ibc_peer = peer;
1405 + if (peer->ibp_reconnected < KIB_RECONN_HIGH_RACE)
1406 +diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
1407 +index 4de9dbc93380..c7bf8ab26192 100644
1408 +--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
1409 ++++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
1410 +@@ -1397,19 +1397,13 @@ static int rtw_wx_get_essid(struct net_device *dev,
1411 + if ((check_fwstate(pmlmepriv, _FW_LINKED)) ||
1412 + (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))) {
1413 + len = pcur_bss->Ssid.SsidLength;
1414 +-
1415 +- wrqu->essid.length = len;
1416 +-
1417 + memcpy(extra, pcur_bss->Ssid.Ssid, len);
1418 +-
1419 +- wrqu->essid.flags = 1;
1420 + } else {
1421 +- ret = -1;
1422 +- goto exit;
1423 ++ len = 0;
1424 ++ *extra = 0;
1425 + }
1426 +-
1427 +-exit:
1428 +-
1429 ++ wrqu->essid.length = len;
1430 ++ wrqu->essid.flags = 1;
1431 +
1432 + return ret;
1433 + }
1434 +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
1435 +index a70356dad1b7..521a6e450755 100644
1436 +--- a/drivers/tty/serial/imx.c
1437 ++++ b/drivers/tty/serial/imx.c
1438 +@@ -2239,12 +2239,14 @@ static void serial_imx_enable_wakeup(struct imx_port *sport, bool on)
1439 + val &= ~UCR3_AWAKEN;
1440 + writel(val, sport->port.membase + UCR3);
1441 +
1442 +- val = readl(sport->port.membase + UCR1);
1443 +- if (on)
1444 +- val |= UCR1_RTSDEN;
1445 +- else
1446 +- val &= ~UCR1_RTSDEN;
1447 +- writel(val, sport->port.membase + UCR1);
1448 ++ if (sport->have_rtscts) {
1449 ++ val = readl(sport->port.membase + UCR1);
1450 ++ if (on)
1451 ++ val |= UCR1_RTSDEN;
1452 ++ else
1453 ++ val &= ~UCR1_RTSDEN;
1454 ++ writel(val, sport->port.membase + UCR1);
1455 ++ }
1456 + }
1457 +
1458 + static int imx_serial_port_suspend_noirq(struct device *dev)
1459 +diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
1460 +index 734a635e7363..8d9f9a803b42 100644
1461 +--- a/drivers/tty/tty_io.c
1462 ++++ b/drivers/tty/tty_io.c
1463 +@@ -1543,6 +1543,9 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
1464 + "%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n",
1465 + __func__, tty->driver->name);
1466 +
1467 ++ retval = tty_ldisc_lock(tty, 5 * HZ);
1468 ++ if (retval)
1469 ++ goto err_release_lock;
1470 + tty->port->itty = tty;
1471 +
1472 + /*
1473 +@@ -1553,6 +1556,7 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
1474 + retval = tty_ldisc_setup(tty, tty->link);
1475 + if (retval)
1476 + goto err_release_tty;
1477 ++ tty_ldisc_unlock(tty);
1478 + /* Return the tty locked so that it cannot vanish under the caller */
1479 + return tty;
1480 +
1481 +@@ -1565,9 +1569,11 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
1482 +
1483 + /* call the tty release_tty routine to clean out this slot */
1484 + err_release_tty:
1485 +- tty_unlock(tty);
1486 ++ tty_ldisc_unlock(tty);
1487 + tty_info_ratelimited(tty, "ldisc open failed (%d), clearing slot %d\n",
1488 + retval, idx);
1489 ++err_release_lock:
1490 ++ tty_unlock(tty);
1491 + release_tty(tty, idx);
1492 + return ERR_PTR(retval);
1493 + }
1494 +diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
1495 +index b0500a0a87b8..3a9e2a2fd4c6 100644
1496 +--- a/drivers/tty/tty_ldisc.c
1497 ++++ b/drivers/tty/tty_ldisc.c
1498 +@@ -336,7 +336,7 @@ static inline void __tty_ldisc_unlock(struct tty_struct *tty)
1499 + ldsem_up_write(&tty->ldisc_sem);
1500 + }
1501 +
1502 +-static int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout)
1503 ++int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout)
1504 + {
1505 + int ret;
1506 +
1507 +@@ -347,7 +347,7 @@ static int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout)
1508 + return 0;
1509 + }
1510 +
1511 +-static void tty_ldisc_unlock(struct tty_struct *tty)
1512 ++void tty_ldisc_unlock(struct tty_struct *tty)
1513 + {
1514 + clear_bit(TTY_LDISC_HALTED, &tty->flags);
1515 + __tty_ldisc_unlock(tty);
1516 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1517 +index ea20b2cc189f..34d23cc99fbd 100644
1518 +--- a/drivers/usb/class/cdc-acm.c
1519 ++++ b/drivers/usb/class/cdc-acm.c
1520 +@@ -375,7 +375,7 @@ static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags)
1521 +
1522 + res = usb_submit_urb(acm->read_urbs[index], mem_flags);
1523 + if (res) {
1524 +- if (res != -EPERM) {
1525 ++ if (res != -EPERM && res != -ENODEV) {
1526 + dev_err(&acm->data->dev,
1527 + "urb %d failed submission with %d\n",
1528 + index, res);
1529 +@@ -1706,6 +1706,9 @@ static const struct usb_device_id acm_ids[] = {
1530 + { USB_DEVICE(0x0ace, 0x1611), /* ZyDAS 56K USB MODEM - new version */
1531 + .driver_info = SINGLE_RX_URB, /* firmware bug */
1532 + },
1533 ++ { USB_DEVICE(0x11ca, 0x0201), /* VeriFone Mx870 Gadget Serial */
1534 ++ .driver_info = SINGLE_RX_URB,
1535 ++ },
1536 + { USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */
1537 + .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1538 + },
1539 +diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
1540 +index 325bf21ba13b..406758ed0b23 100644
1541 +--- a/drivers/usb/gadget/composite.c
1542 ++++ b/drivers/usb/gadget/composite.c
1543 +@@ -150,7 +150,6 @@ int config_ep_by_speed(struct usb_gadget *g,
1544 + struct usb_function *f,
1545 + struct usb_ep *_ep)
1546 + {
1547 +- struct usb_composite_dev *cdev = get_gadget_data(g);
1548 + struct usb_endpoint_descriptor *chosen_desc = NULL;
1549 + struct usb_descriptor_header **speed_desc = NULL;
1550 +
1551 +@@ -229,8 +228,12 @@ int config_ep_by_speed(struct usb_gadget *g,
1552 + _ep->maxburst = comp_desc->bMaxBurst + 1;
1553 + break;
1554 + default:
1555 +- if (comp_desc->bMaxBurst != 0)
1556 ++ if (comp_desc->bMaxBurst != 0) {
1557 ++ struct usb_composite_dev *cdev;
1558 ++
1559 ++ cdev = get_gadget_data(g);
1560 + ERROR(cdev, "ep0 bMaxBurst must be 0\n");
1561 ++ }
1562 + _ep->maxburst = 1;
1563 + break;
1564 + }
1565 +diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
1566 +index 7b107e43b1c4..d90bf57ba30e 100644
1567 +--- a/drivers/usb/gadget/function/f_fs.c
1568 ++++ b/drivers/usb/gadget/function/f_fs.c
1569 +@@ -3725,7 +3725,8 @@ static void ffs_closed(struct ffs_data *ffs)
1570 + ci = opts->func_inst.group.cg_item.ci_parent->ci_parent;
1571 + ffs_dev_unlock();
1572 +
1573 +- unregister_gadget_item(ci);
1574 ++ if (test_bit(FFS_FL_BOUND, &ffs->flags))
1575 ++ unregister_gadget_item(ci);
1576 + return;
1577 + done:
1578 + ffs_dev_unlock();
1579 +diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
1580 +index d685d82dcf48..e97539fc127e 100644
1581 +--- a/drivers/usb/gadget/udc/core.c
1582 ++++ b/drivers/usb/gadget/udc/core.c
1583 +@@ -913,7 +913,7 @@ int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
1584 + return 0;
1585 +
1586 + /* "high bandwidth" works only at high speed */
1587 +- if (!gadget_is_dualspeed(gadget) && usb_endpoint_maxp(desc) & (3<<11))
1588 ++ if (!gadget_is_dualspeed(gadget) && usb_endpoint_maxp_mult(desc) > 1)
1589 + return 0;
1590 +
1591 + switch (type) {
1592 +diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
1593 +index 56ecb8b5115d..584ae8cbaf1c 100644
1594 +--- a/drivers/usb/serial/Kconfig
1595 ++++ b/drivers/usb/serial/Kconfig
1596 +@@ -63,6 +63,7 @@ config USB_SERIAL_SIMPLE
1597 + - Google USB serial devices
1598 + - HP4x calculators
1599 + - a number of Motorola phones
1600 ++ - Motorola Tetra devices
1601 + - Novatel Wireless GPS receivers
1602 + - Siemens USB/MPI adapter.
1603 + - ViVOtech ViVOpay USB device.
1604 +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
1605 +index 464db17b5328..de61271f2ba3 100644
1606 +--- a/drivers/usb/serial/io_edgeport.c
1607 ++++ b/drivers/usb/serial/io_edgeport.c
1608 +@@ -2215,7 +2215,6 @@ static int write_cmd_usb(struct edgeport_port *edge_port,
1609 + /* something went wrong */
1610 + dev_err(dev, "%s - usb_submit_urb(write command) failed, status = %d\n",
1611 + __func__, status);
1612 +- usb_kill_urb(urb);
1613 + usb_free_urb(urb);
1614 + atomic_dec(&CmdUrbs);
1615 + return status;
1616 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1617 +index a818c43a02ec..1799aa058a5b 100644
1618 +--- a/drivers/usb/serial/option.c
1619 ++++ b/drivers/usb/serial/option.c
1620 +@@ -383,6 +383,9 @@ static void option_instat_callback(struct urb *urb);
1621 + #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
1622 + #define FOUR_G_SYSTEMS_PRODUCT_W100 0x9b01
1623 +
1624 ++/* Fujisoft products */
1625 ++#define FUJISOFT_PRODUCT_FS040U 0x9b02
1626 ++
1627 + /* iBall 3.5G connect wireless modem */
1628 + #define IBALL_3_5G_CONNECT 0x9605
1629 +
1630 +@@ -1897,6 +1900,8 @@ static const struct usb_device_id option_ids[] = {
1631 + { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100),
1632 + .driver_info = (kernel_ulong_t)&four_g_w100_blacklist
1633 + },
1634 ++ {USB_DEVICE(LONGCHEER_VENDOR_ID, FUJISOFT_PRODUCT_FS040U),
1635 ++ .driver_info = (kernel_ulong_t)&net_intf3_blacklist},
1636 + { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
1637 + { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, 0x9801, 0xff),
1638 + .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1639 +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1640 +index a51b28379850..3da25ad267a2 100644
1641 +--- a/drivers/usb/serial/pl2303.c
1642 ++++ b/drivers/usb/serial/pl2303.c
1643 +@@ -39,6 +39,7 @@ static const struct usb_device_id id_table[] = {
1644 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) },
1645 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) },
1646 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) },
1647 ++ { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_CHILITAG) },
1648 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) },
1649 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) },
1650 + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
1651 +diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
1652 +index 3b5a15d1dc0d..123289085ee2 100644
1653 +--- a/drivers/usb/serial/pl2303.h
1654 ++++ b/drivers/usb/serial/pl2303.h
1655 +@@ -17,6 +17,7 @@
1656 + #define PL2303_PRODUCT_ID_DCU11 0x1234
1657 + #define PL2303_PRODUCT_ID_PHAROS 0xaaa0
1658 + #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2
1659 ++#define PL2303_PRODUCT_ID_CHILITAG 0xaaa8
1660 + #define PL2303_PRODUCT_ID_ALDIGA 0x0611
1661 + #define PL2303_PRODUCT_ID_MMX 0x0612
1662 + #define PL2303_PRODUCT_ID_GPRS 0x0609
1663 +diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c
1664 +index e98b6e57b703..6aa7ff2c1cf7 100644
1665 +--- a/drivers/usb/serial/usb-serial-simple.c
1666 ++++ b/drivers/usb/serial/usb-serial-simple.c
1667 +@@ -80,6 +80,11 @@ DEVICE(vivopay, VIVOPAY_IDS);
1668 + { USB_DEVICE(0x22b8, 0x2c64) } /* Motorola V950 phone */
1669 + DEVICE(moto_modem, MOTO_IDS);
1670 +
1671 ++/* Motorola Tetra driver */
1672 ++#define MOTOROLA_TETRA_IDS() \
1673 ++ { USB_DEVICE(0x0cad, 0x9011) } /* Motorola Solutions TETRA PEI */
1674 ++DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
1675 ++
1676 + /* Novatel Wireless GPS driver */
1677 + #define NOVATEL_IDS() \
1678 + { USB_DEVICE(0x09d7, 0x0100) } /* NovAtel FlexPack GPS */
1679 +@@ -110,6 +115,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
1680 + &google_device,
1681 + &vivopay_device,
1682 + &moto_modem_device,
1683 ++ &motorola_tetra_device,
1684 + &novatel_gps_device,
1685 + &hp4x_device,
1686 + &suunto_device,
1687 +@@ -125,6 +131,7 @@ static const struct usb_device_id id_table[] = {
1688 + GOOGLE_IDS(),
1689 + VIVOPAY_IDS(),
1690 + MOTO_IDS(),
1691 ++ MOTOROLA_TETRA_IDS(),
1692 + NOVATEL_IDS(),
1693 + HP4X_IDS(),
1694 + SUUNTO_IDS(),
1695 +diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
1696 +index 9876af4ab64e..6891e9092775 100644
1697 +--- a/drivers/usb/storage/uas.c
1698 ++++ b/drivers/usb/storage/uas.c
1699 +@@ -1076,20 +1076,19 @@ static int uas_post_reset(struct usb_interface *intf)
1700 + return 0;
1701 +
1702 + err = uas_configure_endpoints(devinfo);
1703 +- if (err) {
1704 ++ if (err && err != ENODEV)
1705 + shost_printk(KERN_ERR, shost,
1706 + "%s: alloc streams error %d after reset",
1707 + __func__, err);
1708 +- return 1;
1709 +- }
1710 +
1711 ++ /* we must unblock the host in every case lest we deadlock */
1712 + spin_lock_irqsave(shost->host_lock, flags);
1713 + scsi_report_bus_reset(shost, 0);
1714 + spin_unlock_irqrestore(shost->host_lock, flags);
1715 +
1716 + scsi_unblock_requests(shost);
1717 +
1718 +- return 0;
1719 ++ return err ? 1 : 0;
1720 + }
1721 +
1722 + static int uas_suspend(struct usb_interface *intf, pm_message_t message)
1723 +diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
1724 +index 7f161b095176..dbe615ba07c9 100644
1725 +--- a/drivers/usb/usbip/vhci_hcd.c
1726 ++++ b/drivers/usb/usbip/vhci_hcd.c
1727 +@@ -300,7 +300,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1728 + case USB_PORT_FEAT_POWER:
1729 + usbip_dbg_vhci_rh(
1730 + " ClearPortFeature: USB_PORT_FEAT_POWER\n");
1731 +- dum->port_status[rhport] = 0;
1732 ++ dum->port_status[rhport] &= ~USB_PORT_STAT_POWER;
1733 + dum->resuming = 0;
1734 + break;
1735 + case USB_PORT_FEAT_C_RESET:
1736 +diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
1737 +index e4b48f377d3a..c56253a1e5b4 100644
1738 +--- a/fs/btrfs/free-space-cache.c
1739 ++++ b/fs/btrfs/free-space-cache.c
1740 +@@ -1253,7 +1253,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
1741 + /* Lock all pages first so we can lock the extent safely. */
1742 + ret = io_ctl_prepare_pages(io_ctl, inode, 0);
1743 + if (ret)
1744 +- goto out;
1745 ++ goto out_unlock;
1746 +
1747 + lock_extent_bits(&BTRFS_I(inode)->io_tree, 0, i_size_read(inode) - 1,
1748 + &cached_state);
1749 +@@ -1346,6 +1346,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
1750 + out_nospc:
1751 + cleanup_write_cache_enospc(inode, io_ctl, &cached_state, &bitmap_list);
1752 +
1753 ++out_unlock:
1754 + if (block_group && (block_group->flags & BTRFS_BLOCK_GROUP_DATA))
1755 + up_write(&block_group->data_rwsem);
1756 +
1757 +diff --git a/fs/nfs_common/grace.c b/fs/nfs_common/grace.c
1758 +index fd8c9a5bcac4..77d136ac8909 100644
1759 +--- a/fs/nfs_common/grace.c
1760 ++++ b/fs/nfs_common/grace.c
1761 +@@ -30,7 +30,11 @@ locks_start_grace(struct net *net, struct lock_manager *lm)
1762 + struct list_head *grace_list = net_generic(net, grace_net_id);
1763 +
1764 + spin_lock(&grace_lock);
1765 +- list_add(&lm->list, grace_list);
1766 ++ if (list_empty(&lm->list))
1767 ++ list_add(&lm->list, grace_list);
1768 ++ else
1769 ++ WARN(1, "double list_add attempt detected in net %x %s\n",
1770 ++ net->ns.inum, (net == &init_net) ? "(init_net)" : "");
1771 + spin_unlock(&grace_lock);
1772 + }
1773 + EXPORT_SYMBOL_GPL(locks_start_grace);
1774 +@@ -104,7 +108,9 @@ grace_exit_net(struct net *net)
1775 + {
1776 + struct list_head *grace_list = net_generic(net, grace_net_id);
1777 +
1778 +- BUG_ON(!list_empty(grace_list));
1779 ++ WARN_ONCE(!list_empty(grace_list),
1780 ++ "net %x %s: grace_list is not empty\n",
1781 ++ net->ns.inum, __func__);
1782 + }
1783 +
1784 + static struct pernet_operations grace_net_ops = {
1785 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1786 +index 9ebb2d7c8182..f463c4e0b2ea 100644
1787 +--- a/fs/nfsd/nfs4state.c
1788 ++++ b/fs/nfsd/nfs4state.c
1789 +@@ -63,12 +63,16 @@ static const stateid_t zero_stateid = {
1790 + static const stateid_t currentstateid = {
1791 + .si_generation = 1,
1792 + };
1793 ++static const stateid_t close_stateid = {
1794 ++ .si_generation = 0xffffffffU,
1795 ++};
1796 +
1797 + static u64 current_sessionid = 1;
1798 +
1799 + #define ZERO_STATEID(stateid) (!memcmp((stateid), &zero_stateid, sizeof(stateid_t)))
1800 + #define ONE_STATEID(stateid) (!memcmp((stateid), &one_stateid, sizeof(stateid_t)))
1801 + #define CURRENT_STATEID(stateid) (!memcmp((stateid), &currentstateid, sizeof(stateid_t)))
1802 ++#define CLOSE_STATEID(stateid) (!memcmp((stateid), &close_stateid, sizeof(stateid_t)))
1803 +
1804 + /* forward declarations */
1805 + static bool check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner);
1806 +@@ -4866,7 +4870,8 @@ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid)
1807 + struct nfs4_stid *s;
1808 + __be32 status = nfserr_bad_stateid;
1809 +
1810 +- if (ZERO_STATEID(stateid) || ONE_STATEID(stateid))
1811 ++ if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) ||
1812 ++ CLOSE_STATEID(stateid))
1813 + return status;
1814 + /* Client debugging aid. */
1815 + if (!same_clid(&stateid->si_opaque.so_clid, &cl->cl_clientid)) {
1816 +@@ -4924,7 +4929,8 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
1817 + else if (typemask & NFS4_DELEG_STID)
1818 + typemask |= NFS4_REVOKED_DELEG_STID;
1819 +
1820 +- if (ZERO_STATEID(stateid) || ONE_STATEID(stateid))
1821 ++ if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) ||
1822 ++ CLOSE_STATEID(stateid))
1823 + return nfserr_bad_stateid;
1824 + status = lookup_clientid(&stateid->si_opaque.so_clid, cstate, nn);
1825 + if (status == nfserr_stale_clientid) {
1826 +@@ -5175,15 +5181,9 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_
1827 + status = nfsd4_check_seqid(cstate, sop, seqid);
1828 + if (status)
1829 + return status;
1830 +- if (stp->st_stid.sc_type == NFS4_CLOSED_STID
1831 +- || stp->st_stid.sc_type == NFS4_REVOKED_DELEG_STID)
1832 +- /*
1833 +- * "Closed" stateid's exist *only* to return
1834 +- * nfserr_replay_me from the previous step, and
1835 +- * revoked delegations are kept only for free_stateid.
1836 +- */
1837 +- return nfserr_bad_stateid;
1838 +- mutex_lock(&stp->st_mutex);
1839 ++ status = nfsd4_lock_ol_stateid(stp);
1840 ++ if (status != nfs_ok)
1841 ++ return status;
1842 + status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate));
1843 + if (status == nfs_ok)
1844 + status = nfs4_check_fh(current_fh, &stp->st_stid);
1845 +@@ -5407,6 +5407,11 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1846 + nfsd4_close_open_stateid(stp);
1847 + mutex_unlock(&stp->st_mutex);
1848 +
1849 ++ /* See RFC5661 sectionm 18.2.4 */
1850 ++ if (stp->st_stid.sc_client->cl_minorversion)
1851 ++ memcpy(&close->cl_stateid, &close_stateid,
1852 ++ sizeof(close->cl_stateid));
1853 ++
1854 + /* put reference from nfs4_preprocess_seqid_op */
1855 + nfs4_put_stid(&stp->st_stid);
1856 + out:
1857 +@@ -7007,6 +7012,10 @@ static int nfs4_state_create_net(struct net *net)
1858 + INIT_LIST_HEAD(&nn->sessionid_hashtbl[i]);
1859 + nn->conf_name_tree = RB_ROOT;
1860 + nn->unconf_name_tree = RB_ROOT;
1861 ++ nn->boot_time = get_seconds();
1862 ++ nn->grace_ended = false;
1863 ++ nn->nfsd4_manager.block_opens = true;
1864 ++ INIT_LIST_HEAD(&nn->nfsd4_manager.list);
1865 + INIT_LIST_HEAD(&nn->client_lru);
1866 + INIT_LIST_HEAD(&nn->close_lru);
1867 + INIT_LIST_HEAD(&nn->del_recall_lru);
1868 +@@ -7064,9 +7073,6 @@ nfs4_state_start_net(struct net *net)
1869 + ret = nfs4_state_create_net(net);
1870 + if (ret)
1871 + return ret;
1872 +- nn->boot_time = get_seconds();
1873 +- nn->grace_ended = false;
1874 +- nn->nfsd4_manager.block_opens = true;
1875 + locks_start_grace(net, &nn->nfsd4_manager);
1876 + nfsd4_client_tracking_init(net);
1877 + printk(KERN_INFO "NFSD: starting %ld-second grace period (net %p)\n",
1878 +diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
1879 +index 1bfac28b7e7d..f9246ac4eef8 100644
1880 +--- a/fs/quota/dquot.c
1881 ++++ b/fs/quota/dquot.c
1882 +@@ -2985,7 +2985,8 @@ static int __init dquot_init(void)
1883 + pr_info("VFS: Dquot-cache hash table entries: %ld (order %ld,"
1884 + " %ld bytes)\n", nr_hash, order, (PAGE_SIZE << order));
1885 +
1886 +- register_shrinker(&dqcache_shrinker);
1887 ++ if (register_shrinker(&dqcache_shrinker))
1888 ++ panic("Cannot register dquot shrinker");
1889 +
1890 + return 0;
1891 + }
1892 +diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
1893 +index 0a6ad4e71e88..e101d70d2327 100644
1894 +--- a/fs/reiserfs/super.c
1895 ++++ b/fs/reiserfs/super.c
1896 +@@ -2521,7 +2521,6 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
1897 + return err;
1898 + if (inode->i_size < off + len - towrite)
1899 + i_size_write(inode, off + len - towrite);
1900 +- inode->i_version++;
1901 + inode->i_mtime = inode->i_ctime = current_time(inode);
1902 + mark_inode_dirty(inode);
1903 + return len - towrite;
1904 +diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
1905 +index d31cd1ebd8e9..f3acecf3869d 100644
1906 +--- a/fs/xfs/xfs_aops.c
1907 ++++ b/fs/xfs/xfs_aops.c
1908 +@@ -391,7 +391,7 @@ xfs_map_blocks(
1909 + (ip->i_df.if_flags & XFS_IFEXTENTS));
1910 + ASSERT(offset <= mp->m_super->s_maxbytes);
1911 +
1912 +- if (offset + count > mp->m_super->s_maxbytes)
1913 ++ if ((xfs_ufsize_t)offset + count > mp->m_super->s_maxbytes)
1914 + count = mp->m_super->s_maxbytes - offset;
1915 + end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count);
1916 + offset_fsb = XFS_B_TO_FSBT(mp, offset);
1917 +@@ -1295,7 +1295,7 @@ xfs_map_trim_size(
1918 + if (mapping_size > size)
1919 + mapping_size = size;
1920 + if (offset < i_size_read(inode) &&
1921 +- offset + mapping_size >= i_size_read(inode)) {
1922 ++ (xfs_ufsize_t)offset + mapping_size >= i_size_read(inode)) {
1923 + /* limit mapping to block that spans EOF */
1924 + mapping_size = roundup_64(i_size_read(inode) - offset,
1925 + i_blocksize(inode));
1926 +@@ -1347,7 +1347,7 @@ __xfs_get_blocks(
1927 + lockmode = xfs_ilock_data_map_shared(ip);
1928 +
1929 + ASSERT(offset <= mp->m_super->s_maxbytes);
1930 +- if (offset + size > mp->m_super->s_maxbytes)
1931 ++ if ((xfs_ufsize_t)offset + size > mp->m_super->s_maxbytes)
1932 + size = mp->m_super->s_maxbytes - offset;
1933 + end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + size);
1934 + offset_fsb = XFS_B_TO_FSBT(mp, offset);
1935 +diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
1936 +index eca7baecc9f0..3f45d9867e10 100644
1937 +--- a/fs/xfs/xfs_buf.c
1938 ++++ b/fs/xfs/xfs_buf.c
1939 +@@ -1785,22 +1785,27 @@ xfs_alloc_buftarg(
1940 + btp->bt_bdi = blk_get_backing_dev_info(bdev);
1941 +
1942 + if (xfs_setsize_buftarg_early(btp, bdev))
1943 +- goto error;
1944 ++ goto error_free;
1945 +
1946 + if (list_lru_init(&btp->bt_lru))
1947 +- goto error;
1948 ++ goto error_free;
1949 +
1950 + if (percpu_counter_init(&btp->bt_io_count, 0, GFP_KERNEL))
1951 +- goto error;
1952 ++ goto error_lru;
1953 +
1954 + btp->bt_shrinker.count_objects = xfs_buftarg_shrink_count;
1955 + btp->bt_shrinker.scan_objects = xfs_buftarg_shrink_scan;
1956 + btp->bt_shrinker.seeks = DEFAULT_SEEKS;
1957 + btp->bt_shrinker.flags = SHRINKER_NUMA_AWARE;
1958 +- register_shrinker(&btp->bt_shrinker);
1959 ++ if (register_shrinker(&btp->bt_shrinker))
1960 ++ goto error_pcpu;
1961 + return btp;
1962 +
1963 +-error:
1964 ++error_pcpu:
1965 ++ percpu_counter_destroy(&btp->bt_io_count);
1966 ++error_lru:
1967 ++ list_lru_destroy(&btp->bt_lru);
1968 ++error_free:
1969 + kmem_free(btp);
1970 + return NULL;
1971 + }
1972 +diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
1973 +index 9d06cc30e875..7a7b3ccf2273 100644
1974 +--- a/fs/xfs/xfs_dquot.c
1975 ++++ b/fs/xfs/xfs_dquot.c
1976 +@@ -1004,14 +1004,22 @@ xfs_qm_dqflush_done(
1977 + * holding the lock before removing the dquot from the AIL.
1978 + */
1979 + if ((lip->li_flags & XFS_LI_IN_AIL) &&
1980 +- lip->li_lsn == qip->qli_flush_lsn) {
1981 ++ ((lip->li_lsn == qip->qli_flush_lsn) ||
1982 ++ (lip->li_flags & XFS_LI_FAILED))) {
1983 +
1984 + /* xfs_trans_ail_delete() drops the AIL lock. */
1985 + spin_lock(&ailp->xa_lock);
1986 +- if (lip->li_lsn == qip->qli_flush_lsn)
1987 ++ if (lip->li_lsn == qip->qli_flush_lsn) {
1988 + xfs_trans_ail_delete(ailp, lip, SHUTDOWN_CORRUPT_INCORE);
1989 +- else
1990 ++ } else {
1991 ++ /*
1992 ++ * Clear the failed state since we are about to drop the
1993 ++ * flush lock
1994 ++ */
1995 ++ if (lip->li_flags & XFS_LI_FAILED)
1996 ++ xfs_clear_li_failed(lip);
1997 + spin_unlock(&ailp->xa_lock);
1998 ++ }
1999 + }
2000 +
2001 + /*
2002 +diff --git a/fs/xfs/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c
2003 +index 2c7a1629e064..664dea105e76 100644
2004 +--- a/fs/xfs/xfs_dquot_item.c
2005 ++++ b/fs/xfs/xfs_dquot_item.c
2006 +@@ -137,6 +137,26 @@ xfs_qm_dqunpin_wait(
2007 + wait_event(dqp->q_pinwait, (atomic_read(&dqp->q_pincount) == 0));
2008 + }
2009 +
2010 ++/*
2011 ++ * Callback used to mark a buffer with XFS_LI_FAILED when items in the buffer
2012 ++ * have been failed during writeback
2013 ++ *
2014 ++ * this informs the AIL that the dquot is already flush locked on the next push,
2015 ++ * and acquires a hold on the buffer to ensure that it isn't reclaimed before
2016 ++ * dirty data makes it to disk.
2017 ++ */
2018 ++STATIC void
2019 ++xfs_dquot_item_error(
2020 ++ struct xfs_log_item *lip,
2021 ++ struct xfs_buf *bp)
2022 ++{
2023 ++ struct xfs_dquot *dqp;
2024 ++
2025 ++ dqp = DQUOT_ITEM(lip)->qli_dquot;
2026 ++ ASSERT(!completion_done(&dqp->q_flush));
2027 ++ xfs_set_li_failed(lip, bp);
2028 ++}
2029 ++
2030 + STATIC uint
2031 + xfs_qm_dquot_logitem_push(
2032 + struct xfs_log_item *lip,
2033 +@@ -144,13 +164,28 @@ xfs_qm_dquot_logitem_push(
2034 + __acquires(&lip->li_ailp->xa_lock)
2035 + {
2036 + struct xfs_dquot *dqp = DQUOT_ITEM(lip)->qli_dquot;
2037 +- struct xfs_buf *bp = NULL;
2038 ++ struct xfs_buf *bp = lip->li_buf;
2039 + uint rval = XFS_ITEM_SUCCESS;
2040 + int error;
2041 +
2042 + if (atomic_read(&dqp->q_pincount) > 0)
2043 + return XFS_ITEM_PINNED;
2044 +
2045 ++ /*
2046 ++ * The buffer containing this item failed to be written back
2047 ++ * previously. Resubmit the buffer for IO
2048 ++ */
2049 ++ if (lip->li_flags & XFS_LI_FAILED) {
2050 ++ if (!xfs_buf_trylock(bp))
2051 ++ return XFS_ITEM_LOCKED;
2052 ++
2053 ++ if (!xfs_buf_resubmit_failed_buffers(bp, lip, buffer_list))
2054 ++ rval = XFS_ITEM_FLUSHING;
2055 ++
2056 ++ xfs_buf_unlock(bp);
2057 ++ return rval;
2058 ++ }
2059 ++
2060 + if (!xfs_dqlock_nowait(dqp))
2061 + return XFS_ITEM_LOCKED;
2062 +
2063 +@@ -242,7 +277,8 @@ static const struct xfs_item_ops xfs_dquot_item_ops = {
2064 + .iop_unlock = xfs_qm_dquot_logitem_unlock,
2065 + .iop_committed = xfs_qm_dquot_logitem_committed,
2066 + .iop_push = xfs_qm_dquot_logitem_push,
2067 +- .iop_committing = xfs_qm_dquot_logitem_committing
2068 ++ .iop_committing = xfs_qm_dquot_logitem_committing,
2069 ++ .iop_error = xfs_dquot_item_error
2070 + };
2071 +
2072 + /*
2073 +diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
2074 +index 98ca9f1b6a07..c5f2f1e3cc4b 100644
2075 +--- a/fs/xfs/xfs_inode.c
2076 ++++ b/fs/xfs/xfs_inode.c
2077 +@@ -2429,6 +2429,24 @@ xfs_ifree_cluster(
2078 + return 0;
2079 + }
2080 +
2081 ++/*
2082 ++ * Free any local-format buffers sitting around before we reset to
2083 ++ * extents format.
2084 ++ */
2085 ++static inline void
2086 ++xfs_ifree_local_data(
2087 ++ struct xfs_inode *ip,
2088 ++ int whichfork)
2089 ++{
2090 ++ struct xfs_ifork *ifp;
2091 ++
2092 ++ if (XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_LOCAL)
2093 ++ return;
2094 ++
2095 ++ ifp = XFS_IFORK_PTR(ip, whichfork);
2096 ++ xfs_idata_realloc(ip, -ifp->if_bytes, whichfork);
2097 ++}
2098 ++
2099 + /*
2100 + * This is called to return an inode to the inode free list.
2101 + * The inode should already be truncated to 0 length and have
2102 +@@ -2466,6 +2484,9 @@ xfs_ifree(
2103 + if (error)
2104 + return error;
2105 +
2106 ++ xfs_ifree_local_data(ip, XFS_DATA_FORK);
2107 ++ xfs_ifree_local_data(ip, XFS_ATTR_FORK);
2108 ++
2109 + VFS_I(ip)->i_mode = 0; /* mark incore inode as free */
2110 + ip->i_d.di_flags = 0;
2111 + ip->i_d.di_dmevmask = 0;
2112 +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
2113 +index 25ed105bbcfb..20ee90c47cd5 100644
2114 +--- a/include/linux/mlx5/mlx5_ifc.h
2115 ++++ b/include/linux/mlx5/mlx5_ifc.h
2116 +@@ -737,6 +737,12 @@ enum {
2117 + MLX5_CAP_PORT_TYPE_ETH = 0x1,
2118 + };
2119 +
2120 ++enum {
2121 ++ MLX5_CAP_UMR_FENCE_STRONG = 0x0,
2122 ++ MLX5_CAP_UMR_FENCE_SMALL = 0x1,
2123 ++ MLX5_CAP_UMR_FENCE_NONE = 0x2,
2124 ++};
2125 ++
2126 + struct mlx5_ifc_cmd_hca_cap_bits {
2127 + u8 reserved_at_0[0x80];
2128 +
2129 +@@ -838,7 +844,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
2130 + u8 striding_rq[0x1];
2131 + u8 reserved_at_201[0x2];
2132 + u8 ipoib_basic_offloads[0x1];
2133 +- u8 reserved_at_205[0xa];
2134 ++ u8 reserved_at_205[0x5];
2135 ++ u8 umr_fence[0x2];
2136 ++ u8 reserved_at_20c[0x3];
2137 + u8 drain_sigerr[0x1];
2138 + u8 cmdif_checksum[0x2];
2139 + u8 sigerr_cqe[0x1];
2140 +diff --git a/include/linux/tty.h b/include/linux/tty.h
2141 +index 40144f382516..a41244fe58d0 100644
2142 +--- a/include/linux/tty.h
2143 ++++ b/include/linux/tty.h
2144 +@@ -394,6 +394,8 @@ extern struct tty_struct *get_current_tty(void);
2145 + /* tty_io.c */
2146 + extern int __init tty_init(void);
2147 + extern const char *tty_name(const struct tty_struct *tty);
2148 ++extern int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout);
2149 ++extern void tty_ldisc_unlock(struct tty_struct *tty);
2150 + #else
2151 + static inline void console_init(void)
2152 + { }
2153 +diff --git a/mm/kmemleak.c b/mm/kmemleak.c
2154 +index d1380ed93fdf..20cf3be9a5e8 100644
2155 +--- a/mm/kmemleak.c
2156 ++++ b/mm/kmemleak.c
2157 +@@ -1442,6 +1442,8 @@ static void kmemleak_scan(void)
2158 + if (page_count(page) == 0)
2159 + continue;
2160 + scan_block(page, page + 1, NULL);
2161 ++ if (!(pfn % (MAX_SCAN_SIZE / sizeof(*page))))
2162 ++ cond_resched();
2163 + }
2164 + }
2165 + put_online_mems();
2166 +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
2167 +index b747c9645e43..fed598a202c8 100644
2168 +--- a/net/mac80211/mesh_hwmp.c
2169 ++++ b/net/mac80211/mesh_hwmp.c
2170 +@@ -788,7 +788,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
2171 + struct mesh_path *mpath;
2172 + u8 ttl, flags, hopcount;
2173 + const u8 *orig_addr;
2174 +- u32 orig_sn, metric, metric_txsta, interval;
2175 ++ u32 orig_sn, new_metric, orig_metric, last_hop_metric, interval;
2176 + bool root_is_gate;
2177 +
2178 + ttl = rann->rann_ttl;
2179 +@@ -799,7 +799,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
2180 + interval = le32_to_cpu(rann->rann_interval);
2181 + hopcount = rann->rann_hopcount;
2182 + hopcount++;
2183 +- metric = le32_to_cpu(rann->rann_metric);
2184 ++ orig_metric = le32_to_cpu(rann->rann_metric);
2185 +
2186 + /* Ignore our own RANNs */
2187 + if (ether_addr_equal(orig_addr, sdata->vif.addr))
2188 +@@ -816,7 +816,10 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
2189 + return;
2190 + }
2191 +
2192 +- metric_txsta = airtime_link_metric_get(local, sta);
2193 ++ last_hop_metric = airtime_link_metric_get(local, sta);
2194 ++ new_metric = orig_metric + last_hop_metric;
2195 ++ if (new_metric < orig_metric)
2196 ++ new_metric = MAX_METRIC;
2197 +
2198 + mpath = mesh_path_lookup(sdata, orig_addr);
2199 + if (!mpath) {
2200 +@@ -829,7 +832,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
2201 + }
2202 +
2203 + if (!(SN_LT(mpath->sn, orig_sn)) &&
2204 +- !(mpath->sn == orig_sn && metric < mpath->rann_metric)) {
2205 ++ !(mpath->sn == orig_sn && new_metric < mpath->rann_metric)) {
2206 + rcu_read_unlock();
2207 + return;
2208 + }
2209 +@@ -847,7 +850,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
2210 + }
2211 +
2212 + mpath->sn = orig_sn;
2213 +- mpath->rann_metric = metric + metric_txsta;
2214 ++ mpath->rann_metric = new_metric;
2215 + mpath->is_root = true;
2216 + /* Recording RANNs sender address to send individually
2217 + * addressed PREQs destined for root mesh STA */
2218 +@@ -867,7 +870,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
2219 + mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr,
2220 + orig_sn, 0, NULL, 0, broadcast_addr,
2221 + hopcount, ttl, interval,
2222 +- metric + metric_txsta, 0, sdata);
2223 ++ new_metric, 0, sdata);
2224 + }
2225 +
2226 + rcu_read_unlock();
2227 +diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
2228 +index 07925418c2a5..1668916bdbde 100644
2229 +--- a/net/openvswitch/flow_netlink.c
2230 ++++ b/net/openvswitch/flow_netlink.c
2231 +@@ -1789,14 +1789,11 @@ int ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb)
2232 +
2233 + #define MAX_ACTIONS_BUFSIZE (32 * 1024)
2234 +
2235 +-static struct sw_flow_actions *nla_alloc_flow_actions(int size, bool log)
2236 ++static struct sw_flow_actions *nla_alloc_flow_actions(int size)
2237 + {
2238 + struct sw_flow_actions *sfa;
2239 +
2240 +- if (size > MAX_ACTIONS_BUFSIZE) {
2241 +- OVS_NLERR(log, "Flow action size %u bytes exceeds max", size);
2242 +- return ERR_PTR(-EINVAL);
2243 +- }
2244 ++ WARN_ON_ONCE(size > MAX_ACTIONS_BUFSIZE);
2245 +
2246 + sfa = kmalloc(sizeof(*sfa) + size, GFP_KERNEL);
2247 + if (!sfa)
2248 +@@ -1869,12 +1866,15 @@ static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa,
2249 + new_acts_size = ksize(*sfa) * 2;
2250 +
2251 + if (new_acts_size > MAX_ACTIONS_BUFSIZE) {
2252 +- if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size)
2253 ++ if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) {
2254 ++ OVS_NLERR(log, "Flow action size exceeds max %u",
2255 ++ MAX_ACTIONS_BUFSIZE);
2256 + return ERR_PTR(-EMSGSIZE);
2257 ++ }
2258 + new_acts_size = MAX_ACTIONS_BUFSIZE;
2259 + }
2260 +
2261 +- acts = nla_alloc_flow_actions(new_acts_size, log);
2262 ++ acts = nla_alloc_flow_actions(new_acts_size);
2263 + if (IS_ERR(acts))
2264 + return (void *)acts;
2265 +
2266 +@@ -2500,7 +2500,7 @@ int ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
2267 + {
2268 + int err;
2269 +
2270 +- *sfa = nla_alloc_flow_actions(nla_len(attr), log);
2271 ++ *sfa = nla_alloc_flow_actions(min(nla_len(attr), MAX_ACTIONS_BUFSIZE));
2272 + if (IS_ERR(*sfa))
2273 + return PTR_ERR(*sfa);
2274 +
2275 +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
2276 +index e01c825bc683..d24d14ea8ba4 100644
2277 +--- a/net/sunrpc/xprtsock.c
2278 ++++ b/net/sunrpc/xprtsock.c
2279 +@@ -2381,6 +2381,7 @@ static void xs_tcp_setup_socket(struct work_struct *work)
2280 + case -ECONNREFUSED:
2281 + case -ECONNRESET:
2282 + case -ENETUNREACH:
2283 ++ case -EHOSTUNREACH:
2284 + case -EADDRINUSE:
2285 + case -ENOBUFS:
2286 + /* retry with existing socket, after a delay */
2287 +diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c
2288 +index 1c14c2595158..4b36323ea64b 100644
2289 +--- a/tools/gpio/gpio-event-mon.c
2290 ++++ b/tools/gpio/gpio-event-mon.c
2291 +@@ -23,6 +23,7 @@
2292 + #include <getopt.h>
2293 + #include <inttypes.h>
2294 + #include <sys/ioctl.h>
2295 ++#include <sys/types.h>
2296 + #include <linux/gpio.h>
2297 +
2298 + int monitor_device(const char *device_name,
2299 +diff --git a/tools/power/cpupower/bench/system.c b/tools/power/cpupower/bench/system.c
2300 +index c25a74ae51ba..2bb3eef7d5c1 100644
2301 +--- a/tools/power/cpupower/bench/system.c
2302 ++++ b/tools/power/cpupower/bench/system.c
2303 +@@ -61,7 +61,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu)
2304 +
2305 + dprintf("set %s as cpufreq governor\n", governor);
2306 +
2307 +- if (cpupower_is_cpu_online(cpu) != 0) {
2308 ++ if (cpupower_is_cpu_online(cpu) != 1) {
2309 + perror("cpufreq_cpu_exists");
2310 + fprintf(stderr, "error: cpu %u does not exist\n", cpu);
2311 + return -1;
2312 +diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
2313 +index 1b5da0066ebf..5b3205f16217 100644
2314 +--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
2315 ++++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
2316 +@@ -130,15 +130,18 @@ static struct cpuidle_monitor *cpuidle_register(void)
2317 + {
2318 + int num;
2319 + char *tmp;
2320 ++ int this_cpu;
2321 ++
2322 ++ this_cpu = sched_getcpu();
2323 +
2324 + /* Assume idle state count is the same for all CPUs */
2325 +- cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(0);
2326 ++ cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(this_cpu);
2327 +
2328 + if (cpuidle_sysfs_monitor.hw_states_num <= 0)
2329 + return NULL;
2330 +
2331 + for (num = 0; num < cpuidle_sysfs_monitor.hw_states_num; num++) {
2332 +- tmp = cpuidle_state_name(0, num);
2333 ++ tmp = cpuidle_state_name(this_cpu, num);
2334 + if (tmp == NULL)
2335 + continue;
2336 +
2337 +@@ -146,7 +149,7 @@ static struct cpuidle_monitor *cpuidle_register(void)
2338 + strncpy(cpuidle_cstates[num].name, tmp, CSTATE_NAME_LEN - 1);
2339 + free(tmp);
2340 +
2341 +- tmp = cpuidle_state_desc(0, num);
2342 ++ tmp = cpuidle_state_desc(this_cpu, num);
2343 + if (tmp == NULL)
2344 + continue;
2345 + strncpy(cpuidle_cstates[num].desc, tmp, CSTATE_DESC_LEN - 1);
2346 +diff --git a/tools/usb/usbip/src/usbip_bind.c b/tools/usb/usbip/src/usbip_bind.c
2347 +index fa46141ae68b..e121cfb1746a 100644
2348 +--- a/tools/usb/usbip/src/usbip_bind.c
2349 ++++ b/tools/usb/usbip/src/usbip_bind.c
2350 +@@ -144,6 +144,7 @@ static int bind_device(char *busid)
2351 + int rc;
2352 + struct udev *udev;
2353 + struct udev_device *dev;
2354 ++ const char *devpath;
2355 +
2356 + /* Check whether the device with this bus ID exists. */
2357 + udev = udev_new();
2358 +@@ -152,8 +153,16 @@ static int bind_device(char *busid)
2359 + err("device with the specified bus ID does not exist");
2360 + return -1;
2361 + }
2362 ++ devpath = udev_device_get_devpath(dev);
2363 + udev_unref(udev);
2364 +
2365 ++ /* If the device is already attached to vhci_hcd - bail out */
2366 ++ if (strstr(devpath, USBIP_VHCI_DRV_NAME)) {
2367 ++ err("bind loop detected: device: %s is attached to %s\n",
2368 ++ devpath, USBIP_VHCI_DRV_NAME);
2369 ++ return -1;
2370 ++ }
2371 ++
2372 + rc = unbind_other(busid);
2373 + if (rc == UNBIND_ST_FAILED) {
2374 + err("could not unbind driver from device on busid %s", busid);
2375 +diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c
2376 +index f1b38e866dd7..d65a9f444174 100644
2377 +--- a/tools/usb/usbip/src/usbip_list.c
2378 ++++ b/tools/usb/usbip/src/usbip_list.c
2379 +@@ -187,6 +187,7 @@ static int list_devices(bool parsable)
2380 + const char *busid;
2381 + char product_name[128];
2382 + int ret = -1;
2383 ++ const char *devpath;
2384 +
2385 + /* Create libudev context. */
2386 + udev = udev_new();
2387 +@@ -209,6 +210,14 @@ static int list_devices(bool parsable)
2388 + path = udev_list_entry_get_name(dev_list_entry);
2389 + dev = udev_device_new_from_syspath(udev, path);
2390 +
2391 ++ /* Ignore devices attached to vhci_hcd */
2392 ++ devpath = udev_device_get_devpath(dev);
2393 ++ if (strstr(devpath, USBIP_VHCI_DRV_NAME)) {
2394 ++ dbg("Skip the device %s already attached to %s\n",
2395 ++ devpath, USBIP_VHCI_DRV_NAME);
2396 ++ continue;
2397 ++ }
2398 ++
2399 + /* Get device information. */
2400 + idVendor = udev_device_get_sysattr_value(dev, "idVendor");
2401 + idProduct = udev_device_get_sysattr_value(dev, "idProduct");