serial: uartps: Remove static port array
Allocate uart port structure dynamically. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1f2107223e
commit
0a84bae7ed
|
@ -1097,8 +1097,6 @@ static const struct uart_ops cdns_uart_ops = {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct uart_port cdns_uart_port[CDNS_UART_NR_PORTS];
|
|
||||||
|
|
||||||
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
|
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
|
||||||
/**
|
/**
|
||||||
* cdns_uart_console_wait_tx - Wait for the TX to be full
|
* cdns_uart_console_wait_tx - Wait for the TX to be full
|
||||||
|
@ -1436,6 +1434,9 @@ static int cdns_uart_probe(struct platform_device *pdev)
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!cdns_uart_data)
|
if (!cdns_uart_data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL);
|
||||||
|
if (!port)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
match = of_match_node(cdns_uart_of_match, pdev->dev.of_node);
|
match = of_match_node(cdns_uart_of_match, pdev->dev.of_node);
|
||||||
if (match && match->data) {
|
if (match && match->data) {
|
||||||
|
@ -1501,16 +1502,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
id = 0;
|
id = 0;
|
||||||
|
|
||||||
/* Try the given port id if failed use default method */
|
if (id >= CDNS_UART_NR_PORTS) {
|
||||||
if (id < CDNS_UART_NR_PORTS && cdns_uart_port[id].mapbase != 0) {
|
|
||||||
/* Find the next unused port */
|
|
||||||
for (id = 0; id < CDNS_UART_NR_PORTS; id++)
|
|
||||||
if (cdns_uart_port[id].mapbase == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
port = &cdns_uart_port[id];
|
|
||||||
if (!port || id >= CDNS_UART_NR_PORTS) {
|
|
||||||
dev_err(&pdev->dev, "Cannot get uart_port structure\n");
|
dev_err(&pdev->dev, "Cannot get uart_port structure\n");
|
||||||
rc = -ENODEV;
|
rc = -ENODEV;
|
||||||
goto err_out_notif_unreg;
|
goto err_out_notif_unreg;
|
||||||
|
|
Loading…
Reference in New Issue