diff options
author | Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> | 2018-08-06 14:22:12 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-18 16:07:23 +0200 |
commit | 415b43bdb00890f5698ceff3d3531d2daa98c5a1 (patch) | |
tree | c8d2e490f9e27f379ff0507f04de4bc51d3fc691 /drivers/tty | |
parent | ea42d7a67a9e2b2e780eacbf9b2c3848c9ce2a0f (diff) | |
download | linux-stable-415b43bdb00890f5698ceff3d3531d2daa98c5a1.tar.gz linux-stable-415b43bdb00890f5698ceff3d3531d2daa98c5a1.tar.bz2 linux-stable-415b43bdb00890f5698ceff3d3531d2daa98c5a1.zip |
tty: serial: uartlite: Move uart register to probe
Move uart register to probe.
This is in preparation of removing the hardcoding of number of uarts.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/uartlite.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index 69411b6cc2a2..77da5652fc60 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -782,6 +782,15 @@ static int ulite_probe(struct platform_device *pdev) return ret; } + if (!ulite_uart_driver.state) { + dev_dbg(&pdev->dev, "uartlite: calling uart_register_driver()\n"); + ret = uart_register_driver(&ulite_uart_driver); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to register driver\n"); + return ret; + } + } + ret = ulite_assign(&pdev->dev, id, res->start, irq, pdata); clk_disable(pdata->clk); @@ -817,25 +826,9 @@ static struct platform_driver ulite_platform_driver = { static int __init ulite_init(void) { - int ret; - - pr_debug("uartlite: calling uart_register_driver()\n"); - ret = uart_register_driver(&ulite_uart_driver); - if (ret) - goto err_uart; pr_debug("uartlite: calling platform_driver_register()\n"); - ret = platform_driver_register(&ulite_platform_driver); - if (ret) - goto err_plat; - - return 0; - -err_plat: - uart_unregister_driver(&ulite_uart_driver); -err_uart: - pr_err("registering uartlite driver failed: err=%i\n", ret); - return ret; + return platform_driver_register(&ulite_platform_driver); } static void __exit ulite_exit(void) |