Commit cc432aee authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'tty-5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

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
parents fd3f6cc9 2b2e71fe
...@@ -16080,6 +16080,8 @@ SYNOPSYS DESIGNWARE 8250 UART DRIVER ...@@ -16080,6 +16080,8 @@ SYNOPSYS DESIGNWARE 8250 UART DRIVER
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com> R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
S: Maintained S: Maintained
F: drivers/tty/serial/8250/8250_dw.c F: drivers/tty/serial/8250/8250_dw.c
F: drivers/tty/serial/8250/8250_dwlib.*
F: drivers/tty/serial/8250/8250_lpss.c
SYNOPSYS DESIGNWARE APB GPIO DRIVER SYNOPSYS DESIGNWARE APB GPIO DRIVER
M: Hoan Tran <hoan@os.amperecomputing.com> M: Hoan Tran <hoan@os.amperecomputing.com>
......
...@@ -51,9 +51,7 @@ static void __speakup_set_selection(struct work_struct *work) ...@@ -51,9 +51,7 @@ static void __speakup_set_selection(struct work_struct *work)
goto unref; goto unref;
} }
console_lock();
set_selection_kernel(&sel, tty); set_selection_kernel(&sel, tty);
console_unlock();
unref: unref:
tty_kref_put(tty); tty_kref_put(tty);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/serdev.h> #include <linux/serdev.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/platform_data/x86/apple.h>
static bool is_registered; static bool is_registered;
static DEFINE_IDA(ctrl_ida); static DEFINE_IDA(ctrl_ida);
...@@ -631,6 +632,15 @@ static int acpi_serdev_check_resources(struct serdev_controller *ctrl, ...@@ -631,6 +632,15 @@ static int acpi_serdev_check_resources(struct serdev_controller *ctrl,
if (ret) if (ret)
return ret; return ret;
/*
* Apple machines provide an empty resource template, so on those
* machines just look for immediate children with a "baud" property
* (from the _DSM method) instead.
*/
if (!lookup.controller_handle && x86_apple_machine &&
!acpi_dev_get_property(adev, "baud", ACPI_TYPE_BUFFER, NULL))
acpi_get_parent(adev->handle, &lookup.controller_handle);
/* Make sure controller and ResourceSource handle match */ /* Make sure controller and ResourceSource handle match */
if (ACPI_HANDLE(ctrl->dev.parent) != lookup.controller_handle) if (ACPI_HANDLE(ctrl->dev.parent) != lookup.controller_handle)
return -ENODEV; return -ENODEV;
......
...@@ -25,6 +25,14 @@ ...@@ -25,6 +25,14 @@
#include "8250.h" #include "8250.h"
#define PCI_DEVICE_ID_ACCES_COM_2S 0x1052
#define PCI_DEVICE_ID_ACCES_COM_4S 0x105d
#define PCI_DEVICE_ID_ACCES_COM_8S 0x106c
#define PCI_DEVICE_ID_ACCES_COM232_8 0x10a8
#define PCI_DEVICE_ID_ACCES_COM_2SM 0x10d2
#define PCI_DEVICE_ID_ACCES_COM_4SM 0x10db
#define PCI_DEVICE_ID_ACCES_COM_8SM 0x10ea
#define PCI_DEVICE_ID_COMMTECH_4224PCI335 0x0002 #define PCI_DEVICE_ID_COMMTECH_4224PCI335 0x0002
#define PCI_DEVICE_ID_COMMTECH_4222PCI335 0x0004 #define PCI_DEVICE_ID_COMMTECH_4222PCI335 0x0004
#define PCI_DEVICE_ID_COMMTECH_2324PCI335 0x000a #define PCI_DEVICE_ID_COMMTECH_2324PCI335 0x000a
...@@ -677,6 +685,22 @@ static int __maybe_unused exar_resume(struct device *dev) ...@@ -677,6 +685,22 @@ static int __maybe_unused exar_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume); static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume);
static const struct exar8250_board acces_com_2x = {
.num_ports = 2,
.setup = pci_xr17c154_setup,
};
static const struct exar8250_board acces_com_4x = {
.num_ports = 4,
.setup = pci_xr17c154_setup,
};
static const struct exar8250_board acces_com_8x = {
.num_ports = 8,
.setup = pci_xr17c154_setup,
};
static const struct exar8250_board pbn_fastcom335_2 = { static const struct exar8250_board pbn_fastcom335_2 = {
.num_ports = 2, .num_ports = 2,
.setup = pci_fastcom335_setup, .setup = pci_fastcom335_setup,
...@@ -745,6 +769,15 @@ static const struct exar8250_board pbn_exar_XR17V8358 = { ...@@ -745,6 +769,15 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
} }
static const struct pci_device_id exar_pci_tbl[] = { static const struct pci_device_id exar_pci_tbl[] = {
EXAR_DEVICE(ACCESSIO, ACCES_COM_2S, acces_com_2x),
EXAR_DEVICE(ACCESSIO, ACCES_COM_4S, acces_com_4x),
EXAR_DEVICE(ACCESSIO, ACCES_COM_8S, acces_com_8x),
EXAR_DEVICE(ACCESSIO, ACCES_COM232_8, acces_com_8x),
EXAR_DEVICE(ACCESSIO, ACCES_COM_2SM, acces_com_2x),
EXAR_DEVICE(ACCESSIO, ACCES_COM_4SM, acces_com_4x),
EXAR_DEVICE(ACCESSIO, ACCES_COM_8SM, acces_com_8x),
CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect), CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect),
CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect), CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect),
CONNECT_DEVICE(XR17C158, UART_8_232, pbn_connect), CONNECT_DEVICE(XR17C158, UART_8_232, pbn_connect),
......
...@@ -264,6 +264,7 @@ struct lpuart_port { ...@@ -264,6 +264,7 @@ struct lpuart_port {
int rx_dma_rng_buf_len; int rx_dma_rng_buf_len;
unsigned int dma_tx_nents; unsigned int dma_tx_nents;
wait_queue_head_t dma_wait; wait_queue_head_t dma_wait;
bool id_allocated;
}; };
struct lpuart_soc_data { struct lpuart_soc_data {
...@@ -2390,6 +2391,8 @@ static int __init lpuart32_imx_early_console_setup(struct earlycon_device *devic ...@@ -2390,6 +2391,8 @@ static int __init lpuart32_imx_early_console_setup(struct earlycon_device *devic
OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lpuart", lpuart_early_console_setup); OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lpuart", lpuart_early_console_setup);
OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup); OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup);
OF_EARLYCON_DECLARE(lpuart32, "fsl,imx7ulp-lpuart", lpuart32_imx_early_console_setup); OF_EARLYCON_DECLARE(lpuart32, "fsl,imx7ulp-lpuart", lpuart32_imx_early_console_setup);
EARLYCON_DECLARE(lpuart, lpuart_early_console_setup);
EARLYCON_DECLARE(lpuart32, lpuart32_early_console_setup);
#define LPUART_CONSOLE (&lpuart_console) #define LPUART_CONSOLE (&lpuart_console)
#define LPUART32_CONSOLE (&lpuart32_console) #define LPUART32_CONSOLE (&lpuart32_console)
...@@ -2420,19 +2423,6 @@ static int lpuart_probe(struct platform_device *pdev) ...@@ -2420,19 +2423,6 @@ static int lpuart_probe(struct platform_device *pdev)
if (!sport) if (!sport)
return -ENOMEM; return -ENOMEM;
ret = of_alias_get_id(np, "serial");
if (ret < 0) {
ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL);
if (ret < 0) {
dev_err(&pdev->dev, "port line is full, add device failed\n");
return ret;
}
}
if (ret >= ARRAY_SIZE(lpuart_ports)) {
dev_err(&pdev->dev, "serial%d out of range\n", ret);
return -EINVAL;
}
sport->port.line = ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
sport->port.membase = devm_ioremap_resource(&pdev->dev, res); sport->port.membase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(sport->port.membase)) if (IS_ERR(sport->port.membase))
...@@ -2477,9 +2467,25 @@ static int lpuart_probe(struct platform_device *pdev) ...@@ -2477,9 +2467,25 @@ static int lpuart_probe(struct platform_device *pdev)
} }
} }
ret = of_alias_get_id(np, "serial");
if (ret < 0) {
ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL);
if (ret < 0) {
dev_err(&pdev->dev, "port line is full, add device failed\n");
return ret;
}
sport->id_allocated = true;
}
if (ret >= ARRAY_SIZE(lpuart_ports)) {
dev_err(&pdev->dev, "serial%d out of range\n", ret);
ret = -EINVAL;
goto failed_out_of_range;
}
sport->port.line = ret;
ret = lpuart_enable_clks(sport); ret = lpuart_enable_clks(sport);
if (ret) if (ret)
return ret; goto failed_clock_enable;
sport->port.uartclk = lpuart_get_baud_clk_rate(sport); sport->port.uartclk = lpuart_get_baud_clk_rate(sport);
lpuart_ports[sport->port.line] = sport; lpuart_ports[sport->port.line] = sport;
...@@ -2529,6 +2535,10 @@ static int lpuart_probe(struct platform_device *pdev) ...@@ -2529,6 +2535,10 @@ static int lpuart_probe(struct platform_device *pdev)
failed_attach_port: failed_attach_port:
failed_irq_request: failed_irq_request:
lpuart_disable_clks(sport); lpuart_disable_clks(sport);
failed_clock_enable:
failed_out_of_range:
if (sport->id_allocated)
ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
return ret; return ret;
} }
...@@ -2538,6 +2548,7 @@ static int lpuart_remove(struct platform_device *pdev) ...@@ -2538,6 +2548,7 @@ static int lpuart_remove(struct platform_device *pdev)
uart_remove_one_port(&lpuart_reg, &sport->port); uart_remove_one_port(&lpuart_reg, &sport->port);
if (sport->id_allocated)
ida_simple_remove(&fsl_lpuart_ida, sport->port.line); ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
lpuart_disable_clks(sport); lpuart_disable_clks(sport);
......
...@@ -851,7 +851,7 @@ static int mvebu_uart_probe(struct platform_device *pdev) ...@@ -851,7 +851,7 @@ static int mvebu_uart_probe(struct platform_device *pdev)
port->membase = devm_ioremap_resource(&pdev->dev, reg); port->membase = devm_ioremap_resource(&pdev->dev, reg);
if (IS_ERR(port->membase)) if (IS_ERR(port->membase))
return -PTR_ERR(port->membase); return PTR_ERR(port->membase);
mvuart = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart), mvuart = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart),
GFP_KERNEL); GFP_KERNEL);
......
...@@ -181,7 +181,7 @@ int set_selection_user(const struct tiocl_selection __user *sel, ...@@ -181,7 +181,7 @@ int set_selection_user(const struct tiocl_selection __user *sel,
return set_selection_kernel(&v, tty); return set_selection_kernel(&v, tty);
} }
int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) static int __set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
{ {
struct vc_data *vc = vc_cons[fg_console].d; struct vc_data *vc = vc_cons[fg_console].d;
int new_sel_start, new_sel_end, spc; int new_sel_start, new_sel_end, spc;
...@@ -214,7 +214,6 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) ...@@ -214,7 +214,6 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
if (ps > pe) /* make sel_start <= sel_end */ if (ps > pe) /* make sel_start <= sel_end */
swap(ps, pe); swap(ps, pe);
mutex_lock(&sel_lock);
if (sel_cons != vc_cons[fg_console].d) { if (sel_cons != vc_cons[fg_console].d) {
clear_selection(); clear_selection();
sel_cons = vc_cons[fg_console].d; sel_cons = vc_cons[fg_console].d;
...@@ -260,10 +259,9 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) ...@@ -260,10 +259,9 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
break; break;
case TIOCL_SELPOINTER: case TIOCL_SELPOINTER:
highlight_pointer(pe); highlight_pointer(pe);
goto unlock; return 0;
default: default:
ret = -EINVAL; return -EINVAL;
goto unlock;
} }
/* remove the pointer */ /* remove the pointer */
...@@ -285,7 +283,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) ...@@ -285,7 +283,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
else if (new_sel_start == sel_start) else if (new_sel_start == sel_start)
{ {
if (new_sel_end == sel_end) /* no action required */ if (new_sel_end == sel_end) /* no action required */
goto unlock; return 0;
else if (new_sel_end > sel_end) /* extend to right */ else if (new_sel_end > sel_end) /* extend to right */
highlight(sel_end + 2, new_sel_end); highlight(sel_end + 2, new_sel_end);
else /* contract from right */ else /* contract from right */
...@@ -313,8 +311,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) ...@@ -313,8 +311,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
if (!bp) { if (!bp) {
printk(KERN_WARNING "selection: kmalloc() failed\n"); printk(KERN_WARNING "selection: kmalloc() failed\n");
clear_selection(); clear_selection();
ret = -ENOMEM; return -ENOMEM;
goto unlock;
} }
kfree(sel_buffer); kfree(sel_buffer);
sel_buffer = bp; sel_buffer = bp;
...@@ -339,8 +336,20 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty) ...@@ -339,8 +336,20 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
} }
} }
sel_buffer_lth = bp - sel_buffer; sel_buffer_lth = bp - sel_buffer;
unlock:
return ret;
}
int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
{
int ret;
mutex_lock(&sel_lock);
console_lock();
ret = __set_selection_kernel(v, tty);
console_unlock();
mutex_unlock(&sel_lock); mutex_unlock(&sel_lock);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(set_selection_kernel); EXPORT_SYMBOL_GPL(set_selection_kernel);
......
...@@ -3046,10 +3046,8 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) ...@@ -3046,10 +3046,8 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
switch (type) switch (type)
{ {
case TIOCL_SETSEL: case TIOCL_SETSEL:
console_lock();
ret = set_selection_user((struct tiocl_selection ret = set_selection_user((struct tiocl_selection
__user *)(p+1), tty); __user *)(p+1), tty);
console_unlock();
break; break;
case TIOCL_PASTESEL: case TIOCL_PASTESEL:
ret = paste_selection(tty); ret = paste_selection(tty);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment