Magellan Linux

Contents of /trunk/kernel-magellan/patches-4.16/0107-4.16.8-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3111 - (show annotations) (download)
Wed May 16 14:24:42 2018 UTC (5 years, 11 months ago) by niro
File size: 113036 byte(s)
-linux-4.16.8
1 diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
2 index c1d520de6dfe..3b2f2dd82225 100644
3 --- a/Documentation/arm64/silicon-errata.txt
4 +++ b/Documentation/arm64/silicon-errata.txt
5 @@ -55,6 +55,7 @@ stable kernels.
6 | ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 |
7 | ARM | Cortex-A72 | #853709 | N/A |
8 | ARM | Cortex-A73 | #858921 | ARM64_ERRATUM_858921 |
9 +| ARM | Cortex-A55 | #1024718 | ARM64_ERRATUM_1024718 |
10 | ARM | MMU-500 | #841119,#826419 | N/A |
11 | | | | |
12 | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |
13 diff --git a/Makefile b/Makefile
14 index 1c5d5d8c45e2..5da6ffd69209 100644
15 --- a/Makefile
16 +++ b/Makefile
17 @@ -1,7 +1,7 @@
18 # SPDX-License-Identifier: GPL-2.0
19 VERSION = 4
20 PATCHLEVEL = 16
21 -SUBLEVEL = 7
22 +SUBLEVEL = 8
23 EXTRAVERSION =
24 NAME = Fearless Coyote
25
26 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
27 index 7381eeb7ef8e..be665760f2bd 100644
28 --- a/arch/arm64/Kconfig
29 +++ b/arch/arm64/Kconfig
30 @@ -464,6 +464,20 @@ config ARM64_ERRATUM_843419
31
32 If unsure, say Y.
33
34 +config ARM64_ERRATUM_1024718
35 + bool "Cortex-A55: 1024718: Update of DBM/AP bits without break before make might result in incorrect update"
36 + default y
37 + help
38 + This option adds work around for Arm Cortex-A55 Erratum 1024718.
39 +
40 + Affected Cortex-A55 cores (r0p0, r0p1, r1p0) could cause incorrect
41 + update of the hardware dirty bit when the DBM/AP bits are updated
42 + without a break-before-make. The work around is to disable the usage
43 + of hardware DBM locally on the affected cores. CPUs not affected by
44 + erratum will continue to use the feature.
45 +
46 + If unsure, say Y.
47 +
48 config CAVIUM_ERRATUM_22375
49 bool "Cavium erratum 22375, 24313"
50 default y
51 diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
52 index 3c78835bba94..a3ca19e68b73 100644
53 --- a/arch/arm64/include/asm/assembler.h
54 +++ b/arch/arm64/include/asm/assembler.h
55 @@ -25,6 +25,7 @@
56
57 #include <asm/asm-offsets.h>
58 #include <asm/cpufeature.h>
59 +#include <asm/cputype.h>
60 #include <asm/debug-monitors.h>
61 #include <asm/page.h>
62 #include <asm/pgtable-hwdef.h>
63 @@ -595,4 +596,43 @@ USER(\label, ic ivau, \tmp2) // invalidate I line PoU
64 #endif
65 .endm
66
67 +/*
68 + * Check the MIDR_EL1 of the current CPU for a given model and a range of
69 + * variant/revision. See asm/cputype.h for the macros used below.
70 + *
71 + * model: MIDR_CPU_MODEL of CPU
72 + * rv_min: Minimum of MIDR_CPU_VAR_REV()
73 + * rv_max: Maximum of MIDR_CPU_VAR_REV()
74 + * res: Result register.
75 + * tmp1, tmp2, tmp3: Temporary registers
76 + *
77 + * Corrupts: res, tmp1, tmp2, tmp3
78 + * Returns: 0, if the CPU id doesn't match. Non-zero otherwise
79 + */
80 + .macro cpu_midr_match model, rv_min, rv_max, res, tmp1, tmp2, tmp3
81 + mrs \res, midr_el1
82 + mov_q \tmp1, (MIDR_REVISION_MASK | MIDR_VARIANT_MASK)
83 + mov_q \tmp2, MIDR_CPU_MODEL_MASK
84 + and \tmp3, \res, \tmp2 // Extract model
85 + and \tmp1, \res, \tmp1 // rev & variant
86 + mov_q \tmp2, \model
87 + cmp \tmp3, \tmp2
88 + cset \res, eq
89 + cbz \res, .Ldone\@ // Model matches ?
90 +
91 + .if (\rv_min != 0) // Skip min check if rv_min == 0
92 + mov_q \tmp3, \rv_min
93 + cmp \tmp1, \tmp3
94 + cset \res, ge
95 + .endif // \rv_min != 0
96 + /* Skip rv_max check if rv_min == rv_max && rv_min != 0 */
97 + .if ((\rv_min != \rv_max) || \rv_min == 0)
98 + mov_q \tmp2, \rv_max
99 + cmp \tmp1, \tmp2
100 + cset \tmp2, le
101 + and \res, \res, \tmp2
102 + .endif
103 +.Ldone\@:
104 + .endm
105 +
106 #endif /* __ASM_ASSEMBLER_H */
107 diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
108 index 350c76a1d15b..8e32a6f28f00 100644
109 --- a/arch/arm64/include/asm/cputype.h
110 +++ b/arch/arm64/include/asm/cputype.h
111 @@ -83,6 +83,7 @@
112 #define ARM_CPU_PART_CORTEX_A53 0xD03
113 #define ARM_CPU_PART_CORTEX_A73 0xD09
114 #define ARM_CPU_PART_CORTEX_A75 0xD0A
115 +#define ARM_CPU_PART_CORTEX_A55 0xD05
116
117 #define APM_CPU_PART_POTENZA 0x000
118
119 @@ -102,6 +103,7 @@
120 #define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)
121 #define MIDR_CORTEX_A73 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A73)
122 #define MIDR_CORTEX_A75 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A75)
123 +#define MIDR_CORTEX_A55 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A55)
124 #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX)
125 #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX)
126 #define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX)
127 diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
128 index c0af47617299..5244440baea4 100644
129 --- a/arch/arm64/mm/proc.S
130 +++ b/arch/arm64/mm/proc.S
131 @@ -448,6 +448,11 @@ ENTRY(__cpu_setup)
132 cbz x9, 2f
133 cmp x9, #2
134 b.lt 1f
135 +#ifdef CONFIG_ARM64_ERRATUM_1024718
136 + /* Disable hardware DBM on Cortex-A55 r0p0, r0p1 & r1p0 */
137 + cpu_midr_match MIDR_CORTEX_A55, MIDR_CPU_VAR_REV(0, 0), MIDR_CPU_VAR_REV(1, 0), x1, x2, x3, x4
138 + cbnz x1, 1f
139 +#endif
140 orr x10, x10, #TCR_HD // hardware Dirty flag update
141 1: orr x10, x10, #TCR_HA // hardware Access flag update
142 2:
143 diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
144 index 3615c0f255e9..c375b0aef877 100644
145 --- a/arch/x86/kernel/tsc.c
146 +++ b/arch/x86/kernel/tsc.c
147 @@ -1067,6 +1067,7 @@ static struct clocksource clocksource_tsc_early = {
148 .resume = tsc_resume,
149 .mark_unstable = tsc_cs_mark_unstable,
150 .tick_stable = tsc_cs_tick_stable,
151 + .list = LIST_HEAD_INIT(clocksource_tsc_early.list),
152 };
153
154 /*
155 @@ -1086,6 +1087,7 @@ static struct clocksource clocksource_tsc = {
156 .resume = tsc_resume,
157 .mark_unstable = tsc_cs_mark_unstable,
158 .tick_stable = tsc_cs_tick_stable,
159 + .list = LIST_HEAD_INIT(clocksource_tsc.list),
160 };
161
162 void mark_tsc_unstable(char *reason)
163 @@ -1098,13 +1100,9 @@ void mark_tsc_unstable(char *reason)
164 clear_sched_clock_stable();
165 disable_sched_clock_irqtime();
166 pr_info("Marking TSC unstable due to %s\n", reason);
167 - /* Change only the rating, when not registered */
168 - if (clocksource_tsc.mult) {
169 - clocksource_mark_unstable(&clocksource_tsc);
170 - } else {
171 - clocksource_tsc.flags |= CLOCK_SOURCE_UNSTABLE;
172 - clocksource_tsc.rating = 0;
173 - }
174 +
175 + clocksource_mark_unstable(&clocksource_tsc_early);
176 + clocksource_mark_unstable(&clocksource_tsc);
177 }
178
179 EXPORT_SYMBOL_GPL(mark_tsc_unstable);
180 @@ -1205,7 +1203,7 @@ static void tsc_refine_calibration_work(struct work_struct *work)
181
182 /* Don't bother refining TSC on unstable systems */
183 if (tsc_unstable)
184 - return;
185 + goto unreg;
186
187 /*
188 * Since the work is started early in boot, we may be
189 @@ -1258,11 +1256,12 @@ static void tsc_refine_calibration_work(struct work_struct *work)
190
191 out:
192 if (tsc_unstable)
193 - return;
194 + goto unreg;
195
196 if (boot_cpu_has(X86_FEATURE_ART))
197 art_related_clocksource = &clocksource_tsc;
198 clocksource_register_khz(&clocksource_tsc, tsc_khz);
199 +unreg:
200 clocksource_unregister(&clocksource_tsc_early);
201 }
202
203 @@ -1272,8 +1271,8 @@ static int __init init_tsc_clocksource(void)
204 if (!boot_cpu_has(X86_FEATURE_TSC) || tsc_disabled > 0 || !tsc_khz)
205 return 0;
206
207 - if (check_tsc_unstable())
208 - return 0;
209 + if (tsc_unstable)
210 + goto unreg;
211
212 if (tsc_clocksource_reliable)
213 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
214 @@ -1289,6 +1288,7 @@ static int __init init_tsc_clocksource(void)
215 if (boot_cpu_has(X86_FEATURE_ART))
216 art_related_clocksource = &clocksource_tsc;
217 clocksource_register_khz(&clocksource_tsc, tsc_khz);
218 +unreg:
219 clocksource_unregister(&clocksource_tsc_early);
220 return 0;
221 }
222 diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
223 index 391dda8d43b7..7cf470a3755f 100644
224 --- a/arch/x86/kvm/lapic.c
225 +++ b/arch/x86/kvm/lapic.c
226 @@ -1455,23 +1455,6 @@ static void start_sw_tscdeadline(struct kvm_lapic *apic)
227 local_irq_restore(flags);
228 }
229
230 -static void start_sw_period(struct kvm_lapic *apic)
231 -{
232 - if (!apic->lapic_timer.period)
233 - return;
234 -
235 - if (apic_lvtt_oneshot(apic) &&
236 - ktime_after(ktime_get(),
237 - apic->lapic_timer.target_expiration)) {
238 - apic_timer_expired(apic);
239 - return;
240 - }
241 -
242 - hrtimer_start(&apic->lapic_timer.timer,
243 - apic->lapic_timer.target_expiration,
244 - HRTIMER_MODE_ABS_PINNED);
245 -}
246 -
247 static void update_target_expiration(struct kvm_lapic *apic, uint32_t old_divisor)
248 {
249 ktime_t now, remaining;
250 @@ -1538,6 +1521,26 @@ static void advance_periodic_target_expiration(struct kvm_lapic *apic)
251 apic->lapic_timer.period);
252 }
253
254 +static void start_sw_period(struct kvm_lapic *apic)
255 +{
256 + if (!apic->lapic_timer.period)
257 + return;
258 +
259 + if (ktime_after(ktime_get(),
260 + apic->lapic_timer.target_expiration)) {
261 + apic_timer_expired(apic);
262 +
263 + if (apic_lvtt_oneshot(apic))
264 + return;
265 +
266 + advance_periodic_target_expiration(apic);
267 + }
268 +
269 + hrtimer_start(&apic->lapic_timer.timer,
270 + apic->lapic_timer.target_expiration,
271 + HRTIMER_MODE_ABS_PINNED);
272 +}
273 +
274 bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)
275 {
276 if (!lapic_in_kernel(vcpu))
277 diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
278 index e1eee7a60fad..f1cc4f9d31cd 100644
279 --- a/drivers/acpi/button.c
280 +++ b/drivers/acpi/button.c
281 @@ -635,4 +635,26 @@ module_param_call(lid_init_state,
282 NULL, 0644);
283 MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state");
284
285 -module_acpi_driver(acpi_button_driver);
286 +static int acpi_button_register_driver(struct acpi_driver *driver)
287 +{
288 + /*
289 + * Modules such as nouveau.ko and i915.ko have a link time dependency
290 + * on acpi_lid_open(), and would therefore not be loadable on ACPI
291 + * capable kernels booted in non-ACPI mode if the return value of
292 + * acpi_bus_register_driver() is returned from here with ACPI disabled
293 + * when this driver is built as a module.
294 + */
295 + if (acpi_disabled)
296 + return 0;
297 +
298 + return acpi_bus_register_driver(driver);
299 +}
300 +
301 +static void acpi_button_unregister_driver(struct acpi_driver *driver)
302 +{
303 + if (!acpi_disabled)
304 + acpi_bus_unregister_driver(driver);
305 +}
306 +
307 +module_driver(acpi_button_driver, acpi_button_register_driver,
308 + acpi_button_unregister_driver);
309 diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c
310 index de5e7dee7ad6..2e6c61d9b8ea 100644
311 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
312 +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
313 @@ -55,7 +55,9 @@ static int dumb_vga_get_modes(struct drm_connector *connector)
314 }
315
316 drm_mode_connector_update_edid_property(connector, edid);
317 - return drm_add_edid_modes(connector, edid);
318 + ret = drm_add_edid_modes(connector, edid);
319 + kfree(edid);
320 + return ret;
321
322 fallback:
323 /*
324 diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
325 index ce1e3b9e14c9..75f379c67a31 100644
326 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
327 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
328 @@ -735,6 +735,7 @@ static irqreturn_t vc4_crtc_irq_handler(int irq, void *data)
329 struct vc4_async_flip_state {
330 struct drm_crtc *crtc;
331 struct drm_framebuffer *fb;
332 + struct drm_framebuffer *old_fb;
333 struct drm_pending_vblank_event *event;
334
335 struct vc4_seqno_cb cb;
336 @@ -764,6 +765,23 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb)
337
338 drm_crtc_vblank_put(crtc);
339 drm_framebuffer_put(flip_state->fb);
340 +
341 + /* Decrement the BO usecnt in order to keep the inc/dec calls balanced
342 + * when the planes are updated through the async update path.
343 + * FIXME: we should move to generic async-page-flip when it's
344 + * available, so that we can get rid of this hand-made cleanup_fb()
345 + * logic.
346 + */
347 + if (flip_state->old_fb) {
348 + struct drm_gem_cma_object *cma_bo;
349 + struct vc4_bo *bo;
350 +
351 + cma_bo = drm_fb_cma_get_gem_obj(flip_state->old_fb, 0);
352 + bo = to_vc4_bo(&cma_bo->base);
353 + vc4_bo_dec_usecnt(bo);
354 + drm_framebuffer_put(flip_state->old_fb);
355 + }
356 +
357 kfree(flip_state);
358
359 up(&vc4->async_modeset);
360 @@ -788,9 +806,22 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
361 struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0);
362 struct vc4_bo *bo = to_vc4_bo(&cma_bo->base);
363
364 + /* Increment the BO usecnt here, so that we never end up with an
365 + * unbalanced number of vc4_bo_{dec,inc}_usecnt() calls when the
366 + * plane is later updated through the non-async path.
367 + * FIXME: we should move to generic async-page-flip when it's
368 + * available, so that we can get rid of this hand-made prepare_fb()
369 + * logic.
370 + */
371 + ret = vc4_bo_inc_usecnt(bo);
372 + if (ret)
373 + return ret;
374 +
375 flip_state = kzalloc(sizeof(*flip_state), GFP_KERNEL);
376 - if (!flip_state)
377 + if (!flip_state) {
378 + vc4_bo_dec_usecnt(bo);
379 return -ENOMEM;
380 + }
381
382 drm_framebuffer_get(fb);
383 flip_state->fb = fb;
384 @@ -801,10 +832,23 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
385 ret = down_interruptible(&vc4->async_modeset);
386 if (ret) {
387 drm_framebuffer_put(fb);
388 + vc4_bo_dec_usecnt(bo);
389 kfree(flip_state);
390 return ret;
391 }
392
393 + /* Save the current FB before it's replaced by the new one in
394 + * drm_atomic_set_fb_for_plane(). We'll need the old FB in
395 + * vc4_async_page_flip_complete() to decrement the BO usecnt and keep
396 + * it consistent.
397 + * FIXME: we should move to generic async-page-flip when it's
398 + * available, so that we can get rid of this hand-made cleanup_fb()
399 + * logic.
400 + */
401 + flip_state->old_fb = plane->state->fb;
402 + if (flip_state->old_fb)
403 + drm_framebuffer_get(flip_state->old_fb);
404 +
405 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
406
407 /* Immediately update the plane's legacy fb pointer, so that later
408 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
409 index 3c824fd7cbf3..af9fd49c22e6 100644
410 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
411 +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
412 @@ -2598,6 +2598,7 @@ void vmw_kms_helper_resource_finish(struct vmw_validation_ctx *ctx,
413 vmw_kms_helper_buffer_finish(res->dev_priv, NULL, ctx->buf,
414 out_fence, NULL);
415
416 + vmw_dmabuf_unreference(&ctx->buf);
417 vmw_resource_unreserve(res, false, NULL, 0);
418 mutex_unlock(&res->dev_priv->cmdbuf_mutex);
419 }
420 diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
421 index 5c21ae237f82..006e9c0e1ea3 100644
422 --- a/drivers/infiniband/core/ucma.c
423 +++ b/drivers/infiniband/core/ucma.c
424 @@ -678,7 +678,7 @@ static ssize_t ucma_resolve_ip(struct ucma_file *file,
425 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
426 return -EFAULT;
427
428 - if (!rdma_addr_size_in6(&cmd.src_addr) ||
429 + if ((cmd.src_addr.sin6_family && !rdma_addr_size_in6(&cmd.src_addr)) ||
430 !rdma_addr_size_in6(&cmd.dst_addr))
431 return -EINVAL;
432
433 diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
434 index 6f2b26126c64..2be2e1ac1b5f 100644
435 --- a/drivers/infiniband/hw/cxgb4/cq.c
436 +++ b/drivers/infiniband/hw/cxgb4/cq.c
437 @@ -315,7 +315,7 @@ static void advance_oldest_read(struct t4_wq *wq)
438 * Deal with out-of-order and/or completions that complete
439 * prior unsignalled WRs.
440 */
441 -void c4iw_flush_hw_cq(struct c4iw_cq *chp)
442 +void c4iw_flush_hw_cq(struct c4iw_cq *chp, struct c4iw_qp *flush_qhp)
443 {
444 struct t4_cqe *hw_cqe, *swcqe, read_cqe;
445 struct c4iw_qp *qhp;
446 @@ -339,6 +339,13 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp)
447 if (qhp == NULL)
448 goto next_cqe;
449
450 + if (flush_qhp != qhp) {
451 + spin_lock(&qhp->lock);
452 +
453 + if (qhp->wq.flushed == 1)
454 + goto next_cqe;
455 + }
456 +
457 if (CQE_OPCODE(hw_cqe) == FW_RI_TERMINATE)
458 goto next_cqe;
459
460 @@ -390,6 +397,8 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp)
461 next_cqe:
462 t4_hwcq_consume(&chp->cq);
463 ret = t4_next_hw_cqe(&chp->cq, &hw_cqe);
464 + if (qhp && flush_qhp != qhp)
465 + spin_unlock(&qhp->lock);
466 }
467 }
468
469 diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
470 index 7a9d0de89d6a..01d94cd88916 100644
471 --- a/drivers/infiniband/hw/cxgb4/device.c
472 +++ b/drivers/infiniband/hw/cxgb4/device.c
473 @@ -875,6 +875,11 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
474
475 rdev->status_page->db_off = 0;
476
477 + init_completion(&rdev->rqt_compl);
478 + init_completion(&rdev->pbl_compl);
479 + kref_init(&rdev->rqt_kref);
480 + kref_init(&rdev->pbl_kref);
481 +
482 return 0;
483 err_free_status_page_and_wr_log:
484 if (c4iw_wr_log && rdev->wr_log)
485 @@ -893,13 +898,15 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
486
487 static void c4iw_rdev_close(struct c4iw_rdev *rdev)
488 {
489 - destroy_workqueue(rdev->free_workq);
490 kfree(rdev->wr_log);
491 c4iw_release_dev_ucontext(rdev, &rdev->uctx);
492 free_page((unsigned long)rdev->status_page);
493 c4iw_pblpool_destroy(rdev);
494 c4iw_rqtpool_destroy(rdev);
495 + wait_for_completion(&rdev->pbl_compl);
496 + wait_for_completion(&rdev->rqt_compl);
497 c4iw_ocqp_pool_destroy(rdev);
498 + destroy_workqueue(rdev->free_workq);
499 c4iw_destroy_resource(&rdev->resource);
500 }
501
502 diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
503 index cc929002c05e..831027717121 100644
504 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
505 +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
506 @@ -185,6 +185,10 @@ struct c4iw_rdev {
507 struct wr_log_entry *wr_log;
508 int wr_log_size;
509 struct workqueue_struct *free_workq;
510 + struct completion rqt_compl;
511 + struct completion pbl_compl;
512 + struct kref rqt_kref;
513 + struct kref pbl_kref;
514 };
515
516 static inline int c4iw_fatal_error(struct c4iw_rdev *rdev)
517 @@ -1049,7 +1053,7 @@ u32 c4iw_pblpool_alloc(struct c4iw_rdev *rdev, int size);
518 void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size);
519 u32 c4iw_ocqp_pool_alloc(struct c4iw_rdev *rdev, int size);
520 void c4iw_ocqp_pool_free(struct c4iw_rdev *rdev, u32 addr, int size);
521 -void c4iw_flush_hw_cq(struct c4iw_cq *chp);
522 +void c4iw_flush_hw_cq(struct c4iw_cq *chp, struct c4iw_qp *flush_qhp);
523 void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count);
524 int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp);
525 int c4iw_flush_rq(struct t4_wq *wq, struct t4_cq *cq, int count);
526 diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
527 index de77b6027d69..ae167b686608 100644
528 --- a/drivers/infiniband/hw/cxgb4/qp.c
529 +++ b/drivers/infiniband/hw/cxgb4/qp.c
530 @@ -1343,12 +1343,12 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
531 qhp->wq.flushed = 1;
532 t4_set_wq_in_error(&qhp->wq);
533
534 - c4iw_flush_hw_cq(rchp);
535 + c4iw_flush_hw_cq(rchp, qhp);
536 c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
537 rq_flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
538
539 if (schp != rchp)
540 - c4iw_flush_hw_cq(schp);
541 + c4iw_flush_hw_cq(schp, qhp);
542 sq_flushed = c4iw_flush_sq(qhp);
543
544 spin_unlock(&qhp->lock);
545 diff --git a/drivers/infiniband/hw/cxgb4/resource.c b/drivers/infiniband/hw/cxgb4/resource.c
546 index 3cf25997ed2b..0ef25ae05e6f 100644
547 --- a/drivers/infiniband/hw/cxgb4/resource.c
548 +++ b/drivers/infiniband/hw/cxgb4/resource.c
549 @@ -260,12 +260,22 @@ u32 c4iw_pblpool_alloc(struct c4iw_rdev *rdev, int size)
550 rdev->stats.pbl.cur += roundup(size, 1 << MIN_PBL_SHIFT);
551 if (rdev->stats.pbl.cur > rdev->stats.pbl.max)
552 rdev->stats.pbl.max = rdev->stats.pbl.cur;
553 + kref_get(&rdev->pbl_kref);
554 } else
555 rdev->stats.pbl.fail++;
556 mutex_unlock(&rdev->stats.lock);
557 return (u32)addr;
558 }
559
560 +static void destroy_pblpool(struct kref *kref)
561 +{
562 + struct c4iw_rdev *rdev;
563 +
564 + rdev = container_of(kref, struct c4iw_rdev, pbl_kref);
565 + gen_pool_destroy(rdev->pbl_pool);
566 + complete(&rdev->pbl_compl);
567 +}
568 +
569 void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size)
570 {
571 pr_debug("addr 0x%x size %d\n", addr, size);
572 @@ -273,6 +283,7 @@ void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size)
573 rdev->stats.pbl.cur -= roundup(size, 1 << MIN_PBL_SHIFT);
574 mutex_unlock(&rdev->stats.lock);
575 gen_pool_free(rdev->pbl_pool, (unsigned long)addr, size);
576 + kref_put(&rdev->pbl_kref, destroy_pblpool);
577 }
578
579 int c4iw_pblpool_create(struct c4iw_rdev *rdev)
580 @@ -310,7 +321,7 @@ int c4iw_pblpool_create(struct c4iw_rdev *rdev)
581
582 void c4iw_pblpool_destroy(struct c4iw_rdev *rdev)
583 {
584 - gen_pool_destroy(rdev->pbl_pool);
585 + kref_put(&rdev->pbl_kref, destroy_pblpool);
586 }
587
588 /*
589 @@ -331,12 +342,22 @@ u32 c4iw_rqtpool_alloc(struct c4iw_rdev *rdev, int size)
590 rdev->stats.rqt.cur += roundup(size << 6, 1 << MIN_RQT_SHIFT);
591 if (rdev->stats.rqt.cur > rdev->stats.rqt.max)
592 rdev->stats.rqt.max = rdev->stats.rqt.cur;
593 + kref_get(&rdev->rqt_kref);
594 } else
595 rdev->stats.rqt.fail++;
596 mutex_unlock(&rdev->stats.lock);
597 return (u32)addr;
598 }
599
600 +static void destroy_rqtpool(struct kref *kref)
601 +{
602 + struct c4iw_rdev *rdev;
603 +
604 + rdev = container_of(kref, struct c4iw_rdev, rqt_kref);
605 + gen_pool_destroy(rdev->rqt_pool);
606 + complete(&rdev->rqt_compl);
607 +}
608 +
609 void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size)
610 {
611 pr_debug("addr 0x%x size %d\n", addr, size << 6);
612 @@ -344,6 +365,7 @@ void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size)
613 rdev->stats.rqt.cur -= roundup(size << 6, 1 << MIN_RQT_SHIFT);
614 mutex_unlock(&rdev->stats.lock);
615 gen_pool_free(rdev->rqt_pool, (unsigned long)addr, size << 6);
616 + kref_put(&rdev->rqt_kref, destroy_rqtpool);
617 }
618
619 int c4iw_rqtpool_create(struct c4iw_rdev *rdev)
620 @@ -380,7 +402,7 @@ int c4iw_rqtpool_create(struct c4iw_rdev *rdev)
621
622 void c4iw_rqtpool_destroy(struct c4iw_rdev *rdev)
623 {
624 - gen_pool_destroy(rdev->rqt_pool);
625 + kref_put(&rdev->rqt_kref, destroy_rqtpool);
626 }
627
628 /*
629 diff --git a/drivers/infiniband/hw/hfi1/driver.c b/drivers/infiniband/hw/hfi1/driver.c
630 index addc68e83606..78f7c4e743dd 100644
631 --- a/drivers/infiniband/hw/hfi1/driver.c
632 +++ b/drivers/infiniband/hw/hfi1/driver.c
633 @@ -432,31 +432,43 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,
634 bool do_cnp)
635 {
636 struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num);
637 + struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
638 struct ib_other_headers *ohdr = pkt->ohdr;
639 struct ib_grh *grh = pkt->grh;
640 u32 rqpn = 0, bth1;
641 - u16 pkey, rlid, dlid = ib_get_dlid(pkt->hdr);
642 + u16 pkey;
643 + u32 rlid, slid, dlid = 0;
644 u8 hdr_type, sc, svc_type;
645 bool is_mcast = false;
646
647 + /* can be called from prescan */
648 if (pkt->etype == RHF_RCV_TYPE_BYPASS) {
649 is_mcast = hfi1_is_16B_mcast(dlid);
650 pkey = hfi1_16B_get_pkey(pkt->hdr);
651 sc = hfi1_16B_get_sc(pkt->hdr);
652 + dlid = hfi1_16B_get_dlid(pkt->hdr);
653 + slid = hfi1_16B_get_slid(pkt->hdr);
654 hdr_type = HFI1_PKT_TYPE_16B;
655 } else {
656 is_mcast = (dlid > be16_to_cpu(IB_MULTICAST_LID_BASE)) &&
657 (dlid != be16_to_cpu(IB_LID_PERMISSIVE));
658 pkey = ib_bth_get_pkey(ohdr);
659 sc = hfi1_9B_get_sc5(pkt->hdr, pkt->rhf);
660 + dlid = ib_get_dlid(pkt->hdr);
661 + slid = ib_get_slid(pkt->hdr);
662 hdr_type = HFI1_PKT_TYPE_9B;
663 }
664
665 switch (qp->ibqp.qp_type) {
666 + case IB_QPT_UD:
667 + dlid = ppd->lid;
668 + rlid = slid;
669 + rqpn = ib_get_sqpn(pkt->ohdr);
670 + svc_type = IB_CC_SVCTYPE_UD;
671 + break;
672 case IB_QPT_SMI:
673 case IB_QPT_GSI:
674 - case IB_QPT_UD:
675 - rlid = ib_get_slid(pkt->hdr);
676 + rlid = slid;
677 rqpn = ib_get_sqpn(pkt->ohdr);
678 svc_type = IB_CC_SVCTYPE_UD;
679 break;
680 @@ -481,7 +493,6 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,
681 dlid, rlid, sc, grh);
682
683 if (!is_mcast && (bth1 & IB_BECN_SMASK)) {
684 - struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
685 u32 lqpn = bth1 & RVT_QPN_MASK;
686 u8 sl = ibp->sc_to_sl[sc];
687
688 diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h
689 index 90bc8c76d2ca..43050006f301 100644
690 --- a/drivers/infiniband/hw/hfi1/hfi.h
691 +++ b/drivers/infiniband/hw/hfi1/hfi.h
692 @@ -1538,13 +1538,13 @@ void set_link_ipg(struct hfi1_pportdata *ppd);
693 void process_becn(struct hfi1_pportdata *ppd, u8 sl, u32 rlid, u32 lqpn,
694 u32 rqpn, u8 svc_type);
695 void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn,
696 - u32 pkey, u32 slid, u32 dlid, u8 sc5,
697 + u16 pkey, u32 slid, u32 dlid, u8 sc5,
698 const struct ib_grh *old_grh);
699 void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp,
700 - u32 remote_qpn, u32 pkey, u32 slid, u32 dlid,
701 + u32 remote_qpn, u16 pkey, u32 slid, u32 dlid,
702 u8 sc5, const struct ib_grh *old_grh);
703 typedef void (*hfi1_handle_cnp)(struct hfi1_ibport *ibp, struct rvt_qp *qp,
704 - u32 remote_qpn, u32 pkey, u32 slid, u32 dlid,
705 + u32 remote_qpn, u16 pkey, u32 slid, u32 dlid,
706 u8 sc5, const struct ib_grh *old_grh);
707
708 #define PKEY_CHECK_INVALID -1
709 @@ -2438,7 +2438,7 @@ static inline void hfi1_make_16b_hdr(struct hfi1_16b_header *hdr,
710 ((slid >> OPA_16B_SLID_SHIFT) << OPA_16B_SLID_HIGH_SHIFT);
711 lrh2 = (lrh2 & ~OPA_16B_DLID_MASK) |
712 ((dlid >> OPA_16B_DLID_SHIFT) << OPA_16B_DLID_HIGH_SHIFT);
713 - lrh2 = (lrh2 & ~OPA_16B_PKEY_MASK) | (pkey << OPA_16B_PKEY_SHIFT);
714 + lrh2 = (lrh2 & ~OPA_16B_PKEY_MASK) | ((u32)pkey << OPA_16B_PKEY_SHIFT);
715 lrh2 = (lrh2 & ~OPA_16B_L4_MASK) | l4;
716
717 hdr->lrh[0] = lrh0;
718 diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
719 index 33eba2356742..b27fe75c7102 100644
720 --- a/drivers/infiniband/hw/hfi1/init.c
721 +++ b/drivers/infiniband/hw/hfi1/init.c
722 @@ -1265,6 +1265,8 @@ struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra)
723 return ERR_PTR(-ENOMEM);
724 dd->num_pports = nports;
725 dd->pport = (struct hfi1_pportdata *)(dd + 1);
726 + dd->pcidev = pdev;
727 + pci_set_drvdata(pdev, dd);
728
729 INIT_LIST_HEAD(&dd->list);
730 idr_preload(GFP_KERNEL);
731 diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c
732 index 83d66e862207..c1c982908b4b 100644
733 --- a/drivers/infiniband/hw/hfi1/pcie.c
734 +++ b/drivers/infiniband/hw/hfi1/pcie.c
735 @@ -163,9 +163,6 @@ int hfi1_pcie_ddinit(struct hfi1_devdata *dd, struct pci_dev *pdev)
736 resource_size_t addr;
737 int ret = 0;
738
739 - dd->pcidev = pdev;
740 - pci_set_drvdata(pdev, dd);
741 -
742 addr = pci_resource_start(pdev, 0);
743 len = pci_resource_len(pdev, 0);
744
745 diff --git a/drivers/infiniband/hw/hfi1/ruc.c b/drivers/infiniband/hw/hfi1/ruc.c
746 index 3daa94bdae3a..c0071ca4147a 100644
747 --- a/drivers/infiniband/hw/hfi1/ruc.c
748 +++ b/drivers/infiniband/hw/hfi1/ruc.c
749 @@ -733,6 +733,20 @@ static inline void hfi1_make_ruc_bth(struct rvt_qp *qp,
750 ohdr->bth[2] = cpu_to_be32(bth2);
751 }
752
753 +/**
754 + * hfi1_make_ruc_header_16B - build a 16B header
755 + * @qp: the queue pair
756 + * @ohdr: a pointer to the destination header memory
757 + * @bth0: bth0 passed in from the RC/UC builder
758 + * @bth2: bth2 passed in from the RC/UC builder
759 + * @middle: non zero implies indicates ahg "could" be used
760 + * @ps: the current packet state
761 + *
762 + * This routine may disarm ahg under these situations:
763 + * - packet needs a GRH
764 + * - BECN needed
765 + * - migration state not IB_MIG_MIGRATED
766 + */
767 static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
768 struct ib_other_headers *ohdr,
769 u32 bth0, u32 bth2, int middle,
770 @@ -777,6 +791,12 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
771 else
772 middle = 0;
773
774 + if (qp->s_flags & RVT_S_ECN) {
775 + qp->s_flags &= ~RVT_S_ECN;
776 + /* we recently received a FECN, so return a BECN */
777 + becn = true;
778 + middle = 0;
779 + }
780 if (middle)
781 build_ahg(qp, bth2);
782 else
783 @@ -784,11 +804,6 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
784
785 bth0 |= pkey;
786 bth0 |= extra_bytes << 20;
787 - if (qp->s_flags & RVT_S_ECN) {
788 - qp->s_flags &= ~RVT_S_ECN;
789 - /* we recently received a FECN, so return a BECN */
790 - becn = true;
791 - }
792 hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
793
794 if (!ppd->lid)
795 @@ -806,6 +821,20 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
796 pkey, becn, 0, l4, priv->s_sc);
797 }
798
799 +/**
800 + * hfi1_make_ruc_header_9B - build a 9B header
801 + * @qp: the queue pair
802 + * @ohdr: a pointer to the destination header memory
803 + * @bth0: bth0 passed in from the RC/UC builder
804 + * @bth2: bth2 passed in from the RC/UC builder
805 + * @middle: non zero implies indicates ahg "could" be used
806 + * @ps: the current packet state
807 + *
808 + * This routine may disarm ahg under these situations:
809 + * - packet needs a GRH
810 + * - BECN needed
811 + * - migration state not IB_MIG_MIGRATED
812 + */
813 static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,
814 struct ib_other_headers *ohdr,
815 u32 bth0, u32 bth2, int middle,
816 @@ -839,6 +868,12 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,
817 else
818 middle = 0;
819
820 + if (qp->s_flags & RVT_S_ECN) {
821 + qp->s_flags &= ~RVT_S_ECN;
822 + /* we recently received a FECN, so return a BECN */
823 + bth1 |= (IB_BECN_MASK << IB_BECN_SHIFT);
824 + middle = 0;
825 + }
826 if (middle)
827 build_ahg(qp, bth2);
828 else
829 @@ -846,11 +881,6 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,
830
831 bth0 |= pkey;
832 bth0 |= extra_bytes << 20;
833 - if (qp->s_flags & RVT_S_ECN) {
834 - qp->s_flags &= ~RVT_S_ECN;
835 - /* we recently received a FECN, so return a BECN */
836 - bth1 |= (IB_BECN_MASK << IB_BECN_SHIFT);
837 - }
838 hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
839 hfi1_make_ib_hdr(&ps->s_txreq->phdr.hdr.ibh,
840 lrh0,
841 diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c
842 index bcf3b0bebac8..69c17a5ef038 100644
843 --- a/drivers/infiniband/hw/hfi1/ud.c
844 +++ b/drivers/infiniband/hw/hfi1/ud.c
845 @@ -628,7 +628,7 @@ int hfi1_lookup_pkey_idx(struct hfi1_ibport *ibp, u16 pkey)
846 }
847
848 void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp,
849 - u32 remote_qpn, u32 pkey, u32 slid, u32 dlid,
850 + u32 remote_qpn, u16 pkey, u32 slid, u32 dlid,
851 u8 sc5, const struct ib_grh *old_grh)
852 {
853 u64 pbc, pbc_flags = 0;
854 @@ -687,7 +687,7 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp,
855 }
856
857 void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn,
858 - u32 pkey, u32 slid, u32 dlid, u8 sc5,
859 + u16 pkey, u32 slid, u32 dlid, u8 sc5,
860 const struct ib_grh *old_grh)
861 {
862 u64 pbc, pbc_flags = 0;
863 diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
864 index f045491f2c14..93af6b704d06 100644
865 --- a/drivers/infiniband/hw/mlx4/qp.c
866 +++ b/drivers/infiniband/hw/mlx4/qp.c
867 @@ -673,7 +673,8 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
868 MLX4_IB_RX_HASH_SRC_PORT_TCP |
869 MLX4_IB_RX_HASH_DST_PORT_TCP |
870 MLX4_IB_RX_HASH_SRC_PORT_UDP |
871 - MLX4_IB_RX_HASH_DST_PORT_UDP)) {
872 + MLX4_IB_RX_HASH_DST_PORT_UDP |
873 + MLX4_IB_RX_HASH_INNER)) {
874 pr_debug("RX Hash fields_mask has unsupported mask (0x%llx)\n",
875 ucmd->rx_hash_fields_mask);
876 return (-EOPNOTSUPP);
877 diff --git a/drivers/infiniband/hw/mlx5/Kconfig b/drivers/infiniband/hw/mlx5/Kconfig
878 index bce263b92821..fb4d77be019b 100644
879 --- a/drivers/infiniband/hw/mlx5/Kconfig
880 +++ b/drivers/infiniband/hw/mlx5/Kconfig
881 @@ -1,6 +1,7 @@
882 config MLX5_INFINIBAND
883 tristate "Mellanox Connect-IB HCA support"
884 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
885 + depends on INFINIBAND_USER_ACCESS || INFINIBAND_USER_ACCESS=n
886 ---help---
887 This driver provides low-level InfiniBand support for
888 Mellanox Connect-IB PCI Express host channel adapters (HCAs).
889 diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
890 index 6857c61bdee1..deccd91c2361 100644
891 --- a/drivers/infiniband/hw/mlx5/mr.c
892 +++ b/drivers/infiniband/hw/mlx5/mr.c
893 @@ -836,25 +836,28 @@ static int mr_umem_get(struct ib_pd *pd, u64 start, u64 length,
894 int *order)
895 {
896 struct mlx5_ib_dev *dev = to_mdev(pd->device);
897 + struct ib_umem *u;
898 int err;
899
900 - *umem = ib_umem_get(pd->uobject->context, start, length,
901 - access_flags, 0);
902 - err = PTR_ERR_OR_ZERO(*umem);
903 + *umem = NULL;
904 +
905 + u = ib_umem_get(pd->uobject->context, start, length, access_flags, 0);
906 + err = PTR_ERR_OR_ZERO(u);
907 if (err) {
908 - *umem = NULL;
909 - mlx5_ib_err(dev, "umem get failed (%d)\n", err);
910 + mlx5_ib_dbg(dev, "umem get failed (%d)\n", err);
911 return err;
912 }
913
914 - mlx5_ib_cont_pages(*umem, start, MLX5_MKEY_PAGE_SHIFT_MASK, npages,
915 + mlx5_ib_cont_pages(u, start, MLX5_MKEY_PAGE_SHIFT_MASK, npages,
916 page_shift, ncont, order);
917 if (!*npages) {
918 mlx5_ib_warn(dev, "avoid zero region\n");
919 - ib_umem_release(*umem);
920 + ib_umem_release(u);
921 return -EINVAL;
922 }
923
924 + *umem = u;
925 +
926 mlx5_ib_dbg(dev, "npages %d, ncont %d, order %d, page_shift %d\n",
927 *npages, *ncont, *order, *page_shift);
928
929 @@ -1343,13 +1346,12 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
930 int access_flags = flags & IB_MR_REREG_ACCESS ?
931 new_access_flags :
932 mr->access_flags;
933 - u64 addr = (flags & IB_MR_REREG_TRANS) ? virt_addr : mr->umem->address;
934 - u64 len = (flags & IB_MR_REREG_TRANS) ? length : mr->umem->length;
935 int page_shift = 0;
936 int upd_flags = 0;
937 int npages = 0;
938 int ncont = 0;
939 int order = 0;
940 + u64 addr, len;
941 int err;
942
943 mlx5_ib_dbg(dev, "start 0x%llx, virt_addr 0x%llx, length 0x%llx, access_flags 0x%x\n",
944 @@ -1357,6 +1359,17 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
945
946 atomic_sub(mr->npages, &dev->mdev->priv.reg_pages);
947
948 + if (!mr->umem)
949 + return -EINVAL;
950 +
951 + if (flags & IB_MR_REREG_TRANS) {
952 + addr = virt_addr;
953 + len = length;
954 + } else {
955 + addr = mr->umem->address;
956 + len = mr->umem->length;
957 + }
958 +
959 if (flags != IB_MR_REREG_PD) {
960 /*
961 * Replace umem. This needs to be done whether or not UMR is
962 @@ -1364,6 +1377,7 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
963 */
964 flags |= IB_MR_REREG_TRANS;
965 ib_umem_release(mr->umem);
966 + mr->umem = NULL;
967 err = mr_umem_get(pd, addr, len, access_flags, &mr->umem,
968 &npages, &page_shift, &ncont, &order);
969 if (err < 0) {
970 diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
971 index 6c424afea25f..5f0144fee2ac 100644
972 --- a/drivers/infiniband/hw/mlx5/qp.c
973 +++ b/drivers/infiniband/hw/mlx5/qp.c
974 @@ -256,7 +256,11 @@ static int set_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap,
975 } else {
976 if (ucmd) {
977 qp->rq.wqe_cnt = ucmd->rq_wqe_count;
978 + if (ucmd->rq_wqe_shift > BITS_PER_BYTE * sizeof(ucmd->rq_wqe_shift))
979 + return -EINVAL;
980 qp->rq.wqe_shift = ucmd->rq_wqe_shift;
981 + if ((1 << qp->rq.wqe_shift) / sizeof(struct mlx5_wqe_data_seg) < qp->wq_sig)
982 + return -EINVAL;
983 qp->rq.max_gs = (1 << qp->rq.wqe_shift) / sizeof(struct mlx5_wqe_data_seg) - qp->wq_sig;
984 qp->rq.max_post = qp->rq.wqe_cnt;
985 } else {
986 @@ -2420,18 +2424,18 @@ enum {
987
988 static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 rate)
989 {
990 - if (rate == IB_RATE_PORT_CURRENT) {
991 + if (rate == IB_RATE_PORT_CURRENT)
992 return 0;
993 - } else if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_300_GBPS) {
994 +
995 + if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_300_GBPS)
996 return -EINVAL;
997 - } else {
998 - while (rate != IB_RATE_2_5_GBPS &&
999 - !(1 << (rate + MLX5_STAT_RATE_OFFSET) &
1000 - MLX5_CAP_GEN(dev->mdev, stat_rate_support)))
1001 - --rate;
1002 - }
1003
1004 - return rate + MLX5_STAT_RATE_OFFSET;
1005 + while (rate != IB_RATE_PORT_CURRENT &&
1006 + !(1 << (rate + MLX5_STAT_RATE_OFFSET) &
1007 + MLX5_CAP_GEN(dev->mdev, stat_rate_support)))
1008 + --rate;
1009 +
1010 + return rate ? rate + MLX5_STAT_RATE_OFFSET : rate;
1011 }
1012
1013 static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev,
1014 diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c
1015 index 766bf2660116..5f04b2d94635 100644
1016 --- a/drivers/input/input-leds.c
1017 +++ b/drivers/input/input-leds.c
1018 @@ -88,6 +88,7 @@ static int input_leds_connect(struct input_handler *handler,
1019 const struct input_device_id *id)
1020 {
1021 struct input_leds *leds;
1022 + struct input_led *led;
1023 unsigned int num_leds;
1024 unsigned int led_code;
1025 int led_no;
1026 @@ -119,14 +120,13 @@ static int input_leds_connect(struct input_handler *handler,
1027
1028 led_no = 0;
1029 for_each_set_bit(led_code, dev->ledbit, LED_CNT) {
1030 - struct input_led *led = &leds->leds[led_no];
1031 + if (!input_led_info[led_code].name)
1032 + continue;
1033
1034 + led = &leds->leds[led_no];
1035 led->handle = &leds->handle;
1036 led->code = led_code;
1037
1038 - if (!input_led_info[led_code].name)
1039 - continue;
1040 -
1041 led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s",
1042 dev_name(&dev->dev),
1043 input_led_info[led_code].name);
1044 diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
1045 index 7659bc48f1db..429b694405c7 100644
1046 --- a/drivers/input/touchscreen/atmel_mxt_ts.c
1047 +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
1048 @@ -3030,6 +3030,15 @@ static const struct dmi_system_id mxt_dmi_table[] = {
1049 },
1050 .driver_data = samus_platform_data,
1051 },
1052 + {
1053 + /* Samsung Chromebook Pro */
1054 + .ident = "Samsung Chromebook Pro",
1055 + .matches = {
1056 + DMI_MATCH(DMI_SYS_VENDOR, "Google"),
1057 + DMI_MATCH(DMI_PRODUCT_NAME, "Caroline"),
1058 + },
1059 + .driver_data = samus_platform_data,
1060 + },
1061 {
1062 /* Other Google Chromebooks */
1063 .ident = "Chromebook",
1064 diff --git a/drivers/irqchip/qcom-irq-combiner.c b/drivers/irqchip/qcom-irq-combiner.c
1065 index f31265937439..7f0c0be322e0 100644
1066 --- a/drivers/irqchip/qcom-irq-combiner.c
1067 +++ b/drivers/irqchip/qcom-irq-combiner.c
1068 @@ -1,4 +1,4 @@
1069 -/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
1070 +/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
1071 *
1072 * This program is free software; you can redistribute it and/or modify
1073 * it under the terms of the GNU General Public License version 2 and
1074 @@ -68,7 +68,7 @@ static void combiner_handle_irq(struct irq_desc *desc)
1075
1076 bit = readl_relaxed(combiner->regs[reg].addr);
1077 status = bit & combiner->regs[reg].enabled;
1078 - if (!status)
1079 + if (bit && !status)
1080 pr_warn_ratelimited("Unexpected IRQ on CPU%d: (%08x %08lx %p)\n",
1081 smp_processor_id(), bit,
1082 combiner->regs[reg].enabled,
1083 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1084 index c853e7410f5a..51c68fc416fa 100644
1085 --- a/drivers/net/usb/qmi_wwan.c
1086 +++ b/drivers/net/usb/qmi_wwan.c
1087 @@ -1098,6 +1098,7 @@ static const struct usb_device_id products[] = {
1088 {QMI_FIXED_INTF(0x05c6, 0x9080, 8)},
1089 {QMI_FIXED_INTF(0x05c6, 0x9083, 3)},
1090 {QMI_FIXED_INTF(0x05c6, 0x9084, 4)},
1091 + {QMI_FIXED_INTF(0x05c6, 0x90b2, 3)}, /* ublox R410M */
1092 {QMI_FIXED_INTF(0x05c6, 0x920d, 0)},
1093 {QMI_FIXED_INTF(0x05c6, 0x920d, 5)},
1094 {QMI_QUIRK_SET_DTR(0x05c6, 0x9625, 4)}, /* YUGA CLM920-NC5 */
1095 diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
1096 index 1404729441a2..71f9eee8fbe5 100644
1097 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
1098 +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
1099 @@ -158,16 +158,6 @@ static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist)
1100
1101 static u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)
1102 {
1103 - struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
1104 -
1105 - /* override ant_num / ant_path */
1106 - if (mod_params->ant_sel) {
1107 - rtlpriv->btcoexist.btc_info.ant_num =
1108 - (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1);
1109 -
1110 - rtlpriv->btcoexist.btc_info.single_ant_path =
1111 - (mod_params->ant_sel == 1 ? 0 : 1);
1112 - }
1113 return rtlpriv->btcoexist.btc_info.single_ant_path;
1114 }
1115
1116 @@ -178,7 +168,6 @@ static u8 rtl_get_hwpg_bt_type(struct rtl_priv *rtlpriv)
1117
1118 static u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)
1119 {
1120 - struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
1121 u8 num;
1122
1123 if (rtlpriv->btcoexist.btc_info.ant_num == ANT_X2)
1124 @@ -186,10 +175,6 @@ static u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)
1125 else
1126 num = 1;
1127
1128 - /* override ant_num / ant_path */
1129 - if (mod_params->ant_sel)
1130 - num = (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1) + 1;
1131 -
1132 return num;
1133 }
1134
1135 diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
1136 index e7bbbc95cdb1..b4f3f91b590e 100644
1137 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
1138 +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
1139 @@ -848,6 +848,9 @@ static bool _rtl8723be_init_mac(struct ieee80211_hw *hw)
1140 return false;
1141 }
1142
1143 + if (rtlpriv->cfg->ops->get_btc_status())
1144 + rtlpriv->btcoexist.btc_ops->btc_power_on_setting(rtlpriv);
1145 +
1146 bytetmp = rtl_read_byte(rtlpriv, REG_MULTI_FUNC_CTRL);
1147 rtl_write_byte(rtlpriv, REG_MULTI_FUNC_CTRL, bytetmp | BIT(3));
1148
1149 @@ -2696,21 +2699,21 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw,
1150 rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8723B;
1151 rtlpriv->btcoexist.btc_info.ant_num = (value & 0x1);
1152 rtlpriv->btcoexist.btc_info.single_ant_path =
1153 - (value & 0x40); /*0xc3[6]*/
1154 + (value & 0x40 ? ANT_AUX : ANT_MAIN); /*0xc3[6]*/
1155 } else {
1156 rtlpriv->btcoexist.btc_info.btcoexist = 0;
1157 rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8723B;
1158 rtlpriv->btcoexist.btc_info.ant_num = ANT_X2;
1159 - rtlpriv->btcoexist.btc_info.single_ant_path = 0;
1160 + rtlpriv->btcoexist.btc_info.single_ant_path = ANT_MAIN;
1161 }
1162
1163 /* override ant_num / ant_path */
1164 if (mod_params->ant_sel) {
1165 rtlpriv->btcoexist.btc_info.ant_num =
1166 - (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1);
1167 + (mod_params->ant_sel == 1 ? ANT_X1 : ANT_X2);
1168
1169 rtlpriv->btcoexist.btc_info.single_ant_path =
1170 - (mod_params->ant_sel == 1 ? 0 : 1);
1171 + (mod_params->ant_sel == 1 ? ANT_AUX : ANT_MAIN);
1172 }
1173 }
1174
1175 diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
1176 index 46dcb7fef195..36683364dbc7 100644
1177 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
1178 +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
1179 @@ -2759,6 +2759,11 @@ enum bt_ant_num {
1180 ANT_X1 = 1,
1181 };
1182
1183 +enum bt_ant_path {
1184 + ANT_MAIN = 0,
1185 + ANT_AUX = 1,
1186 +};
1187 +
1188 enum bt_co_type {
1189 BT_2WIRE = 0,
1190 BT_ISSC_3WIRE = 1,
1191 diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
1192 index 51ebc5a6053f..51a1b49760ea 100644
1193 --- a/drivers/platform/x86/Kconfig
1194 +++ b/drivers/platform/x86/Kconfig
1195 @@ -154,7 +154,7 @@ config DELL_LAPTOP
1196 depends on ACPI_VIDEO || ACPI_VIDEO = n
1197 depends on RFKILL || RFKILL = n
1198 depends on SERIO_I8042
1199 - select DELL_SMBIOS
1200 + depends on DELL_SMBIOS
1201 select POWER_SUPPLY
1202 select LEDS_CLASS
1203 select NEW_LEDS
1204 diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
1205 index d4aeac3477f5..f086469ea740 100644
1206 --- a/drivers/platform/x86/asus-wireless.c
1207 +++ b/drivers/platform/x86/asus-wireless.c
1208 @@ -178,8 +178,10 @@ static int asus_wireless_remove(struct acpi_device *adev)
1209 {
1210 struct asus_wireless_data *data = acpi_driver_data(adev);
1211
1212 - if (data->wq)
1213 + if (data->wq) {
1214 + devm_led_classdev_unregister(&adev->dev, &data->led);
1215 destroy_workqueue(data->wq);
1216 + }
1217 return 0;
1218 }
1219
1220 diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
1221 index 07c814c42648..60429011292a 100644
1222 --- a/drivers/target/target_core_iblock.c
1223 +++ b/drivers/target/target_core_iblock.c
1224 @@ -427,8 +427,8 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
1225 {
1226 struct se_device *dev = cmd->se_dev;
1227 struct scatterlist *sg = &cmd->t_data_sg[0];
1228 - unsigned char *buf, zero = 0x00, *p = &zero;
1229 - int rc, ret;
1230 + unsigned char *buf, *not_zero;
1231 + int ret;
1232
1233 buf = kmap(sg_page(sg)) + sg->offset;
1234 if (!buf)
1235 @@ -437,10 +437,10 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
1236 * Fall back to block_execute_write_same() slow-path if
1237 * incoming WRITE_SAME payload does not contain zeros.
1238 */
1239 - rc = memcmp(buf, p, cmd->data_length);
1240 + not_zero = memchr_inv(buf, 0x00, cmd->data_length);
1241 kunmap(sg_page(sg));
1242
1243 - if (rc)
1244 + if (not_zero)
1245 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
1246
1247 ret = blkdev_issue_zeroout(bdev,
1248 diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
1249 index c821b4b9647e..7b5cb28ffb35 100644
1250 --- a/drivers/usb/core/config.c
1251 +++ b/drivers/usb/core/config.c
1252 @@ -191,7 +191,9 @@ static const unsigned short full_speed_maxpacket_maxes[4] = {
1253 static const unsigned short high_speed_maxpacket_maxes[4] = {
1254 [USB_ENDPOINT_XFER_CONTROL] = 64,
1255 [USB_ENDPOINT_XFER_ISOC] = 1024,
1256 - [USB_ENDPOINT_XFER_BULK] = 512,
1257 +
1258 + /* Bulk should be 512, but some devices use 1024: we will warn below */
1259 + [USB_ENDPOINT_XFER_BULK] = 1024,
1260 [USB_ENDPOINT_XFER_INT] = 1024,
1261 };
1262 static const unsigned short super_speed_maxpacket_maxes[4] = {
1263 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
1264 index 100454c514d5..726ae915c03a 100644
1265 --- a/drivers/usb/dwc3/gadget.c
1266 +++ b/drivers/usb/dwc3/gadget.c
1267 @@ -1424,7 +1424,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
1268 dwc->lock);
1269
1270 if (!r->trb)
1271 - goto out1;
1272 + goto out0;
1273
1274 if (r->num_pending_sgs) {
1275 struct dwc3_trb *trb;
1276 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1277 index 5d37700ae4b0..b60a02c50b89 100644
1278 --- a/drivers/usb/host/xhci.c
1279 +++ b/drivers/usb/host/xhci.c
1280 @@ -3548,6 +3548,7 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
1281 del_timer_sync(&virt_dev->eps[i].stop_cmd_timer);
1282 }
1283 xhci_debugfs_remove_slot(xhci, udev->slot_id);
1284 + virt_dev->udev = NULL;
1285 ret = xhci_disable_slot(xhci, udev->slot_id);
1286 if (ret)
1287 xhci_free_virt_device(xhci, udev->slot_id);
1288 diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
1289 index 293e5b8da565..21b87a077c69 100644
1290 --- a/drivers/usb/musb/musb_gadget.c
1291 +++ b/drivers/usb/musb/musb_gadget.c
1292 @@ -417,7 +417,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
1293 req = next_request(musb_ep);
1294 request = &req->request;
1295
1296 - trace_musb_req_tx(req);
1297 csr = musb_readw(epio, MUSB_TXCSR);
1298 musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr);
1299
1300 @@ -456,6 +455,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)
1301 u8 is_dma = 0;
1302 bool short_packet = false;
1303
1304 + trace_musb_req_tx(req);
1305 +
1306 if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
1307 is_dma = 1;
1308 csr |= MUSB_TXCSR_P_WZC_BITS;
1309 diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
1310 index 45ed32c2cba9..0ee0c6d7f194 100644
1311 --- a/drivers/usb/musb/musb_host.c
1312 +++ b/drivers/usb/musb/musb_host.c
1313 @@ -996,7 +996,9 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep,
1314 /* set tx_reinit and schedule the next qh */
1315 ep->tx_reinit = 1;
1316 }
1317 - musb_start_urb(musb, is_in, next_qh);
1318 +
1319 + if (next_qh)
1320 + musb_start_urb(musb, is_in, next_qh);
1321 }
1322 }
1323
1324 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1325 index 2d8d9150da0c..10c7ab427a52 100644
1326 --- a/drivers/usb/serial/option.c
1327 +++ b/drivers/usb/serial/option.c
1328 @@ -233,6 +233,8 @@ static void option_instat_callback(struct urb *urb);
1329 /* These Quectel products use Qualcomm's vendor ID */
1330 #define QUECTEL_PRODUCT_UC20 0x9003
1331 #define QUECTEL_PRODUCT_UC15 0x9090
1332 +/* These u-blox products use Qualcomm's vendor ID */
1333 +#define UBLOX_PRODUCT_R410M 0x90b2
1334 /* These Yuga products use Qualcomm's vendor ID */
1335 #define YUGA_PRODUCT_CLM920_NC5 0x9625
1336
1337 @@ -548,151 +550,15 @@ static void option_instat_callback(struct urb *urb);
1338 #define WETELECOM_PRODUCT_6802 0x6802
1339 #define WETELECOM_PRODUCT_WMD300 0x6803
1340
1341 -struct option_blacklist_info {
1342 - /* bitmask of interface numbers blacklisted for send_setup */
1343 - const unsigned long sendsetup;
1344 - /* bitmask of interface numbers that are reserved */
1345 - const unsigned long reserved;
1346 -};
1347
1348 -static const struct option_blacklist_info four_g_w14_blacklist = {
1349 - .sendsetup = BIT(0) | BIT(1),
1350 -};
1351 +/* Device flags */
1352
1353 -static const struct option_blacklist_info four_g_w100_blacklist = {
1354 - .sendsetup = BIT(1) | BIT(2),
1355 - .reserved = BIT(3),
1356 -};
1357 +/* Interface does not support modem-control requests */
1358 +#define NCTRL(ifnum) ((BIT(ifnum) & 0xff) << 8)
1359
1360 -static const struct option_blacklist_info alcatel_x200_blacklist = {
1361 - .sendsetup = BIT(0) | BIT(1),
1362 - .reserved = BIT(4),
1363 -};
1364 +/* Interface is reserved */
1365 +#define RSVD(ifnum) ((BIT(ifnum) & 0xff) << 0)
1366
1367 -static const struct option_blacklist_info zte_0037_blacklist = {
1368 - .sendsetup = BIT(0) | BIT(1),
1369 -};
1370 -
1371 -static const struct option_blacklist_info zte_k3765_z_blacklist = {
1372 - .sendsetup = BIT(0) | BIT(1) | BIT(2),
1373 - .reserved = BIT(4),
1374 -};
1375 -
1376 -static const struct option_blacklist_info zte_ad3812_z_blacklist = {
1377 - .sendsetup = BIT(0) | BIT(1) | BIT(2),
1378 -};
1379 -
1380 -static const struct option_blacklist_info zte_mc2718_z_blacklist = {
1381 - .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4),
1382 -};
1383 -
1384 -static const struct option_blacklist_info zte_mc2716_z_blacklist = {
1385 - .sendsetup = BIT(1) | BIT(2) | BIT(3),
1386 -};
1387 -
1388 -static const struct option_blacklist_info zte_me3620_mbim_blacklist = {
1389 - .reserved = BIT(2) | BIT(3) | BIT(4),
1390 -};
1391 -
1392 -static const struct option_blacklist_info zte_me3620_xl_blacklist = {
1393 - .reserved = BIT(3) | BIT(4) | BIT(5),
1394 -};
1395 -
1396 -static const struct option_blacklist_info zte_zm8620_x_blacklist = {
1397 - .reserved = BIT(3) | BIT(4) | BIT(5),
1398 -};
1399 -
1400 -static const struct option_blacklist_info huawei_cdc12_blacklist = {
1401 - .reserved = BIT(1) | BIT(2),
1402 -};
1403 -
1404 -static const struct option_blacklist_info net_intf0_blacklist = {
1405 - .reserved = BIT(0),
1406 -};
1407 -
1408 -static const struct option_blacklist_info net_intf1_blacklist = {
1409 - .reserved = BIT(1),
1410 -};
1411 -
1412 -static const struct option_blacklist_info net_intf2_blacklist = {
1413 - .reserved = BIT(2),
1414 -};
1415 -
1416 -static const struct option_blacklist_info net_intf3_blacklist = {
1417 - .reserved = BIT(3),
1418 -};
1419 -
1420 -static const struct option_blacklist_info net_intf4_blacklist = {
1421 - .reserved = BIT(4),
1422 -};
1423 -
1424 -static const struct option_blacklist_info net_intf5_blacklist = {
1425 - .reserved = BIT(5),
1426 -};
1427 -
1428 -static const struct option_blacklist_info net_intf6_blacklist = {
1429 - .reserved = BIT(6),
1430 -};
1431 -
1432 -static const struct option_blacklist_info zte_mf626_blacklist = {
1433 - .sendsetup = BIT(0) | BIT(1),
1434 - .reserved = BIT(4),
1435 -};
1436 -
1437 -static const struct option_blacklist_info zte_1255_blacklist = {
1438 - .reserved = BIT(3) | BIT(4),
1439 -};
1440 -
1441 -static const struct option_blacklist_info simcom_sim7100e_blacklist = {
1442 - .reserved = BIT(5) | BIT(6),
1443 -};
1444 -
1445 -static const struct option_blacklist_info telit_me910_blacklist = {
1446 - .sendsetup = BIT(0),
1447 - .reserved = BIT(1) | BIT(3),
1448 -};
1449 -
1450 -static const struct option_blacklist_info telit_me910_dual_modem_blacklist = {
1451 - .sendsetup = BIT(0),
1452 - .reserved = BIT(3),
1453 -};
1454 -
1455 -static const struct option_blacklist_info telit_le910_blacklist = {
1456 - .sendsetup = BIT(0),
1457 - .reserved = BIT(1) | BIT(2),
1458 -};
1459 -
1460 -static const struct option_blacklist_info telit_le920_blacklist = {
1461 - .sendsetup = BIT(0),
1462 - .reserved = BIT(1) | BIT(5),
1463 -};
1464 -
1465 -static const struct option_blacklist_info telit_le920a4_blacklist_1 = {
1466 - .sendsetup = BIT(0),
1467 - .reserved = BIT(1),
1468 -};
1469 -
1470 -static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = {
1471 - .sendsetup = BIT(2),
1472 - .reserved = BIT(0) | BIT(1) | BIT(3),
1473 -};
1474 -
1475 -static const struct option_blacklist_info telit_le922_blacklist_usbcfg3 = {
1476 - .sendsetup = BIT(0),
1477 - .reserved = BIT(1) | BIT(2) | BIT(3),
1478 -};
1479 -
1480 -static const struct option_blacklist_info cinterion_rmnet2_blacklist = {
1481 - .reserved = BIT(4) | BIT(5),
1482 -};
1483 -
1484 -static const struct option_blacklist_info yuga_clm920_nc5_blacklist = {
1485 - .reserved = BIT(1) | BIT(4),
1486 -};
1487 -
1488 -static const struct option_blacklist_info quectel_ep06_blacklist = {
1489 - .reserved = BIT(4) | BIT(5),
1490 -};
1491
1492 static const struct usb_device_id option_ids[] = {
1493 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
1494 @@ -726,26 +592,26 @@ static const struct usb_device_id option_ids[] = {
1495 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) },
1496 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
1497 { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
1498 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1499 + .driver_info = RSVD(4) },
1500 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
1501 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
1502 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },
1503 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff),
1504 - .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
1505 + .driver_info = RSVD(1) },
1506 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S6, 0xff, 0xff, 0xff),
1507 - .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
1508 + .driver_info = RSVD(1) },
1509 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1750, 0xff, 0xff, 0xff),
1510 - .driver_info = (kernel_ulong_t) &net_intf2_blacklist },
1511 + .driver_info = RSVD(2) },
1512 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) },
1513 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1442, USB_CLASS_COMM, 0x02, 0xff) },
1514 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
1515 - .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
1516 + .driver_info = RSVD(1) | RSVD(2) },
1517 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
1518 - .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
1519 + .driver_info = RSVD(1) | RSVD(2) },
1520 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x14ac, 0xff, 0xff, 0xff), /* Huawei E1820 */
1521 - .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
1522 + .driver_info = RSVD(1) },
1523 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff),
1524 - .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
1525 + .driver_info = RSVD(1) | RSVD(2) },
1526 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) },
1527 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x01) },
1528 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x02) },
1529 @@ -1190,67 +1056,70 @@ static const struct usb_device_id option_ids[] = {
1530 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
1531 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */
1532 { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, 0x6001, 0xff, 0xff, 0xff), /* 4G LTE usb-modem U901 */
1533 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1534 + .driver_info = RSVD(3) },
1535 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
1536 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
1537 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
1538 /* Quectel products using Qualcomm vendor ID */
1539 { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)},
1540 { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20),
1541 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1542 + .driver_info = RSVD(4) },
1543 /* Yuga products use Qualcomm vendor ID */
1544 { USB_DEVICE(QUALCOMM_VENDOR_ID, YUGA_PRODUCT_CLM920_NC5),
1545 - .driver_info = (kernel_ulong_t)&yuga_clm920_nc5_blacklist },
1546 + .driver_info = RSVD(1) | RSVD(4) },
1547 + /* u-blox products using Qualcomm vendor ID */
1548 + { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
1549 + .driver_info = RSVD(1) | RSVD(3) },
1550 /* Quectel products using Quectel vendor ID */
1551 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
1552 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1553 + .driver_info = RSVD(4) },
1554 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
1555 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1556 + .driver_info = RSVD(4) },
1557 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
1558 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1559 + .driver_info = RSVD(4) },
1560 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06),
1561 - .driver_info = (kernel_ulong_t)&quectel_ep06_blacklist },
1562 + .driver_info = RSVD(4) | RSVD(5) },
1563 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
1564 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
1565 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
1566 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1567 + .driver_info = RSVD(0) },
1568 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6004) },
1569 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6005) },
1570 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CGU_628A) },
1571 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHE_628S),
1572 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1573 + .driver_info = RSVD(0) },
1574 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_301),
1575 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1576 + .driver_info = RSVD(0) },
1577 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_628),
1578 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1579 + .driver_info = RSVD(0) },
1580 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_628S) },
1581 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU_680) },
1582 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU_685A) },
1583 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_720S),
1584 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1585 + .driver_info = RSVD(0) },
1586 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7002),
1587 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1588 + .driver_info = RSVD(0) },
1589 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_629K),
1590 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1591 + .driver_info = RSVD(4) },
1592 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7004),
1593 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1594 + .driver_info = RSVD(3) },
1595 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7005) },
1596 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CGU_629),
1597 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1598 + .driver_info = RSVD(5) },
1599 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_629S),
1600 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1601 + .driver_info = RSVD(4) },
1602 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_720I),
1603 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1604 + .driver_info = RSVD(0) },
1605 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7212),
1606 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1607 + .driver_info = RSVD(0) },
1608 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7213),
1609 - .driver_info = (kernel_ulong_t)&net_intf0_blacklist },
1610 + .driver_info = RSVD(0) },
1611 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7251),
1612 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1613 + .driver_info = RSVD(1) },
1614 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7252),
1615 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1616 + .driver_info = RSVD(1) },
1617 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7253),
1618 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1619 + .driver_info = RSVD(1) },
1620 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
1621 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) },
1622 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) },
1623 @@ -1258,38 +1127,38 @@ static const struct usb_device_id option_ids[] = {
1624 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) },
1625 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) },
1626 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0),
1627 - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 },
1628 + .driver_info = RSVD(0) | RSVD(1) | NCTRL(2) | RSVD(3) },
1629 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG1),
1630 - .driver_info = (kernel_ulong_t)&telit_le910_blacklist },
1631 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1632 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG2),
1633 - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1634 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
1635 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG3),
1636 - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1637 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
1638 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff),
1639 - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 },
1640 + .driver_info = RSVD(0) | RSVD(1) | NCTRL(2) | RSVD(3) },
1641 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
1642 - .driver_info = (kernel_ulong_t)&telit_me910_blacklist },
1643 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
1644 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
1645 - .driver_info = (kernel_ulong_t)&telit_me910_dual_modem_blacklist },
1646 + .driver_info = NCTRL(0) | RSVD(3) },
1647 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
1648 - .driver_info = (kernel_ulong_t)&telit_le910_blacklist },
1649 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1650 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
1651 - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1652 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
1653 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
1654 - .driver_info = (kernel_ulong_t)&telit_le920_blacklist },
1655 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(5) },
1656 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1207) },
1657 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1208),
1658 - .driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
1659 + .driver_info = NCTRL(0) | RSVD(1) },
1660 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1211),
1661 - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1662 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
1663 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1212),
1664 - .driver_info = (kernel_ulong_t)&telit_le920a4_blacklist_1 },
1665 + .driver_info = NCTRL(0) | RSVD(1) },
1666 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) },
1667 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214),
1668 - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1669 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
1670 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
1671 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
1672 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1673 + .driver_info = RSVD(1) },
1674 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0003, 0xff, 0xff, 0xff) },
1675 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0004, 0xff, 0xff, 0xff) },
1676 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0005, 0xff, 0xff, 0xff) },
1677 @@ -1305,58 +1174,58 @@ static const struct usb_device_id option_ids[] = {
1678 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0010, 0xff, 0xff, 0xff) },
1679 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) },
1680 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff),
1681 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1682 + .driver_info = RSVD(1) },
1683 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) },
1684 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) },
1685 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) },
1686 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff),
1687 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1688 + .driver_info = RSVD(3) },
1689 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0018, 0xff, 0xff, 0xff) },
1690 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff),
1691 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1692 + .driver_info = RSVD(3) },
1693 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0020, 0xff, 0xff, 0xff) },
1694 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0021, 0xff, 0xff, 0xff),
1695 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1696 + .driver_info = RSVD(4) },
1697 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0022, 0xff, 0xff, 0xff) },
1698 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) },
1699 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) },
1700 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff),
1701 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1702 + .driver_info = RSVD(1) },
1703 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) },
1704 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) },
1705 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) },
1706 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff,
1707 - 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_mf626_blacklist },
1708 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, 0xff, 0xff),
1709 + .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) },
1710 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) },
1711 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) },
1712 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0034, 0xff, 0xff, 0xff) },
1713 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff),
1714 - .driver_info = (kernel_ulong_t)&zte_0037_blacklist },
1715 + .driver_info = NCTRL(0) | NCTRL(1) },
1716 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0038, 0xff, 0xff, 0xff) },
1717 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) },
1718 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0040, 0xff, 0xff, 0xff) },
1719 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff),
1720 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1721 + .driver_info = RSVD(4) },
1722 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) },
1723 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0044, 0xff, 0xff, 0xff) },
1724 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) },
1725 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff),
1726 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1727 + .driver_info = RSVD(5) },
1728 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0050, 0xff, 0xff, 0xff) },
1729 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) },
1730 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff),
1731 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1732 + .driver_info = RSVD(4) },
1733 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) },
1734 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff),
1735 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1736 + .driver_info = RSVD(1) },
1737 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0056, 0xff, 0xff, 0xff) },
1738 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) },
1739 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff),
1740 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1741 + .driver_info = RSVD(4) },
1742 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) },
1743 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) },
1744 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff),
1745 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1746 + .driver_info = RSVD(4) },
1747 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) },
1748 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0065, 0xff, 0xff, 0xff) },
1749 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) },
1750 @@ -1381,26 +1250,26 @@ static const struct usb_device_id option_ids[] = {
1751 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0096, 0xff, 0xff, 0xff) },
1752 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0097, 0xff, 0xff, 0xff) },
1753 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff),
1754 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1755 + .driver_info = RSVD(4) },
1756 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) },
1757 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) },
1758 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) },
1759 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff),
1760 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1761 + .driver_info = RSVD(5) },
1762 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) },
1763 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff),
1764 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1765 + .driver_info = RSVD(5) },
1766 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff),
1767 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1768 + .driver_info = RSVD(5) },
1769 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0122, 0xff, 0xff, 0xff) },
1770 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff),
1771 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1772 + .driver_info = RSVD(4) },
1773 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff),
1774 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1775 + .driver_info = RSVD(5) },
1776 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff),
1777 - .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
1778 + .driver_info = RSVD(6) },
1779 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff),
1780 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1781 + .driver_info = RSVD(5) },
1782 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0128, 0xff, 0xff, 0xff) },
1783 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0135, 0xff, 0xff, 0xff) },
1784 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0136, 0xff, 0xff, 0xff) },
1785 @@ -1416,50 +1285,50 @@ static const struct usb_device_id option_ids[] = {
1786 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) },
1787 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) },
1788 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff),
1789 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1790 + .driver_info = RSVD(5) },
1791 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff),
1792 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1793 + .driver_info = RSVD(3) },
1794 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) },
1795 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
1796 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
1797 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0164, 0xff, 0xff, 0xff) },
1798 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
1799 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff),
1800 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1801 + .driver_info = RSVD(4) },
1802 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0189, 0xff, 0xff, 0xff) },
1803 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0191, 0xff, 0xff, 0xff), /* ZTE EuFi890 */
1804 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1805 + .driver_info = RSVD(4) },
1806 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0196, 0xff, 0xff, 0xff) },
1807 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0197, 0xff, 0xff, 0xff) },
1808 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0199, 0xff, 0xff, 0xff), /* ZTE MF820S */
1809 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1810 + .driver_info = RSVD(1) },
1811 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0200, 0xff, 0xff, 0xff) },
1812 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0201, 0xff, 0xff, 0xff) },
1813 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0254, 0xff, 0xff, 0xff) },
1814 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */
1815 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1816 + .driver_info = RSVD(3) },
1817 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff), /* ONDA MT8205 */
1818 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1819 + .driver_info = RSVD(4) },
1820 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */
1821 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1822 + .driver_info = RSVD(4) },
1823 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) },
1824 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
1825 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1826 + .driver_info = RSVD(4) },
1827 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) },
1828 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) },
1829 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0412, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G */
1830 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1831 + .driver_info = RSVD(4) },
1832 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) },
1833 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) },
1834 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
1835 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1836 + .driver_info = RSVD(4) },
1837 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
1838 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1839 + .driver_info = RSVD(4) },
1840 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff),
1841 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1842 + .driver_info = RSVD(4) },
1843 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1018, 0xff, 0xff, 0xff) },
1844 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1021, 0xff, 0xff, 0xff),
1845 - .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1846 + .driver_info = RSVD(2) },
1847 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
1848 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
1849 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
1850 @@ -1576,23 +1445,23 @@ static const struct usb_device_id option_ids[] = {
1851 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1170, 0xff, 0xff, 0xff) },
1852 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1244, 0xff, 0xff, 0xff) },
1853 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1245, 0xff, 0xff, 0xff),
1854 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1855 + .driver_info = RSVD(4) },
1856 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1246, 0xff, 0xff, 0xff) },
1857 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1247, 0xff, 0xff, 0xff),
1858 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1859 + .driver_info = RSVD(4) },
1860 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1248, 0xff, 0xff, 0xff) },
1861 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1249, 0xff, 0xff, 0xff) },
1862 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1250, 0xff, 0xff, 0xff) },
1863 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1251, 0xff, 0xff, 0xff) },
1864 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1252, 0xff, 0xff, 0xff),
1865 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1866 + .driver_info = RSVD(4) },
1867 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1253, 0xff, 0xff, 0xff) },
1868 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1254, 0xff, 0xff, 0xff),
1869 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1870 + .driver_info = RSVD(4) },
1871 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1255, 0xff, 0xff, 0xff),
1872 - .driver_info = (kernel_ulong_t)&zte_1255_blacklist },
1873 + .driver_info = RSVD(3) | RSVD(4) },
1874 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1256, 0xff, 0xff, 0xff),
1875 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1876 + .driver_info = RSVD(4) },
1877 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1257, 0xff, 0xff, 0xff) },
1878 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1258, 0xff, 0xff, 0xff) },
1879 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1259, 0xff, 0xff, 0xff) },
1880 @@ -1607,7 +1476,7 @@ static const struct usb_device_id option_ids[] = {
1881 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1268, 0xff, 0xff, 0xff) },
1882 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1269, 0xff, 0xff, 0xff) },
1883 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1270, 0xff, 0xff, 0xff),
1884 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1885 + .driver_info = RSVD(5) },
1886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1271, 0xff, 0xff, 0xff) },
1887 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1272, 0xff, 0xff, 0xff) },
1888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1273, 0xff, 0xff, 0xff) },
1889 @@ -1643,17 +1512,17 @@ static const struct usb_device_id option_ids[] = {
1890 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1303, 0xff, 0xff, 0xff) },
1891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1333, 0xff, 0xff, 0xff) },
1892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1401, 0xff, 0xff, 0xff),
1893 - .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1894 + .driver_info = RSVD(2) },
1895 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff),
1896 - .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1897 + .driver_info = RSVD(2) },
1898 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1424, 0xff, 0xff, 0xff),
1899 - .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1900 + .driver_info = RSVD(2) },
1901 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1425, 0xff, 0xff, 0xff),
1902 - .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1903 + .driver_info = RSVD(2) },
1904 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */
1905 - .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1906 + .driver_info = RSVD(2) },
1907 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G v2 */
1908 - .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1909 + .driver_info = RSVD(2) },
1910 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) },
1911 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) },
1912 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) },
1913 @@ -1671,8 +1540,8 @@ static const struct usb_device_id option_ids[] = {
1914 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1596, 0xff, 0xff, 0xff) },
1915 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1598, 0xff, 0xff, 0xff) },
1916 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1600, 0xff, 0xff, 0xff) },
1917 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
1918 - 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
1919 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff),
1920 + .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | RSVD(4) },
1921 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
1922
1923 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */
1924 @@ -1683,20 +1552,20 @@ static const struct usb_device_id option_ids[] = {
1925 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
1926 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) },
1927 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff),
1928 - .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1929 + .driver_info = RSVD(1) },
1930 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff),
1931 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1932 + .driver_info = RSVD(3) },
1933 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff),
1934 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1935 + .driver_info = RSVD(5) },
1936 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
1937 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
1938 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff),
1939 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1940 + .driver_info = RSVD(4) },
1941 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) },
1942 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff),
1943 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1944 + .driver_info = RSVD(3) },
1945 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff),
1946 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1947 + .driver_info = RSVD(3) },
1948 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff42, 0xff, 0xff, 0xff) },
1949 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff43, 0xff, 0xff, 0xff) },
1950 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff44, 0xff, 0xff, 0xff) },
1951 @@ -1848,19 +1717,19 @@ static const struct usb_device_id option_ids[] = {
1952 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
1953 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
1954 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff),
1955 - .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist },
1956 + .driver_info = NCTRL(1) | NCTRL(2) | NCTRL(3) | NCTRL(4) },
1957 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff),
1958 - .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
1959 + .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) },
1960 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
1961 - .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
1962 + .driver_info = NCTRL(1) | NCTRL(2) | NCTRL(3) },
1963 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_L),
1964 - .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist },
1965 + .driver_info = RSVD(3) | RSVD(4) | RSVD(5) },
1966 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_MBIM),
1967 - .driver_info = (kernel_ulong_t)&zte_me3620_mbim_blacklist },
1968 + .driver_info = RSVD(2) | RSVD(3) | RSVD(4) },
1969 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_X),
1970 - .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist },
1971 + .driver_info = RSVD(3) | RSVD(4) | RSVD(5) },
1972 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ZM8620_X),
1973 - .driver_info = (kernel_ulong_t)&zte_zm8620_x_blacklist },
1974 + .driver_info = RSVD(3) | RSVD(4) | RSVD(5) },
1975 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
1976 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
1977 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
1978 @@ -1880,37 +1749,34 @@ static const struct usb_device_id option_ids[] = {
1979 { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) },
1980 { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
1981 { USB_DEVICE(ALINK_VENDOR_ID, SIMCOM_PRODUCT_SIM7100E),
1982 - .driver_info = (kernel_ulong_t)&simcom_sim7100e_blacklist },
1983 + .driver_info = RSVD(5) | RSVD(6) },
1984 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
1985 - .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist
1986 - },
1987 + .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) },
1988 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D),
1989 - .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
1990 + .driver_info = RSVD(6) },
1991 { USB_DEVICE(ALCATEL_VENDOR_ID, 0x0052),
1992 - .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
1993 + .driver_info = RSVD(6) },
1994 { USB_DEVICE(ALCATEL_VENDOR_ID, 0x00b6),
1995 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1996 + .driver_info = RSVD(3) },
1997 { USB_DEVICE(ALCATEL_VENDOR_ID, 0x00b7),
1998 - .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1999 + .driver_info = RSVD(5) },
2000 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V),
2001 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2002 + .driver_info = RSVD(4) },
2003 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L800MA),
2004 - .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
2005 + .driver_info = RSVD(2) },
2006 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
2007 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
2008 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
2009 - .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
2010 - },
2011 + .driver_info = NCTRL(0) | NCTRL(1) },
2012 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100),
2013 - .driver_info = (kernel_ulong_t)&four_g_w100_blacklist
2014 - },
2015 + .driver_info = NCTRL(1) | NCTRL(2) | RSVD(3) },
2016 {USB_DEVICE(LONGCHEER_VENDOR_ID, FUJISOFT_PRODUCT_FS040U),
2017 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist},
2018 + .driver_info = RSVD(3)},
2019 { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
2020 { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, 0x9801, 0xff),
2021 - .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
2022 + .driver_info = RSVD(3) },
2023 { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, 0x9803, 0xff),
2024 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2025 + .driver_info = RSVD(4) },
2026 { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
2027 { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
2028 { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
2029 @@ -1936,14 +1802,14 @@ static const struct usb_device_id option_ids[] = {
2030 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
2031 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
2032 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8),
2033 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2034 + .driver_info = RSVD(4) },
2035 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) },
2036 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
2037 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2038 + .driver_info = RSVD(4) },
2039 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8_2RMNET, 0xff),
2040 - .driver_info = (kernel_ulong_t)&cinterion_rmnet2_blacklist },
2041 + .driver_info = RSVD(4) | RSVD(5) },
2042 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8_AUDIO, 0xff),
2043 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2044 + .driver_info = RSVD(4) },
2045 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_2RMNET, 0xff) },
2046 { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) },
2047 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
2048 @@ -1953,20 +1819,20 @@ static const struct usb_device_id option_ids[] = {
2049 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */
2050 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
2051 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100),
2052 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2053 + .driver_info = RSVD(4) },
2054 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120),
2055 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2056 + .driver_info = RSVD(4) },
2057 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140),
2058 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2059 + .driver_info = RSVD(4) },
2060 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
2061 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155),
2062 - .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
2063 + .driver_info = RSVD(6) },
2064 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200),
2065 - .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
2066 + .driver_info = RSVD(6) },
2067 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160),
2068 - .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
2069 + .driver_info = RSVD(6) },
2070 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500),
2071 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2072 + .driver_info = RSVD(4) },
2073 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
2074 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
2075 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
2076 @@ -2043,9 +1909,9 @@ static const struct usb_device_id option_ids[] = {
2077 { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) },
2078 { USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, TPLINK_PRODUCT_LTE, 0xff, 0x00, 0x00) }, /* TP-Link LTE Module */
2079 { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
2080 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2081 + .driver_info = RSVD(4) },
2082 { USB_DEVICE(TPLINK_VENDOR_ID, 0x9000), /* TP-Link MA260 */
2083 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2084 + .driver_info = RSVD(4) },
2085 { USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) },
2086 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d01, 0xff) }, /* D-Link DWM-156 (variant) */
2087 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d02, 0xff) },
2088 @@ -2053,9 +1919,9 @@ static const struct usb_device_id option_ids[] = {
2089 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d04, 0xff) }, /* D-Link DWM-158 */
2090 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d0e, 0xff) }, /* D-Link DWM-157 C1 */
2091 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e19, 0xff), /* D-Link DWM-221 B1 */
2092 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2093 + .driver_info = RSVD(4) },
2094 { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e35, 0xff), /* D-Link DWM-222 */
2095 - .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
2096 + .driver_info = RSVD(4) },
2097 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
2098 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
2099 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */
2100 @@ -2115,7 +1981,7 @@ static int option_probe(struct usb_serial *serial,
2101 struct usb_interface_descriptor *iface_desc =
2102 &serial->interface->cur_altsetting->desc;
2103 struct usb_device_descriptor *dev_desc = &serial->dev->descriptor;
2104 - const struct option_blacklist_info *blacklist;
2105 + unsigned long device_flags = id->driver_info;
2106
2107 /* Never bind to the CD-Rom emulation interface */
2108 if (iface_desc->bInterfaceClass == 0x08)
2109 @@ -2126,9 +1992,7 @@ static int option_probe(struct usb_serial *serial,
2110 * the same class/subclass/protocol as the serial interfaces. Look at
2111 * the Windows driver .INF files for reserved interface numbers.
2112 */
2113 - blacklist = (void *)id->driver_info;
2114 - if (blacklist && test_bit(iface_desc->bInterfaceNumber,
2115 - &blacklist->reserved))
2116 + if (device_flags & RSVD(iface_desc->bInterfaceNumber))
2117 return -ENODEV;
2118 /*
2119 * Don't bind network interface on Samsung GT-B3730, it is handled by
2120 @@ -2139,8 +2003,8 @@ static int option_probe(struct usb_serial *serial,
2121 iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA)
2122 return -ENODEV;
2123
2124 - /* Store the blacklist info so we can use it during attach. */
2125 - usb_set_serial_data(serial, (void *)blacklist);
2126 + /* Store the device flags so we can use them during attach. */
2127 + usb_set_serial_data(serial, (void *)device_flags);
2128
2129 return 0;
2130 }
2131 @@ -2148,22 +2012,21 @@ static int option_probe(struct usb_serial *serial,
2132 static int option_attach(struct usb_serial *serial)
2133 {
2134 struct usb_interface_descriptor *iface_desc;
2135 - const struct option_blacklist_info *blacklist;
2136 struct usb_wwan_intf_private *data;
2137 + unsigned long device_flags;
2138
2139 data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
2140 if (!data)
2141 return -ENOMEM;
2142
2143 - /* Retrieve blacklist info stored at probe. */
2144 - blacklist = usb_get_serial_data(serial);
2145 + /* Retrieve device flags stored at probe. */
2146 + device_flags = (unsigned long)usb_get_serial_data(serial);
2147
2148 iface_desc = &serial->interface->cur_altsetting->desc;
2149
2150 - if (!blacklist || !test_bit(iface_desc->bInterfaceNumber,
2151 - &blacklist->sendsetup)) {
2152 + if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber)))
2153 data->use_send_setup = 1;
2154 - }
2155 +
2156 spin_lock_init(&data->susp_lock);
2157
2158 usb_set_serial_data(serial, data);
2159 diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
2160 index f5373ed2cd45..8ddbecc25d89 100644
2161 --- a/drivers/usb/serial/visor.c
2162 +++ b/drivers/usb/serial/visor.c
2163 @@ -335,47 +335,48 @@ static int palm_os_3_probe(struct usb_serial *serial,
2164 goto exit;
2165 }
2166
2167 - if (retval == sizeof(*connection_info)) {
2168 - connection_info = (struct visor_connection_info *)
2169 - transfer_buffer;
2170 -
2171 - num_ports = le16_to_cpu(connection_info->num_ports);
2172 - for (i = 0; i < num_ports; ++i) {
2173 - switch (
2174 - connection_info->connections[i].port_function_id) {
2175 - case VISOR_FUNCTION_GENERIC:
2176 - string = "Generic";
2177 - break;
2178 - case VISOR_FUNCTION_DEBUGGER:
2179 - string = "Debugger";
2180 - break;
2181 - case VISOR_FUNCTION_HOTSYNC:
2182 - string = "HotSync";
2183 - break;
2184 - case VISOR_FUNCTION_CONSOLE:
2185 - string = "Console";
2186 - break;
2187 - case VISOR_FUNCTION_REMOTE_FILE_SYS:
2188 - string = "Remote File System";
2189 - break;
2190 - default:
2191 - string = "unknown";
2192 - break;
2193 - }
2194 - dev_info(dev, "%s: port %d, is for %s use\n",
2195 - serial->type->description,
2196 - connection_info->connections[i].port, string);
2197 - }
2198 + if (retval != sizeof(*connection_info)) {
2199 + dev_err(dev, "Invalid connection information received from device\n");
2200 + retval = -ENODEV;
2201 + goto exit;
2202 }
2203 - /*
2204 - * Handle devices that report invalid stuff here.
2205 - */
2206 +
2207 + connection_info = (struct visor_connection_info *)transfer_buffer;
2208 +
2209 + num_ports = le16_to_cpu(connection_info->num_ports);
2210 +
2211 + /* Handle devices that report invalid stuff here. */
2212 if (num_ports == 0 || num_ports > 2) {
2213 dev_warn(dev, "%s: No valid connect info available\n",
2214 serial->type->description);
2215 num_ports = 2;
2216 }
2217
2218 + for (i = 0; i < num_ports; ++i) {
2219 + switch (connection_info->connections[i].port_function_id) {
2220 + case VISOR_FUNCTION_GENERIC:
2221 + string = "Generic";
2222 + break;
2223 + case VISOR_FUNCTION_DEBUGGER:
2224 + string = "Debugger";
2225 + break;
2226 + case VISOR_FUNCTION_HOTSYNC:
2227 + string = "HotSync";
2228 + break;
2229 + case VISOR_FUNCTION_CONSOLE:
2230 + string = "Console";
2231 + break;
2232 + case VISOR_FUNCTION_REMOTE_FILE_SYS:
2233 + string = "Remote File System";
2234 + break;
2235 + default:
2236 + string = "unknown";
2237 + break;
2238 + }
2239 + dev_info(dev, "%s: port %d, is for %s use\n",
2240 + serial->type->description,
2241 + connection_info->connections[i].port, string);
2242 + }
2243 dev_info(dev, "%s: Number of ports: %d\n", serial->type->description,
2244 num_ports);
2245
2246 diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
2247 index 16b54b1ff20e..53ddfafa440b 100644
2248 --- a/fs/btrfs/extent-tree.c
2249 +++ b/fs/btrfs/extent-tree.c
2250 @@ -3155,7 +3155,11 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
2251 struct rb_node *node;
2252 int ret = 0;
2253
2254 + spin_lock(&root->fs_info->trans_lock);
2255 cur_trans = root->fs_info->running_transaction;
2256 + if (cur_trans)
2257 + refcount_inc(&cur_trans->use_count);
2258 + spin_unlock(&root->fs_info->trans_lock);
2259 if (!cur_trans)
2260 return 0;
2261
2262 @@ -3164,6 +3168,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
2263 head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
2264 if (!head) {
2265 spin_unlock(&delayed_refs->lock);
2266 + btrfs_put_transaction(cur_trans);
2267 return 0;
2268 }
2269
2270 @@ -3180,6 +3185,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
2271 mutex_lock(&head->mutex);
2272 mutex_unlock(&head->mutex);
2273 btrfs_put_delayed_ref_head(head);
2274 + btrfs_put_transaction(cur_trans);
2275 return -EAGAIN;
2276 }
2277 spin_unlock(&delayed_refs->lock);
2278 @@ -3212,6 +3218,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
2279 }
2280 spin_unlock(&head->lock);
2281 mutex_unlock(&head->mutex);
2282 + btrfs_put_transaction(cur_trans);
2283 return ret;
2284 }
2285
2286 diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
2287 index 9ea08326f876..a7e8fdb5fc72 100644
2288 --- a/fs/xfs/xfs_file.c
2289 +++ b/fs/xfs/xfs_file.c
2290 @@ -812,22 +812,26 @@ xfs_file_fallocate(
2291 if (error)
2292 goto out_unlock;
2293 } else if (mode & FALLOC_FL_INSERT_RANGE) {
2294 - unsigned int blksize_mask = i_blocksize(inode) - 1;
2295 + unsigned int blksize_mask = i_blocksize(inode) - 1;
2296 + loff_t isize = i_size_read(inode);
2297
2298 - new_size = i_size_read(inode) + len;
2299 if (offset & blksize_mask || len & blksize_mask) {
2300 error = -EINVAL;
2301 goto out_unlock;
2302 }
2303
2304 - /* check the new inode size does not wrap through zero */
2305 - if (new_size > inode->i_sb->s_maxbytes) {
2306 + /*
2307 + * New inode size must not exceed ->s_maxbytes, accounting for
2308 + * possible signed overflow.
2309 + */
2310 + if (inode->i_sb->s_maxbytes - isize < len) {
2311 error = -EFBIG;
2312 goto out_unlock;
2313 }
2314 + new_size = isize + len;
2315
2316 /* Offset should be less than i_size */
2317 - if (offset >= i_size_read(inode)) {
2318 + if (offset >= isize) {
2319 error = -EINVAL;
2320 goto out_unlock;
2321 }
2322 diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
2323 index 65f9e3f24dde..0e1b4be93dbf 100644
2324 --- a/kernel/time/clocksource.c
2325 +++ b/kernel/time/clocksource.c
2326 @@ -119,6 +119,16 @@ static DEFINE_SPINLOCK(watchdog_lock);
2327 static int watchdog_running;
2328 static atomic_t watchdog_reset_pending;
2329
2330 +static void inline clocksource_watchdog_lock(unsigned long *flags)
2331 +{
2332 + spin_lock_irqsave(&watchdog_lock, *flags);
2333 +}
2334 +
2335 +static void inline clocksource_watchdog_unlock(unsigned long *flags)
2336 +{
2337 + spin_unlock_irqrestore(&watchdog_lock, *flags);
2338 +}
2339 +
2340 static int clocksource_watchdog_kthread(void *data);
2341 static void __clocksource_change_rating(struct clocksource *cs, int rating);
2342
2343 @@ -142,9 +152,19 @@ static void __clocksource_unstable(struct clocksource *cs)
2344 cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG);
2345 cs->flags |= CLOCK_SOURCE_UNSTABLE;
2346
2347 + /*
2348 + * If the clocksource is registered clocksource_watchdog_kthread() will
2349 + * re-rate and re-select.
2350 + */
2351 + if (list_empty(&cs->list)) {
2352 + cs->rating = 0;
2353 + return;
2354 + }
2355 +
2356 if (cs->mark_unstable)
2357 cs->mark_unstable(cs);
2358
2359 + /* kick clocksource_watchdog_kthread() */
2360 if (finished_booting)
2361 schedule_work(&watchdog_work);
2362 }
2363 @@ -164,7 +184,7 @@ void clocksource_mark_unstable(struct clocksource *cs)
2364
2365 spin_lock_irqsave(&watchdog_lock, flags);
2366 if (!(cs->flags & CLOCK_SOURCE_UNSTABLE)) {
2367 - if (list_empty(&cs->wd_list))
2368 + if (!list_empty(&cs->list) && list_empty(&cs->wd_list))
2369 list_add(&cs->wd_list, &watchdog_list);
2370 __clocksource_unstable(cs);
2371 }
2372 @@ -319,9 +339,8 @@ static void clocksource_resume_watchdog(void)
2373
2374 static void clocksource_enqueue_watchdog(struct clocksource *cs)
2375 {
2376 - unsigned long flags;
2377 + INIT_LIST_HEAD(&cs->wd_list);
2378
2379 - spin_lock_irqsave(&watchdog_lock, flags);
2380 if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
2381 /* cs is a clocksource to be watched. */
2382 list_add(&cs->wd_list, &watchdog_list);
2383 @@ -331,7 +350,6 @@ static void clocksource_enqueue_watchdog(struct clocksource *cs)
2384 if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
2385 cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
2386 }
2387 - spin_unlock_irqrestore(&watchdog_lock, flags);
2388 }
2389
2390 static void clocksource_select_watchdog(bool fallback)
2391 @@ -373,9 +391,6 @@ static void clocksource_select_watchdog(bool fallback)
2392
2393 static void clocksource_dequeue_watchdog(struct clocksource *cs)
2394 {
2395 - unsigned long flags;
2396 -
2397 - spin_lock_irqsave(&watchdog_lock, flags);
2398 if (cs != watchdog) {
2399 if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
2400 /* cs is a watched clocksource. */
2401 @@ -384,21 +399,19 @@ static void clocksource_dequeue_watchdog(struct clocksource *cs)
2402 clocksource_stop_watchdog();
2403 }
2404 }
2405 - spin_unlock_irqrestore(&watchdog_lock, flags);
2406 }
2407
2408 static int __clocksource_watchdog_kthread(void)
2409 {
2410 struct clocksource *cs, *tmp;
2411 unsigned long flags;
2412 - LIST_HEAD(unstable);
2413 int select = 0;
2414
2415 spin_lock_irqsave(&watchdog_lock, flags);
2416 list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) {
2417 if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
2418 list_del_init(&cs->wd_list);
2419 - list_add(&cs->wd_list, &unstable);
2420 + __clocksource_change_rating(cs, 0);
2421 select = 1;
2422 }
2423 if (cs->flags & CLOCK_SOURCE_RESELECT) {
2424 @@ -410,11 +423,6 @@ static int __clocksource_watchdog_kthread(void)
2425 clocksource_stop_watchdog();
2426 spin_unlock_irqrestore(&watchdog_lock, flags);
2427
2428 - /* Needs to be done outside of watchdog lock */
2429 - list_for_each_entry_safe(cs, tmp, &unstable, wd_list) {
2430 - list_del_init(&cs->wd_list);
2431 - __clocksource_change_rating(cs, 0);
2432 - }
2433 return select;
2434 }
2435
2436 @@ -447,6 +455,9 @@ static inline int __clocksource_watchdog_kthread(void) { return 0; }
2437 static bool clocksource_is_watchdog(struct clocksource *cs) { return false; }
2438 void clocksource_mark_unstable(struct clocksource *cs) { }
2439
2440 +static void inline clocksource_watchdog_lock(unsigned long *flags) { }
2441 +static void inline clocksource_watchdog_unlock(unsigned long *flags) { }
2442 +
2443 #endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
2444
2445 /**
2446 @@ -775,14 +786,19 @@ EXPORT_SYMBOL_GPL(__clocksource_update_freq_scale);
2447 */
2448 int __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq)
2449 {
2450 + unsigned long flags;
2451
2452 /* Initialize mult/shift and max_idle_ns */
2453 __clocksource_update_freq_scale(cs, scale, freq);
2454
2455 /* Add clocksource to the clocksource list */
2456 mutex_lock(&clocksource_mutex);
2457 +
2458 + clocksource_watchdog_lock(&flags);
2459 clocksource_enqueue(cs);
2460 clocksource_enqueue_watchdog(cs);
2461 + clocksource_watchdog_unlock(&flags);
2462 +
2463 clocksource_select();
2464 clocksource_select_watchdog(false);
2465 mutex_unlock(&clocksource_mutex);
2466 @@ -804,8 +820,13 @@ static void __clocksource_change_rating(struct clocksource *cs, int rating)
2467 */
2468 void clocksource_change_rating(struct clocksource *cs, int rating)
2469 {
2470 + unsigned long flags;
2471 +
2472 mutex_lock(&clocksource_mutex);
2473 + clocksource_watchdog_lock(&flags);
2474 __clocksource_change_rating(cs, rating);
2475 + clocksource_watchdog_unlock(&flags);
2476 +
2477 clocksource_select();
2478 clocksource_select_watchdog(false);
2479 mutex_unlock(&clocksource_mutex);
2480 @@ -817,6 +838,8 @@ EXPORT_SYMBOL(clocksource_change_rating);
2481 */
2482 static int clocksource_unbind(struct clocksource *cs)
2483 {
2484 + unsigned long flags;
2485 +
2486 if (clocksource_is_watchdog(cs)) {
2487 /* Select and try to install a replacement watchdog. */
2488 clocksource_select_watchdog(true);
2489 @@ -830,8 +853,12 @@ static int clocksource_unbind(struct clocksource *cs)
2490 if (curr_clocksource == cs)
2491 return -EBUSY;
2492 }
2493 +
2494 + clocksource_watchdog_lock(&flags);
2495 clocksource_dequeue_watchdog(cs);
2496 list_del_init(&cs->list);
2497 + clocksource_watchdog_unlock(&flags);
2498 +
2499 return 0;
2500 }
2501
2502 diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
2503 index df08863e6d53..fff97dc0b70f 100644
2504 --- a/kernel/trace/trace_uprobe.c
2505 +++ b/kernel/trace/trace_uprobe.c
2506 @@ -55,6 +55,7 @@ struct trace_uprobe {
2507 struct list_head list;
2508 struct trace_uprobe_filter filter;
2509 struct uprobe_consumer consumer;
2510 + struct path path;
2511 struct inode *inode;
2512 char *filename;
2513 unsigned long offset;
2514 @@ -287,7 +288,7 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
2515 for (i = 0; i < tu->tp.nr_args; i++)
2516 traceprobe_free_probe_arg(&tu->tp.args[i]);
2517
2518 - iput(tu->inode);
2519 + path_put(&tu->path);
2520 kfree(tu->tp.call.class->system);
2521 kfree(tu->tp.call.name);
2522 kfree(tu->filename);
2523 @@ -361,7 +362,6 @@ static int register_trace_uprobe(struct trace_uprobe *tu)
2524 static int create_trace_uprobe(int argc, char **argv)
2525 {
2526 struct trace_uprobe *tu;
2527 - struct inode *inode;
2528 char *arg, *event, *group, *filename;
2529 char buf[MAX_EVENT_NAME_LEN];
2530 struct path path;
2531 @@ -369,7 +369,6 @@ static int create_trace_uprobe(int argc, char **argv)
2532 bool is_delete, is_return;
2533 int i, ret;
2534
2535 - inode = NULL;
2536 ret = 0;
2537 is_delete = false;
2538 is_return = false;
2539 @@ -435,21 +434,16 @@ static int create_trace_uprobe(int argc, char **argv)
2540 }
2541 /* Find the last occurrence, in case the path contains ':' too. */
2542 arg = strrchr(argv[1], ':');
2543 - if (!arg) {
2544 - ret = -EINVAL;
2545 - goto fail_address_parse;
2546 - }
2547 + if (!arg)
2548 + return -EINVAL;
2549
2550 *arg++ = '\0';
2551 filename = argv[1];
2552 ret = kern_path(filename, LOOKUP_FOLLOW, &path);
2553 if (ret)
2554 - goto fail_address_parse;
2555 -
2556 - inode = igrab(d_inode(path.dentry));
2557 - path_put(&path);
2558 + return ret;
2559
2560 - if (!inode || !S_ISREG(inode->i_mode)) {
2561 + if (!d_is_reg(path.dentry)) {
2562 ret = -EINVAL;
2563 goto fail_address_parse;
2564 }
2565 @@ -488,7 +482,7 @@ static int create_trace_uprobe(int argc, char **argv)
2566 goto fail_address_parse;
2567 }
2568 tu->offset = offset;
2569 - tu->inode = inode;
2570 + tu->path = path;
2571 tu->filename = kstrdup(filename, GFP_KERNEL);
2572
2573 if (!tu->filename) {
2574 @@ -556,7 +550,7 @@ static int create_trace_uprobe(int argc, char **argv)
2575 return ret;
2576
2577 fail_address_parse:
2578 - iput(inode);
2579 + path_put(&path);
2580
2581 pr_info("Failed to parse address or file.\n");
2582
2583 @@ -935,6 +929,7 @@ probe_event_enable(struct trace_uprobe *tu, struct trace_event_file *file,
2584 goto err_flags;
2585
2586 tu->consumer.filter = filter;
2587 + tu->inode = d_real_inode(tu->path.dentry);
2588 ret = uprobe_register(tu->inode, tu->offset, &tu->consumer);
2589 if (ret)
2590 goto err_buffer;
2591 @@ -980,6 +975,7 @@ probe_event_disable(struct trace_uprobe *tu, struct trace_event_file *file)
2592 WARN_ON(!uprobe_filter_is_empty(&tu->filter));
2593
2594 uprobe_unregister(tu->inode, tu->offset, &tu->consumer);
2595 + tu->inode = NULL;
2596 tu->tp.flags &= file ? ~TP_FLAG_TRACE : ~TP_FLAG_PROFILE;
2597
2598 uprobe_buffer_disable();
2599 diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
2600 index 671b13457387..1e37da2e0c25 100644
2601 --- a/kernel/tracepoint.c
2602 +++ b/kernel/tracepoint.c
2603 @@ -207,7 +207,7 @@ static int tracepoint_add_func(struct tracepoint *tp,
2604 lockdep_is_held(&tracepoints_mutex));
2605 old = func_add(&tp_funcs, func, prio);
2606 if (IS_ERR(old)) {
2607 - WARN_ON_ONCE(1);
2608 + WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM);
2609 return PTR_ERR(old);
2610 }
2611
2612 @@ -239,7 +239,7 @@ static int tracepoint_remove_func(struct tracepoint *tp,
2613 lockdep_is_held(&tracepoints_mutex));
2614 old = func_remove(&tp_funcs, func);
2615 if (IS_ERR(old)) {
2616 - WARN_ON_ONCE(1);
2617 + WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM);
2618 return PTR_ERR(old);
2619 }
2620
2621 diff --git a/lib/errseq.c b/lib/errseq.c
2622 index df782418b333..81f9e33aa7e7 100644
2623 --- a/lib/errseq.c
2624 +++ b/lib/errseq.c
2625 @@ -111,27 +111,22 @@ EXPORT_SYMBOL(errseq_set);
2626 * errseq_sample() - Grab current errseq_t value.
2627 * @eseq: Pointer to errseq_t to be sampled.
2628 *
2629 - * This function allows callers to sample an errseq_t value, marking it as
2630 - * "seen" if required.
2631 + * This function allows callers to initialise their errseq_t variable.
2632 + * If the error has been "seen", new callers will not see an old error.
2633 + * If there is an unseen error in @eseq, the caller of this function will
2634 + * see it the next time it checks for an error.
2635 *
2636 + * Context: Any context.
2637 * Return: The current errseq value.
2638 */
2639 errseq_t errseq_sample(errseq_t *eseq)
2640 {
2641 errseq_t old = READ_ONCE(*eseq);
2642 - errseq_t new = old;
2643
2644 - /*
2645 - * For the common case of no errors ever having been set, we can skip
2646 - * marking the SEEN bit. Once an error has been set, the value will
2647 - * never go back to zero.
2648 - */
2649 - if (old != 0) {
2650 - new |= ERRSEQ_SEEN;
2651 - if (old != new)
2652 - cmpxchg(eseq, old, new);
2653 - }
2654 - return new;
2655 + /* If nobody has seen this error yet, then we can be the first. */
2656 + if (!(old & ERRSEQ_SEEN))
2657 + old = 0;
2658 + return old;
2659 }
2660 EXPORT_SYMBOL(errseq_sample);
2661
2662 diff --git a/lib/swiotlb.c b/lib/swiotlb.c
2663 index 44f7eb408fdb..0331de0e9144 100644
2664 --- a/lib/swiotlb.c
2665 +++ b/lib/swiotlb.c
2666 @@ -750,7 +750,7 @@ swiotlb_alloc_buffer(struct device *dev, size_t size, dma_addr_t *dma_handle,
2667 swiotlb_tbl_unmap_single(dev, phys_addr, size, DMA_TO_DEVICE,
2668 DMA_ATTR_SKIP_CPU_SYNC);
2669 out_warn:
2670 - if ((attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) {
2671 + if (!(attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) {
2672 dev_warn(dev,
2673 "swiotlb: coherent allocation failed, size=%zu\n",
2674 size);
2675 diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
2676 index 06d7c40af570..6491afbb5fd5 100644
2677 --- a/sound/core/pcm_compat.c
2678 +++ b/sound/core/pcm_compat.c
2679 @@ -423,6 +423,8 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
2680 return -ENOTTY;
2681 if (substream->stream != dir)
2682 return -EINVAL;
2683 + if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN)
2684 + return -EBADFD;
2685
2686 if ((ch = substream->runtime->channels) > 128)
2687 return -EINVAL;
2688 diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
2689 index f48a4cd24ffc..289ae6bb81d9 100644
2690 --- a/sound/core/seq/seq_virmidi.c
2691 +++ b/sound/core/seq/seq_virmidi.c
2692 @@ -174,12 +174,12 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,
2693 }
2694 return;
2695 }
2696 + spin_lock_irqsave(&substream->runtime->lock, flags);
2697 if (vmidi->event.type != SNDRV_SEQ_EVENT_NONE) {
2698 if (snd_seq_kernel_client_dispatch(vmidi->client, &vmidi->event, in_atomic(), 0) < 0)
2699 - return;
2700 + goto out;
2701 vmidi->event.type = SNDRV_SEQ_EVENT_NONE;
2702 }
2703 - spin_lock_irqsave(&substream->runtime->lock, flags);
2704 while (1) {
2705 count = __snd_rawmidi_transmit_peek(substream, buf, sizeof(buf));
2706 if (count <= 0)
2707 diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
2708 index 1063a4377502..eab7f594ebe7 100644
2709 --- a/sound/drivers/aloop.c
2710 +++ b/sound/drivers/aloop.c
2711 @@ -296,6 +296,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
2712 cable->pause |= stream;
2713 loopback_timer_stop(dpcm);
2714 spin_unlock(&cable->lock);
2715 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
2716 + loopback_active_notify(dpcm);
2717 break;
2718 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
2719 case SNDRV_PCM_TRIGGER_RESUME:
2720 @@ -304,6 +306,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
2721 cable->pause &= ~stream;
2722 loopback_timer_start(dpcm);
2723 spin_unlock(&cable->lock);
2724 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
2725 + loopback_active_notify(dpcm);
2726 break;
2727 default:
2728 return -EINVAL;
2729 @@ -827,9 +831,11 @@ static int loopback_rate_shift_get(struct snd_kcontrol *kcontrol,
2730 {
2731 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
2732
2733 + mutex_lock(&loopback->cable_lock);
2734 ucontrol->value.integer.value[0] =
2735 loopback->setup[kcontrol->id.subdevice]
2736 [kcontrol->id.device].rate_shift;
2737 + mutex_unlock(&loopback->cable_lock);
2738 return 0;
2739 }
2740
2741 @@ -861,9 +867,11 @@ static int loopback_notify_get(struct snd_kcontrol *kcontrol,
2742 {
2743 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
2744
2745 + mutex_lock(&loopback->cable_lock);
2746 ucontrol->value.integer.value[0] =
2747 loopback->setup[kcontrol->id.subdevice]
2748 [kcontrol->id.device].notify;
2749 + mutex_unlock(&loopback->cable_lock);
2750 return 0;
2751 }
2752
2753 @@ -875,12 +883,14 @@ static int loopback_notify_put(struct snd_kcontrol *kcontrol,
2754 int change = 0;
2755
2756 val = ucontrol->value.integer.value[0] ? 1 : 0;
2757 + mutex_lock(&loopback->cable_lock);
2758 if (val != loopback->setup[kcontrol->id.subdevice]
2759 [kcontrol->id.device].notify) {
2760 loopback->setup[kcontrol->id.subdevice]
2761 [kcontrol->id.device].notify = val;
2762 change = 1;
2763 }
2764 + mutex_unlock(&loopback->cable_lock);
2765 return change;
2766 }
2767
2768 @@ -888,13 +898,18 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol,
2769 struct snd_ctl_elem_value *ucontrol)
2770 {
2771 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
2772 - struct loopback_cable *cable = loopback->cables
2773 - [kcontrol->id.subdevice][kcontrol->id.device ^ 1];
2774 + struct loopback_cable *cable;
2775 +
2776 unsigned int val = 0;
2777
2778 - if (cable != NULL)
2779 - val = (cable->running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ?
2780 - 1 : 0;
2781 + mutex_lock(&loopback->cable_lock);
2782 + cable = loopback->cables[kcontrol->id.subdevice][kcontrol->id.device ^ 1];
2783 + if (cable != NULL) {
2784 + unsigned int running = cable->running ^ cable->pause;
2785 +
2786 + val = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? 1 : 0;
2787 + }
2788 + mutex_unlock(&loopback->cable_lock);
2789 ucontrol->value.integer.value[0] = val;
2790 return 0;
2791 }
2792 @@ -937,9 +952,11 @@ static int loopback_rate_get(struct snd_kcontrol *kcontrol,
2793 {
2794 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
2795
2796 + mutex_lock(&loopback->cable_lock);
2797 ucontrol->value.integer.value[0] =
2798 loopback->setup[kcontrol->id.subdevice]
2799 [kcontrol->id.device].rate;
2800 + mutex_unlock(&loopback->cable_lock);
2801 return 0;
2802 }
2803
2804 @@ -959,9 +976,11 @@ static int loopback_channels_get(struct snd_kcontrol *kcontrol,
2805 {
2806 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
2807
2808 + mutex_lock(&loopback->cable_lock);
2809 ucontrol->value.integer.value[0] =
2810 loopback->setup[kcontrol->id.subdevice]
2811 [kcontrol->id.device].channels;
2812 + mutex_unlock(&loopback->cable_lock);
2813 return 0;
2814 }
2815
2816 diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
2817 index 4a1dc145327b..cb9acfe60f6a 100644
2818 --- a/sound/firewire/amdtp-stream.c
2819 +++ b/sound/firewire/amdtp-stream.c
2820 @@ -773,8 +773,6 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context,
2821 u32 cycle;
2822 unsigned int packets;
2823
2824 - s->max_payload_length = amdtp_stream_get_max_payload(s);
2825 -
2826 /*
2827 * For in-stream, first packet has come.
2828 * For out-stream, prepared to transmit first packet
2829 @@ -879,6 +877,9 @@ int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
2830
2831 amdtp_stream_update(s);
2832
2833 + if (s->direction == AMDTP_IN_STREAM)
2834 + s->max_payload_length = amdtp_stream_get_max_payload(s);
2835 +
2836 if (s->flags & CIP_NO_HEADER)
2837 s->tag = TAG_NO_CIP_HEADER;
2838 else
2839 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2840 index 8c238e51bb5a..2dd34dd77447 100644
2841 --- a/sound/pci/hda/patch_realtek.c
2842 +++ b/sound/pci/hda/patch_realtek.c
2843 @@ -3832,7 +3832,7 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
2844 }
2845 }
2846
2847 -#if IS_REACHABLE(INPUT)
2848 +#if IS_REACHABLE(CONFIG_INPUT)
2849 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
2850 struct hda_jack_callback *event)
2851 {
2852 diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
2853 index 2cccbba64418..f304be71c278 100644
2854 --- a/tools/power/acpi/Makefile.config
2855 +++ b/tools/power/acpi/Makefile.config
2856 @@ -56,6 +56,7 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
2857 # to compile vs uClibc, that can be done here as well.
2858 CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
2859 CROSS_COMPILE ?= $(CROSS)
2860 +LD = $(CC)
2861 HOSTCC = gcc
2862
2863 # check if compiler option is supported
2864 diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh
2865 index f9508e1a4058..6b63b6bf2661 100755
2866 --- a/tools/testing/selftests/firmware/fw_filesystem.sh
2867 +++ b/tools/testing/selftests/firmware/fw_filesystem.sh
2868 @@ -46,9 +46,11 @@ test_finish()
2869 echo "$OLD_TIMEOUT" >/sys/class/firmware/timeout
2870 fi
2871 if [ "$OLD_FWPATH" = "" ]; then
2872 - OLD_FWPATH=" "
2873 + # A zero-length write won't work; write a null byte
2874 + printf '\000' >/sys/module/firmware_class/parameters/path
2875 + else
2876 + echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path
2877 fi
2878 - echo -n "$OLD_FWPATH" >/sys/module/firmware_class/parameters/path
2879 rm -f "$FW"
2880 rmdir "$FWPATH"
2881 }