diff options
author | Michal Simek <michal.simek@xilinx.com> | 2018-09-03 09:10:55 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-18 10:07:23 -0400 |
commit | 10a5315b47b09ea3c8e69e5bb5b51a829fe84028 (patch) | |
tree | da9657470f1ab7de21d8b7be96abaff5e149e3e0 /drivers/tty/serial | |
parent | e4bbb5194ea3bc77ab843fe01c9f243cf8c6c6b2 (diff) |
serial: uartps: Fill struct uart_driver in probe()
This is preparation step for dynamic port allocation without
CDNS_UART_NR_PORTS macro. Fill the structure only once at probe.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r-- | drivers/tty/serial/xilinx_uartps.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 382f11c6720c..945d252b93e3 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -1100,6 +1100,8 @@ static const struct uart_ops cdns_uart_ops = { | |||
1100 | #endif | 1100 | #endif |
1101 | }; | 1101 | }; |
1102 | 1102 | ||
1103 | static struct uart_driver cdns_uart_uart_driver; | ||
1104 | |||
1103 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE | 1105 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE |
1104 | /** | 1106 | /** |
1105 | * cdns_uart_console_putchar - write the character to the FIFO buffer | 1107 | * cdns_uart_console_putchar - write the character to the FIFO buffer |
@@ -1240,8 +1242,6 @@ static int cdns_uart_console_setup(struct console *co, char *options) | |||
1240 | return uart_set_options(port, co, baud, parity, bits, flow); | 1242 | return uart_set_options(port, co, baud, parity, bits, flow); |
1241 | } | 1243 | } |
1242 | 1244 | ||
1243 | static struct uart_driver cdns_uart_uart_driver; | ||
1244 | |||
1245 | static struct console cdns_uart_console = { | 1245 | static struct console cdns_uart_console = { |
1246 | .name = CDNS_UART_TTY_NAME, | 1246 | .name = CDNS_UART_TTY_NAME, |
1247 | .write = cdns_uart_console_write, | 1247 | .write = cdns_uart_console_write, |
@@ -1253,18 +1253,6 @@ static struct console cdns_uart_console = { | |||
1253 | }; | 1253 | }; |
1254 | #endif /* CONFIG_SERIAL_XILINX_PS_UART_CONSOLE */ | 1254 | #endif /* CONFIG_SERIAL_XILINX_PS_UART_CONSOLE */ |
1255 | 1255 | ||
1256 | static struct uart_driver cdns_uart_uart_driver = { | ||
1257 | .owner = THIS_MODULE, | ||
1258 | .driver_name = CDNS_UART_NAME, | ||
1259 | .dev_name = CDNS_UART_TTY_NAME, | ||
1260 | .major = CDNS_UART_MAJOR, | ||
1261 | .minor = CDNS_UART_MINOR, | ||
1262 | .nr = CDNS_UART_NR_PORTS, | ||
1263 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE | ||
1264 | .cons = &cdns_uart_console, | ||
1265 | #endif | ||
1266 | }; | ||
1267 | |||
1268 | #ifdef CONFIG_PM_SLEEP | 1256 | #ifdef CONFIG_PM_SLEEP |
1269 | /** | 1257 | /** |
1270 | * cdns_uart_suspend - suspend event | 1258 | * cdns_uart_suspend - suspend event |
@@ -1430,6 +1418,16 @@ static int cdns_uart_probe(struct platform_device *pdev) | |||
1430 | } | 1418 | } |
1431 | 1419 | ||
1432 | if (!cdns_uart_uart_driver.state) { | 1420 | if (!cdns_uart_uart_driver.state) { |
1421 | cdns_uart_uart_driver.owner = THIS_MODULE; | ||
1422 | cdns_uart_uart_driver.driver_name = CDNS_UART_NAME; | ||
1423 | cdns_uart_uart_driver.dev_name = CDNS_UART_TTY_NAME; | ||
1424 | cdns_uart_uart_driver.major = CDNS_UART_MAJOR; | ||
1425 | cdns_uart_uart_driver.minor = CDNS_UART_MINOR; | ||
1426 | cdns_uart_uart_driver.nr = CDNS_UART_NR_PORTS; | ||
1427 | #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE | ||
1428 | cdns_uart_uart_driver.cons = &cdns_uart_console; | ||
1429 | #endif | ||
1430 | |||
1433 | rc = uart_register_driver(&cdns_uart_uart_driver); | 1431 | rc = uart_register_driver(&cdns_uart_uart_driver); |
1434 | if (rc < 0) { | 1432 | if (rc < 0) { |
1435 | dev_err(&pdev->dev, "Failed to register driver\n"); | 1433 | dev_err(&pdev->dev, "Failed to register driver\n"); |