Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0304-5.4.205-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3635 - (show annotations) (download)
Mon Oct 24 12:34:12 2022 UTC (18 months, 1 week ago) by niro
File size: 57712 byte(s)
-sync kernel patches
1 diff --git a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
2 index 4cb9d6b931389..c61c4a6b57f10 100644
3 --- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
4 +++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
5 @@ -58,7 +58,7 @@ if:
6 then:
7 properties:
8 clocks:
9 - maxItems: 2
10 + minItems: 2
11
12 required:
13 - clock-names
14 diff --git a/Makefile b/Makefile
15 index b5d1718ae70c6..c40565492ffba 100644
16 --- a/Makefile
17 +++ b/Makefile
18 @@ -1,7 +1,7 @@
19 # SPDX-License-Identifier: GPL-2.0
20 VERSION = 5
21 PATCHLEVEL = 4
22 -SUBLEVEL = 204
23 +SUBLEVEL = 205
24 EXTRAVERSION =
25 NAME = Kleptomaniac Octopus
26
27 diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
28 index 676cc2a318f41..5d75ab82d5a6a 100644
29 --- a/arch/arm/mach-at91/pm.c
30 +++ b/arch/arm/mach-at91/pm.c
31 @@ -103,7 +103,7 @@ static const struct wakeup_source_info ws_info[] = {
32
33 static const struct of_device_id sama5d2_ws_ids[] = {
34 { .compatible = "atmel,sama5d2-gem", .data = &ws_info[0] },
35 - { .compatible = "atmel,at91rm9200-rtc", .data = &ws_info[1] },
36 + { .compatible = "atmel,sama5d2-rtc", .data = &ws_info[1] },
37 { .compatible = "atmel,sama5d3-udc", .data = &ws_info[2] },
38 { .compatible = "atmel,at91rm9200-ohci", .data = &ws_info[2] },
39 { .compatible = "usb-ohci", .data = &ws_info[2] },
40 @@ -114,12 +114,12 @@ static const struct of_device_id sama5d2_ws_ids[] = {
41 };
42
43 static const struct of_device_id sam9x60_ws_ids[] = {
44 - { .compatible = "atmel,at91sam9x5-rtc", .data = &ws_info[1] },
45 + { .compatible = "microchip,sam9x60-rtc", .data = &ws_info[1] },
46 { .compatible = "atmel,at91rm9200-ohci", .data = &ws_info[2] },
47 { .compatible = "usb-ohci", .data = &ws_info[2] },
48 { .compatible = "atmel,at91sam9g45-ehci", .data = &ws_info[2] },
49 { .compatible = "usb-ehci", .data = &ws_info[2] },
50 - { .compatible = "atmel,at91sam9260-rtt", .data = &ws_info[4] },
51 + { .compatible = "microchip,sam9x60-rtt", .data = &ws_info[4] },
52 { .compatible = "cdns,sam9x60-macb", .data = &ws_info[5] },
53 { /* sentinel */ }
54 };
55 diff --git a/arch/arm/mach-meson/platsmp.c b/arch/arm/mach-meson/platsmp.c
56 index 4b8ad728bb42a..32ac60b89fdcc 100644
57 --- a/arch/arm/mach-meson/platsmp.c
58 +++ b/arch/arm/mach-meson/platsmp.c
59 @@ -71,6 +71,7 @@ static void __init meson_smp_prepare_cpus(const char *scu_compatible,
60 }
61
62 sram_base = of_iomap(node, 0);
63 + of_node_put(node);
64 if (!sram_base) {
65 pr_err("Couldn't map SRAM registers\n");
66 return;
67 @@ -91,6 +92,7 @@ static void __init meson_smp_prepare_cpus(const char *scu_compatible,
68 }
69
70 scu_base = of_iomap(node, 0);
71 + of_node_put(node);
72 if (!scu_base) {
73 pr_err("Couldn't map SCU registers\n");
74 return;
75 diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
76 index eba4142998b03..7186e17cfd3dc 100644
77 --- a/arch/powerpc/platforms/powernv/rng.c
78 +++ b/arch/powerpc/platforms/powernv/rng.c
79 @@ -176,12 +176,8 @@ static int __init pnv_get_random_long_early(unsigned long *v)
80 NULL) != pnv_get_random_long_early)
81 return 0;
82
83 - for_each_compatible_node(dn, NULL, "ibm,power-rng") {
84 - if (rng_create(dn))
85 - continue;
86 - /* Create devices for hwrng driver */
87 - of_platform_device_create(dn, NULL, NULL);
88 - }
89 + for_each_compatible_node(dn, NULL, "ibm,power-rng")
90 + rng_create(dn);
91
92 if (!ppc_md.get_random_seed)
93 return 0;
94 @@ -205,10 +201,18 @@ void __init pnv_rng_init(void)
95
96 static int __init pnv_rng_late_init(void)
97 {
98 + struct device_node *dn;
99 unsigned long v;
100 +
101 /* In case it wasn't called during init for some other reason. */
102 if (ppc_md.get_random_seed == pnv_get_random_long_early)
103 pnv_get_random_long_early(&v);
104 +
105 + if (ppc_md.get_random_seed == powernv_get_random_long) {
106 + for_each_compatible_node(dn, NULL, "ibm,power-rng")
107 + of_platform_device_create(dn, NULL, NULL);
108 + }
109 +
110 return 0;
111 }
112 machine_subsys_initcall(powernv, pnv_rng_late_init);
113 diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
114 index 6473a4a81d58b..a406b3c0d170a 100644
115 --- a/drivers/dma/at_xdmac.c
116 +++ b/drivers/dma/at_xdmac.c
117 @@ -1848,6 +1848,11 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan)
118 for (i = 0; i < init_nr_desc_per_channel; i++) {
119 desc = at_xdmac_alloc_desc(chan, GFP_ATOMIC);
120 if (!desc) {
121 + if (i == 0) {
122 + dev_warn(chan2dev(chan),
123 + "can't allocate any descriptors\n");
124 + return -EIO;
125 + }
126 dev_warn(chan2dev(chan),
127 "only %d descriptors have been allocated\n", i);
128 break;
129 diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
130 index 801bef83df2a5..8ec7a7041e840 100644
131 --- a/drivers/dma/imx-sdma.c
132 +++ b/drivers/dma/imx-sdma.c
133 @@ -2208,7 +2208,7 @@ MODULE_DESCRIPTION("i.MX SDMA driver");
134 #if IS_ENABLED(CONFIG_SOC_IMX6Q)
135 MODULE_FIRMWARE("imx/sdma/sdma-imx6q.bin");
136 #endif
137 -#if IS_ENABLED(CONFIG_SOC_IMX7D)
138 +#if IS_ENABLED(CONFIG_SOC_IMX7D) || IS_ENABLED(CONFIG_SOC_IMX8M)
139 MODULE_FIRMWARE("imx/sdma/sdma-imx7d.bin");
140 #endif
141 MODULE_LICENSE("GPL");
142 diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
143 index 9a94d5b9e0590..77a6495bb6b19 100644
144 --- a/drivers/dma/pl330.c
145 +++ b/drivers/dma/pl330.c
146 @@ -2585,7 +2585,7 @@ static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch)
147
148 /* If the DMAC pool is empty, alloc new */
149 if (!desc) {
150 - DEFINE_SPINLOCK(lock);
151 + static DEFINE_SPINLOCK(lock);
152 LIST_HEAD(pool);
153
154 if (!add_desc(&pool, &lock, GFP_ATOMIC, 1))
155 diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c
156 index f255056696eec..26cf62af08fc8 100644
157 --- a/drivers/dma/ti/dma-crossbar.c
158 +++ b/drivers/dma/ti/dma-crossbar.c
159 @@ -247,6 +247,7 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
160 if (dma_spec->args[0] >= xbar->xbar_requests) {
161 dev_err(&pdev->dev, "Invalid XBAR request number: %d\n",
162 dma_spec->args[0]);
163 + put_device(&pdev->dev);
164 return ERR_PTR(-EINVAL);
165 }
166
167 @@ -254,12 +255,14 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
168 dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0);
169 if (!dma_spec->np) {
170 dev_err(&pdev->dev, "Can't get DMA master\n");
171 + put_device(&pdev->dev);
172 return ERR_PTR(-EINVAL);
173 }
174
175 map = kzalloc(sizeof(*map), GFP_KERNEL);
176 if (!map) {
177 of_node_put(dma_spec->np);
178 + put_device(&pdev->dev);
179 return ERR_PTR(-ENOMEM);
180 }
181
182 @@ -270,6 +273,8 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
183 mutex_unlock(&xbar->mutex);
184 dev_err(&pdev->dev, "Run out of free DMA requests\n");
185 kfree(map);
186 + of_node_put(dma_spec->np);
187 + put_device(&pdev->dev);
188 return ERR_PTR(-ENOMEM);
189 }
190 set_bit(map->xbar_out, xbar->dma_inuse);
191 diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
192 index 8a3a0991bc1c5..3a1bdc75275f4 100644
193 --- a/drivers/i2c/busses/i2c-cadence.c
194 +++ b/drivers/i2c/busses/i2c-cadence.c
195 @@ -985,6 +985,7 @@ static int cdns_i2c_probe(struct platform_device *pdev)
196 return 0;
197
198 err_clk_dis:
199 + clk_notifier_unregister(id->clk, &id->clk_rate_change_nb);
200 clk_disable_unprepare(id->clk);
201 pm_runtime_set_suspended(&pdev->dev);
202 pm_runtime_disable(&pdev->dev);
203 diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
204 index 24616525c90dc..9f7c1e29e86a3 100644
205 --- a/drivers/iommu/dmar.c
206 +++ b/drivers/iommu/dmar.c
207 @@ -363,7 +363,7 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb,
208
209 static struct notifier_block dmar_pci_bus_nb = {
210 .notifier_call = dmar_pci_bus_notifier,
211 - .priority = INT_MIN,
212 + .priority = 1,
213 };
214
215 static struct dmar_drhd_unit *
216 diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c
217 index 4aef33d07cc36..8acf6e6aff316 100644
218 --- a/drivers/misc/cardreader/rtsx_usb.c
219 +++ b/drivers/misc/cardreader/rtsx_usb.c
220 @@ -631,16 +631,20 @@ static int rtsx_usb_probe(struct usb_interface *intf,
221
222 ucr->pusb_dev = usb_dev;
223
224 - ucr->iobuf = usb_alloc_coherent(ucr->pusb_dev, IOBUF_SIZE,
225 - GFP_KERNEL, &ucr->iobuf_dma);
226 - if (!ucr->iobuf)
227 + ucr->cmd_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL);
228 + if (!ucr->cmd_buf)
229 return -ENOMEM;
230
231 + ucr->rsp_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL);
232 + if (!ucr->rsp_buf) {
233 + ret = -ENOMEM;
234 + goto out_free_cmd_buf;
235 + }
236 +
237 usb_set_intfdata(intf, ucr);
238
239 ucr->vendor_id = id->idVendor;
240 ucr->product_id = id->idProduct;
241 - ucr->cmd_buf = ucr->rsp_buf = ucr->iobuf;
242
243 mutex_init(&ucr->dev_mutex);
244
245 @@ -668,8 +672,11 @@ static int rtsx_usb_probe(struct usb_interface *intf,
246
247 out_init_fail:
248 usb_set_intfdata(ucr->pusb_intf, NULL);
249 - usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf,
250 - ucr->iobuf_dma);
251 + kfree(ucr->rsp_buf);
252 + ucr->rsp_buf = NULL;
253 +out_free_cmd_buf:
254 + kfree(ucr->cmd_buf);
255 + ucr->cmd_buf = NULL;
256 return ret;
257 }
258
259 @@ -682,8 +689,12 @@ static void rtsx_usb_disconnect(struct usb_interface *intf)
260 mfd_remove_devices(&intf->dev);
261
262 usb_set_intfdata(ucr->pusb_intf, NULL);
263 - usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf,
264 - ucr->iobuf_dma);
265 +
266 + kfree(ucr->cmd_buf);
267 + ucr->cmd_buf = NULL;
268 +
269 + kfree(ucr->rsp_buf);
270 + ucr->rsp_buf = NULL;
271 }
272
273 #ifdef CONFIG_PM
274 diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
275 index e613cd5707e27..ca864ece89ae5 100644
276 --- a/drivers/net/can/grcan.c
277 +++ b/drivers/net/can/grcan.c
278 @@ -1660,7 +1660,6 @@ static int grcan_probe(struct platform_device *ofdev)
279 */
280 sysid_parent = of_find_node_by_path("/ambapp0");
281 if (sysid_parent) {
282 - of_node_get(sysid_parent);
283 err = of_property_read_u32(sysid_parent, "systemid", &sysid);
284 if (!err && ((sysid & GRLIB_VERSION_MASK) >=
285 GRCAN_TXBUG_SAFE_GRLIB_VERSION))
286 diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
287 index 76747d94c7602..bf4ab30186aff 100644
288 --- a/drivers/net/can/usb/gs_usb.c
289 +++ b/drivers/net/can/usb/gs_usb.c
290 @@ -184,6 +184,8 @@ struct gs_can {
291
292 struct usb_anchor tx_submitted;
293 atomic_t active_tx_urbs;
294 + void *rxbuf[GS_MAX_RX_URBS];
295 + dma_addr_t rxbuf_dma[GS_MAX_RX_URBS];
296 };
297
298 /* usb interface struct */
299 @@ -592,6 +594,7 @@ static int gs_can_open(struct net_device *netdev)
300 for (i = 0; i < GS_MAX_RX_URBS; i++) {
301 struct urb *urb;
302 u8 *buf;
303 + dma_addr_t buf_dma;
304
305 /* alloc rx urb */
306 urb = usb_alloc_urb(0, GFP_KERNEL);
307 @@ -602,7 +605,7 @@ static int gs_can_open(struct net_device *netdev)
308 buf = usb_alloc_coherent(dev->udev,
309 sizeof(struct gs_host_frame),
310 GFP_KERNEL,
311 - &urb->transfer_dma);
312 + &buf_dma);
313 if (!buf) {
314 netdev_err(netdev,
315 "No memory left for USB buffer\n");
316 @@ -610,6 +613,8 @@ static int gs_can_open(struct net_device *netdev)
317 return -ENOMEM;
318 }
319
320 + urb->transfer_dma = buf_dma;
321 +
322 /* fill, anchor, and submit rx urb */
323 usb_fill_bulk_urb(urb,
324 dev->udev,
325 @@ -633,10 +638,17 @@ static int gs_can_open(struct net_device *netdev)
326 rc);
327
328 usb_unanchor_urb(urb);
329 + usb_free_coherent(dev->udev,
330 + sizeof(struct gs_host_frame),
331 + buf,
332 + buf_dma);
333 usb_free_urb(urb);
334 break;
335 }
336
337 + dev->rxbuf[i] = buf;
338 + dev->rxbuf_dma[i] = buf_dma;
339 +
340 /* Drop reference,
341 * USB core will take care of freeing it
342 */
343 @@ -701,13 +713,20 @@ static int gs_can_close(struct net_device *netdev)
344 int rc;
345 struct gs_can *dev = netdev_priv(netdev);
346 struct gs_usb *parent = dev->parent;
347 + unsigned int i;
348
349 netif_stop_queue(netdev);
350
351 /* Stop polling */
352 parent->active_channels--;
353 - if (!parent->active_channels)
354 + if (!parent->active_channels) {
355 usb_kill_anchored_urbs(&parent->rx_submitted);
356 + for (i = 0; i < GS_MAX_RX_URBS; i++)
357 + usb_free_coherent(dev->udev,
358 + sizeof(struct gs_host_frame),
359 + dev->rxbuf[i],
360 + dev->rxbuf_dma[i]);
361 + }
362
363 /* Stop sending URBs */
364 usb_kill_anchored_urbs(&dev->tx_submitted);
365 diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb.h b/drivers/net/can/usb/kvaser_usb/kvaser_usb.h
366 index 390b6bde883c8..61e67986b625e 100644
367 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb.h
368 +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb.h
369 @@ -35,9 +35,10 @@
370 #define KVASER_USB_RX_BUFFER_SIZE 3072
371 #define KVASER_USB_MAX_NET_DEVICES 5
372
373 -/* USB devices features */
374 -#define KVASER_USB_HAS_SILENT_MODE BIT(0)
375 -#define KVASER_USB_HAS_TXRX_ERRORS BIT(1)
376 +/* Kvaser USB device quirks */
377 +#define KVASER_USB_QUIRK_HAS_SILENT_MODE BIT(0)
378 +#define KVASER_USB_QUIRK_HAS_TXRX_ERRORS BIT(1)
379 +#define KVASER_USB_QUIRK_IGNORE_CLK_FREQ BIT(2)
380
381 /* Device capabilities */
382 #define KVASER_USB_CAP_BERR_CAP 0x01
383 @@ -65,12 +66,7 @@ struct kvaser_usb_dev_card_data_hydra {
384 struct kvaser_usb_dev_card_data {
385 u32 ctrlmode_supported;
386 u32 capabilities;
387 - union {
388 - struct {
389 - enum kvaser_usb_leaf_family family;
390 - } leaf;
391 - struct kvaser_usb_dev_card_data_hydra hydra;
392 - };
393 + struct kvaser_usb_dev_card_data_hydra hydra;
394 };
395
396 /* Context for an outstanding, not yet ACKed, transmission */
397 @@ -84,7 +80,7 @@ struct kvaser_usb {
398 struct usb_device *udev;
399 struct usb_interface *intf;
400 struct kvaser_usb_net_priv *nets[KVASER_USB_MAX_NET_DEVICES];
401 - const struct kvaser_usb_dev_ops *ops;
402 + const struct kvaser_usb_driver_info *driver_info;
403 const struct kvaser_usb_dev_cfg *cfg;
404
405 struct usb_endpoint_descriptor *bulk_in, *bulk_out;
406 @@ -166,6 +162,12 @@ struct kvaser_usb_dev_ops {
407 int *cmd_len, u16 transid);
408 };
409
410 +struct kvaser_usb_driver_info {
411 + u32 quirks;
412 + enum kvaser_usb_leaf_family family;
413 + const struct kvaser_usb_dev_ops *ops;
414 +};
415 +
416 struct kvaser_usb_dev_cfg {
417 const struct can_clock clock;
418 const unsigned int timestamp_freq;
419 @@ -185,4 +187,7 @@ int kvaser_usb_send_cmd_async(struct kvaser_usb_net_priv *priv, void *cmd,
420 int len);
421
422 int kvaser_usb_can_rx_over_error(struct net_device *netdev);
423 +
424 +extern const struct can_bittiming_const kvaser_usb_flexc_bittiming_const;
425 +
426 #endif /* KVASER_USB_H */
427 diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
428 index 0f1d3e807d631..416763fd1f11c 100644
429 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
430 +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
431 @@ -79,104 +79,134 @@
432 #define USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID 269
433 #define USB_HYBRID_PRO_CANLIN_PRODUCT_ID 270
434
435 -static inline bool kvaser_is_leaf(const struct usb_device_id *id)
436 -{
437 - return (id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID &&
438 - id->idProduct <= USB_CAN_R_PRODUCT_ID) ||
439 - (id->idProduct >= USB_LEAF_LITE_V2_PRODUCT_ID &&
440 - id->idProduct <= USB_MINI_PCIE_2HS_PRODUCT_ID);
441 -}
442 +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_hydra = {
443 + .quirks = 0,
444 + .ops = &kvaser_usb_hydra_dev_ops,
445 +};
446
447 -static inline bool kvaser_is_usbcan(const struct usb_device_id *id)
448 -{
449 - return id->idProduct >= USB_USBCAN_REVB_PRODUCT_ID &&
450 - id->idProduct <= USB_MEMORATOR_PRODUCT_ID;
451 -}
452 +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_usbcan = {
453 + .quirks = KVASER_USB_QUIRK_HAS_TXRX_ERRORS |
454 + KVASER_USB_QUIRK_HAS_SILENT_MODE,
455 + .family = KVASER_USBCAN,
456 + .ops = &kvaser_usb_leaf_dev_ops,
457 +};
458
459 -static inline bool kvaser_is_hydra(const struct usb_device_id *id)
460 -{
461 - return id->idProduct >= USB_BLACKBIRD_V2_PRODUCT_ID &&
462 - id->idProduct <= USB_HYBRID_PRO_CANLIN_PRODUCT_ID;
463 -}
464 +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf = {
465 + .quirks = KVASER_USB_QUIRK_IGNORE_CLK_FREQ,
466 + .family = KVASER_LEAF,
467 + .ops = &kvaser_usb_leaf_dev_ops,
468 +};
469 +
470 +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf_err = {
471 + .quirks = KVASER_USB_QUIRK_HAS_TXRX_ERRORS |
472 + KVASER_USB_QUIRK_IGNORE_CLK_FREQ,
473 + .family = KVASER_LEAF,
474 + .ops = &kvaser_usb_leaf_dev_ops,
475 +};
476 +
477 +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leaf_err_listen = {
478 + .quirks = KVASER_USB_QUIRK_HAS_TXRX_ERRORS |
479 + KVASER_USB_QUIRK_HAS_SILENT_MODE |
480 + KVASER_USB_QUIRK_IGNORE_CLK_FREQ,
481 + .family = KVASER_LEAF,
482 + .ops = &kvaser_usb_leaf_dev_ops,
483 +};
484 +
485 +static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leafimx = {
486 + .quirks = 0,
487 + .ops = &kvaser_usb_leaf_dev_ops,
488 +};
489
490 static const struct usb_device_id kvaser_usb_table[] = {
491 - /* Leaf USB product IDs */
492 - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID) },
493 - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID) },
494 + /* Leaf M32C USB product IDs */
495 + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_DEVEL_PRODUCT_ID),
496 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf },
497 + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_PRODUCT_ID),
498 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf },
499 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_PRODUCT_ID),
500 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
501 - KVASER_USB_HAS_SILENT_MODE },
502 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
503 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_PRODUCT_ID),
504 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
505 - KVASER_USB_HAS_SILENT_MODE },
506 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
507 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_LS_PRODUCT_ID),
508 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
509 - KVASER_USB_HAS_SILENT_MODE },
510 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
511 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_SWC_PRODUCT_ID),
512 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
513 - KVASER_USB_HAS_SILENT_MODE },
514 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
515 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_LIN_PRODUCT_ID),
516 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
517 - KVASER_USB_HAS_SILENT_MODE },
518 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
519 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_LS_PRODUCT_ID),
520 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
521 - KVASER_USB_HAS_SILENT_MODE },
522 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
523 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_SPRO_SWC_PRODUCT_ID),
524 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
525 - KVASER_USB_HAS_SILENT_MODE },
526 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
527 { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_DEVEL_PRODUCT_ID),
528 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
529 - KVASER_USB_HAS_SILENT_MODE },
530 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
531 { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_HSHS_PRODUCT_ID),
532 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
533 - KVASER_USB_HAS_SILENT_MODE },
534 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
535 { USB_DEVICE(KVASER_VENDOR_ID, USB_UPRO_HSHS_PRODUCT_ID),
536 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
537 - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_GI_PRODUCT_ID) },
538 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err },
539 + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_GI_PRODUCT_ID),
540 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf },
541 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_OBDII_PRODUCT_ID),
542 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS |
543 - KVASER_USB_HAS_SILENT_MODE },
544 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err_listen },
545 { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO2_HSLS_PRODUCT_ID),
546 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
547 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err },
548 { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_CH_PRODUCT_ID),
549 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
550 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err },
551 { USB_DEVICE(KVASER_VENDOR_ID, USB_BLACKBIRD_SPRO_PRODUCT_ID),
552 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
553 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err },
554 { USB_DEVICE(KVASER_VENDOR_ID, USB_OEM_MERCURY_PRODUCT_ID),
555 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
556 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err },
557 { USB_DEVICE(KVASER_VENDOR_ID, USB_OEM_LEAF_PRODUCT_ID),
558 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
559 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err },
560 { USB_DEVICE(KVASER_VENDOR_ID, USB_CAN_R_PRODUCT_ID),
561 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
562 - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) },
563 - { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) },
564 - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID) },
565 - { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_2HS_PRODUCT_ID) },
566 - { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_2HS_PRODUCT_ID) },
567 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leaf_err },
568 +
569 + /* Leaf i.MX28 USB product IDs */
570 + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID),
571 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx },
572 + { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID),
573 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx },
574 + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID),
575 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx },
576 + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_2HS_PRODUCT_ID),
577 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx },
578 + { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_2HS_PRODUCT_ID),
579 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_leafimx },
580
581 /* USBCANII USB product IDs */
582 { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID),
583 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
584 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_usbcan },
585 { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_REVB_PRODUCT_ID),
586 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
587 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_usbcan },
588 { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMORATOR_PRODUCT_ID),
589 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
590 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_usbcan },
591 { USB_DEVICE(KVASER_VENDOR_ID, USB_VCI2_PRODUCT_ID),
592 - .driver_info = KVASER_USB_HAS_TXRX_ERRORS },
593 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_usbcan },
594
595 /* Minihydra USB product IDs */
596 - { USB_DEVICE(KVASER_VENDOR_ID, USB_BLACKBIRD_V2_PRODUCT_ID) },
597 - { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_5HS_PRODUCT_ID) },
598 - { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_5HS_PRODUCT_ID) },
599 - { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_4HS_PRODUCT_ID) },
600 - { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_HS_V2_PRODUCT_ID) },
601 - { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_2HS_V2_PRODUCT_ID) },
602 - { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_2HS_PRODUCT_ID) },
603 - { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_2HS_V2_PRODUCT_ID) },
604 - { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_CANLIN_PRODUCT_ID) },
605 - { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID) },
606 - { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID) },
607 - { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_PRO_CANLIN_PRODUCT_ID) },
608 + { USB_DEVICE(KVASER_VENDOR_ID, USB_BLACKBIRD_V2_PRODUCT_ID),
609 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
610 + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_5HS_PRODUCT_ID),
611 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
612 + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_5HS_PRODUCT_ID),
613 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
614 + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_4HS_PRODUCT_ID),
615 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
616 + { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_PRO_HS_V2_PRODUCT_ID),
617 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
618 + { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_2HS_V2_PRODUCT_ID),
619 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
620 + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_2HS_PRODUCT_ID),
621 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
622 + { USB_DEVICE(KVASER_VENDOR_ID, USB_MEMO_PRO_2HS_V2_PRODUCT_ID),
623 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
624 + { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_CANLIN_PRODUCT_ID),
625 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
626 + { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID),
627 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
628 + { USB_DEVICE(KVASER_VENDOR_ID, USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID),
629 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
630 + { USB_DEVICE(KVASER_VENDOR_ID, USB_HYBRID_PRO_CANLIN_PRODUCT_ID),
631 + .driver_info = (kernel_ulong_t)&kvaser_usb_driver_info_hydra },
632 { }
633 };
634 MODULE_DEVICE_TABLE(usb, kvaser_usb_table);
635 @@ -267,6 +297,7 @@ int kvaser_usb_can_rx_over_error(struct net_device *netdev)
636 static void kvaser_usb_read_bulk_callback(struct urb *urb)
637 {
638 struct kvaser_usb *dev = urb->context;
639 + const struct kvaser_usb_dev_ops *ops = dev->driver_info->ops;
640 int err;
641 unsigned int i;
642
643 @@ -283,8 +314,8 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
644 goto resubmit_urb;
645 }
646
647 - dev->ops->dev_read_bulk_callback(dev, urb->transfer_buffer,
648 - urb->actual_length);
649 + ops->dev_read_bulk_callback(dev, urb->transfer_buffer,
650 + urb->actual_length);
651
652 resubmit_urb:
653 usb_fill_bulk_urb(urb, dev->udev,
654 @@ -378,6 +409,7 @@ static int kvaser_usb_open(struct net_device *netdev)
655 {
656 struct kvaser_usb_net_priv *priv = netdev_priv(netdev);
657 struct kvaser_usb *dev = priv->dev;
658 + const struct kvaser_usb_dev_ops *ops = dev->driver_info->ops;
659 int err;
660
661 err = open_candev(netdev);
662 @@ -388,11 +420,11 @@ static int kvaser_usb_open(struct net_device *netdev)
663 if (err)
664 goto error;
665
666 - err = dev->ops->dev_set_opt_mode(priv);
667 + err = ops->dev_set_opt_mode(priv);
668 if (err)
669 goto error;
670
671 - err = dev->ops->dev_start_chip(priv);
672 + err = ops->dev_start_chip(priv);
673 if (err) {
674 netdev_warn(netdev, "Cannot start device, error %d\n", err);
675 goto error;
676 @@ -449,22 +481,23 @@ static int kvaser_usb_close(struct net_device *netdev)
677 {
678 struct kvaser_usb_net_priv *priv = netdev_priv(netdev);
679 struct kvaser_usb *dev = priv->dev;
680 + const struct kvaser_usb_dev_ops *ops = dev->driver_info->ops;
681 int err;
682
683 netif_stop_queue(netdev);
684
685 - err = dev->ops->dev_flush_queue(priv);
686 + err = ops->dev_flush_queue(priv);
687 if (err)
688 netdev_warn(netdev, "Cannot flush queue, error %d\n", err);
689
690 - if (dev->ops->dev_reset_chip) {
691 - err = dev->ops->dev_reset_chip(dev, priv->channel);
692 + if (ops->dev_reset_chip) {
693 + err = ops->dev_reset_chip(dev, priv->channel);
694 if (err)
695 netdev_warn(netdev, "Cannot reset card, error %d\n",
696 err);
697 }
698
699 - err = dev->ops->dev_stop_chip(priv);
700 + err = ops->dev_stop_chip(priv);
701 if (err)
702 netdev_warn(netdev, "Cannot stop device, error %d\n", err);
703
704 @@ -503,6 +536,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
705 {
706 struct kvaser_usb_net_priv *priv = netdev_priv(netdev);
707 struct kvaser_usb *dev = priv->dev;
708 + const struct kvaser_usb_dev_ops *ops = dev->driver_info->ops;
709 struct net_device_stats *stats = &netdev->stats;
710 struct kvaser_usb_tx_urb_context *context = NULL;
711 struct urb *urb;
712 @@ -545,8 +579,8 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb,
713 goto freeurb;
714 }
715
716 - buf = dev->ops->dev_frame_to_cmd(priv, skb, &context->dlc, &cmd_len,
717 - context->echo_index);
718 + buf = ops->dev_frame_to_cmd(priv, skb, &context->dlc, &cmd_len,
719 + context->echo_index);
720 if (!buf) {
721 stats->tx_dropped++;
722 dev_kfree_skb(skb);
723 @@ -630,15 +664,16 @@ static void kvaser_usb_remove_interfaces(struct kvaser_usb *dev)
724 }
725 }
726
727 -static int kvaser_usb_init_one(struct kvaser_usb *dev,
728 - const struct usb_device_id *id, int channel)
729 +static int kvaser_usb_init_one(struct kvaser_usb *dev, int channel)
730 {
731 struct net_device *netdev;
732 struct kvaser_usb_net_priv *priv;
733 + const struct kvaser_usb_driver_info *driver_info = dev->driver_info;
734 + const struct kvaser_usb_dev_ops *ops = driver_info->ops;
735 int err;
736
737 - if (dev->ops->dev_reset_chip) {
738 - err = dev->ops->dev_reset_chip(dev, channel);
739 + if (ops->dev_reset_chip) {
740 + err = ops->dev_reset_chip(dev, channel);
741 if (err)
742 return err;
743 }
744 @@ -667,20 +702,19 @@ static int kvaser_usb_init_one(struct kvaser_usb *dev,
745 priv->can.state = CAN_STATE_STOPPED;
746 priv->can.clock.freq = dev->cfg->clock.freq;
747 priv->can.bittiming_const = dev->cfg->bittiming_const;
748 - priv->can.do_set_bittiming = dev->ops->dev_set_bittiming;
749 - priv->can.do_set_mode = dev->ops->dev_set_mode;
750 - if ((id->driver_info & KVASER_USB_HAS_TXRX_ERRORS) ||
751 + priv->can.do_set_bittiming = ops->dev_set_bittiming;
752 + priv->can.do_set_mode = ops->dev_set_mode;
753 + if ((driver_info->quirks & KVASER_USB_QUIRK_HAS_TXRX_ERRORS) ||
754 (priv->dev->card_data.capabilities & KVASER_USB_CAP_BERR_CAP))
755 - priv->can.do_get_berr_counter = dev->ops->dev_get_berr_counter;
756 - if (id->driver_info & KVASER_USB_HAS_SILENT_MODE)
757 + priv->can.do_get_berr_counter = ops->dev_get_berr_counter;
758 + if (driver_info->quirks & KVASER_USB_QUIRK_HAS_SILENT_MODE)
759 priv->can.ctrlmode_supported |= CAN_CTRLMODE_LISTENONLY;
760
761 priv->can.ctrlmode_supported |= dev->card_data.ctrlmode_supported;
762
763 if (priv->can.ctrlmode_supported & CAN_CTRLMODE_FD) {
764 priv->can.data_bittiming_const = dev->cfg->data_bittiming_const;
765 - priv->can.do_set_data_bittiming =
766 - dev->ops->dev_set_data_bittiming;
767 + priv->can.do_set_data_bittiming = ops->dev_set_data_bittiming;
768 }
769
770 netdev->flags |= IFF_ECHO;
771 @@ -711,29 +745,22 @@ static int kvaser_usb_probe(struct usb_interface *intf,
772 struct kvaser_usb *dev;
773 int err;
774 int i;
775 + const struct kvaser_usb_driver_info *driver_info;
776 + const struct kvaser_usb_dev_ops *ops;
777 +
778 + driver_info = (const struct kvaser_usb_driver_info *)id->driver_info;
779 + if (!driver_info)
780 + return -ENODEV;
781
782 dev = devm_kzalloc(&intf->dev, sizeof(*dev), GFP_KERNEL);
783 if (!dev)
784 return -ENOMEM;
785
786 - if (kvaser_is_leaf(id)) {
787 - dev->card_data.leaf.family = KVASER_LEAF;
788 - dev->ops = &kvaser_usb_leaf_dev_ops;
789 - } else if (kvaser_is_usbcan(id)) {
790 - dev->card_data.leaf.family = KVASER_USBCAN;
791 - dev->ops = &kvaser_usb_leaf_dev_ops;
792 - } else if (kvaser_is_hydra(id)) {
793 - dev->ops = &kvaser_usb_hydra_dev_ops;
794 - } else {
795 - dev_err(&intf->dev,
796 - "Product ID (%d) is not a supported Kvaser USB device\n",
797 - id->idProduct);
798 - return -ENODEV;
799 - }
800 -
801 dev->intf = intf;
802 + dev->driver_info = driver_info;
803 + ops = driver_info->ops;
804
805 - err = dev->ops->dev_setup_endpoints(dev);
806 + err = ops->dev_setup_endpoints(dev);
807 if (err) {
808 dev_err(&intf->dev, "Cannot get usb endpoint(s)");
809 return err;
810 @@ -747,22 +774,22 @@ static int kvaser_usb_probe(struct usb_interface *intf,
811
812 dev->card_data.ctrlmode_supported = 0;
813 dev->card_data.capabilities = 0;
814 - err = dev->ops->dev_init_card(dev);
815 + err = ops->dev_init_card(dev);
816 if (err) {
817 dev_err(&intf->dev,
818 "Failed to initialize card, error %d\n", err);
819 return err;
820 }
821
822 - err = dev->ops->dev_get_software_info(dev);
823 + err = ops->dev_get_software_info(dev);
824 if (err) {
825 dev_err(&intf->dev,
826 "Cannot get software info, error %d\n", err);
827 return err;
828 }
829
830 - if (dev->ops->dev_get_software_details) {
831 - err = dev->ops->dev_get_software_details(dev);
832 + if (ops->dev_get_software_details) {
833 + err = ops->dev_get_software_details(dev);
834 if (err) {
835 dev_err(&intf->dev,
836 "Cannot get software details, error %d\n", err);
837 @@ -780,14 +807,14 @@ static int kvaser_usb_probe(struct usb_interface *intf,
838
839 dev_dbg(&intf->dev, "Max outstanding tx = %d URBs\n", dev->max_tx_urbs);
840
841 - err = dev->ops->dev_get_card_info(dev);
842 + err = ops->dev_get_card_info(dev);
843 if (err) {
844 dev_err(&intf->dev, "Cannot get card info, error %d\n", err);
845 return err;
846 }
847
848 - if (dev->ops->dev_get_capabilities) {
849 - err = dev->ops->dev_get_capabilities(dev);
850 + if (ops->dev_get_capabilities) {
851 + err = ops->dev_get_capabilities(dev);
852 if (err) {
853 dev_err(&intf->dev,
854 "Cannot get capabilities, error %d\n", err);
855 @@ -797,7 +824,7 @@ static int kvaser_usb_probe(struct usb_interface *intf,
856 }
857
858 for (i = 0; i < dev->nchannels; i++) {
859 - err = kvaser_usb_init_one(dev, id, i);
860 + err = kvaser_usb_init_one(dev, i);
861 if (err) {
862 kvaser_usb_remove_interfaces(dev);
863 return err;
864 diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
865 index 218fadc911558..a7c408acb0c09 100644
866 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
867 +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
868 @@ -371,7 +371,7 @@ static const struct can_bittiming_const kvaser_usb_hydra_kcan_bittiming_c = {
869 .brp_inc = 1,
870 };
871
872 -static const struct can_bittiming_const kvaser_usb_hydra_flexc_bittiming_c = {
873 +const struct can_bittiming_const kvaser_usb_flexc_bittiming_const = {
874 .name = "kvaser_usb_flex",
875 .tseg1_min = 4,
876 .tseg1_max = 16,
877 @@ -2024,5 +2024,5 @@ static const struct kvaser_usb_dev_cfg kvaser_usb_hydra_dev_cfg_flexc = {
878 .freq = 24000000,
879 },
880 .timestamp_freq = 1,
881 - .bittiming_const = &kvaser_usb_hydra_flexc_bittiming_c,
882 + .bittiming_const = &kvaser_usb_flexc_bittiming_const,
883 };
884 diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
885 index 8b5d1add899a6..0e0403dd05500 100644
886 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
887 +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
888 @@ -100,16 +100,6 @@
889 #define USBCAN_ERROR_STATE_RX_ERROR BIT(1)
890 #define USBCAN_ERROR_STATE_BUSERROR BIT(2)
891
892 -/* bittiming parameters */
893 -#define KVASER_USB_TSEG1_MIN 1
894 -#define KVASER_USB_TSEG1_MAX 16
895 -#define KVASER_USB_TSEG2_MIN 1
896 -#define KVASER_USB_TSEG2_MAX 8
897 -#define KVASER_USB_SJW_MAX 4
898 -#define KVASER_USB_BRP_MIN 1
899 -#define KVASER_USB_BRP_MAX 64
900 -#define KVASER_USB_BRP_INC 1
901 -
902 /* ctrl modes */
903 #define KVASER_CTRL_MODE_NORMAL 1
904 #define KVASER_CTRL_MODE_SILENT 2
905 @@ -342,48 +332,68 @@ struct kvaser_usb_err_summary {
906 };
907 };
908
909 -static const struct can_bittiming_const kvaser_usb_leaf_bittiming_const = {
910 - .name = "kvaser_usb",
911 - .tseg1_min = KVASER_USB_TSEG1_MIN,
912 - .tseg1_max = KVASER_USB_TSEG1_MAX,
913 - .tseg2_min = KVASER_USB_TSEG2_MIN,
914 - .tseg2_max = KVASER_USB_TSEG2_MAX,
915 - .sjw_max = KVASER_USB_SJW_MAX,
916 - .brp_min = KVASER_USB_BRP_MIN,
917 - .brp_max = KVASER_USB_BRP_MAX,
918 - .brp_inc = KVASER_USB_BRP_INC,
919 +static const struct can_bittiming_const kvaser_usb_leaf_m16c_bittiming_const = {
920 + .name = "kvaser_usb_ucii",
921 + .tseg1_min = 4,
922 + .tseg1_max = 16,
923 + .tseg2_min = 2,
924 + .tseg2_max = 8,
925 + .sjw_max = 4,
926 + .brp_min = 1,
927 + .brp_max = 16,
928 + .brp_inc = 1,
929 +};
930 +
931 +static const struct can_bittiming_const kvaser_usb_leaf_m32c_bittiming_const = {
932 + .name = "kvaser_usb_leaf",
933 + .tseg1_min = 3,
934 + .tseg1_max = 16,
935 + .tseg2_min = 2,
936 + .tseg2_max = 8,
937 + .sjw_max = 4,
938 + .brp_min = 2,
939 + .brp_max = 128,
940 + .brp_inc = 2,
941 };
942
943 -static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_8mhz = {
944 +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_usbcan_dev_cfg = {
945 .clock = {
946 .freq = 8000000,
947 },
948 .timestamp_freq = 1,
949 - .bittiming_const = &kvaser_usb_leaf_bittiming_const,
950 + .bittiming_const = &kvaser_usb_leaf_m16c_bittiming_const,
951 +};
952 +
953 +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_m32c_dev_cfg = {
954 + .clock = {
955 + .freq = 16000000,
956 + },
957 + .timestamp_freq = 1,
958 + .bittiming_const = &kvaser_usb_leaf_m32c_bittiming_const,
959 };
960
961 -static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_16mhz = {
962 +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_16mhz = {
963 .clock = {
964 .freq = 16000000,
965 },
966 .timestamp_freq = 1,
967 - .bittiming_const = &kvaser_usb_leaf_bittiming_const,
968 + .bittiming_const = &kvaser_usb_flexc_bittiming_const,
969 };
970
971 -static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_24mhz = {
972 +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_24mhz = {
973 .clock = {
974 .freq = 24000000,
975 },
976 .timestamp_freq = 1,
977 - .bittiming_const = &kvaser_usb_leaf_bittiming_const,
978 + .bittiming_const = &kvaser_usb_flexc_bittiming_const,
979 };
980
981 -static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_dev_cfg_32mhz = {
982 +static const struct kvaser_usb_dev_cfg kvaser_usb_leaf_imx_dev_cfg_32mhz = {
983 .clock = {
984 .freq = 32000000,
985 },
986 .timestamp_freq = 1,
987 - .bittiming_const = &kvaser_usb_leaf_bittiming_const,
988 + .bittiming_const = &kvaser_usb_flexc_bittiming_const,
989 };
990
991 static void *
992 @@ -405,7 +415,7 @@ kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv,
993 sizeof(struct kvaser_cmd_tx_can);
994 cmd->u.tx_can.channel = priv->channel;
995
996 - switch (dev->card_data.leaf.family) {
997 + switch (dev->driver_info->family) {
998 case KVASER_LEAF:
999 cmd_tx_can_flags = &cmd->u.tx_can.leaf.flags;
1000 break;
1001 @@ -525,16 +535,23 @@ static void kvaser_usb_leaf_get_software_info_leaf(struct kvaser_usb *dev,
1002 dev->fw_version = le32_to_cpu(softinfo->fw_version);
1003 dev->max_tx_urbs = le16_to_cpu(softinfo->max_outstanding_tx);
1004
1005 - switch (sw_options & KVASER_USB_LEAF_SWOPTION_FREQ_MASK) {
1006 - case KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK:
1007 - dev->cfg = &kvaser_usb_leaf_dev_cfg_16mhz;
1008 - break;
1009 - case KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK:
1010 - dev->cfg = &kvaser_usb_leaf_dev_cfg_24mhz;
1011 - break;
1012 - case KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK:
1013 - dev->cfg = &kvaser_usb_leaf_dev_cfg_32mhz;
1014 - break;
1015 + if (dev->driver_info->quirks & KVASER_USB_QUIRK_IGNORE_CLK_FREQ) {
1016 + /* Firmware expects bittiming parameters calculated for 16MHz
1017 + * clock, regardless of the actual clock
1018 + */
1019 + dev->cfg = &kvaser_usb_leaf_m32c_dev_cfg;
1020 + } else {
1021 + switch (sw_options & KVASER_USB_LEAF_SWOPTION_FREQ_MASK) {
1022 + case KVASER_USB_LEAF_SWOPTION_FREQ_16_MHZ_CLK:
1023 + dev->cfg = &kvaser_usb_leaf_imx_dev_cfg_16mhz;
1024 + break;
1025 + case KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK:
1026 + dev->cfg = &kvaser_usb_leaf_imx_dev_cfg_24mhz;
1027 + break;
1028 + case KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK:
1029 + dev->cfg = &kvaser_usb_leaf_imx_dev_cfg_32mhz;
1030 + break;
1031 + }
1032 }
1033 }
1034
1035 @@ -551,7 +568,7 @@ static int kvaser_usb_leaf_get_software_info_inner(struct kvaser_usb *dev)
1036 if (err)
1037 return err;
1038
1039 - switch (dev->card_data.leaf.family) {
1040 + switch (dev->driver_info->family) {
1041 case KVASER_LEAF:
1042 kvaser_usb_leaf_get_software_info_leaf(dev, &cmd.u.leaf.softinfo);
1043 break;
1044 @@ -559,7 +576,7 @@ static int kvaser_usb_leaf_get_software_info_inner(struct kvaser_usb *dev)
1045 dev->fw_version = le32_to_cpu(cmd.u.usbcan.softinfo.fw_version);
1046 dev->max_tx_urbs =
1047 le16_to_cpu(cmd.u.usbcan.softinfo.max_outstanding_tx);
1048 - dev->cfg = &kvaser_usb_leaf_dev_cfg_8mhz;
1049 + dev->cfg = &kvaser_usb_leaf_usbcan_dev_cfg;
1050 break;
1051 }
1052
1053 @@ -598,7 +615,7 @@ static int kvaser_usb_leaf_get_card_info(struct kvaser_usb *dev)
1054
1055 dev->nchannels = cmd.u.cardinfo.nchannels;
1056 if (dev->nchannels > KVASER_USB_MAX_NET_DEVICES ||
1057 - (dev->card_data.leaf.family == KVASER_USBCAN &&
1058 + (dev->driver_info->family == KVASER_USBCAN &&
1059 dev->nchannels > MAX_USBCAN_NET_DEVICES))
1060 return -EINVAL;
1061
1062 @@ -734,7 +751,7 @@ kvaser_usb_leaf_rx_error_update_can_state(struct kvaser_usb_net_priv *priv,
1063 new_state < CAN_STATE_BUS_OFF)
1064 priv->can.can_stats.restarts++;
1065
1066 - switch (dev->card_data.leaf.family) {
1067 + switch (dev->driver_info->family) {
1068 case KVASER_LEAF:
1069 if (es->leaf.error_factor) {
1070 priv->can.can_stats.bus_error++;
1071 @@ -813,7 +830,7 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,
1072 }
1073 }
1074
1075 - switch (dev->card_data.leaf.family) {
1076 + switch (dev->driver_info->family) {
1077 case KVASER_LEAF:
1078 if (es->leaf.error_factor) {
1079 cf->can_id |= CAN_ERR_BUSERROR | CAN_ERR_PROT;
1080 @@ -1005,7 +1022,7 @@ static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
1081 stats = &priv->netdev->stats;
1082
1083 if ((cmd->u.rx_can_header.flag & MSG_FLAG_ERROR_FRAME) &&
1084 - (dev->card_data.leaf.family == KVASER_LEAF &&
1085 + (dev->driver_info->family == KVASER_LEAF &&
1086 cmd->id == CMD_LEAF_LOG_MESSAGE)) {
1087 kvaser_usb_leaf_leaf_rx_error(dev, cmd);
1088 return;
1089 @@ -1021,7 +1038,7 @@ static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
1090 return;
1091 }
1092
1093 - switch (dev->card_data.leaf.family) {
1094 + switch (dev->driver_info->family) {
1095 case KVASER_LEAF:
1096 rx_data = cmd->u.leaf.rx_can.data;
1097 break;
1098 @@ -1036,7 +1053,7 @@ static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
1099 return;
1100 }
1101
1102 - if (dev->card_data.leaf.family == KVASER_LEAF && cmd->id ==
1103 + if (dev->driver_info->family == KVASER_LEAF && cmd->id ==
1104 CMD_LEAF_LOG_MESSAGE) {
1105 cf->can_id = le32_to_cpu(cmd->u.leaf.log_message.id);
1106 if (cf->can_id & KVASER_EXTENDED_FRAME)
1107 @@ -1133,14 +1150,14 @@ static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev,
1108 break;
1109
1110 case CMD_LEAF_LOG_MESSAGE:
1111 - if (dev->card_data.leaf.family != KVASER_LEAF)
1112 + if (dev->driver_info->family != KVASER_LEAF)
1113 goto warn;
1114 kvaser_usb_leaf_rx_can_msg(dev, cmd);
1115 break;
1116
1117 case CMD_CHIP_STATE_EVENT:
1118 case CMD_CAN_ERROR_EVENT:
1119 - if (dev->card_data.leaf.family == KVASER_LEAF)
1120 + if (dev->driver_info->family == KVASER_LEAF)
1121 kvaser_usb_leaf_leaf_rx_error(dev, cmd);
1122 else
1123 kvaser_usb_leaf_usbcan_rx_error(dev, cmd);
1124 @@ -1152,12 +1169,12 @@ static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev,
1125
1126 /* Ignored commands */
1127 case CMD_USBCAN_CLOCK_OVERFLOW_EVENT:
1128 - if (dev->card_data.leaf.family != KVASER_USBCAN)
1129 + if (dev->driver_info->family != KVASER_USBCAN)
1130 goto warn;
1131 break;
1132
1133 case CMD_FLUSH_QUEUE_REPLY:
1134 - if (dev->card_data.leaf.family != KVASER_LEAF)
1135 + if (dev->driver_info->family != KVASER_LEAF)
1136 goto warn;
1137 break;
1138
1139 diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
1140 index 34bf6f4eef4ab..bc313d85fe13a 100644
1141 --- a/drivers/net/ethernet/ibm/ibmvnic.c
1142 +++ b/drivers/net/ethernet/ibm/ibmvnic.c
1143 @@ -5022,6 +5022,15 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
1144 release_sub_crqs(adapter, 0);
1145 rc = init_sub_crqs(adapter);
1146 } else {
1147 + /* no need to reinitialize completely, but we do
1148 + * need to clean up transmits that were in flight
1149 + * when we processed the reset. Failure to do so
1150 + * will confound the upper layer, usually TCP, by
1151 + * creating the illusion of transmits that are
1152 + * awaiting completion.
1153 + */
1154 + clean_tx_pools(adapter);
1155 +
1156 rc = reset_sub_crq_queues(adapter);
1157 }
1158 } else {
1159 diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
1160 index 997936c3a30fd..6598a4cba158a 100644
1161 --- a/drivers/net/usb/usbnet.c
1162 +++ b/drivers/net/usb/usbnet.c
1163 @@ -2120,7 +2120,7 @@ static void usbnet_async_cmd_cb(struct urb *urb)
1164 int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
1165 u16 value, u16 index, const void *data, u16 size)
1166 {
1167 - struct usb_ctrlrequest *req = NULL;
1168 + struct usb_ctrlrequest *req;
1169 struct urb *urb;
1170 int err = -ENOMEM;
1171 void *buf = NULL;
1172 @@ -2138,7 +2138,7 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
1173 if (!buf) {
1174 netdev_err(dev->net, "Error allocating buffer"
1175 " in %s!\n", __func__);
1176 - goto fail_free;
1177 + goto fail_free_urb;
1178 }
1179 }
1180
1181 @@ -2162,14 +2162,21 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
1182 if (err < 0) {
1183 netdev_err(dev->net, "Error submitting the control"
1184 " message: status=%d\n", err);
1185 - goto fail_free;
1186 + goto fail_free_all;
1187 }
1188 return 0;
1189
1190 +fail_free_all:
1191 + kfree(req);
1192 fail_free_buf:
1193 kfree(buf);
1194 -fail_free:
1195 - kfree(req);
1196 + /*
1197 + * avoid a double free
1198 + * needed because the flag can be set only
1199 + * after filling the URB
1200 + */
1201 + urb->transfer_flags = 0;
1202 +fail_free_urb:
1203 usb_free_urb(urb);
1204 fail:
1205 return err;
1206 diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c
1207 index 4ada80317a3bd..b5c1a8f363f32 100644
1208 --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c
1209 +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c
1210 @@ -158,26 +158,26 @@ static const struct sunxi_desc_pin sun8i_a83t_pins[] = {
1211 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
1212 SUNXI_FUNCTION(0x0, "gpio_in"),
1213 SUNXI_FUNCTION(0x1, "gpio_out"),
1214 - SUNXI_FUNCTION(0x2, "nand"), /* DQ6 */
1215 + SUNXI_FUNCTION(0x2, "nand0"), /* DQ6 */
1216 SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
1217 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
1218 SUNXI_FUNCTION(0x0, "gpio_in"),
1219 SUNXI_FUNCTION(0x1, "gpio_out"),
1220 - SUNXI_FUNCTION(0x2, "nand"), /* DQ7 */
1221 + SUNXI_FUNCTION(0x2, "nand0"), /* DQ7 */
1222 SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
1223 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16),
1224 SUNXI_FUNCTION(0x0, "gpio_in"),
1225 SUNXI_FUNCTION(0x1, "gpio_out"),
1226 - SUNXI_FUNCTION(0x2, "nand"), /* DQS */
1227 + SUNXI_FUNCTION(0x2, "nand0"), /* DQS */
1228 SUNXI_FUNCTION(0x3, "mmc2")), /* RST */
1229 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 17),
1230 SUNXI_FUNCTION(0x0, "gpio_in"),
1231 SUNXI_FUNCTION(0x1, "gpio_out"),
1232 - SUNXI_FUNCTION(0x2, "nand")), /* CE2 */
1233 + SUNXI_FUNCTION(0x2, "nand0")), /* CE2 */
1234 SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 18),
1235 SUNXI_FUNCTION(0x0, "gpio_in"),
1236 SUNXI_FUNCTION(0x1, "gpio_out"),
1237 - SUNXI_FUNCTION(0x2, "nand")), /* CE3 */
1238 + SUNXI_FUNCTION(0x2, "nand0")), /* CE3 */
1239 /* Hole */
1240 SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
1241 SUNXI_FUNCTION(0x0, "gpio_in"),
1242 diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
1243 index 77783582080c7..c4052eab6bfcc 100644
1244 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
1245 +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
1246 @@ -536,6 +536,8 @@ static int sunxi_pconf_set(struct pinctrl_dev *pctldev, unsigned pin,
1247 struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
1248 int i;
1249
1250 + pin -= pctl->desc->pin_base;
1251 +
1252 for (i = 0; i < num_configs; i++) {
1253 enum pin_config_param param;
1254 unsigned long flags;
1255 diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
1256 index 1decded4845f7..8721b75131362 100644
1257 --- a/drivers/video/fbdev/core/fbcon.c
1258 +++ b/drivers/video/fbdev/core/fbcon.c
1259 @@ -2490,6 +2490,11 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
1260 if (charcount != 256 && charcount != 512)
1261 return -EINVAL;
1262
1263 + /* font bigger than screen resolution ? */
1264 + if (w > FBCON_SWAP(info->var.rotate, info->var.xres, info->var.yres) ||
1265 + h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
1266 + return -EINVAL;
1267 +
1268 /* Make sure drawing engine can handle the font */
1269 if (!(info->pixmap.blit_x & (1 << (font->width - 1))) ||
1270 !(info->pixmap.blit_y & (1 << (font->height - 1))))
1271 @@ -2756,6 +2761,34 @@ void fbcon_update_vcs(struct fb_info *info, bool all)
1272 }
1273 EXPORT_SYMBOL(fbcon_update_vcs);
1274
1275 +/* let fbcon check if it supports a new screen resolution */
1276 +int fbcon_modechange_possible(struct fb_info *info, struct fb_var_screeninfo *var)
1277 +{
1278 + struct fbcon_ops *ops = info->fbcon_par;
1279 + struct vc_data *vc;
1280 + unsigned int i;
1281 +
1282 + WARN_CONSOLE_UNLOCKED();
1283 +
1284 + if (!ops)
1285 + return 0;
1286 +
1287 + /* prevent setting a screen size which is smaller than font size */
1288 + for (i = first_fb_vc; i <= last_fb_vc; i++) {
1289 + vc = vc_cons[i].d;
1290 + if (!vc || vc->vc_mode != KD_TEXT ||
1291 + registered_fb[con2fb_map[i]] != info)
1292 + continue;
1293 +
1294 + if (vc->vc_font.width > FBCON_SWAP(var->rotate, var->xres, var->yres) ||
1295 + vc->vc_font.height > FBCON_SWAP(var->rotate, var->yres, var->xres))
1296 + return -EINVAL;
1297 + }
1298 +
1299 + return 0;
1300 +}
1301 +EXPORT_SYMBOL_GPL(fbcon_modechange_possible);
1302 +
1303 int fbcon_mode_deleted(struct fb_info *info,
1304 struct fb_videomode *mode)
1305 {
1306 diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
1307 index 03b1bf994cc90..23ce47655c931 100644
1308 --- a/drivers/video/fbdev/core/fbmem.c
1309 +++ b/drivers/video/fbdev/core/fbmem.c
1310 @@ -512,7 +512,7 @@ static int fb_show_logo_line(struct fb_info *info, int rotate,
1311
1312 while (n && (n * (logo->width + 8) - 8 > xres))
1313 --n;
1314 - image.dx = (xres - n * (logo->width + 8) - 8) / 2;
1315 + image.dx = (xres - (n * (logo->width + 8) - 8)) / 2;
1316 image.dy = y ?: (yres - logo->height) / 2;
1317 } else {
1318 image.dx = 0;
1319 @@ -1014,6 +1014,16 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
1320 if (ret)
1321 return ret;
1322
1323 + /* verify that virtual resolution >= physical resolution */
1324 + if (var->xres_virtual < var->xres ||
1325 + var->yres_virtual < var->yres) {
1326 + pr_warn("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n",
1327 + info->fix.id,
1328 + var->xres_virtual, var->yres_virtual,
1329 + var->xres, var->yres);
1330 + return -EINVAL;
1331 + }
1332 +
1333 if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW)
1334 return 0;
1335
1336 @@ -1104,7 +1114,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
1337 return -EFAULT;
1338 console_lock();
1339 lock_fb_info(info);
1340 - ret = fb_set_var(info, &var);
1341 + ret = fbcon_modechange_possible(info, &var);
1342 + if (!ret)
1343 + ret = fb_set_var(info, &var);
1344 if (!ret)
1345 fbcon_update_vcs(info, var.activate & FB_ACTIVATE_ALL);
1346 unlock_fb_info(info);
1347 diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
1348 index b339ff93df997..7a9048c4c2f95 100644
1349 --- a/fs/xfs/xfs_inode.c
1350 +++ b/fs/xfs/xfs_inode.c
1351 @@ -3232,7 +3232,6 @@ xfs_rename(
1352 * appropriately.
1353 */
1354 if (flags & RENAME_WHITEOUT) {
1355 - ASSERT(!(flags & (RENAME_NOREPLACE | RENAME_EXCHANGE)));
1356 error = xfs_rename_alloc_whiteout(target_dp, &wip);
1357 if (error)
1358 return error;
1359 diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
1360 index ff5596dd30f85..2382dec6d6ab8 100644
1361 --- a/include/linux/fbcon.h
1362 +++ b/include/linux/fbcon.h
1363 @@ -15,6 +15,8 @@ void fbcon_new_modelist(struct fb_info *info);
1364 void fbcon_get_requirement(struct fb_info *info,
1365 struct fb_blit_caps *caps);
1366 void fbcon_fb_blanked(struct fb_info *info, int blank);
1367 +int fbcon_modechange_possible(struct fb_info *info,
1368 + struct fb_var_screeninfo *var);
1369 void fbcon_update_vcs(struct fb_info *info, bool all);
1370 void fbcon_remap_all(struct fb_info *info);
1371 int fbcon_set_con2fb_map_ioctl(void __user *argp);
1372 @@ -33,6 +35,8 @@ static inline void fbcon_new_modelist(struct fb_info *info) {}
1373 static inline void fbcon_get_requirement(struct fb_info *info,
1374 struct fb_blit_caps *caps) {}
1375 static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
1376 +static inline int fbcon_modechange_possible(struct fb_info *info,
1377 + struct fb_var_screeninfo *var) { return 0; }
1378 static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
1379 static inline void fbcon_remap_all(struct fb_info *info) {}
1380 static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; }
1381 diff --git a/include/linux/rtsx_usb.h b/include/linux/rtsx_usb.h
1382 index 159729cffd8e1..3247ed8e9ff0f 100644
1383 --- a/include/linux/rtsx_usb.h
1384 +++ b/include/linux/rtsx_usb.h
1385 @@ -54,8 +54,6 @@ struct rtsx_ucr {
1386 struct usb_device *pusb_dev;
1387 struct usb_interface *pusb_intf;
1388 struct usb_sg_request current_sg;
1389 - unsigned char *iobuf;
1390 - dma_addr_t iobuf_dma;
1391
1392 struct timer_list sg_timer;
1393 struct mutex dev_mutex;
1394 diff --git a/include/net/esp.h b/include/net/esp.h
1395 index 465e38890ee98..117652eb6ea32 100644
1396 --- a/include/net/esp.h
1397 +++ b/include/net/esp.h
1398 @@ -4,8 +4,6 @@
1399
1400 #include <linux/skbuff.h>
1401
1402 -#define ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE << SKB_FRAG_PAGE_ORDER)
1403 -
1404 struct ip_esp_hdr;
1405
1406 static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
1407 diff --git a/include/video/of_display_timing.h b/include/video/of_display_timing.h
1408 index e1126a74882a5..eff166fdd81b9 100644
1409 --- a/include/video/of_display_timing.h
1410 +++ b/include/video/of_display_timing.h
1411 @@ -8,6 +8,8 @@
1412 #ifndef __LINUX_OF_DISPLAY_TIMING_H
1413 #define __LINUX_OF_DISPLAY_TIMING_H
1414
1415 +#include <linux/errno.h>
1416 +
1417 struct device_node;
1418 struct display_timing;
1419 struct display_timings;
1420 diff --git a/lib/idr.c b/lib/idr.c
1421 index 4d2eef0259d2c..b2bc190431ddf 100644
1422 --- a/lib/idr.c
1423 +++ b/lib/idr.c
1424 @@ -489,7 +489,8 @@ void ida_free(struct ida *ida, unsigned int id)
1425 struct ida_bitmap *bitmap;
1426 unsigned long flags;
1427
1428 - BUG_ON((int)id < 0);
1429 + if ((int)id < 0)
1430 + return;
1431
1432 xas_lock_irqsave(&xas, flags);
1433 bitmap = xas_load(&xas);
1434 diff --git a/mm/slub.c b/mm/slub.c
1435 index 63fe43c8d3323..5211496f6d24f 100644
1436 --- a/mm/slub.c
1437 +++ b/mm/slub.c
1438 @@ -2214,6 +2214,7 @@ redo:
1439
1440 c->page = NULL;
1441 c->freelist = NULL;
1442 + c->tid = next_tid(c->tid);
1443 }
1444
1445 /*
1446 @@ -2347,8 +2348,6 @@ static inline void flush_slab(struct kmem_cache *s, struct kmem_cache_cpu *c)
1447 {
1448 stat(s, CPUSLAB_FLUSH);
1449 deactivate_slab(s, c->page, c->freelist, c);
1450 -
1451 - c->tid = next_tid(c->tid);
1452 }
1453
1454 /*
1455 @@ -2632,6 +2631,7 @@ redo:
1456
1457 if (!freelist) {
1458 c->page = NULL;
1459 + c->tid = next_tid(c->tid);
1460 stat(s, DEACTIVATE_BYPASS);
1461 goto new_slab;
1462 }
1463 diff --git a/net/can/bcm.c b/net/can/bcm.c
1464 index 1e17778d5ceeb..63d81147fb4e3 100644
1465 --- a/net/can/bcm.c
1466 +++ b/net/can/bcm.c
1467 @@ -102,6 +102,7 @@ static inline u64 get_u64(const struct canfd_frame *cp, int offset)
1468
1469 struct bcm_op {
1470 struct list_head list;
1471 + struct rcu_head rcu;
1472 int ifindex;
1473 canid_t can_id;
1474 u32 flags;
1475 @@ -720,10 +721,9 @@ static struct bcm_op *bcm_find_op(struct list_head *ops,
1476 return NULL;
1477 }
1478
1479 -static void bcm_remove_op(struct bcm_op *op)
1480 +static void bcm_free_op_rcu(struct rcu_head *rcu_head)
1481 {
1482 - hrtimer_cancel(&op->timer);
1483 - hrtimer_cancel(&op->thrtimer);
1484 + struct bcm_op *op = container_of(rcu_head, struct bcm_op, rcu);
1485
1486 if ((op->frames) && (op->frames != &op->sframe))
1487 kfree(op->frames);
1488 @@ -734,6 +734,14 @@ static void bcm_remove_op(struct bcm_op *op)
1489 kfree(op);
1490 }
1491
1492 +static void bcm_remove_op(struct bcm_op *op)
1493 +{
1494 + hrtimer_cancel(&op->timer);
1495 + hrtimer_cancel(&op->thrtimer);
1496 +
1497 + call_rcu(&op->rcu, bcm_free_op_rcu);
1498 +}
1499 +
1500 static void bcm_rx_unreg(struct net_device *dev, struct bcm_op *op)
1501 {
1502 if (op->rx_reg_dev == dev) {
1503 @@ -759,6 +767,9 @@ static int bcm_delete_rx_op(struct list_head *ops, struct bcm_msg_head *mh,
1504 if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) &&
1505 (op->flags & CAN_FD_FRAME) == (mh->flags & CAN_FD_FRAME)) {
1506
1507 + /* disable automatic timer on frame reception */
1508 + op->flags |= RX_NO_AUTOTIMER;
1509 +
1510 /*
1511 * Don't care if we're bound or not (due to netdev
1512 * problems) can_rx_unregister() is always a save
1513 @@ -787,7 +798,6 @@ static int bcm_delete_rx_op(struct list_head *ops, struct bcm_msg_head *mh,
1514 bcm_rx_handler, op);
1515
1516 list_del(&op->list);
1517 - synchronize_rcu();
1518 bcm_remove_op(op);
1519 return 1; /* done */
1520 }
1521 diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
1522 index ef20f550d2f81..f555dd4bac653 100644
1523 --- a/net/ipv4/esp4.c
1524 +++ b/net/ipv4/esp4.c
1525 @@ -277,7 +277,6 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
1526 struct page *page;
1527 struct sk_buff *trailer;
1528 int tailen = esp->tailen;
1529 - unsigned int allocsz;
1530
1531 /* this is non-NULL only with UDP Encapsulation */
1532 if (x->encap) {
1533 @@ -287,8 +286,8 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
1534 return err;
1535 }
1536
1537 - allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES);
1538 - if (allocsz > ESP_SKB_FRAG_MAXSIZE)
1539 + if (ALIGN(tailen, L1_CACHE_BYTES) > PAGE_SIZE ||
1540 + ALIGN(skb->data_len, L1_CACHE_BYTES) > PAGE_SIZE)
1541 goto cow;
1542
1543 if (!skb_cloned(skb)) {
1544 diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
1545 index 79f117e33b80e..b64791d3b0f81 100644
1546 --- a/net/ipv6/esp6.c
1547 +++ b/net/ipv6/esp6.c
1548 @@ -230,10 +230,9 @@ int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info
1549 struct page *page;
1550 struct sk_buff *trailer;
1551 int tailen = esp->tailen;
1552 - unsigned int allocsz;
1553
1554 - allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES);
1555 - if (allocsz > ESP_SKB_FRAG_MAXSIZE)
1556 + if (ALIGN(tailen, L1_CACHE_BYTES) > PAGE_SIZE ||
1557 + ALIGN(skb->data_len, L1_CACHE_BYTES) > PAGE_SIZE)
1558 goto cow;
1559
1560 if (!skb_cloned(skb)) {
1561 diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
1562 index c533076232361..5f32113c9bbda 100644
1563 --- a/net/rose/rose_route.c
1564 +++ b/net/rose/rose_route.c
1565 @@ -227,8 +227,8 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
1566 {
1567 struct rose_neigh *s;
1568
1569 - rose_stop_ftimer(rose_neigh);
1570 - rose_stop_t0timer(rose_neigh);
1571 + del_timer_sync(&rose_neigh->ftimer);
1572 + del_timer_sync(&rose_neigh->t0timer);
1573
1574 skb_queue_purge(&rose_neigh->queue);
1575
1576 diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
1577 index 85c587a03c8a5..f190ad58e00d4 100644
1578 --- a/tools/testing/selftests/net/forwarding/lib.sh
1579 +++ b/tools/testing/selftests/net/forwarding/lib.sh
1580 @@ -894,6 +894,7 @@ learning_test()
1581 # FDB entry was installed.
1582 bridge link set dev $br_port1 flood off
1583
1584 + ip link set $host1_if promisc on
1585 tc qdisc add dev $host1_if ingress
1586 tc filter add dev $host1_if ingress protocol ip pref 1 handle 101 \
1587 flower dst_mac $mac action drop
1588 @@ -904,7 +905,7 @@ learning_test()
1589 tc -j -s filter show dev $host1_if ingress \
1590 | jq -e ".[] | select(.options.handle == 101) \
1591 | select(.options.actions[0].stats.packets == 1)" &> /dev/null
1592 - check_fail $? "Packet reached second host when should not"
1593 + check_fail $? "Packet reached first host when should not"
1594
1595 $MZ $host1_if -c 1 -p 64 -a $mac -t ip -q
1596 sleep 1
1597 @@ -943,6 +944,7 @@ learning_test()
1598
1599 tc filter del dev $host1_if ingress protocol ip pref 1 handle 101 flower
1600 tc qdisc del dev $host1_if ingress
1601 + ip link set $host1_if promisc off
1602
1603 bridge link set dev $br_port1 flood on
1604
1605 @@ -960,6 +962,7 @@ flood_test_do()
1606
1607 # Add an ACL on `host2_if` which will tell us whether the packet
1608 # was flooded to it or not.
1609 + ip link set $host2_if promisc on
1610 tc qdisc add dev $host2_if ingress
1611 tc filter add dev $host2_if ingress protocol ip pref 1 handle 101 \
1612 flower dst_mac $mac action drop
1613 @@ -977,6 +980,7 @@ flood_test_do()
1614
1615 tc filter del dev $host2_if ingress protocol ip pref 1 handle 101 flower
1616 tc qdisc del dev $host2_if ingress
1617 + ip link set $host2_if promisc off
1618
1619 return $err
1620 }