Magellan Linux

Contents of /trunk/kernel-alx/patches-4.14/0129-4.14.30-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3238 - (show annotations) (download)
Fri Nov 9 12:14:58 2018 UTC (5 years, 5 months ago) by niro
File size: 85896 byte(s)
-added up to patches-4.14.79
1 diff --git a/Documentation/devicetree/bindings/display/panel/toppoly,td028ttec1.txt b/Documentation/devicetree/bindings/display/panel/toppoly,td028ttec1.txt
2 deleted file mode 100644
3 index 7175dc3740ac..000000000000
4 --- a/Documentation/devicetree/bindings/display/panel/toppoly,td028ttec1.txt
5 +++ /dev/null
6 @@ -1,30 +0,0 @@
7 -Toppoly TD028TTEC1 Panel
8 -========================
9 -
10 -Required properties:
11 -- compatible: "toppoly,td028ttec1"
12 -
13 -Optional properties:
14 -- label: a symbolic name for the panel
15 -
16 -Required nodes:
17 -- Video port for DPI input
18 -
19 -Example
20 --------
21 -
22 -lcd-panel: td028ttec1@0 {
23 - compatible = "toppoly,td028ttec1";
24 - reg = <0>;
25 - spi-max-frequency = <100000>;
26 - spi-cpol;
27 - spi-cpha;
28 -
29 - label = "lcd";
30 - port {
31 - lcd_in: endpoint {
32 - remote-endpoint = <&dpi_out>;
33 - };
34 - };
35 -};
36 -
37 diff --git a/Documentation/devicetree/bindings/display/panel/tpo,td028ttec1.txt b/Documentation/devicetree/bindings/display/panel/tpo,td028ttec1.txt
38 new file mode 100644
39 index 000000000000..ed34253d9fb1
40 --- /dev/null
41 +++ b/Documentation/devicetree/bindings/display/panel/tpo,td028ttec1.txt
42 @@ -0,0 +1,30 @@
43 +Toppoly TD028TTEC1 Panel
44 +========================
45 +
46 +Required properties:
47 +- compatible: "tpo,td028ttec1"
48 +
49 +Optional properties:
50 +- label: a symbolic name for the panel
51 +
52 +Required nodes:
53 +- Video port for DPI input
54 +
55 +Example
56 +-------
57 +
58 +lcd-panel: td028ttec1@0 {
59 + compatible = "tpo,td028ttec1";
60 + reg = <0>;
61 + spi-max-frequency = <100000>;
62 + spi-cpol;
63 + spi-cpha;
64 +
65 + label = "lcd";
66 + port {
67 + lcd_in: endpoint {
68 + remote-endpoint = <&dpi_out>;
69 + };
70 + };
71 +};
72 +
73 diff --git a/Makefile b/Makefile
74 index 4b2aa0dd4043..29fc3c91f3e4 100644
75 --- a/Makefile
76 +++ b/Makefile
77 @@ -1,7 +1,7 @@
78 # SPDX-License-Identifier: GPL-2.0
79 VERSION = 4
80 PATCHLEVEL = 14
81 -SUBLEVEL = 29
82 +SUBLEVEL = 30
83 EXTRAVERSION =
84 NAME = Petit Gorille
85
86 diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c
87 index 8e9a41966881..5476279329a6 100644
88 --- a/arch/alpha/kernel/console.c
89 +++ b/arch/alpha/kernel/console.c
90 @@ -21,6 +21,7 @@
91 struct pci_controller *pci_vga_hose;
92 static struct resource alpha_vga = {
93 .name = "alpha-vga+",
94 + .flags = IORESOURCE_IO,
95 .start = 0x3C0,
96 .end = 0x3DF
97 };
98 diff --git a/arch/arm/boot/dts/aspeed-ast2500-evb.dts b/arch/arm/boot/dts/aspeed-ast2500-evb.dts
99 index f53e89d63477..c971cc93f42d 100644
100 --- a/arch/arm/boot/dts/aspeed-ast2500-evb.dts
101 +++ b/arch/arm/boot/dts/aspeed-ast2500-evb.dts
102 @@ -16,7 +16,7 @@
103 bootargs = "console=ttyS4,115200 earlyprintk";
104 };
105
106 - memory {
107 + memory@80000000 {
108 reg = <0x80000000 0x20000000>;
109 };
110 };
111 diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c
112 index bd810d01538a..093fd096f0c8 100644
113 --- a/drivers/bluetooth/btqcomsmd.c
114 +++ b/drivers/bluetooth/btqcomsmd.c
115 @@ -86,7 +86,8 @@ static int btqcomsmd_send(struct hci_dev *hdev, struct sk_buff *skb)
116 break;
117 }
118
119 - kfree_skb(skb);
120 + if (!ret)
121 + kfree_skb(skb);
122
123 return ret;
124 }
125 diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
126 index 392f412b4575..c9f0ac083a3e 100644
127 --- a/drivers/bluetooth/hci_qca.c
128 +++ b/drivers/bluetooth/hci_qca.c
129 @@ -933,6 +933,9 @@ static int qca_setup(struct hci_uart *hu)
130 if (!ret) {
131 set_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags);
132 qca_debugfs_init(hdev);
133 + } else if (ret == -ENOENT) {
134 + /* No patch/nvm-config found, run with original fw/config */
135 + ret = 0;
136 }
137
138 /* Setup bdaddr */
139 diff --git a/drivers/char/mem.c b/drivers/char/mem.c
140 index 970e1242a282..3a70dba2c645 100644
141 --- a/drivers/char/mem.c
142 +++ b/drivers/char/mem.c
143 @@ -107,6 +107,8 @@ static ssize_t read_mem(struct file *file, char __user *buf,
144 phys_addr_t p = *ppos;
145 ssize_t read, sz;
146 void *ptr;
147 + char *bounce;
148 + int err;
149
150 if (p != *ppos)
151 return 0;
152 @@ -129,15 +131,22 @@ static ssize_t read_mem(struct file *file, char __user *buf,
153 }
154 #endif
155
156 + bounce = kmalloc(PAGE_SIZE, GFP_KERNEL);
157 + if (!bounce)
158 + return -ENOMEM;
159 +
160 while (count > 0) {
161 unsigned long remaining;
162 int allowed;
163
164 sz = size_inside_page(p, count);
165
166 + err = -EPERM;
167 allowed = page_is_allowed(p >> PAGE_SHIFT);
168 if (!allowed)
169 - return -EPERM;
170 + goto failed;
171 +
172 + err = -EFAULT;
173 if (allowed == 2) {
174 /* Show zeros for restricted memory. */
175 remaining = clear_user(buf, sz);
176 @@ -149,24 +158,32 @@ static ssize_t read_mem(struct file *file, char __user *buf,
177 */
178 ptr = xlate_dev_mem_ptr(p);
179 if (!ptr)
180 - return -EFAULT;
181 -
182 - remaining = copy_to_user(buf, ptr, sz);
183 + goto failed;
184
185 + err = probe_kernel_read(bounce, ptr, sz);
186 unxlate_dev_mem_ptr(p, ptr);
187 + if (err)
188 + goto failed;
189 +
190 + remaining = copy_to_user(buf, bounce, sz);
191 }
192
193 if (remaining)
194 - return -EFAULT;
195 + goto failed;
196
197 buf += sz;
198 p += sz;
199 count -= sz;
200 read += sz;
201 }
202 + kfree(bounce);
203
204 *ppos += read;
205 return read;
206 +
207 +failed:
208 + kfree(bounce);
209 + return err;
210 }
211
212 static ssize_t write_mem(struct file *file, const char __user *buf,
213 diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
214 index 775af473fe11..5c2b26de303e 100644
215 --- a/drivers/clk/at91/pmc.c
216 +++ b/drivers/clk/at91/pmc.c
217 @@ -107,10 +107,20 @@ static int pmc_suspend(void)
218 return 0;
219 }
220
221 +static bool pmc_ready(unsigned int mask)
222 +{
223 + unsigned int status;
224 +
225 + regmap_read(pmcreg, AT91_PMC_SR, &status);
226 +
227 + return ((status & mask) == mask) ? 1 : 0;
228 +}
229 +
230 static void pmc_resume(void)
231 {
232 - int i, ret = 0;
233 + int i;
234 u32 tmp;
235 + u32 mask = AT91_PMC_MCKRDY | AT91_PMC_LOCKA;
236
237 regmap_read(pmcreg, AT91_PMC_MCKR, &tmp);
238 if (pmc_cache.mckr != tmp)
239 @@ -134,13 +144,11 @@ static void pmc_resume(void)
240 AT91_PMC_PCR_CMD);
241 }
242
243 - if (pmc_cache.uckr & AT91_PMC_UPLLEN) {
244 - ret = regmap_read_poll_timeout(pmcreg, AT91_PMC_SR, tmp,
245 - !(tmp & AT91_PMC_LOCKU),
246 - 10, 5000);
247 - if (ret)
248 - pr_crit("USB PLL didn't lock when resuming\n");
249 - }
250 + if (pmc_cache.uckr & AT91_PMC_UPLLEN)
251 + mask |= AT91_PMC_LOCKU;
252 +
253 + while (!pmc_ready(mask))
254 + cpu_relax();
255 }
256
257 static struct syscore_ops pmc_syscore_ops = {
258 diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
259 index 5e918e7afaba..95a6e9834392 100644
260 --- a/drivers/clk/clk-axi-clkgen.c
261 +++ b/drivers/clk/clk-axi-clkgen.c
262 @@ -40,6 +40,10 @@
263 #define MMCM_REG_FILTER1 0x4e
264 #define MMCM_REG_FILTER2 0x4f
265
266 +#define MMCM_CLKOUT_NOCOUNT BIT(6)
267 +
268 +#define MMCM_CLK_DIV_NOCOUNT BIT(12)
269 +
270 struct axi_clkgen {
271 void __iomem *base;
272 struct clk_hw clk_hw;
273 @@ -315,12 +319,27 @@ static unsigned long axi_clkgen_recalc_rate(struct clk_hw *clk_hw,
274 unsigned int reg;
275 unsigned long long tmp;
276
277 - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_1, &reg);
278 - dout = (reg & 0x3f) + ((reg >> 6) & 0x3f);
279 + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_2, &reg);
280 + if (reg & MMCM_CLKOUT_NOCOUNT) {
281 + dout = 1;
282 + } else {
283 + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLKOUT0_1, &reg);
284 + dout = (reg & 0x3f) + ((reg >> 6) & 0x3f);
285 + }
286 +
287 axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_DIV, &reg);
288 - d = (reg & 0x3f) + ((reg >> 6) & 0x3f);
289 - axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB1, &reg);
290 - m = (reg & 0x3f) + ((reg >> 6) & 0x3f);
291 + if (reg & MMCM_CLK_DIV_NOCOUNT)
292 + d = 1;
293 + else
294 + d = (reg & 0x3f) + ((reg >> 6) & 0x3f);
295 +
296 + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB2, &reg);
297 + if (reg & MMCM_CLKOUT_NOCOUNT) {
298 + m = 1;
299 + } else {
300 + axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_FB1, &reg);
301 + m = (reg & 0x3f) + ((reg >> 6) & 0x3f);
302 + }
303
304 if (d == 0 || dout == 0)
305 return 0;
306 diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
307 index 20d90769cced..653b0f38d475 100644
308 --- a/drivers/clk/clk-si5351.c
309 +++ b/drivers/clk/clk-si5351.c
310 @@ -72,7 +72,7 @@ static const char * const si5351_input_names[] = {
311 "xtal", "clkin"
312 };
313 static const char * const si5351_pll_names[] = {
314 - "plla", "pllb", "vxco"
315 + "si5351_plla", "si5351_pllb", "si5351_vxco"
316 };
317 static const char * const si5351_msynth_names[] = {
318 "ms0", "ms1", "ms2", "ms3", "ms4", "ms5", "ms6", "ms7"
319 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
320 index c8d83acda006..60c7fde37d23 100644
321 --- a/drivers/clk/clk.c
322 +++ b/drivers/clk/clk.c
323 @@ -2470,6 +2470,21 @@ static int __clk_core_init(struct clk_core *core)
324 rate = 0;
325 core->rate = core->req_rate = rate;
326
327 + /*
328 + * Enable CLK_IS_CRITICAL clocks so newly added critical clocks
329 + * don't get accidentally disabled when walking the orphan tree and
330 + * reparenting clocks
331 + */
332 + if (core->flags & CLK_IS_CRITICAL) {
333 + unsigned long flags;
334 +
335 + clk_core_prepare(core);
336 +
337 + flags = clk_enable_lock();
338 + clk_core_enable(core);
339 + clk_enable_unlock(flags);
340 + }
341 +
342 /*
343 * walk the list of orphan clocks and reparent any that newly finds a
344 * parent.
345 @@ -2478,10 +2493,13 @@ static int __clk_core_init(struct clk_core *core)
346 struct clk_core *parent = __clk_init_parent(orphan);
347
348 /*
349 - * we could call __clk_set_parent, but that would result in a
350 - * redundant call to the .set_rate op, if it exists
351 + * We need to use __clk_set_parent_before() and _after() to
352 + * to properly migrate any prepare/enable count of the orphan
353 + * clock. This is important for CLK_IS_CRITICAL clocks, which
354 + * are enabled during init but might not have a parent yet.
355 */
356 if (parent) {
357 + /* update the clk tree topology */
358 __clk_set_parent_before(orphan, parent);
359 __clk_set_parent_after(orphan, parent, NULL);
360 __clk_recalc_accuracies(orphan);
361 @@ -2500,16 +2518,6 @@ static int __clk_core_init(struct clk_core *core)
362 if (core->ops->init)
363 core->ops->init(core->hw);
364
365 - if (core->flags & CLK_IS_CRITICAL) {
366 - unsigned long flags;
367 -
368 - clk_core_prepare(core);
369 -
370 - flags = clk_enable_lock();
371 - clk_core_enable(core);
372 - clk_enable_unlock(flags);
373 - }
374 -
375 kref_init(&core->ref);
376 out:
377 clk_prepare_unlock();
378 diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
379 index d5e27bc7585a..859a62ea6120 100644
380 --- a/drivers/cpufreq/longhaul.c
381 +++ b/drivers/cpufreq/longhaul.c
382 @@ -894,7 +894,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy)
383 if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0))
384 longhaul_setup_voltagescaling();
385
386 - policy->cpuinfo.transition_latency = 200000; /* nsec */
387 + policy->transition_delay_us = 200000; /* usec */
388
389 return cpufreq_table_validate_and_show(policy, longhaul_table);
390 }
391 diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
392 index 0f9754e07719..6eb5cb92b986 100644
393 --- a/drivers/crypto/axis/artpec6_crypto.c
394 +++ b/drivers/crypto/axis/artpec6_crypto.c
395 @@ -22,6 +22,7 @@
396 #include <linux/slab.h>
397
398 #include <crypto/aes.h>
399 +#include <crypto/gcm.h>
400 #include <crypto/internal/aead.h>
401 #include <crypto/internal/hash.h>
402 #include <crypto/internal/skcipher.h>
403 @@ -1934,7 +1935,7 @@ static int artpec6_crypto_prepare_aead(struct aead_request *areq)
404
405 memcpy(req_ctx->hw_ctx.J0, areq->iv, crypto_aead_ivsize(cipher));
406 // The HW omits the initial increment of the counter field.
407 - crypto_inc(req_ctx->hw_ctx.J0+12, 4);
408 + memcpy(req_ctx->hw_ctx.J0 + GCM_AES_IV_SIZE, "\x00\x00\x00\x01", 4);
409
410 ret = artpec6_crypto_setup_out_descr(common, &req_ctx->hw_ctx,
411 sizeof(struct artpec6_crypto_aead_hw_ctx), false, false);
412 @@ -2956,7 +2957,7 @@ static struct aead_alg aead_algos[] = {
413 .setkey = artpec6_crypto_aead_set_key,
414 .encrypt = artpec6_crypto_aead_encrypt,
415 .decrypt = artpec6_crypto_aead_decrypt,
416 - .ivsize = AES_BLOCK_SIZE,
417 + .ivsize = GCM_AES_IV_SIZE,
418 .maxauthsize = AES_BLOCK_SIZE,
419
420 .base = {
421 diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
422 index 7df910e7c348..9272b173c746 100644
423 --- a/drivers/dma/ti-dma-crossbar.c
424 +++ b/drivers/dma/ti-dma-crossbar.c
425 @@ -54,7 +54,15 @@ struct ti_am335x_xbar_map {
426
427 static inline void ti_am335x_xbar_write(void __iomem *iomem, int event, u8 val)
428 {
429 - writeb_relaxed(val, iomem + event);
430 + /*
431 + * TPCC_EVT_MUX_60_63 register layout is different than the
432 + * rest, in the sense, that event 63 is mapped to lowest byte
433 + * and event 60 is mapped to highest, handle it separately.
434 + */
435 + if (event >= 60 && event <= 63)
436 + writeb_relaxed(val, iomem + (63 - event % 4));
437 + else
438 + writeb_relaxed(val, iomem + event);
439 }
440
441 static void ti_am335x_xbar_free(struct device *dev, void *route_data)
442 diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
443 index 1ee1241ca797..5cc8ed31f26b 100644
444 --- a/drivers/dma/xilinx/zynqmp_dma.c
445 +++ b/drivers/dma/xilinx/zynqmp_dma.c
446 @@ -838,7 +838,8 @@ static void zynqmp_dma_chan_remove(struct zynqmp_dma_chan *chan)
447 if (!chan)
448 return;
449
450 - devm_free_irq(chan->zdev->dev, chan->irq, chan);
451 + if (chan->irq)
452 + devm_free_irq(chan->zdev->dev, chan->irq, chan);
453 tasklet_kill(&chan->tasklet);
454 list_del(&chan->common.device_node);
455 clk_disable_unprepare(chan->clk_apb);
456 diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
457 index ea5bb0e1632c..6e0fb50d0de4 100644
458 --- a/drivers/gpu/drm/msm/msm_gem.c
459 +++ b/drivers/gpu/drm/msm/msm_gem.c
460 @@ -93,14 +93,17 @@ static struct page **get_pages(struct drm_gem_object *obj)
461 return p;
462 }
463
464 + msm_obj->pages = p;
465 +
466 msm_obj->sgt = drm_prime_pages_to_sg(p, npages);
467 if (IS_ERR(msm_obj->sgt)) {
468 + void *ptr = ERR_CAST(msm_obj->sgt);
469 +
470 dev_err(dev->dev, "failed to allocate sgt\n");
471 - return ERR_CAST(msm_obj->sgt);
472 + msm_obj->sgt = NULL;
473 + return ptr;
474 }
475
476 - msm_obj->pages = p;
477 -
478 /* For non-cached buffers, ensure the new pages are clean
479 * because display controller, GPU, etc. are not coherent:
480 */
481 @@ -135,7 +138,10 @@ static void put_pages(struct drm_gem_object *obj)
482 if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED))
483 dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl,
484 msm_obj->sgt->nents, DMA_BIDIRECTIONAL);
485 - sg_free_table(msm_obj->sgt);
486 +
487 + if (msm_obj->sgt)
488 + sg_free_table(msm_obj->sgt);
489 +
490 kfree(msm_obj->sgt);
491
492 if (use_pages(obj))
493 diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
494 index 0a38a0e8c925..a0dfa14f4fab 100644
495 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
496 +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
497 @@ -452,6 +452,8 @@ static int td028ttec1_panel_remove(struct spi_device *spi)
498 }
499
500 static const struct of_device_id td028ttec1_of_match[] = {
501 + { .compatible = "omapdss,tpo,td028ttec1", },
502 + /* keep to not break older DTB */
503 { .compatible = "omapdss,toppoly,td028ttec1", },
504 {},
505 };
506 @@ -471,6 +473,7 @@ static struct spi_driver td028ttec1_spi_driver = {
507
508 module_spi_driver(td028ttec1_spi_driver);
509
510 +MODULE_ALIAS("spi:tpo,td028ttec1");
511 MODULE_ALIAS("spi:toppoly,td028ttec1");
512 MODULE_AUTHOR("H. Nikolaus Schaller <hns@goldelico.com>");
513 MODULE_DESCRIPTION("Toppoly TD028TTEC1 panel driver");
514 diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
515 index c60a85e82c6d..fd05f7e9f43f 100644
516 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
517 +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
518 @@ -298,7 +298,12 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait)
519 msecs_to_jiffies(100))) {
520 dev_err(dmm->dev, "timed out waiting for done\n");
521 ret = -ETIMEDOUT;
522 + goto cleanup;
523 }
524 +
525 + /* Check the engine status before continue */
526 + ret = wait_status(engine, DMM_PATSTATUS_READY |
527 + DMM_PATSTATUS_VALID | DMM_PATSTATUS_DONE);
528 }
529
530 cleanup:
531 diff --git a/drivers/gpu/drm/tilcdc/tilcdc_regs.h b/drivers/gpu/drm/tilcdc/tilcdc_regs.h
532 index 9d528c0a67a4..5048ebb86835 100644
533 --- a/drivers/gpu/drm/tilcdc/tilcdc_regs.h
534 +++ b/drivers/gpu/drm/tilcdc/tilcdc_regs.h
535 @@ -133,7 +133,7 @@ static inline void tilcdc_write64(struct drm_device *dev, u32 reg, u64 data)
536 struct tilcdc_drm_private *priv = dev->dev_private;
537 volatile void __iomem *addr = priv->mmio + reg;
538
539 -#ifdef iowrite64
540 +#if defined(iowrite64) && !defined(iowrite64_is_nonatomic)
541 iowrite64(data, addr);
542 #else
543 __iowmb();
544 diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c
545 index d7a3e453016d..735dca089389 100644
546 --- a/drivers/hwtracing/coresight/coresight-tpiu.c
547 +++ b/drivers/hwtracing/coresight/coresight-tpiu.c
548 @@ -46,8 +46,11 @@
549 #define TPIU_ITATBCTR0 0xef8
550
551 /** register definition **/
552 +/* FFSR - 0x300 */
553 +#define FFSR_FT_STOPPED BIT(1)
554 /* FFCR - 0x304 */
555 #define FFCR_FON_MAN BIT(6)
556 +#define FFCR_STOP_FI BIT(12)
557
558 /**
559 * @base: memory mapped base address for this component.
560 @@ -85,10 +88,14 @@ static void tpiu_disable_hw(struct tpiu_drvdata *drvdata)
561 {
562 CS_UNLOCK(drvdata->base);
563
564 - /* Clear formatter controle reg. */
565 - writel_relaxed(0x0, drvdata->base + TPIU_FFCR);
566 + /* Clear formatter and stop on flush */
567 + writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR);
568 /* Generate manual flush */
569 - writel_relaxed(FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
570 + writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR);
571 + /* Wait for flush to complete */
572 + coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN, 0);
573 + /* Wait for formatter to stop */
574 + coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED, 1);
575
576 CS_LOCK(drvdata->base);
577 }
578 diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
579 index e457dface2d2..6cae00ecc905 100644
580 --- a/drivers/infiniband/core/cma.c
581 +++ b/drivers/infiniband/core/cma.c
582 @@ -3017,7 +3017,8 @@ static int cma_port_is_unique(struct rdma_bind_list *bind_list,
583 continue;
584
585 /* different dest port -> unique */
586 - if (!cma_any_port(cur_daddr) &&
587 + if (!cma_any_port(daddr) &&
588 + !cma_any_port(cur_daddr) &&
589 (dport != cur_dport))
590 continue;
591
592 @@ -3028,7 +3029,8 @@ static int cma_port_is_unique(struct rdma_bind_list *bind_list,
593 continue;
594
595 /* different dst address -> unique */
596 - if (!cma_any_addr(cur_daddr) &&
597 + if (!cma_any_addr(daddr) &&
598 + !cma_any_addr(cur_daddr) &&
599 cma_addr_cmp(daddr, cur_daddr))
600 continue;
601
602 @@ -3326,13 +3328,13 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
603 }
604 #endif
605 }
606 + daddr = cma_dst_addr(id_priv);
607 + daddr->sa_family = addr->sa_family;
608 +
609 ret = cma_get_port(id_priv);
610 if (ret)
611 goto err2;
612
613 - daddr = cma_dst_addr(id_priv);
614 - daddr->sa_family = addr->sa_family;
615 -
616 return 0;
617 err2:
618 if (id_priv->cma_dev)
619 @@ -4118,6 +4120,9 @@ int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,
620 struct cma_multicast *mc;
621 int ret;
622
623 + if (!id->device)
624 + return -EINVAL;
625 +
626 id_priv = container_of(id, struct rdma_id_private, id);
627 if (!cma_comp(id_priv, RDMA_CM_ADDR_BOUND) &&
628 !cma_comp(id_priv, RDMA_CM_ADDR_RESOLVED))
629 @@ -4436,7 +4441,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)
630 RDMA_NL_RDMA_CM_ATTR_SRC_ADDR))
631 goto out;
632 if (ibnl_put_attr(skb, nlh,
633 - rdma_addr_size(cma_src_addr(id_priv)),
634 + rdma_addr_size(cma_dst_addr(id_priv)),
635 cma_dst_addr(id_priv),
636 RDMA_NL_RDMA_CM_ATTR_DST_ADDR))
637 goto out;
638 diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
639 index 3c4faadb8cdd..81528f64061a 100644
640 --- a/drivers/infiniband/core/iwpm_util.c
641 +++ b/drivers/infiniband/core/iwpm_util.c
642 @@ -654,6 +654,7 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid)
643 }
644 skb_num++;
645 spin_lock_irqsave(&iwpm_mapinfo_lock, flags);
646 + ret = -EINVAL;
647 for (i = 0; i < IWPM_MAPINFO_HASH_SIZE; i++) {
648 hlist_for_each_entry(map_info, &iwpm_hash_bucket[i],
649 hlist_node) {
650 diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
651 index c8b3a45e9edc..77ca9da570a2 100644
652 --- a/drivers/infiniband/core/ucma.c
653 +++ b/drivers/infiniband/core/ucma.c
654 @@ -1348,7 +1348,7 @@ static ssize_t ucma_process_join(struct ucma_file *file,
655 return -ENOSPC;
656
657 addr = (struct sockaddr *) &cmd->addr;
658 - if (!cmd->addr_size || (cmd->addr_size != rdma_addr_size(addr)))
659 + if (cmd->addr_size != rdma_addr_size(addr))
660 return -EINVAL;
661
662 if (cmd->join_flags == RDMA_MC_JOIN_FLAG_FULLMEMBER)
663 @@ -1416,6 +1416,9 @@ static ssize_t ucma_join_ip_multicast(struct ucma_file *file,
664 join_cmd.uid = cmd.uid;
665 join_cmd.id = cmd.id;
666 join_cmd.addr_size = rdma_addr_size((struct sockaddr *) &cmd.addr);
667 + if (!join_cmd.addr_size)
668 + return -EINVAL;
669 +
670 join_cmd.join_flags = RDMA_MC_JOIN_FLAG_FULLMEMBER;
671 memcpy(&join_cmd.addr, &cmd.addr, join_cmd.addr_size);
672
673 @@ -1431,6 +1434,9 @@ static ssize_t ucma_join_multicast(struct ucma_file *file,
674 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
675 return -EFAULT;
676
677 + if (!rdma_addr_size((struct sockaddr *)&cmd.addr))
678 + return -EINVAL;
679 +
680 return ucma_process_join(file, &cmd, out_len);
681 }
682
683 diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
684 index 130606c3b07c..9a4e899d94b3 100644
685 --- a/drivers/infiniband/core/umem.c
686 +++ b/drivers/infiniband/core/umem.c
687 @@ -352,7 +352,7 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset,
688 return -EINVAL;
689 }
690
691 - ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->nmap, dst, length,
692 + ret = sg_pcopy_to_buffer(umem->sg_head.sgl, umem->npages, dst, length,
693 offset + ib_umem_offset(umem));
694
695 if (ret < 0)
696 diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
697 index 756ece6118c0..c4d8cc1c2b1d 100644
698 --- a/drivers/infiniband/hw/mlx5/qp.c
699 +++ b/drivers/infiniband/hw/mlx5/qp.c
700 @@ -1130,7 +1130,7 @@ static void destroy_raw_packet_qp_sq(struct mlx5_ib_dev *dev,
701 ib_umem_release(sq->ubuffer.umem);
702 }
703
704 -static int get_rq_pas_size(void *qpc)
705 +static size_t get_rq_pas_size(void *qpc)
706 {
707 u32 log_page_size = MLX5_GET(qpc, qpc, log_page_size) + 12;
708 u32 log_rq_stride = MLX5_GET(qpc, qpc, log_rq_stride);
709 @@ -1146,7 +1146,8 @@ static int get_rq_pas_size(void *qpc)
710 }
711
712 static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev,
713 - struct mlx5_ib_rq *rq, void *qpin)
714 + struct mlx5_ib_rq *rq, void *qpin,
715 + size_t qpinlen)
716 {
717 struct mlx5_ib_qp *mqp = rq->base.container_mibqp;
718 __be64 *pas;
719 @@ -1155,9 +1156,12 @@ static int create_raw_packet_qp_rq(struct mlx5_ib_dev *dev,
720 void *rqc;
721 void *wq;
722 void *qpc = MLX5_ADDR_OF(create_qp_in, qpin, qpc);
723 - int inlen;
724 + size_t rq_pas_size = get_rq_pas_size(qpc);
725 + size_t inlen;
726 int err;
727 - u32 rq_pas_size = get_rq_pas_size(qpc);
728 +
729 + if (qpinlen < rq_pas_size + MLX5_BYTE_OFF(create_qp_in, pas))
730 + return -EINVAL;
731
732 inlen = MLX5_ST_SZ_BYTES(create_rq_in) + rq_pas_size;
733 in = kvzalloc(inlen, GFP_KERNEL);
734 @@ -1236,7 +1240,7 @@ static void destroy_raw_packet_qp_tir(struct mlx5_ib_dev *dev,
735 }
736
737 static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
738 - u32 *in,
739 + u32 *in, size_t inlen,
740 struct ib_pd *pd)
741 {
742 struct mlx5_ib_raw_packet_qp *raw_packet_qp = &qp->raw_packet_qp;
743 @@ -1266,7 +1270,7 @@ static int create_raw_packet_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
744
745 if (qp->flags & MLX5_IB_QP_CVLAN_STRIPPING)
746 rq->flags |= MLX5_IB_RQ_CVLAN_STRIPPING;
747 - err = create_raw_packet_qp_rq(dev, rq, in);
748 + err = create_raw_packet_qp_rq(dev, rq, in, inlen);
749 if (err)
750 goto err_destroy_sq;
751
752 @@ -1781,11 +1785,16 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
753 qp->flags |= MLX5_IB_QP_LSO;
754 }
755
756 + if (inlen < 0) {
757 + err = -EINVAL;
758 + goto err;
759 + }
760 +
761 if (init_attr->qp_type == IB_QPT_RAW_PACKET ||
762 qp->flags & MLX5_IB_QP_UNDERLAY) {
763 qp->raw_packet_qp.sq.ubuffer.buf_addr = ucmd.sq_buf_addr;
764 raw_packet_qp_copy_info(qp, &qp->raw_packet_qp);
765 - err = create_raw_packet_qp(dev, qp, in, pd);
766 + err = create_raw_packet_qp(dev, qp, in, inlen, pd);
767 } else {
768 err = mlx5_core_create_qp(dev->mdev, &base->mqp, in, inlen);
769 }
770 @@ -1825,6 +1834,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,
771 else if (qp->create_type == MLX5_QP_KERNEL)
772 destroy_qp_kernel(dev, qp);
773
774 +err:
775 kvfree(in);
776 return err;
777 }
778 diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
779 index 6d5fadad9090..3c7522d025f2 100644
780 --- a/drivers/infiniband/hw/mlx5/srq.c
781 +++ b/drivers/infiniband/hw/mlx5/srq.c
782 @@ -241,8 +241,8 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
783 {
784 struct mlx5_ib_dev *dev = to_mdev(pd->device);
785 struct mlx5_ib_srq *srq;
786 - int desc_size;
787 - int buf_size;
788 + size_t desc_size;
789 + size_t buf_size;
790 int err;
791 struct mlx5_srq_attr in = {0};
792 __u32 max_srq_wqes = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz);
793 @@ -266,15 +266,18 @@ struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,
794
795 desc_size = sizeof(struct mlx5_wqe_srq_next_seg) +
796 srq->msrq.max_gs * sizeof(struct mlx5_wqe_data_seg);
797 + if (desc_size == 0 || srq->msrq.max_gs > desc_size)
798 + return ERR_PTR(-EINVAL);
799 desc_size = roundup_pow_of_two(desc_size);
800 - desc_size = max_t(int, 32, desc_size);
801 + desc_size = max_t(size_t, 32, desc_size);
802 + if (desc_size < sizeof(struct mlx5_wqe_srq_next_seg))
803 + return ERR_PTR(-EINVAL);
804 srq->msrq.max_avail_gather = (desc_size - sizeof(struct mlx5_wqe_srq_next_seg)) /
805 sizeof(struct mlx5_wqe_data_seg);
806 srq->msrq.wqe_shift = ilog2(desc_size);
807 buf_size = srq->msrq.max * desc_size;
808 - mlx5_ib_dbg(dev, "desc_size 0x%x, req wr 0x%x, srq size 0x%x, max_gs 0x%x, max_avail_gather 0x%x\n",
809 - desc_size, init_attr->attr.max_wr, srq->msrq.max, srq->msrq.max_gs,
810 - srq->msrq.max_avail_gather);
811 + if (buf_size < desc_size)
812 + return ERR_PTR(-EINVAL);
813 in.type = init_attr->srq_type;
814
815 if (pd->uobject)
816 diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
817 index 66056f9a9700..48a49f8a5014 100644
818 --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
819 +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
820 @@ -834,7 +834,7 @@ void ocrdma_add_port_stats(struct ocrdma_dev *dev)
821
822 dev->reset_stats.type = OCRDMA_RESET_STATS;
823 dev->reset_stats.dev = dev;
824 - if (!debugfs_create_file("reset_stats", S_IRUSR, dev->dir,
825 + if (!debugfs_create_file("reset_stats", 0200, dev->dir,
826 &dev->reset_stats, &ocrdma_dbg_ops))
827 goto err;
828
829 diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
830 index 3562c0c30492..6286b95d77ed 100644
831 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
832 +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
833 @@ -114,6 +114,7 @@ struct ib_cq *pvrdma_create_cq(struct ib_device *ibdev,
834 union pvrdma_cmd_resp rsp;
835 struct pvrdma_cmd_create_cq *cmd = &req.create_cq;
836 struct pvrdma_cmd_create_cq_resp *resp = &rsp.create_cq_resp;
837 + struct pvrdma_create_cq_resp cq_resp = {0};
838 struct pvrdma_create_cq ucmd;
839
840 BUILD_BUG_ON(sizeof(struct pvrdma_cqe) != 64);
841 @@ -198,6 +199,7 @@ struct ib_cq *pvrdma_create_cq(struct ib_device *ibdev,
842
843 cq->ibcq.cqe = resp->cqe;
844 cq->cq_handle = resp->cq_handle;
845 + cq_resp.cqn = resp->cq_handle;
846 spin_lock_irqsave(&dev->cq_tbl_lock, flags);
847 dev->cq_tbl[cq->cq_handle % dev->dsr->caps.max_cq] = cq;
848 spin_unlock_irqrestore(&dev->cq_tbl_lock, flags);
849 @@ -206,7 +208,7 @@ struct ib_cq *pvrdma_create_cq(struct ib_device *ibdev,
850 cq->uar = &(to_vucontext(context)->uar);
851
852 /* Copy udata back. */
853 - if (ib_copy_to_udata(udata, &cq->cq_handle, sizeof(__u32))) {
854 + if (ib_copy_to_udata(udata, &cq_resp, sizeof(cq_resp))) {
855 dev_warn(&dev->pdev->dev,
856 "failed to copy back udata\n");
857 pvrdma_destroy_cq(&cq->ibcq);
858 diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
859 index 48776f5ffb0e..aa533f08e017 100644
860 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
861 +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
862 @@ -444,6 +444,7 @@ struct ib_pd *pvrdma_alloc_pd(struct ib_device *ibdev,
863 union pvrdma_cmd_resp rsp;
864 struct pvrdma_cmd_create_pd *cmd = &req.create_pd;
865 struct pvrdma_cmd_create_pd_resp *resp = &rsp.create_pd_resp;
866 + struct pvrdma_alloc_pd_resp pd_resp = {0};
867 int ret;
868 void *ptr;
869
870 @@ -472,9 +473,10 @@ struct ib_pd *pvrdma_alloc_pd(struct ib_device *ibdev,
871 pd->privileged = !context;
872 pd->pd_handle = resp->pd_handle;
873 pd->pdn = resp->pd_handle;
874 + pd_resp.pdn = resp->pd_handle;
875
876 if (context) {
877 - if (ib_copy_to_udata(udata, &pd->pdn, sizeof(__u32))) {
878 + if (ib_copy_to_udata(udata, &pd_resp, sizeof(pd_resp))) {
879 dev_warn(&dev->pdev->dev,
880 "failed to copy back protection domain\n");
881 pvrdma_dealloc_pd(&pd->ibpd);
882 diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
883 index f6935811ef3f..a009e943362a 100644
884 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
885 +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
886 @@ -776,6 +776,22 @@ static void path_rec_completion(int status,
887 spin_lock_irqsave(&priv->lock, flags);
888
889 if (!IS_ERR_OR_NULL(ah)) {
890 + /*
891 + * pathrec.dgid is used as the database key from the LLADDR,
892 + * it must remain unchanged even if the SA returns a different
893 + * GID to use in the AH.
894 + */
895 + if (memcmp(pathrec->dgid.raw, path->pathrec.dgid.raw,
896 + sizeof(union ib_gid))) {
897 + ipoib_dbg(
898 + priv,
899 + "%s got PathRec for gid %pI6 while asked for %pI6\n",
900 + dev->name, pathrec->dgid.raw,
901 + path->pathrec.dgid.raw);
902 + memcpy(pathrec->dgid.raw, path->pathrec.dgid.raw,
903 + sizeof(union ib_gid));
904 + }
905 +
906 path->pathrec = *pathrec;
907
908 old_ah = path->ah;
909 diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
910 index 9d4785ba24cb..e770c17cbca9 100644
911 --- a/drivers/infiniband/ulp/isert/ib_isert.c
912 +++ b/drivers/infiniband/ulp/isert/ib_isert.c
913 @@ -2124,6 +2124,9 @@ isert_rdma_rw_ctx_post(struct isert_cmd *cmd, struct isert_conn *conn,
914 u32 rkey, offset;
915 int ret;
916
917 + if (cmd->ctx_init_done)
918 + goto rdma_ctx_post;
919 +
920 if (dir == DMA_FROM_DEVICE) {
921 addr = cmd->write_va;
922 rkey = cmd->write_stag;
923 @@ -2151,11 +2154,15 @@ isert_rdma_rw_ctx_post(struct isert_cmd *cmd, struct isert_conn *conn,
924 se_cmd->t_data_sg, se_cmd->t_data_nents,
925 offset, addr, rkey, dir);
926 }
927 +
928 if (ret < 0) {
929 isert_err("Cmd: %p failed to prepare RDMA res\n", cmd);
930 return ret;
931 }
932
933 + cmd->ctx_init_done = true;
934 +
935 +rdma_ctx_post:
936 ret = rdma_rw_ctx_post(&cmd->rw, conn->qp, port_num, cqe, chain_wr);
937 if (ret < 0)
938 isert_err("Cmd: %p failed to post RDMA res\n", cmd);
939 diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
940 index d6fd248320ae..3b296bac4f60 100644
941 --- a/drivers/infiniband/ulp/isert/ib_isert.h
942 +++ b/drivers/infiniband/ulp/isert/ib_isert.h
943 @@ -126,6 +126,7 @@ struct isert_cmd {
944 struct rdma_rw_ctx rw;
945 struct work_struct comp_work;
946 struct scatterlist sg;
947 + bool ctx_init_done;
948 };
949
950 static inline struct isert_cmd *tx_desc_to_cmd(struct iser_tx_desc *desc)
951 diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
952 index f6697e55c2d4..003b4a4d4b78 100644
953 --- a/drivers/iommu/intel-svm.c
954 +++ b/drivers/iommu/intel-svm.c
955 @@ -129,6 +129,7 @@ int intel_svm_enable_prq(struct intel_iommu *iommu)
956 pr_err("IOMMU: %s: Failed to request IRQ for page request queue\n",
957 iommu->name);
958 dmar_free_hwirq(irq);
959 + iommu->pr_irq = 0;
960 goto err;
961 }
962 dmar_writeq(iommu->reg + DMAR_PQH_REG, 0ULL);
963 @@ -144,9 +145,11 @@ int intel_svm_finish_prq(struct intel_iommu *iommu)
964 dmar_writeq(iommu->reg + DMAR_PQT_REG, 0ULL);
965 dmar_writeq(iommu->reg + DMAR_PQA_REG, 0ULL);
966
967 - free_irq(iommu->pr_irq, iommu);
968 - dmar_free_hwirq(iommu->pr_irq);
969 - iommu->pr_irq = 0;
970 + if (iommu->pr_irq) {
971 + free_irq(iommu->pr_irq, iommu);
972 + dmar_free_hwirq(iommu->pr_irq);
973 + iommu->pr_irq = 0;
974 + }
975
976 free_pages((unsigned long)iommu->prq, PRQ_ORDER);
977 iommu->prq = NULL;
978 diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
979 index 172fc367ccaa..24840a2e5a75 100644
980 --- a/drivers/media/dvb-frontends/si2168.c
981 +++ b/drivers/media/dvb-frontends/si2168.c
982 @@ -14,6 +14,8 @@
983 * GNU General Public License for more details.
984 */
985
986 +#include <linux/delay.h>
987 +
988 #include "si2168_priv.h"
989
990 static const struct dvb_frontend_ops si2168_ops;
991 @@ -435,6 +437,7 @@ static int si2168_init(struct dvb_frontend *fe)
992 if (ret)
993 goto err;
994
995 + udelay(100);
996 memcpy(cmd.args, "\x85", 1);
997 cmd.wlen = 1;
998 cmd.rlen = 1;
999 diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
1000 index a5f52137d306..d4bc78b4fcb5 100644
1001 --- a/drivers/media/pci/bt8xx/bt878.c
1002 +++ b/drivers/media/pci/bt8xx/bt878.c
1003 @@ -422,8 +422,7 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
1004 bt878_num);
1005 if (bt878_num >= BT878_MAX) {
1006 printk(KERN_ERR "bt878: Too many devices inserted\n");
1007 - result = -ENOMEM;
1008 - goto fail0;
1009 + return -ENOMEM;
1010 }
1011 if (pci_enable_device(dev))
1012 return -EIO;
1013 diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
1014 index 233622bef4a5..dc8fc2120b63 100644
1015 --- a/drivers/media/platform/davinci/vpif_capture.c
1016 +++ b/drivers/media/platform/davinci/vpif_capture.c
1017 @@ -1397,9 +1397,9 @@ static int vpif_async_bound(struct v4l2_async_notifier *notifier,
1018 vpif_obj.config->chan_config->inputs[i].subdev_name =
1019 (char *)to_of_node(subdev->fwnode)->full_name;
1020 vpif_dbg(2, debug,
1021 - "%s: setting input %d subdev_name = %pOF\n",
1022 + "%s: setting input %d subdev_name = %s\n",
1023 __func__, i,
1024 - to_of_node(subdev->fwnode));
1025 + vpif_obj.config->chan_config->inputs[i].subdev_name);
1026 return 0;
1027 }
1028 }
1029 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
1030 index 1afde5021ca6..8e9531f7f83f 100644
1031 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
1032 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
1033 @@ -1315,6 +1315,12 @@ static int s5p_mfc_probe(struct platform_device *pdev)
1034 goto err_dma;
1035 }
1036
1037 + /*
1038 + * Load fails if fs isn't mounted. Try loading anyway.
1039 + * _open() will load it, it it fails now. Ignore failure.
1040 + */
1041 + s5p_mfc_load_firmware(dev);
1042 +
1043 mutex_init(&dev->mfc_mutex);
1044 init_waitqueue_head(&dev->queue);
1045 dev->hw_lock = 0;
1046 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
1047 index 4220914529b2..76119a8cc477 100644
1048 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
1049 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
1050 @@ -290,6 +290,8 @@ struct s5p_mfc_priv_buf {
1051 * @mfc_cmds: cmd structure holding HW commands function pointers
1052 * @mfc_regs: structure holding MFC registers
1053 * @fw_ver: loaded firmware sub-version
1054 + * @fw_get_done flag set when request_firmware() is complete and
1055 + * copied into fw_buf
1056 * risc_on: flag indicates RISC is on or off
1057 *
1058 */
1059 @@ -336,6 +338,7 @@ struct s5p_mfc_dev {
1060 struct s5p_mfc_hw_cmds *mfc_cmds;
1061 const struct s5p_mfc_regs *mfc_regs;
1062 enum s5p_mfc_fw_ver fw_ver;
1063 + bool fw_get_done;
1064 bool risc_on; /* indicates if RISC is on or off */
1065 };
1066
1067 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
1068 index 69ef9c23a99a..d94e59e79fe9 100644
1069 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
1070 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
1071 @@ -55,6 +55,9 @@ int s5p_mfc_load_firmware(struct s5p_mfc_dev *dev)
1072 * into kernel. */
1073 mfc_debug_enter();
1074
1075 + if (dev->fw_get_done)
1076 + return 0;
1077 +
1078 for (i = MFC_FW_MAX_VERSIONS - 1; i >= 0; i--) {
1079 if (!dev->variant->fw_name[i])
1080 continue;
1081 @@ -82,6 +85,7 @@ int s5p_mfc_load_firmware(struct s5p_mfc_dev *dev)
1082 }
1083 memcpy(dev->fw_buf.virt, fw_blob->data, fw_blob->size);
1084 wmb();
1085 + dev->fw_get_done = true;
1086 release_firmware(fw_blob);
1087 mfc_debug_leave();
1088 return 0;
1089 @@ -93,6 +97,7 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev)
1090 /* Before calling this function one has to make sure
1091 * that MFC is no longer processing */
1092 s5p_mfc_release_priv_buf(dev, &dev->fw_buf);
1093 + dev->fw_get_done = false;
1094 return 0;
1095 }
1096
1097 diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
1098 index 59280ac31937..23d0cedf4d9d 100644
1099 --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
1100 +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c
1101 @@ -83,7 +83,7 @@ static void c8sectpfe_timer_interrupt(unsigned long ac8sectpfei)
1102 static void channel_swdemux_tsklet(unsigned long data)
1103 {
1104 struct channel_info *channel = (struct channel_info *)data;
1105 - struct c8sectpfei *fei = channel->fei;
1106 + struct c8sectpfei *fei;
1107 unsigned long wp, rp;
1108 int pos, num_packets, n, size;
1109 u8 *buf;
1110 @@ -91,6 +91,8 @@ static void channel_swdemux_tsklet(unsigned long data)
1111 if (unlikely(!channel || !channel->irec))
1112 return;
1113
1114 + fei = channel->fei;
1115 +
1116 wp = readl(channel->irec + DMA_PRDS_BUSWP_TP(0));
1117 rp = readl(channel->irec + DMA_PRDS_BUSRP_TP(0));
1118
1119 diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
1120 index ccb516f18d72..9c6f2ce3b710 100644
1121 --- a/drivers/mmc/core/block.c
1122 +++ b/drivers/mmc/core/block.c
1123 @@ -2387,6 +2387,7 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp)
1124
1125 if (n != EXT_CSD_STR_LEN) {
1126 err = -EINVAL;
1127 + kfree(ext_csd);
1128 goto out_free;
1129 }
1130
1131 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
1132 index 66c9cf49ad2f..29bfff2ed4d3 100644
1133 --- a/drivers/mmc/core/core.c
1134 +++ b/drivers/mmc/core/core.c
1135 @@ -2751,6 +2751,14 @@ static int mmc_pm_notify(struct notifier_block *notify_block,
1136 if (!err)
1137 break;
1138
1139 + if (!mmc_card_is_removable(host)) {
1140 + dev_warn(mmc_dev(host),
1141 + "pre_suspend failed for non-removable host: "
1142 + "%d\n", err);
1143 + /* Avoid removing non-removable hosts */
1144 + break;
1145 + }
1146 +
1147 /* Calling bus_ops->remove() with a claimed host can deadlock */
1148 host->bus_ops->remove(host);
1149 mmc_claim_host(host);
1150 diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
1151 index 0842bbc2d7ad..4d0791f6ec23 100644
1152 --- a/drivers/mmc/host/sdhci-xenon.c
1153 +++ b/drivers/mmc/host/sdhci-xenon.c
1154 @@ -230,7 +230,14 @@ static void xenon_set_power(struct sdhci_host *host, unsigned char mode,
1155 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
1156 }
1157
1158 +static void xenon_voltage_switch(struct sdhci_host *host)
1159 +{
1160 + /* Wait for 5ms after set 1.8V signal enable bit */
1161 + usleep_range(5000, 5500);
1162 +}
1163 +
1164 static const struct sdhci_ops sdhci_xenon_ops = {
1165 + .voltage_switch = xenon_voltage_switch,
1166 .set_clock = sdhci_set_clock,
1167 .set_power = xenon_set_power,
1168 .set_bus_width = sdhci_set_bus_width,
1169 diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
1170 index 5176be76ca7d..4f3afcf92a7c 100644
1171 --- a/drivers/net/hyperv/hyperv_net.h
1172 +++ b/drivers/net/hyperv/hyperv_net.h
1173 @@ -635,14 +635,27 @@ struct nvsp_message {
1174 #define NETVSC_MTU 65535
1175 #define NETVSC_MTU_MIN ETH_MIN_MTU
1176
1177 -#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */
1178 -#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */
1179 -#define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */
1180 +/* Max buffer sizes allowed by a host */
1181 +#define NETVSC_RECEIVE_BUFFER_SIZE (1024 * 1024 * 31) /* 31MB */
1182 +#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024 * 1024 * 15) /* 15MB */
1183 +#define NETVSC_RECEIVE_BUFFER_DEFAULT (1024 * 1024 * 16)
1184 +
1185 +#define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */
1186 +#define NETVSC_SEND_BUFFER_DEFAULT (1024 * 1024)
1187 +
1188 #define NETVSC_INVALID_INDEX -1
1189
1190 #define NETVSC_SEND_SECTION_SIZE 6144
1191 #define NETVSC_RECV_SECTION_SIZE 1728
1192
1193 +/* Default size of TX buf: 1MB, RX buf: 16MB */
1194 +#define NETVSC_MIN_TX_SECTIONS 10
1195 +#define NETVSC_DEFAULT_TX (NETVSC_SEND_BUFFER_DEFAULT \
1196 + / NETVSC_SEND_SECTION_SIZE)
1197 +#define NETVSC_MIN_RX_SECTIONS 10
1198 +#define NETVSC_DEFAULT_RX (NETVSC_RECEIVE_BUFFER_DEFAULT \
1199 + / NETVSC_RECV_SECTION_SIZE)
1200 +
1201 #define NETVSC_RECEIVE_BUFFER_ID 0xcafe
1202 #define NETVSC_SEND_BUFFER_ID 0
1203
1204 diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
1205 index 8d5077fb0492..a6bafcf55776 100644
1206 --- a/drivers/net/hyperv/netvsc.c
1207 +++ b/drivers/net/hyperv/netvsc.c
1208 @@ -262,6 +262,11 @@ static int netvsc_init_buf(struct hv_device *device,
1209 buf_size = device_info->recv_sections * device_info->recv_section_size;
1210 buf_size = roundup(buf_size, PAGE_SIZE);
1211
1212 + /* Legacy hosts only allow smaller receive buffer */
1213 + if (net_device->nvsp_version <= NVSP_PROTOCOL_VERSION_2)
1214 + buf_size = min_t(unsigned int, buf_size,
1215 + NETVSC_RECEIVE_BUFFER_SIZE_LEGACY);
1216 +
1217 net_device->recv_buf = vzalloc(buf_size);
1218 if (!net_device->recv_buf) {
1219 netdev_err(ndev,
1220 diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
1221 index a32ae02e1b6c..c849de3cb046 100644
1222 --- a/drivers/net/hyperv/netvsc_drv.c
1223 +++ b/drivers/net/hyperv/netvsc_drv.c
1224 @@ -46,10 +46,6 @@
1225 #include "hyperv_net.h"
1226
1227 #define RING_SIZE_MIN 64
1228 -#define NETVSC_MIN_TX_SECTIONS 10
1229 -#define NETVSC_DEFAULT_TX 192 /* ~1M */
1230 -#define NETVSC_MIN_RX_SECTIONS 10 /* ~64K */
1231 -#define NETVSC_DEFAULT_RX 10485 /* Max ~16M */
1232
1233 #define LINKCHANGE_INT (2 * HZ)
1234 #define VF_TAKEOVER_INT (HZ / 10)
1235 diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
1236 index 1ea69b7585d9..7ddb709f69fc 100644
1237 --- a/drivers/net/phy/meson-gxl.c
1238 +++ b/drivers/net/phy/meson-gxl.c
1239 @@ -25,27 +25,53 @@
1240
1241 static int meson_gxl_config_init(struct phy_device *phydev)
1242 {
1243 + int ret;
1244 +
1245 /* Enable Analog and DSP register Bank access by */
1246 - phy_write(phydev, 0x14, 0x0000);
1247 - phy_write(phydev, 0x14, 0x0400);
1248 - phy_write(phydev, 0x14, 0x0000);
1249 - phy_write(phydev, 0x14, 0x0400);
1250 + ret = phy_write(phydev, 0x14, 0x0000);
1251 + if (ret)
1252 + return ret;
1253 + ret = phy_write(phydev, 0x14, 0x0400);
1254 + if (ret)
1255 + return ret;
1256 + ret = phy_write(phydev, 0x14, 0x0000);
1257 + if (ret)
1258 + return ret;
1259 + ret = phy_write(phydev, 0x14, 0x0400);
1260 + if (ret)
1261 + return ret;
1262
1263 /* Write Analog register 23 */
1264 - phy_write(phydev, 0x17, 0x8E0D);
1265 - phy_write(phydev, 0x14, 0x4417);
1266 + ret = phy_write(phydev, 0x17, 0x8E0D);
1267 + if (ret)
1268 + return ret;
1269 + ret = phy_write(phydev, 0x14, 0x4417);
1270 + if (ret)
1271 + return ret;
1272
1273 /* Enable fractional PLL */
1274 - phy_write(phydev, 0x17, 0x0005);
1275 - phy_write(phydev, 0x14, 0x5C1B);
1276 + ret = phy_write(phydev, 0x17, 0x0005);
1277 + if (ret)
1278 + return ret;
1279 + ret = phy_write(phydev, 0x14, 0x5C1B);
1280 + if (ret)
1281 + return ret;
1282
1283 /* Program fraction FR_PLL_DIV1 */
1284 - phy_write(phydev, 0x17, 0x029A);
1285 - phy_write(phydev, 0x14, 0x5C1D);
1286 + ret = phy_write(phydev, 0x17, 0x029A);
1287 + if (ret)
1288 + return ret;
1289 + ret = phy_write(phydev, 0x14, 0x5C1D);
1290 + if (ret)
1291 + return ret;
1292
1293 /* Program fraction FR_PLL_DIV1 */
1294 - phy_write(phydev, 0x17, 0xAAAA);
1295 - phy_write(phydev, 0x14, 0x5C1C);
1296 + ret = phy_write(phydev, 0x17, 0xAAAA);
1297 + if (ret)
1298 + return ret;
1299 + ret = phy_write(phydev, 0x14, 0x5C1C);
1300 + if (ret)
1301 + return ret;
1302
1303 return 0;
1304 }
1305 diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
1306 index 8bf10aba7452..3165bc7b8e1e 100644
1307 --- a/drivers/net/phy/sfp.c
1308 +++ b/drivers/net/phy/sfp.c
1309 @@ -318,12 +318,12 @@ static void sfp_sm_probe_phy(struct sfp *sfp)
1310 msleep(T_PHY_RESET_MS);
1311
1312 phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR);
1313 - if (IS_ERR(phy)) {
1314 - dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
1315 + if (phy == ERR_PTR(-ENODEV)) {
1316 + dev_info(sfp->dev, "no PHY detected\n");
1317 return;
1318 }
1319 - if (!phy) {
1320 - dev_info(sfp->dev, "no PHY detected\n");
1321 + if (IS_ERR(phy)) {
1322 + dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
1323 return;
1324 }
1325
1326 @@ -667,20 +667,19 @@ static int sfp_module_eeprom(struct sfp *sfp, struct ethtool_eeprom *ee,
1327 len = min_t(unsigned int, last, ETH_MODULE_SFF_8079_LEN);
1328 len -= first;
1329
1330 - ret = sfp->read(sfp, false, first, data, len);
1331 + ret = sfp_read(sfp, false, first, data, len);
1332 if (ret < 0)
1333 return ret;
1334
1335 first += len;
1336 data += len;
1337 }
1338 - if (first >= ETH_MODULE_SFF_8079_LEN &&
1339 - first < ETH_MODULE_SFF_8472_LEN) {
1340 + if (first < ETH_MODULE_SFF_8472_LEN && last > ETH_MODULE_SFF_8079_LEN) {
1341 len = min_t(unsigned int, last, ETH_MODULE_SFF_8472_LEN);
1342 len -= first;
1343 first -= ETH_MODULE_SFF_8079_LEN;
1344
1345 - ret = sfp->read(sfp, true, first, data, len);
1346 + ret = sfp_read(sfp, true, first, data, len);
1347 if (ret < 0)
1348 return ret;
1349 }
1350 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1351 index b1632294174f..5d3d31f5933b 100644
1352 --- a/drivers/net/usb/qmi_wwan.c
1353 +++ b/drivers/net/usb/qmi_wwan.c
1354 @@ -826,7 +826,7 @@ static int qmi_wwan_resume(struct usb_interface *intf)
1355
1356 static const struct driver_info qmi_wwan_info = {
1357 .description = "WWAN/QMI device",
1358 - .flags = FLAG_WWAN,
1359 + .flags = FLAG_WWAN | FLAG_SEND_ZLP,
1360 .bind = qmi_wwan_bind,
1361 .unbind = qmi_wwan_unbind,
1362 .manage_power = qmi_wwan_manage_power,
1363 @@ -835,7 +835,7 @@ static const struct driver_info qmi_wwan_info = {
1364
1365 static const struct driver_info qmi_wwan_info_quirk_dtr = {
1366 .description = "WWAN/QMI device",
1367 - .flags = FLAG_WWAN,
1368 + .flags = FLAG_WWAN | FLAG_SEND_ZLP,
1369 .bind = qmi_wwan_bind,
1370 .unbind = qmi_wwan_unbind,
1371 .manage_power = qmi_wwan_manage_power,
1372 diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
1373 index 35b752353aee..252c2206cbb5 100644
1374 --- a/drivers/net/wireless/ath/ath10k/mac.c
1375 +++ b/drivers/net/wireless/ath/ath10k/mac.c
1376 @@ -2553,7 +2553,7 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar,
1377 }
1378 break;
1379 case WMI_VDEV_TYPE_STA:
1380 - if (vif->bss_conf.qos)
1381 + if (sta->wme)
1382 arg->peer_flags |= arvif->ar->wmi.peer_flags->qos;
1383 break;
1384 case WMI_VDEV_TYPE_IBSS:
1385 diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
1386 index ea18aa7afecb..93256f8bc0b5 100644
1387 --- a/drivers/net/wireless/realtek/rtlwifi/base.c
1388 +++ b/drivers/net/wireless/realtek/rtlwifi/base.c
1389 @@ -1664,7 +1664,7 @@ int rtl_tx_agg_oper(struct ieee80211_hw *hw,
1390 void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv)
1391 {
1392 struct rtl_btc_ops *btc_ops = rtlpriv->btcoexist.btc_ops;
1393 - u8 reject_agg, ctrl_agg_size = 0, agg_size;
1394 + u8 reject_agg = 0, ctrl_agg_size = 0, agg_size = 0;
1395
1396 if (rtlpriv->cfg->ops->get_btc_status())
1397 btc_ops->btc_get_ampdu_cfg(rtlpriv, &reject_agg,
1398 diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
1399 index 08dc8919ef60..d7331225c5f3 100644
1400 --- a/drivers/net/wireless/realtek/rtlwifi/pci.c
1401 +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
1402 @@ -1568,7 +1568,14 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw)
1403 dev_kfree_skb_irq(skb);
1404 ring->idx = (ring->idx + 1) % ring->entries;
1405 }
1406 +
1407 + if (rtlpriv->use_new_trx_flow) {
1408 + rtlpci->tx_ring[i].cur_tx_rp = 0;
1409 + rtlpci->tx_ring[i].cur_tx_wp = 0;
1410 + }
1411 +
1412 ring->idx = 0;
1413 + ring->entries = rtlpci->txringcount[i];
1414 }
1415 }
1416 spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
1417 diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c
1418 index d53d5f168363..7c621877a939 100644
1419 --- a/drivers/pci/dwc/pcie-designware-ep.c
1420 +++ b/drivers/pci/dwc/pcie-designware-ep.c
1421 @@ -197,20 +197,14 @@ static int dw_pcie_ep_map_addr(struct pci_epc *epc, phys_addr_t addr,
1422 static int dw_pcie_ep_get_msi(struct pci_epc *epc)
1423 {
1424 int val;
1425 - u32 lower_addr;
1426 - u32 upper_addr;
1427 struct dw_pcie_ep *ep = epc_get_drvdata(epc);
1428 struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
1429
1430 - val = dw_pcie_readb_dbi(pci, MSI_MESSAGE_CONTROL);
1431 - val = (val & MSI_CAP_MME_MASK) >> MSI_CAP_MME_SHIFT;
1432 -
1433 - lower_addr = dw_pcie_readl_dbi(pci, MSI_MESSAGE_ADDR_L32);
1434 - upper_addr = dw_pcie_readl_dbi(pci, MSI_MESSAGE_ADDR_U32);
1435 -
1436 - if (!(lower_addr || upper_addr))
1437 + val = dw_pcie_readw_dbi(pci, MSI_MESSAGE_CONTROL);
1438 + if (!(val & MSI_CAP_MSI_EN_MASK))
1439 return -EINVAL;
1440
1441 + val = (val & MSI_CAP_MME_MASK) >> MSI_CAP_MME_SHIFT;
1442 return val;
1443 }
1444
1445 diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-designware.h
1446 index e5d9d77b778e..cb493bcae8b4 100644
1447 --- a/drivers/pci/dwc/pcie-designware.h
1448 +++ b/drivers/pci/dwc/pcie-designware.h
1449 @@ -101,6 +101,7 @@
1450 #define MSI_MESSAGE_CONTROL 0x52
1451 #define MSI_CAP_MMC_SHIFT 1
1452 #define MSI_CAP_MME_SHIFT 4
1453 +#define MSI_CAP_MSI_EN_MASK 0x1
1454 #define MSI_CAP_MME_MASK (7 << MSI_CAP_MME_SHIFT)
1455 #define MSI_MESSAGE_ADDR_L32 0x54
1456 #define MSI_MESSAGE_ADDR_U32 0x58
1457 diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c
1458 index 424fdd6ed1ca..16cec66b1d0b 100644
1459 --- a/drivers/pci/endpoint/pci-ep-cfs.c
1460 +++ b/drivers/pci/endpoint/pci-ep-cfs.c
1461 @@ -109,7 +109,10 @@ static int pci_epc_epf_link(struct config_item *epc_item,
1462 goto err_add_epf;
1463
1464 func_no = find_first_zero_bit(&epc_group->function_num_map,
1465 - sizeof(epc_group->function_num_map));
1466 + BITS_PER_LONG);
1467 + if (func_no >= BITS_PER_LONG)
1468 + return -EINVAL;
1469 +
1470 set_bit(func_no, &epc_group->function_num_map);
1471 epf->func_no = func_no;
1472
1473 diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
1474 index f09ff4789bb5..8f44a7d14bff 100644
1475 --- a/drivers/pci/host/pcie-rcar.c
1476 +++ b/drivers/pci/host/pcie-rcar.c
1477 @@ -1141,7 +1141,9 @@ static int rcar_pcie_probe(struct platform_device *pdev)
1478
1479 INIT_LIST_HEAD(&pcie->resources);
1480
1481 - rcar_pcie_parse_request_of_pci_ranges(pcie);
1482 + err = rcar_pcie_parse_request_of_pci_ranges(pcie);
1483 + if (err)
1484 + goto err_free_bridge;
1485
1486 err = rcar_pcie_get_resources(pcie);
1487 if (err < 0) {
1488 @@ -1196,6 +1198,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
1489
1490 err_free_resource_list:
1491 pci_free_resource_list(&pcie->resources);
1492 +err_free_bridge:
1493 pci_free_host_bridge(bridge);
1494
1495 return err;
1496 diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
1497 index 56fbe4c3e800..c55517312485 100644
1498 --- a/drivers/pinctrl/core.c
1499 +++ b/drivers/pinctrl/core.c
1500 @@ -1189,19 +1189,16 @@ struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p,
1501 EXPORT_SYMBOL_GPL(pinctrl_lookup_state);
1502
1503 /**
1504 - * pinctrl_select_state() - select/activate/program a pinctrl state to HW
1505 + * pinctrl_commit_state() - select/activate/program a pinctrl state to HW
1506 * @p: the pinctrl handle for the device that requests configuration
1507 * @state: the state handle to select/activate/program
1508 */
1509 -int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
1510 +static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
1511 {
1512 struct pinctrl_setting *setting, *setting2;
1513 struct pinctrl_state *old_state = p->state;
1514 int ret;
1515
1516 - if (p->state == state)
1517 - return 0;
1518 -
1519 if (p->state) {
1520 /*
1521 * For each pinmux setting in the old state, forget SW's record
1522 @@ -1265,6 +1262,19 @@ int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
1523
1524 return ret;
1525 }
1526 +
1527 +/**
1528 + * pinctrl_select_state() - select/activate/program a pinctrl state to HW
1529 + * @p: the pinctrl handle for the device that requests configuration
1530 + * @state: the state handle to select/activate/program
1531 + */
1532 +int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
1533 +{
1534 + if (p->state == state)
1535 + return 0;
1536 +
1537 + return pinctrl_commit_state(p, state);
1538 +}
1539 EXPORT_SYMBOL_GPL(pinctrl_select_state);
1540
1541 static void devm_pinctrl_release(struct device *dev, void *res)
1542 @@ -1430,7 +1440,7 @@ void pinctrl_unregister_map(const struct pinctrl_map *map)
1543 int pinctrl_force_sleep(struct pinctrl_dev *pctldev)
1544 {
1545 if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_sleep))
1546 - return pinctrl_select_state(pctldev->p, pctldev->hog_sleep);
1547 + return pinctrl_commit_state(pctldev->p, pctldev->hog_sleep);
1548 return 0;
1549 }
1550 EXPORT_SYMBOL_GPL(pinctrl_force_sleep);
1551 @@ -1442,7 +1452,7 @@ EXPORT_SYMBOL_GPL(pinctrl_force_sleep);
1552 int pinctrl_force_default(struct pinctrl_dev *pctldev)
1553 {
1554 if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_default))
1555 - return pinctrl_select_state(pctldev->p, pctldev->hog_default);
1556 + return pinctrl_commit_state(pctldev->p, pctldev->hog_default);
1557 return 0;
1558 }
1559 EXPORT_SYMBOL_GPL(pinctrl_force_default);
1560 diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
1561 index b5cb7858ffdc..a9bc1e01f982 100644
1562 --- a/drivers/pinctrl/pinctrl-rockchip.c
1563 +++ b/drivers/pinctrl/pinctrl-rockchip.c
1564 @@ -1989,8 +1989,16 @@ static int rockchip_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
1565 {
1566 struct rockchip_pin_bank *bank = gpiochip_get_data(chip);
1567 u32 data;
1568 + int ret;
1569
1570 + ret = clk_enable(bank->clk);
1571 + if (ret < 0) {
1572 + dev_err(bank->drvdata->dev,
1573 + "failed to enable clock for bank %s\n", bank->name);
1574 + return ret;
1575 + }
1576 data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR);
1577 + clk_disable(bank->clk);
1578
1579 return !(data & BIT(offset));
1580 }
1581 diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
1582 index 8dfa7fcb1248..e7bbdf947bbc 100644
1583 --- a/drivers/platform/chrome/cros_ec_proto.c
1584 +++ b/drivers/platform/chrome/cros_ec_proto.c
1585 @@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev,
1586 struct cros_ec_command *msg)
1587 {
1588 int ret;
1589 + int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
1590
1591 if (ec_dev->proto_version > 2)
1592 - ret = ec_dev->pkt_xfer(ec_dev, msg);
1593 + xfer_fxn = ec_dev->pkt_xfer;
1594 else
1595 - ret = ec_dev->cmd_xfer(ec_dev, msg);
1596 + xfer_fxn = ec_dev->cmd_xfer;
1597
1598 + ret = (*xfer_fxn)(ec_dev, msg);
1599 if (msg->result == EC_RES_IN_PROGRESS) {
1600 int i;
1601 struct cros_ec_command *status_msg;
1602 @@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev,
1603 for (i = 0; i < EC_COMMAND_RETRIES; i++) {
1604 usleep_range(10000, 11000);
1605
1606 - ret = ec_dev->cmd_xfer(ec_dev, status_msg);
1607 + ret = (*xfer_fxn)(ec_dev, status_msg);
1608 if (ret < 0)
1609 break;
1610
1611 diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c
1612 index f3baf9973989..24f1630a8b3f 100644
1613 --- a/drivers/platform/chrome/cros_ec_sysfs.c
1614 +++ b/drivers/platform/chrome/cros_ec_sysfs.c
1615 @@ -187,7 +187,7 @@ static ssize_t show_ec_version(struct device *dev,
1616 count += scnprintf(buf + count, PAGE_SIZE - count,
1617 "Build info: EC error %d\n", msg->result);
1618 else {
1619 - msg->data[sizeof(msg->data) - 1] = '\0';
1620 + msg->data[EC_HOST_PARAM_SIZE - 1] = '\0';
1621 count += scnprintf(buf + count, PAGE_SIZE - count,
1622 "Build info: %s\n", msg->data);
1623 }
1624 diff --git a/drivers/rtc/rtc-ac100.c b/drivers/rtc/rtc-ac100.c
1625 index 9e336184491c..0e358d4b6738 100644
1626 --- a/drivers/rtc/rtc-ac100.c
1627 +++ b/drivers/rtc/rtc-ac100.c
1628 @@ -567,6 +567,12 @@ static int ac100_rtc_probe(struct platform_device *pdev)
1629 return chip->irq;
1630 }
1631
1632 + chip->rtc = devm_rtc_allocate_device(&pdev->dev);
1633 + if (IS_ERR(chip->rtc))
1634 + return PTR_ERR(chip->rtc);
1635 +
1636 + chip->rtc->ops = &ac100_rtc_ops;
1637 +
1638 ret = devm_request_threaded_irq(&pdev->dev, chip->irq, NULL,
1639 ac100_rtc_irq,
1640 IRQF_SHARED | IRQF_ONESHOT,
1641 @@ -586,17 +592,16 @@ static int ac100_rtc_probe(struct platform_device *pdev)
1642 /* clear counter alarm pending interrupts */
1643 regmap_write(chip->regmap, AC100_ALM_INT_STA, AC100_ALM_INT_ENABLE);
1644
1645 - chip->rtc = devm_rtc_device_register(&pdev->dev, "rtc-ac100",
1646 - &ac100_rtc_ops, THIS_MODULE);
1647 - if (IS_ERR(chip->rtc)) {
1648 - dev_err(&pdev->dev, "unable to register device\n");
1649 - return PTR_ERR(chip->rtc);
1650 - }
1651 -
1652 ret = ac100_rtc_register_clks(chip);
1653 if (ret)
1654 return ret;
1655
1656 + ret = rtc_register_device(chip->rtc);
1657 + if (ret) {
1658 + dev_err(&pdev->dev, "unable to register device\n");
1659 + return ret;
1660 + }
1661 +
1662 dev_info(&pdev->dev, "RTC enabled\n");
1663
1664 return 0;
1665 diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
1666 index 33417681f5d4..126723a5bc6f 100644
1667 --- a/drivers/scsi/lpfc/lpfc_ct.c
1668 +++ b/drivers/scsi/lpfc/lpfc_ct.c
1669 @@ -471,6 +471,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type)
1670 "Parse GID_FTrsp: did:x%x flg:x%x x%x",
1671 Did, ndlp->nlp_flag, vport->fc_flag);
1672
1673 + ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
1674 /* By default, the driver expects to support FCP FC4 */
1675 if (fc4_type == FC_TYPE_FCP)
1676 ndlp->nlp_fc4_type |= NLP_FC4_FCP;
1677 diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
1678 index 3ebf6ccba6e6..91783dbdf10c 100644
1679 --- a/drivers/scsi/lpfc/lpfc_els.c
1680 +++ b/drivers/scsi/lpfc/lpfc_els.c
1681 @@ -2088,6 +2088,10 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1682 ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
1683 spin_lock_irq(shost->host_lock);
1684 ndlp->nlp_flag &= ~NLP_PRLI_SND;
1685 +
1686 + /* Driver supports multiple FC4 types. Counters matter. */
1687 + vport->fc_prli_sent--;
1688 + ndlp->fc4_prli_sent--;
1689 spin_unlock_irq(shost->host_lock);
1690
1691 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
1692 @@ -2095,9 +2099,6 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1693 irsp->ulpStatus, irsp->un.ulpWord[4],
1694 ndlp->nlp_DID);
1695
1696 - /* Ddriver supports multiple FC4 types. Counters matter. */
1697 - vport->fc_prli_sent--;
1698 -
1699 /* PRLI completes to NPort <nlp_DID> */
1700 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1701 "0103 PRLI completes to NPort x%06x "
1702 @@ -2111,7 +2112,6 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1703
1704 if (irsp->ulpStatus) {
1705 /* Check for retry */
1706 - ndlp->fc4_prli_sent--;
1707 if (lpfc_els_retry(phba, cmdiocb, rspiocb)) {
1708 /* ELS command is being retried */
1709 goto out;
1710 @@ -2190,6 +2190,15 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1711 ndlp->nlp_fc4_type |= NLP_FC4_NVME;
1712 local_nlp_type = ndlp->nlp_fc4_type;
1713
1714 + /* This routine will issue 1 or 2 PRLIs, so zero all the ndlp
1715 + * fields here before any of them can complete.
1716 + */
1717 + ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
1718 + ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR);
1719 + ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
1720 + ndlp->nlp_flag &= ~NLP_FIRSTBURST;
1721 + ndlp->nvme_fb_size = 0;
1722 +
1723 send_next_prli:
1724 if (local_nlp_type & NLP_FC4_FCP) {
1725 /* Payload is 4 + 16 = 20 x14 bytes. */
1726 @@ -2298,6 +2307,13 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1727 elsiocb->iocb_cmpl = lpfc_cmpl_els_prli;
1728 spin_lock_irq(shost->host_lock);
1729 ndlp->nlp_flag |= NLP_PRLI_SND;
1730 +
1731 + /* The vport counters are used for lpfc_scan_finished, but
1732 + * the ndlp is used to track outstanding PRLIs for different
1733 + * FC4 types.
1734 + */
1735 + vport->fc_prli_sent++;
1736 + ndlp->fc4_prli_sent++;
1737 spin_unlock_irq(shost->host_lock);
1738 if (lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0) ==
1739 IOCB_ERROR) {
1740 @@ -2308,12 +2324,6 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1741 return 1;
1742 }
1743
1744 - /* The vport counters are used for lpfc_scan_finished, but
1745 - * the ndlp is used to track outstanding PRLIs for different
1746 - * FC4 types.
1747 - */
1748 - vport->fc_prli_sent++;
1749 - ndlp->fc4_prli_sent++;
1750
1751 /* The driver supports 2 FC4 types. Make sure
1752 * a PRLI is issued for all types before exiting.
1753 diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
1754 index b6957d944b9a..d489f6827cc1 100644
1755 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c
1756 +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
1757 @@ -390,6 +390,11 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1758 break;
1759 }
1760
1761 + ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
1762 + ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR);
1763 + ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
1764 + ndlp->nlp_flag &= ~NLP_FIRSTBURST;
1765 +
1766 /* Check for Nport to NPort pt2pt protocol */
1767 if ((vport->fc_flag & FC_PT2PT) &&
1768 !(vport->fc_flag & FC_PT2PT_PLOGI)) {
1769 @@ -742,9 +747,6 @@ lpfc_rcv_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1770 lp = (uint32_t *) pcmd->virt;
1771 npr = (PRLI *) ((uint8_t *) lp + sizeof (uint32_t));
1772
1773 - ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
1774 - ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
1775 - ndlp->nlp_flag &= ~NLP_FIRSTBURST;
1776 if ((npr->prliType == PRLI_FCP_TYPE) ||
1777 (npr->prliType == PRLI_NVME_TYPE)) {
1778 if (npr->initiatorFunc) {
1779 @@ -769,8 +771,12 @@ lpfc_rcv_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1780 * type. Target mode does not issue gft_id so doesn't get
1781 * the fc4 type set until now.
1782 */
1783 - if ((phba->nvmet_support) && (npr->prliType == PRLI_NVME_TYPE))
1784 + if (phba->nvmet_support && (npr->prliType == PRLI_NVME_TYPE)) {
1785 ndlp->nlp_fc4_type |= NLP_FC4_NVME;
1786 + lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
1787 + }
1788 + if (npr->prliType == PRLI_FCP_TYPE)
1789 + ndlp->nlp_fc4_type |= NLP_FC4_FCP;
1790 }
1791 if (rport) {
1792 /* We need to update the rport role values */
1793 @@ -1552,7 +1558,6 @@ lpfc_rcv_prli_reglogin_issue(struct lpfc_vport *vport,
1794 if (ndlp->nlp_flag & NLP_RPI_REGISTERED) {
1795 lpfc_rcv_prli(vport, ndlp, cmdiocb);
1796 lpfc_els_rsp_prli_acc(vport, cmdiocb, ndlp);
1797 - lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
1798 } else {
1799 /* RPI registration has not completed. Reject the PRLI
1800 * to prevent an illegal state transition when the
1801 @@ -1564,10 +1569,11 @@ lpfc_rcv_prli_reglogin_issue(struct lpfc_vport *vport,
1802 ndlp->nlp_rpi, ndlp->nlp_state,
1803 ndlp->nlp_flag);
1804 memset(&stat, 0, sizeof(struct ls_rjt));
1805 - stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
1806 - stat.un.b.lsRjtRsnCodeExp = LSEXP_CMD_IN_PROGRESS;
1807 + stat.un.b.lsRjtRsnCode = LSRJT_LOGICAL_BSY;
1808 + stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE;
1809 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb,
1810 ndlp, NULL);
1811 + return ndlp->nlp_state;
1812 }
1813 } else {
1814 /* Initiator mode. */
1815 @@ -1922,13 +1928,6 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1816 return ndlp->nlp_state;
1817 }
1818
1819 - /* Check out PRLI rsp */
1820 - ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
1821 - ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
1822 -
1823 - /* NVME or FCP first burst must be negotiated for each PRLI. */
1824 - ndlp->nlp_flag &= ~NLP_FIRSTBURST;
1825 - ndlp->nvme_fb_size = 0;
1826 if (npr && (npr->acceptRspCode == PRLI_REQ_EXECUTED) &&
1827 (npr->prliType == PRLI_FCP_TYPE)) {
1828 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC,
1829 @@ -1945,8 +1944,6 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1830 if (npr->Retry)
1831 ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE;
1832
1833 - /* PRLI completed. Decrement count. */
1834 - ndlp->fc4_prli_sent--;
1835 } else if (nvpr &&
1836 (bf_get_be32(prli_acc_rsp_code, nvpr) ==
1837 PRLI_REQ_EXECUTED) &&
1838 @@ -1991,8 +1988,6 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1839 be32_to_cpu(nvpr->word5),
1840 ndlp->nlp_flag, ndlp->nlp_fcp_info,
1841 ndlp->nlp_type);
1842 - /* PRLI completed. Decrement count. */
1843 - ndlp->fc4_prli_sent--;
1844 }
1845 if (!(ndlp->nlp_type & NLP_FCP_TARGET) &&
1846 (vport->port_type == LPFC_NPIV_PORT) &&
1847 @@ -2016,7 +2011,8 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1848 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
1849 if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET))
1850 lpfc_nlp_set_state(vport, ndlp, NLP_STE_MAPPED_NODE);
1851 - else
1852 + else if (ndlp->nlp_type &
1853 + (NLP_FCP_INITIATOR | NLP_NVME_INITIATOR))
1854 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
1855 } else
1856 lpfc_printf_vlog(vport,
1857 diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
1858 index 11bd2e698b84..4bf406df051b 100644
1859 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
1860 +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
1861 @@ -190,36 +190,30 @@ inline void megasas_return_cmd_fusion(struct megasas_instance *instance,
1862 /**
1863 * megasas_fire_cmd_fusion - Sends command to the FW
1864 * @instance: Adapter soft state
1865 - * @req_desc: 32bit or 64bit Request descriptor
1866 + * @req_desc: 64bit Request descriptor
1867 *
1868 - * Perform PCI Write. Ventura supports 32 bit Descriptor.
1869 - * Prior to Ventura (12G) MR controller supports 64 bit Descriptor.
1870 + * Perform PCI Write.
1871 */
1872
1873 static void
1874 megasas_fire_cmd_fusion(struct megasas_instance *instance,
1875 union MEGASAS_REQUEST_DESCRIPTOR_UNION *req_desc)
1876 {
1877 - if (instance->is_ventura)
1878 - writel(le32_to_cpu(req_desc->u.low),
1879 - &instance->reg_set->inbound_single_queue_port);
1880 - else {
1881 #if defined(writeq) && defined(CONFIG_64BIT)
1882 - u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) |
1883 - le32_to_cpu(req_desc->u.low));
1884 + u64 req_data = (((u64)le32_to_cpu(req_desc->u.high) << 32) |
1885 + le32_to_cpu(req_desc->u.low));
1886
1887 - writeq(req_data, &instance->reg_set->inbound_low_queue_port);
1888 + writeq(req_data, &instance->reg_set->inbound_low_queue_port);
1889 #else
1890 - unsigned long flags;
1891 - spin_lock_irqsave(&instance->hba_lock, flags);
1892 - writel(le32_to_cpu(req_desc->u.low),
1893 - &instance->reg_set->inbound_low_queue_port);
1894 - writel(le32_to_cpu(req_desc->u.high),
1895 - &instance->reg_set->inbound_high_queue_port);
1896 - mmiowb();
1897 - spin_unlock_irqrestore(&instance->hba_lock, flags);
1898 + unsigned long flags;
1899 + spin_lock_irqsave(&instance->hba_lock, flags);
1900 + writel(le32_to_cpu(req_desc->u.low),
1901 + &instance->reg_set->inbound_low_queue_port);
1902 + writel(le32_to_cpu(req_desc->u.high),
1903 + &instance->reg_set->inbound_high_queue_port);
1904 + mmiowb();
1905 + spin_unlock_irqrestore(&instance->hba_lock, flags);
1906 #endif
1907 - }
1908 }
1909
1910 /**
1911 @@ -772,7 +766,6 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
1912 const char *sys_info;
1913 MFI_CAPABILITIES *drv_ops;
1914 u32 scratch_pad_2;
1915 - unsigned long flags;
1916
1917 fusion = instance->ctrl_context;
1918
1919 @@ -900,14 +893,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
1920 break;
1921 }
1922
1923 - /* For Ventura also IOC INIT required 64 bit Descriptor write. */
1924 - spin_lock_irqsave(&instance->hba_lock, flags);
1925 - writel(le32_to_cpu(req_desc.u.low),
1926 - &instance->reg_set->inbound_low_queue_port);
1927 - writel(le32_to_cpu(req_desc.u.high),
1928 - &instance->reg_set->inbound_high_queue_port);
1929 - mmiowb();
1930 - spin_unlock_irqrestore(&instance->hba_lock, flags);
1931 + megasas_fire_cmd_fusion(instance, &req_desc);
1932
1933 wait_and_poll(instance, cmd, MFI_POLL_TIMEOUT_SECS);
1934
1935 diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
1936 index 87999905bca3..6efa739a1912 100644
1937 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
1938 +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
1939 @@ -5659,14 +5659,14 @@ _base_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase)
1940 }
1941
1942 /**
1943 - * _wait_for_commands_to_complete - reset controller
1944 + * mpt3sas_wait_for_commands_to_complete - reset controller
1945 * @ioc: Pointer to MPT_ADAPTER structure
1946 *
1947 * This function waiting(3s) for all pending commands to complete
1948 * prior to putting controller in reset.
1949 */
1950 -static void
1951 -_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
1952 +void
1953 +mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc)
1954 {
1955 u32 ioc_state;
1956 unsigned long flags;
1957 @@ -5745,7 +5745,7 @@ mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc,
1958 is_fault = 1;
1959 }
1960 _base_reset_handler(ioc, MPT3_IOC_PRE_RESET);
1961 - _wait_for_commands_to_complete(ioc);
1962 + mpt3sas_wait_for_commands_to_complete(ioc);
1963 _base_mask_interrupts(ioc);
1964 r = _base_make_ioc_ready(ioc, type);
1965 if (r)
1966 diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
1967 index a77bb7dc12b1..2948cb7e9ae6 100644
1968 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h
1969 +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
1970 @@ -1292,6 +1292,9 @@ void mpt3sas_base_update_missing_delay(struct MPT3SAS_ADAPTER *ioc,
1971
1972 int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc);
1973
1974 +void
1975 +mpt3sas_wait_for_commands_to_complete(struct MPT3SAS_ADAPTER *ioc);
1976 +
1977
1978 /* scsih shared API */
1979 u8 mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
1980 diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
1981 index 33ff691878e2..beb4bf8fe9b0 100644
1982 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
1983 +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
1984 @@ -2471,7 +2471,8 @@ scsih_abort(struct scsi_cmnd *scmd)
1985 _scsih_tm_display_info(ioc, scmd);
1986
1987 sas_device_priv_data = scmd->device->hostdata;
1988 - if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
1989 + if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
1990 + ioc->remove_host) {
1991 sdev_printk(KERN_INFO, scmd->device,
1992 "device been deleted! scmd(%p)\n", scmd);
1993 scmd->result = DID_NO_CONNECT << 16;
1994 @@ -2533,7 +2534,8 @@ scsih_dev_reset(struct scsi_cmnd *scmd)
1995 _scsih_tm_display_info(ioc, scmd);
1996
1997 sas_device_priv_data = scmd->device->hostdata;
1998 - if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
1999 + if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
2000 + ioc->remove_host) {
2001 sdev_printk(KERN_INFO, scmd->device,
2002 "device been deleted! scmd(%p)\n", scmd);
2003 scmd->result = DID_NO_CONNECT << 16;
2004 @@ -2595,7 +2597,8 @@ scsih_target_reset(struct scsi_cmnd *scmd)
2005 _scsih_tm_display_info(ioc, scmd);
2006
2007 sas_device_priv_data = scmd->device->hostdata;
2008 - if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
2009 + if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
2010 + ioc->remove_host) {
2011 starget_printk(KERN_INFO, starget, "target been deleted! scmd(%p)\n",
2012 scmd);
2013 scmd->result = DID_NO_CONNECT << 16;
2014 @@ -2652,7 +2655,7 @@ scsih_host_reset(struct scsi_cmnd *scmd)
2015 ioc->name, scmd);
2016 scsi_print_command(scmd);
2017
2018 - if (ioc->is_driver_loading) {
2019 + if (ioc->is_driver_loading || ioc->remove_host) {
2020 pr_info(MPT3SAS_FMT "Blocking the host reset\n",
2021 ioc->name);
2022 r = FAILED;
2023 @@ -3957,7 +3960,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc)
2024 _scsih_set_satl_pending(scmd, false);
2025 mpt3sas_base_free_smid(ioc, smid);
2026 scsi_dma_unmap(scmd);
2027 - if (ioc->pci_error_recovery)
2028 + if (ioc->pci_error_recovery || ioc->remove_host)
2029 scmd->result = DID_NO_CONNECT << 16;
2030 else
2031 scmd->result = DID_RESET << 16;
2032 @@ -8240,6 +8243,10 @@ static void scsih_remove(struct pci_dev *pdev)
2033 unsigned long flags;
2034
2035 ioc->remove_host = 1;
2036 +
2037 + mpt3sas_wait_for_commands_to_complete(ioc);
2038 + _scsih_flush_running_cmds(ioc);
2039 +
2040 _scsih_fw_event_cleanup_queue(ioc);
2041
2042 spin_lock_irqsave(&ioc->fw_event_lock, flags);
2043 @@ -8310,6 +8317,10 @@ scsih_shutdown(struct pci_dev *pdev)
2044 unsigned long flags;
2045
2046 ioc->remove_host = 1;
2047 +
2048 + mpt3sas_wait_for_commands_to_complete(ioc);
2049 + _scsih_flush_running_cmds(ioc);
2050 +
2051 _scsih_fw_event_cleanup_queue(ioc);
2052
2053 spin_lock_irqsave(&ioc->fw_event_lock, flags);
2054 diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
2055 index 403bea9d546b..50214b620865 100644
2056 --- a/drivers/soc/qcom/smsm.c
2057 +++ b/drivers/soc/qcom/smsm.c
2058 @@ -496,8 +496,10 @@ static int qcom_smsm_probe(struct platform_device *pdev)
2059 if (!smsm->hosts)
2060 return -ENOMEM;
2061
2062 - local_node = of_find_node_with_property(of_node_get(pdev->dev.of_node),
2063 - "#qcom,smem-state-cells");
2064 + for_each_child_of_node(pdev->dev.of_node, local_node) {
2065 + if (of_find_property(local_node, "#qcom,smem-state-cells", NULL))
2066 + break;
2067 + }
2068 if (!local_node) {
2069 dev_err(&pdev->dev, "no state entry\n");
2070 return -EINVAL;
2071 diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
2072 index 837bb95eea62..092a5fc85b9a 100644
2073 --- a/drivers/spi/spi-sh-msiof.c
2074 +++ b/drivers/spi/spi-sh-msiof.c
2075 @@ -55,6 +55,8 @@ struct sh_msiof_spi_priv {
2076 void *rx_dma_page;
2077 dma_addr_t tx_dma_addr;
2078 dma_addr_t rx_dma_addr;
2079 + bool native_cs_inited;
2080 + bool native_cs_high;
2081 bool slave_aborted;
2082 };
2083
2084 @@ -528,8 +530,7 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
2085 {
2086 struct device_node *np = spi->master->dev.of_node;
2087 struct sh_msiof_spi_priv *p = spi_master_get_devdata(spi->master);
2088 -
2089 - pm_runtime_get_sync(&p->pdev->dev);
2090 + u32 clr, set, tmp;
2091
2092 if (!np) {
2093 /*
2094 @@ -539,19 +540,31 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
2095 spi->cs_gpio = (uintptr_t)spi->controller_data;
2096 }
2097
2098 - /* Configure pins before deasserting CS */
2099 - sh_msiof_spi_set_pin_regs(p, !!(spi->mode & SPI_CPOL),
2100 - !!(spi->mode & SPI_CPHA),
2101 - !!(spi->mode & SPI_3WIRE),
2102 - !!(spi->mode & SPI_LSB_FIRST),
2103 - !!(spi->mode & SPI_CS_HIGH));
2104 -
2105 - if (spi->cs_gpio >= 0)
2106 + if (spi->cs_gpio >= 0) {
2107 gpio_set_value(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
2108 + return 0;
2109 + }
2110
2111 + if (spi_controller_is_slave(p->master))
2112 + return 0;
2113
2114 - pm_runtime_put(&p->pdev->dev);
2115 + if (p->native_cs_inited &&
2116 + (p->native_cs_high == !!(spi->mode & SPI_CS_HIGH)))
2117 + return 0;
2118
2119 + /* Configure native chip select mode/polarity early */
2120 + clr = MDR1_SYNCMD_MASK;
2121 + set = MDR1_TRMD | TMDR1_PCON | MDR1_SYNCMD_SPI;
2122 + if (spi->mode & SPI_CS_HIGH)
2123 + clr |= BIT(MDR1_SYNCAC_SHIFT);
2124 + else
2125 + set |= BIT(MDR1_SYNCAC_SHIFT);
2126 + pm_runtime_get_sync(&p->pdev->dev);
2127 + tmp = sh_msiof_read(p, TMDR1) & ~clr;
2128 + sh_msiof_write(p, TMDR1, tmp | set);
2129 + pm_runtime_put(&p->pdev->dev);
2130 + p->native_cs_high = spi->mode & SPI_CS_HIGH;
2131 + p->native_cs_inited = true;
2132 return 0;
2133 }
2134
2135 diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
2136 index d9941b0c468d..893b2836089c 100644
2137 --- a/drivers/staging/android/ashmem.c
2138 +++ b/drivers/staging/android/ashmem.c
2139 @@ -709,16 +709,14 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
2140 size_t pgstart, pgend;
2141 int ret = -EINVAL;
2142
2143 + if (unlikely(copy_from_user(&pin, p, sizeof(pin))))
2144 + return -EFAULT;
2145 +
2146 mutex_lock(&ashmem_mutex);
2147
2148 if (unlikely(!asma->file))
2149 goto out_unlock;
2150
2151 - if (unlikely(copy_from_user(&pin, p, sizeof(pin)))) {
2152 - ret = -EFAULT;
2153 - goto out_unlock;
2154 - }
2155 -
2156 /* per custom, you can pass zero for len to mean "everything onward" */
2157 if (!pin.len)
2158 pin.len = PAGE_ALIGN(asma->size) - pin.offset;
2159 diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
2160 index cc2b4d9433ed..b811442c5ce6 100644
2161 --- a/drivers/tty/Kconfig
2162 +++ b/drivers/tty/Kconfig
2163 @@ -394,10 +394,14 @@ config GOLDFISH_TTY
2164 depends on GOLDFISH
2165 select SERIAL_CORE
2166 select SERIAL_CORE_CONSOLE
2167 - select SERIAL_EARLYCON
2168 help
2169 Console and system TTY driver for the Goldfish virtual platform.
2170
2171 +config GOLDFISH_TTY_EARLY_CONSOLE
2172 + bool
2173 + default y if GOLDFISH_TTY=y
2174 + select SERIAL_EARLYCON
2175 +
2176 config DA_TTY
2177 bool "DA TTY"
2178 depends on METAG_DA
2179 diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
2180 index 381e981dee06..85a500ddbcaa 100644
2181 --- a/drivers/tty/goldfish.c
2182 +++ b/drivers/tty/goldfish.c
2183 @@ -442,6 +442,7 @@ static int goldfish_tty_remove(struct platform_device *pdev)
2184 return 0;
2185 }
2186
2187 +#ifdef CONFIG_GOLDFISH_TTY_EARLY_CONSOLE
2188 static void gf_early_console_putchar(struct uart_port *port, int ch)
2189 {
2190 __raw_writel(ch, port->membase);
2191 @@ -465,6 +466,7 @@ static int __init gf_earlycon_setup(struct earlycon_device *device,
2192 }
2193
2194 OF_EARLYCON_DECLARE(early_gf_tty, "google,goldfish-tty", gf_earlycon_setup);
2195 +#endif
2196
2197 static const struct of_device_id goldfish_tty_of_match[] = {
2198 { .compatible = "google,goldfish-tty", },
2199 diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
2200 index 7e638997bfc2..3015789265dd 100644
2201 --- a/drivers/tty/serial/8250/8250_dw.c
2202 +++ b/drivers/tty/serial/8250/8250_dw.c
2203 @@ -513,7 +513,8 @@ static int dw8250_probe(struct platform_device *pdev)
2204 /* If no clock rate is defined, fail. */
2205 if (!p->uartclk) {
2206 dev_err(dev, "clock rate not defined\n");
2207 - return -EINVAL;
2208 + err = -EINVAL;
2209 + goto err_clk;
2210 }
2211
2212 data->pclk = devm_clk_get(dev, "apb_pclk");
2213 diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
2214 index 908110b5cf10..0d814a87acb2 100644
2215 --- a/drivers/tty/serial/8250/8250_pci.c
2216 +++ b/drivers/tty/serial/8250/8250_pci.c
2217 @@ -3389,11 +3389,9 @@ static int serial_pci_is_class_communication(struct pci_dev *dev)
2218 /*
2219 * If it is not a communications device or the programming
2220 * interface is greater than 6, give up.
2221 - *
2222 - * (Should we try to make guesses for multiport serial devices
2223 - * later?)
2224 */
2225 if ((((dev->class >> 8) != PCI_CLASS_COMMUNICATION_SERIAL) &&
2226 + ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MULTISERIAL) &&
2227 ((dev->class >> 8) != PCI_CLASS_COMMUNICATION_MODEM)) ||
2228 (dev->class & 0xff) > 6)
2229 return -ENODEV;
2230 @@ -3430,6 +3428,12 @@ serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
2231 {
2232 int num_iomem, num_port, first_port = -1, i;
2233
2234 + /*
2235 + * Should we try to make guesses for multiport serial devices later?
2236 + */
2237 + if ((dev->class >> 8) == PCI_CLASS_COMMUNICATION_MULTISERIAL)
2238 + return -ENODEV;
2239 +
2240 num_iomem = num_port = 0;
2241 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
2242 if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
2243 diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
2244 index 7892d0be8af9..7e77bd2118ad 100644
2245 --- a/drivers/tty/tty_io.c
2246 +++ b/drivers/tty/tty_io.c
2247 @@ -1481,6 +1481,8 @@ static void release_tty(struct tty_struct *tty, int idx)
2248 if (tty->link)
2249 tty->link->port->itty = NULL;
2250 tty_buffer_cancel_work(tty->port);
2251 + if (tty->link)
2252 + tty_buffer_cancel_work(tty->link->port);
2253
2254 tty_kref_put(tty->link);
2255 tty_kref_put(tty);
2256 diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
2257 index 445b1dc5d441..a17ba1465815 100644
2258 --- a/drivers/video/console/vgacon.c
2259 +++ b/drivers/video/console/vgacon.c
2260 @@ -422,7 +422,10 @@ static const char *vgacon_startup(void)
2261 vga_video_port_val = VGA_CRT_DM;
2262 if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) {
2263 static struct resource ega_console_resource =
2264 - { .name = "ega", .start = 0x3B0, .end = 0x3BF };
2265 + { .name = "ega",
2266 + .flags = IORESOURCE_IO,
2267 + .start = 0x3B0,
2268 + .end = 0x3BF };
2269 vga_video_type = VIDEO_TYPE_EGAM;
2270 vga_vram_size = 0x8000;
2271 display_desc = "EGA+";
2272 @@ -430,9 +433,15 @@ static const char *vgacon_startup(void)
2273 &ega_console_resource);
2274 } else {
2275 static struct resource mda1_console_resource =
2276 - { .name = "mda", .start = 0x3B0, .end = 0x3BB };
2277 + { .name = "mda",
2278 + .flags = IORESOURCE_IO,
2279 + .start = 0x3B0,
2280 + .end = 0x3BB };
2281 static struct resource mda2_console_resource =
2282 - { .name = "mda", .start = 0x3BF, .end = 0x3BF };
2283 + { .name = "mda",
2284 + .flags = IORESOURCE_IO,
2285 + .start = 0x3BF,
2286 + .end = 0x3BF };
2287 vga_video_type = VIDEO_TYPE_MDA;
2288 vga_vram_size = 0x2000;
2289 display_desc = "*MDA";
2290 @@ -454,15 +463,21 @@ static const char *vgacon_startup(void)
2291 vga_vram_size = 0x8000;
2292
2293 if (!screen_info.orig_video_isVGA) {
2294 - static struct resource ega_console_resource
2295 - = { .name = "ega", .start = 0x3C0, .end = 0x3DF };
2296 + static struct resource ega_console_resource =
2297 + { .name = "ega",
2298 + .flags = IORESOURCE_IO,
2299 + .start = 0x3C0,
2300 + .end = 0x3DF };
2301 vga_video_type = VIDEO_TYPE_EGAC;
2302 display_desc = "EGA";
2303 request_resource(&ioport_resource,
2304 &ega_console_resource);
2305 } else {
2306 - static struct resource vga_console_resource
2307 - = { .name = "vga+", .start = 0x3C0, .end = 0x3DF };
2308 + static struct resource vga_console_resource =
2309 + { .name = "vga+",
2310 + .flags = IORESOURCE_IO,
2311 + .start = 0x3C0,
2312 + .end = 0x3DF };
2313 vga_video_type = VIDEO_TYPE_VGAC;
2314 display_desc = "VGA+";
2315 request_resource(&ioport_resource,
2316 @@ -494,7 +509,10 @@ static const char *vgacon_startup(void)
2317 }
2318 } else {
2319 static struct resource cga_console_resource =
2320 - { .name = "cga", .start = 0x3D4, .end = 0x3D5 };
2321 + { .name = "cga",
2322 + .flags = IORESOURCE_IO,
2323 + .start = 0x3D4,
2324 + .end = 0x3D5 };
2325 vga_video_type = VIDEO_TYPE_CGA;
2326 vga_vram_size = 0x2000;
2327 display_desc = "*CGA";
2328 diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c
2329 index 57e9e146ff74..4aeb908f2d1e 100644
2330 --- a/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c
2331 +++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td028ttec1.c
2332 @@ -455,6 +455,8 @@ static int td028ttec1_panel_remove(struct spi_device *spi)
2333 }
2334
2335 static const struct of_device_id td028ttec1_of_match[] = {
2336 + { .compatible = "omapdss,tpo,td028ttec1", },
2337 + /* keep to not break older DTB */
2338 { .compatible = "omapdss,toppoly,td028ttec1", },
2339 {},
2340 };
2341 @@ -474,6 +476,7 @@ static struct spi_driver td028ttec1_spi_driver = {
2342
2343 module_spi_driver(td028ttec1_spi_driver);
2344
2345 +MODULE_ALIAS("spi:tpo,td028ttec1");
2346 MODULE_ALIAS("spi:toppoly,td028ttec1");
2347 MODULE_AUTHOR("H. Nikolaus Schaller <hns@goldelico.com>");
2348 MODULE_DESCRIPTION("Toppoly TD028TTEC1 panel driver");
2349 diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
2350 index 0826e663bd5a..b30fb637ae94 100644
2351 --- a/drivers/watchdog/watchdog_dev.c
2352 +++ b/drivers/watchdog/watchdog_dev.c
2353 @@ -768,6 +768,7 @@ static int watchdog_open(struct inode *inode, struct file *file)
2354 {
2355 struct watchdog_core_data *wd_data;
2356 struct watchdog_device *wdd;
2357 + bool hw_running;
2358 int err;
2359
2360 /* Get the corresponding watchdog device */
2361 @@ -787,7 +788,8 @@ static int watchdog_open(struct inode *inode, struct file *file)
2362 * If the /dev/watchdog device is open, we don't want the module
2363 * to be unloaded.
2364 */
2365 - if (!watchdog_hw_running(wdd) && !try_module_get(wdd->ops->owner)) {
2366 + hw_running = watchdog_hw_running(wdd);
2367 + if (!hw_running && !try_module_get(wdd->ops->owner)) {
2368 err = -EBUSY;
2369 goto out_clear;
2370 }
2371 @@ -798,7 +800,7 @@ static int watchdog_open(struct inode *inode, struct file *file)
2372
2373 file->private_data = wd_data;
2374
2375 - if (!watchdog_hw_running(wdd))
2376 + if (!hw_running)
2377 kref_get(&wd_data->kref);
2378
2379 /* dev/watchdog is a virtual (and thus non-seekable) filesystem */
2380 @@ -964,14 +966,13 @@ static int watchdog_cdev_register(struct watchdog_device *wdd, dev_t devno)
2381 * and schedule an immediate ping.
2382 */
2383 if (watchdog_hw_running(wdd)) {
2384 - if (handle_boot_enabled) {
2385 - __module_get(wdd->ops->owner);
2386 - kref_get(&wd_data->kref);
2387 + __module_get(wdd->ops->owner);
2388 + kref_get(&wd_data->kref);
2389 + if (handle_boot_enabled)
2390 queue_delayed_work(watchdog_wq, &wd_data->work, 0);
2391 - } else {
2392 + else
2393 pr_info("watchdog%d running and kernel based pre-userspace handler disabled\n",
2394 - wdd->id);
2395 - }
2396 + wdd->id);
2397 }
2398
2399 return 0;
2400 diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
2401 index 8487486ec496..8ce60986fb75 100644
2402 --- a/fs/nfsd/nfs4proc.c
2403 +++ b/fs/nfsd/nfs4proc.c
2404 @@ -1372,14 +1372,14 @@ nfsd4_layoutget(struct svc_rqst *rqstp,
2405 const struct nfsd4_layout_ops *ops;
2406 struct nfs4_layout_stateid *ls;
2407 __be32 nfserr;
2408 - int accmode;
2409 + int accmode = NFSD_MAY_READ_IF_EXEC;
2410
2411 switch (lgp->lg_seg.iomode) {
2412 case IOMODE_READ:
2413 - accmode = NFSD_MAY_READ;
2414 + accmode |= NFSD_MAY_READ;
2415 break;
2416 case IOMODE_RW:
2417 - accmode = NFSD_MAY_READ | NFSD_MAY_WRITE;
2418 + accmode |= NFSD_MAY_READ | NFSD_MAY_WRITE;
2419 break;
2420 default:
2421 dprintk("%s: invalid iomode %d\n",
2422 diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
2423 index 8f9fc6e5539a..bfb4a9d962a5 100644
2424 --- a/include/linux/mlx5/driver.h
2425 +++ b/include/linux/mlx5/driver.h
2426 @@ -432,8 +432,8 @@ struct mlx5_core_srq {
2427 struct mlx5_core_rsc_common common; /* must be first */
2428 u32 srqn;
2429 int max;
2430 - int max_gs;
2431 - int max_avail_gather;
2432 + size_t max_gs;
2433 + size_t max_avail_gather;
2434 int wqe_shift;
2435 void (*event) (struct mlx5_core_srq *, enum mlx5_event);
2436
2437 diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
2438 index 1933654007c4..23e6d5532b5c 100644
2439 --- a/net/ipv4/ip_gre.c
2440 +++ b/net/ipv4/ip_gre.c
2441 @@ -303,8 +303,10 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
2442 return PACKET_REJECT;
2443
2444 md = ip_tunnel_info_opts(&tun_dst->u.tun_info);
2445 - if (!md)
2446 + if (!md) {
2447 + dst_release((struct dst_entry *)tun_dst);
2448 return PACKET_REJECT;
2449 + }
2450
2451 md->index = index;
2452 info = &tun_dst->u.tun_info;
2453 @@ -408,11 +410,13 @@ static int gre_rcv(struct sk_buff *skb)
2454 if (unlikely(tpi.proto == htons(ETH_P_ERSPAN))) {
2455 if (erspan_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
2456 return 0;
2457 + goto out;
2458 }
2459
2460 if (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
2461 return 0;
2462
2463 +out:
2464 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
2465 drop:
2466 kfree_skb(skb);
2467 diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
2468 index bcdc2d557de1..413f01be0c9b 100644
2469 --- a/net/ipv6/ip6_vti.c
2470 +++ b/net/ipv6/ip6_vti.c
2471 @@ -626,6 +626,7 @@ static void vti6_link_config(struct ip6_tnl *t)
2472 {
2473 struct net_device *dev = t->dev;
2474 struct __ip6_tnl_parm *p = &t->parms;
2475 + struct net_device *tdev = NULL;
2476
2477 memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
2478 memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
2479 @@ -638,6 +639,25 @@ static void vti6_link_config(struct ip6_tnl *t)
2480 dev->flags |= IFF_POINTOPOINT;
2481 else
2482 dev->flags &= ~IFF_POINTOPOINT;
2483 +
2484 + if (p->flags & IP6_TNL_F_CAP_XMIT) {
2485 + int strict = (ipv6_addr_type(&p->raddr) &
2486 + (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL));
2487 + struct rt6_info *rt = rt6_lookup(t->net,
2488 + &p->raddr, &p->laddr,
2489 + p->link, strict);
2490 +
2491 + if (rt)
2492 + tdev = rt->dst.dev;
2493 + ip6_rt_put(rt);
2494 + }
2495 +
2496 + if (!tdev && p->link)
2497 + tdev = __dev_get_by_index(t->net, p->link);
2498 +
2499 + if (tdev)
2500 + dev->mtu = max_t(int, tdev->mtu - dev->hard_header_len,
2501 + IPV6_MIN_MTU);
2502 }
2503
2504 /**
2505 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
2506 index 9ffd3dda3889..97769465de13 100644
2507 --- a/scripts/Kbuild.include
2508 +++ b/scripts/Kbuild.include
2509 @@ -160,12 +160,13 @@ cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo
2510 # cc-ldoption
2511 # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
2512 cc-ldoption = $(call try-run,\
2513 - $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
2514 + $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
2515
2516 # ld-option
2517 # Usage: LDFLAGS += $(call ld-option, -X)
2518 ld-option = $(call try-run,\
2519 - $(CC) -x c /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
2520 + $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -x c /dev/null -c -o "$$TMPO"; \
2521 + $(LD) $(LDFLAGS) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
2522
2523 # ar-option
2524 # Usage: KBUILD_ARFLAGS := $(call ar-option,D)
2525 diff --git a/security/Kconfig b/security/Kconfig
2526 index b5c2b5d0c6c0..87f2a6f842fd 100644
2527 --- a/security/Kconfig
2528 +++ b/security/Kconfig
2529 @@ -154,6 +154,7 @@ config HARDENED_USERCOPY
2530 bool "Harden memory copies between kernel and userspace"
2531 depends on HAVE_HARDENED_USERCOPY_ALLOCATOR
2532 select BUG
2533 + imply STRICT_DEVMEM
2534 help
2535 This option checks for obviously wrong memory regions when
2536 copying memory to/from the kernel (via copy_to_user() and