Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1608650
| From | Sjoerd Simons <sjoerd.simons@collabora.co.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] serial: sh-sci: Move uart_register_driver call to device probe |
| Date | 2017-03-24 17:30 +0100 |
| Message-ID | <toAgc-4c4-55@gated-at.bofh.it> (permalink) |
| References | <toAga-4c4-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
uart_register_driver call binds the driver to a specific device
node through tty_register_driver call. This should typically
happen during device probe call.
In a multiplatform scenario, it is possible that multiple serial
drivers are part of the kernel. Currently the driver registration fails
if multiple serial drivers with overlapping major/minor numbers are
included.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---
drivers/tty/serial/sh-sci.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 9a47cc4f16a2..7c1c0c08459e 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3063,6 +3063,12 @@ static int sci_probe_single(struct platform_device *dev,
return -EINVAL;
}
+ if (!sci_uart_driver.state) {
+ ret = uart_register_driver(&sci_uart_driver);
+ if (ret)
+ return ret;
+ }
+
ret = sci_init_single(dev, sciport, index, p, false);
if (ret)
return ret;
@@ -3186,24 +3192,17 @@ static struct platform_driver sci_driver = {
static int __init sci_init(void)
{
- int ret;
-
pr_info("%s\n", banner);
- ret = uart_register_driver(&sci_uart_driver);
- if (likely(ret == 0)) {
- ret = platform_driver_register(&sci_driver);
- if (unlikely(ret))
- uart_unregister_driver(&sci_uart_driver);
- }
-
- return ret;
+ return platform_driver_register(&sci_driver);
}
static void __exit sci_exit(void)
{
platform_driver_unregister(&sci_driver);
- uart_unregister_driver(&sci_uart_driver);
+
+ if (sci_uart_driver.state)
+ uart_unregister_driver(&sci_uart_driver);
}
#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci Sjoerd Simons <sjoerd.simons@collabora.co.uk> - 2017-03-24 17:30 +0100
[PATCH 1/2] serial: pl010: Move uart_register_driver call to device probe Sjoerd Simons <sjoerd.simons@collabora.co.uk> - 2017-03-24 17:30 +0100
Re: [PATCH 1/2] serial: pl010: Move uart_register_driver call to device probe Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-24 17:50 +0100
[PATCH 2/2] serial: sh-sci: Move uart_register_driver call to device probe Sjoerd Simons <sjoerd.simons@collabora.co.uk> - 2017-03-24 17:30 +0100
Re: [PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-24 17:50 +0100
Re: [PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-26 11:30 +0200
Re: [PATCH 0/2] Move uart_register_driver call to device probe for pl010 and sh-sci Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-03-26 12:10 +0200
csiph-web