Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1693521
| From | Michal Simek <michal.simek@xilinx.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH 4/4] serial: uartps: Remove static port array |
| Date | 2017-07-21 11:40 +0200 |
| Message-ID | <u5CzF-34w-29@gated-at.bofh.it> (permalink) |
| References | <u5CzE-34w-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Allocate uart port structure dynamically.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
drivers/tty/serial/xilinx_uartps.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 4fb74baeae35..1c9ec8c4c2b6 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1102,8 +1102,6 @@ static void cdns_uart_pm(struct uart_port *port, unsigned int state,
#endif
};
-static struct uart_port cdns_uart_port[CDNS_UART_NR_PORTS];
-
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
/**
* cdns_uart_console_wait_tx - Wait for the TX to be full
@@ -1443,6 +1441,9 @@ static int cdns_uart_probe(struct platform_device *pdev)
GFP_KERNEL);
if (!cdns_uart_data)
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);
if (match && match->data) {
@@ -1508,16 +1509,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
if (id < 0)
id = 0;
- /* Try the given port id if failed use default method */
- if (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) {
+ if (id >= CDNS_UART_NR_PORTS) {
dev_err(&pdev->dev, "Cannot get uart_port structure\n");
rc = -ENODEV;
goto err_out_notif_unreg;
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 0/4] serial: uartps: Dynamic allocation Michal Simek <michal.simek@xilinx.com> - 2017-07-21 11:40 +0200 [RFC PATCH 2/4] serial: uartps: Use dynamic array for console port Michal Simek <michal.simek@xilinx.com> - 2017-07-21 11:40 +0200 [RFC PATCH 4/4] serial: uartps: Remove static port array Michal Simek <michal.simek@xilinx.com> - 2017-07-21 11:40 +0200 [RFC PATCH 3/4] serial: uartps: Move cnds_uart_get_port to probe Michal Simek <michal.simek@xilinx.com> - 2017-07-21 11:40 +0200 Re: [RFC PATCH 0/4] serial: uartps: Dynamic allocation Alan Cox <gnomes@lxorguk.ukuu.org.uk> - 2017-07-28 20:50 +0200
csiph-web