Pull tty/serial fixes from Greg KH: "Here are some small tty/serial fixes for 5.6-rc5 Just some small serial driver fixes, and a vt core fixup, full details are: - vt fixes for issues found by syzbot - serdev fix for Apple boxes - fsl_lpuart serial driver fixes - MAINTAINER update for incorrect serial files - new device ids for 8250_exar driver - mvebu-uart fix All of these have been in linux-next with no reported issues" * tag 'tty-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: tty: serial: fsl_lpuart: free IDs allocated by IDA Revert "tty: serial: fsl_lpuart: drop EARLYCON_DECLARE" serdev: Fix detection of UART devices on Apple machines. MAINTAINERS: Add missed files related to Synopsys DesignWare UART serial: 8250_exar: add support for ACCES cards tty:serial:mvebu-uart:fix a wrong return vt: selection, push sel_lock up vt: selection, push console lock down
Unified · Split
| @@ -16080,6 +16080,8 @@ SYNOPSYS DESIGNWARE 8250 UART DRIVER · 16079 unmodified lines | ||
| 16080 | 16080 | R: Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
| 16081 | 16081 | S: Maintained |
| 16082 | 16082 | F: drivers/tty/serial/8250/8250_dw.c |
| 16083 | +F: drivers/tty/serial/8250/8250_dwlib.* | |
| 16084 | +F: drivers/tty/serial/8250/8250_lpss.c | |
| 16083 | 16085 | |
| 16084 | 16086 | SYNOPSYS DESIGNWARE APB GPIO DRIVER |
| 16085 | 16087 | M: Hoan Tran <hoan@os.amperecomputing.com> |
| @@ -51,9 +51,7 @@ static void __speakup_set_selection(struct work_struct *work) · 50 unmodified lines | ||
| 51 | 51 | goto unref; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | − console_lock(); | |
| 55 | 54 | set_selection_kernel(&sel, tty); |
| 56 | − console_unlock(); | |
| 57 | 55 | |
| 58 | 56 | unref: |
| 59 | 57 | tty_kref_put(tty); |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/sched.h> |
| 19 | 19 | #include <linux/serdev.h> |
| 20 | 20 | #include <linux/slab.h> |
| 21 | +#include <linux/platform_data/x86/apple.h> | |
| 21 | 22 | |
| 22 | 23 | static bool is_registered; |
| 23 | 24 | static DEFINE_IDA(ctrl_ida); |
| @@ -631,6 +632,15 @@ static int acpi_serdev_check_resources(struct serdev_controller *ctrl, · 607 unmodified lines | ||
| 631 | 632 | if (ret) |
| 632 | 633 | return ret; |
| 633 | 634 | |
| 635 | + /* | |
| 636 | + * Apple machines provide an empty resource template, so on those | |
| 637 | + * machines just look for immediate children with a "baud" property | |
| 638 | + * (from the _DSM method) instead. | |
| 639 | + */ | |
| 640 | + if (!lookup.controller_handle && x86_apple_machine && | |
| 641 | + !acpi_dev_get_property(adev, "baud", ACPI_TYPE_BUFFER, NULL)) | |
| 642 | + acpi_get_parent(adev->handle, &lookup.controller_handle); | |
| 643 | + | |
| 634 | 644 | /* Make sure controller and ResourceSource handle match */ |
| 635 | 645 | if (ACPI_HANDLE(ctrl->dev.parent) != lookup.controller_handle) |
| 636 | 646 | return -ENODEV; |
| @@ -25,6 +25,14 @@ · 24 unmodified lines | ||
| 25 | 25 | |
| 26 | 26 | #include "8250.h" |
| 27 | 27 | |
| 28 | +#define PCI_DEVICE_ID_ACCES_COM_2S 0x1052 | |
| 29 | +#define PCI_DEVICE_ID_ACCES_COM_4S 0x105d | |
| 30 | +#define PCI_DEVICE_ID_ACCES_COM_8S 0x106c | |
| 31 | +#define PCI_DEVICE_ID_ACCES_COM232_8 0x10a8 | |
| 32 | +#define PCI_DEVICE_ID_ACCES_COM_2SM 0x10d2 | |
| 33 | +#define PCI_DEVICE_ID_ACCES_COM_4SM 0x10db | |
| 34 | +#define PCI_DEVICE_ID_ACCES_COM_8SM 0x10ea | |
| 35 | + | |
| 28 | 36 | #define PCI_DEVICE_ID_COMMTECH_4224PCI335 0x0002 |
| 29 | 37 | #define PCI_DEVICE_ID_COMMTECH_4222PCI335 0x0004 |
| 30 | 38 | #define PCI_DEVICE_ID_COMMTECH_2324PCI335 0x000a |
| @@ -677,6 +685,22 @@ static int __maybe_unused exar_resume(struct device *dev) · 646 unmodified lines | ||
| 677 | 685 | |
| 678 | 686 | static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume); |
| 679 | 687 | |
| 688 | +static const struct exar8250_board acces_com_2x = { | |
| 689 | + .num_ports = 2, | |
| 690 | + .setup = pci_xr17c154_setup, | |
| 691 | +}; | |
| 692 | + | |
| 693 | +static const struct exar8250_board acces_com_4x = { | |
| 694 | + .num_ports = 4, | |
| 695 | + .setup = pci_xr17c154_setup, | |
| 696 | +}; | |
| 697 | + | |
| 698 | +static const struct exar8250_board acces_com_8x = { | |
| 699 | + .num_ports = 8, | |
| 700 | + .setup = pci_xr17c154_setup, | |
| 701 | +}; | |
| 702 | + | |
| 703 | + | |
| 680 | 704 | static const struct exar8250_board pbn_fastcom335_2 = { |
| 681 | 705 | .num_ports = 2, |
| 682 | 706 | .setup = pci_fastcom335_setup, |
| @@ -745,6 +769,15 @@ static const struct exar8250_board pbn_exar_XR17V8358 = { · 62 unmodified lines | ||
| 745 | 769 | } |
| 746 | 770 | |
| 747 | 771 | static const struct pci_device_id exar_pci_tbl[] = { |
| 772 | + EXAR_DEVICE(ACCESSIO, ACCES_COM_2S, acces_com_2x), | |
| 773 | + EXAR_DEVICE(ACCESSIO, ACCES_COM_4S, acces_com_4x), | |
| 774 | + EXAR_DEVICE(ACCESSIO, ACCES_COM_8S, acces_com_8x), | |
| 775 | + EXAR_DEVICE(ACCESSIO, ACCES_COM232_8, acces_com_8x), | |
| 776 | + EXAR_DEVICE(ACCESSIO, ACCES_COM_2SM, acces_com_2x), | |
| 777 | + EXAR_DEVICE(ACCESSIO, ACCES_COM_4SM, acces_com_4x), | |
| 778 | + EXAR_DEVICE(ACCESSIO, ACCES_COM_8SM, acces_com_8x), | |
| 779 | + | |
| 780 | + | |
| 748 | 781 | CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect), |
| 749 | 782 | CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect), |
| 750 | 783 | CONNECT_DEVICE(XR17C158, UART_8_232, pbn_connect), |
| @@ -264,6 +264,7 @@ struct lpuart_port { · 263 unmodified lines | ||
| 264 | 264 | int rx_dma_rng_buf_len; |
| 265 | 265 | unsigned int dma_tx_nents; |
| 266 | 266 | wait_queue_head_t dma_wait; |
| 267 | + bool id_allocated; | |
| 267 | 268 | }; |
| 268 | 269 | |
| 269 | 270 | struct lpuart_soc_data { |
| @@ -2390,6 +2391,8 @@ static int __init lpuart32_imx_early_console_setup(struct earlycon_device *devic · 2120 unmodified lines | ||
| 2390 | 2391 | OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lpuart", lpuart_early_console_setup); |
| 2391 | 2392 | OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup); |
| 2392 | 2393 | OF_EARLYCON_DECLARE(lpuart32, "fsl,imx7ulp-lpuart", lpuart32_imx_early_console_setup); |
| 2394 | +EARLYCON_DECLARE(lpuart, lpuart_early_console_setup); | |
| 2395 | +EARLYCON_DECLARE(lpuart32, lpuart32_early_console_setup); | |
| 2393 | 2396 | |
| 2394 | 2397 | #define LPUART_CONSOLE (&lpuart_console) |
| 2395 | 2398 | #define LPUART32_CONSOLE (&lpuart32_console) |
| @@ -2420,19 +2423,6 @@ static int lpuart_probe(struct platform_device *pdev) · 24 unmodified lines | ||
| 2420 | 2423 | if (!sport) |
| 2421 | 2424 | return -ENOMEM; |
| 2422 | 2425 | |
| 2423 | − ret = of_alias_get_id(np, "serial"); | |
| 2424 | − if (ret < 0) { | |
| 2425 | − ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL); | |
| 2426 | − if (ret < 0) { | |
| 2427 | − dev_err(&pdev->dev, "port line is full, add device failed\n"); | |
| 2428 | − return ret; | |
| 2429 | − } | |
| 2430 | − } | |
| 2431 | − if (ret >= ARRAY_SIZE(lpuart_ports)) { | |
| 2432 | − dev_err(&pdev->dev, "serial%d out of range\n", ret); | |
| 2433 | − return -EINVAL; | |
| 2434 | − } | |
| 2435 | − sport->port.line = ret; | |
| 2436 | 2426 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 2437 | 2427 | sport->port.membase = devm_ioremap_resource(&pdev->dev, res); |
| 2438 | 2428 | if (IS_ERR(sport->port.membase)) |
| @@ -2477,9 +2467,25 @@ static int lpuart_probe(struct platform_device *pdev) · 38 unmodified lines | ||
| 2477 | 2467 | } |
| 2478 | 2468 | } |
| 2479 | 2469 | |
| 2470 | + ret = of_alias_get_id(np, "serial"); | |
| 2471 | + if (ret < 0) { | |
| 2472 | + ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL); | |
| 2473 | + if (ret < 0) { | |
| 2474 | + dev_err(&pdev->dev, "port line is full, add device failed\n"); | |
| 2475 | + return ret; | |
| 2476 | + } | |
| 2477 | + sport->id_allocated = true; | |
| 2478 | + } | |
| 2479 | + if (ret >= ARRAY_SIZE(lpuart_ports)) { | |
| 2480 | + dev_err(&pdev->dev, "serial%d out of range\n", ret); | |
| 2481 | + ret = -EINVAL; | |
| 2482 | + goto failed_out_of_range; | |
| 2483 | + } | |
| 2484 | + sport->port.line = ret; | |
| 2485 | + | |
| 2480 | 2486 | ret = lpuart_enable_clks(sport); |
| 2481 | 2487 | if (ret) |
| 2482 | − return ret; | |
| 2488 | + goto failed_clock_enable; | |
| 2483 | 2489 | sport->port.uartclk = lpuart_get_baud_clk_rate(sport); |
| 2484 | 2490 | |
| 2485 | 2491 | lpuart_ports[sport->port.line] = sport; |
| @@ -2529,6 +2535,10 @@ static int lpuart_probe(struct platform_device *pdev) · 43 unmodified lines | ||
| 2529 | 2535 | failed_attach_port: |
| 2530 | 2536 | failed_irq_request: |
| 2531 | 2537 | lpuart_disable_clks(sport); |
| 2538 | +failed_clock_enable: | |
| 2539 | +failed_out_of_range: | |
| 2540 | + if (sport->id_allocated) | |
| 2541 | + ida_simple_remove(&fsl_lpuart_ida, sport->port.line); | |
| 2532 | 2542 | return ret; |
| 2533 | 2543 | } |
| 2534 | 2544 | |
| @@ -2538,7 +2548,8 @@ static int lpuart_remove(struct platform_device *pdev) · 3 unmodified lines | ||
| 2538 | 2548 | |
| 2539 | 2549 | uart_remove_one_port(&lpuart_reg, &sport->port); |
| 2540 | 2550 | |
| 2541 | − ida_simple_remove(&fsl_lpuart_ida, sport->port.line); | |
| 2551 | + if (sport->id_allocated) | |
| 2552 | + ida_simple_remove(&fsl_lpuart_ida, sport->port.line); | |
| 2542 | 2553 | |
| 2543 | 2554 | lpuart_disable_clks(sport); |
| 2544 | 2555 | |
| @@ -851,7 +851,7 @@ static int mvebu_uart_probe(struct platform_device *pdev) · 850 unmodified lines | ||
| 851 | 851 | |
| 852 | 852 | port->membase = devm_ioremap_resource(&pdev->dev, reg); |
| 853 | 853 | if (IS_ERR(port->membase)) |
| 854 | − return -PTR_ERR(port->membase); | |
| 854 | + return PTR_ERR(port->membase); | |
| 855 | 855 | |
| 856 | 856 | mvuart = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart), |
| 857 | 857 | GFP_KERNEL); |
| @@ -181,7 +181,7 @@ int set_selection_user(const struct tiocl_selection __user *sel, · 180 unmodified lines | ||
| 181 | 181 | return set_selection_kernel(&v, tty); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | −int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) | |
| 184 | +static int __set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) | |
| 185 | 185 | { |
| 186 | 186 | struct vc_data *vc = vc_cons[fg_console].d; |
| 187 | 187 | int new_sel_start, new_sel_end, spc; |
| @@ -214,7 +214,6 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) · 26 unmodified lines | ||
| 214 | 214 | if (ps > pe) /* make sel_start <= sel_end */ |
| 215 | 215 | swap(ps, pe); |
| 216 | 216 | |
| 217 | − mutex_lock(&sel_lock); | |
| 218 | 217 | if (sel_cons != vc_cons[fg_console].d) { |
| 219 | 218 | clear_selection(); |
| 220 | 219 | sel_cons = vc_cons[fg_console].d; |
| @@ -260,10 +259,9 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) · 39 unmodified lines | ||
| 260 | 259 | break; |
| 261 | 260 | case TIOCL_SELPOINTER: |
| 262 | 261 | highlight_pointer(pe); |
| 263 | − goto unlock; | |
| 262 | + return 0; | |
| 264 | 263 | default: |
| 265 | − ret = -EINVAL; | |
| 266 | − goto unlock; | |
| 264 | + return -EINVAL; | |
| 267 | 265 | } |
| 268 | 266 | |
| 269 | 267 | /* remove the pointer */ |
| @@ -285,7 +283,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) · 15 unmodified lines | ||
| 285 | 283 | else if (new_sel_start == sel_start) |
| 286 | 284 | { |
| 287 | 285 | if (new_sel_end == sel_end) /* no action required */ |
| 288 | − goto unlock; | |
| 286 | + return 0; | |
| 289 | 287 | else if (new_sel_end > sel_end) /* extend to right */ |
| 290 | 288 | highlight(sel_end + 2, new_sel_end); |
| 291 | 289 | else /* contract from right */ |
| @@ -313,8 +311,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) · 21 unmodified lines | ||
| 313 | 311 | if (!bp) { |
| 314 | 312 | printk(KERN_WARNING "selection: kmalloc() failed\n"); |
| 315 | 313 | clear_selection(); |
| 316 | − ret = -ENOMEM; | |
| 317 | − goto unlock; | |
| 314 | + return -ENOMEM; | |
| 318 | 315 | } |
| 319 | 316 | kfree(sel_buffer); |
| 320 | 317 | sel_buffer = bp; |
| @@ -339,8 +336,20 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) · 18 unmodified lines | ||
| 339 | 336 | } |
| 340 | 337 | } |
| 341 | 338 | sel_buffer_lth = bp - sel_buffer; |
| 342 | −unlock: | |
| 339 | + | |
| 340 | + return ret; | |
| 341 | +} | |
| 342 | + | |
| 343 | +int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) | |
| 344 | +{ | |
| 345 | + int ret; | |
| 346 | + | |
| 347 | + mutex_lock(&sel_lock); | |
| 348 | + console_lock(); | |
| 349 | + ret = __set_selection_kernel(v, tty); | |
| 350 | + console_unlock(); | |
| 343 | 351 | mutex_unlock(&sel_lock); |
| 352 | + | |
| 344 | 353 | return ret; |
| 345 | 354 | } |
| 346 | 355 | EXPORT_SYMBOL_GPL(set_selection_kernel); |
| @@ -3046,10 +3046,8 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) · 3045 unmodified lines | ||
| 3046 | 3046 | switch (type) |
| 3047 | 3047 | { |
| 3048 | 3048 | case TIOCL_SETSEL: |
| 3049 | − console_lock(); | |
| 3050 | 3049 | ret = set_selection_user((struct tiocl_selection |
| 3051 | 3050 | __user *)(p+1), tty); |
| 3052 | − console_unlock(); | |
| 3053 | 3051 | break; |
| 3054 | 3052 | case TIOCL_PASTESEL: |
| 3055 | 3053 | ret = paste_selection(tty); |