Thread (8 messages) 8 messages, 2 authors, 2013-07-08
STALE4756d

[PATCH v4] tty: serial: add Freescale lpuart driver support

From: Lu Jingchang-B35083 <hidden>
Date: 2013-05-29 06:57:43
Also in: linux-serial

quoted
+static int __init lpuart_serial_init(void) {
+	int ret;
+
+	pr_info("serial: Freescale lpuart driver\n");
+
+	ret = uart_register_driver(&lpuart_reg);
+	if (ret)
+		return ret;
+
+	ret = platform_driver_register(&lpuart_uart_driver);
+	if (ret)
+		uart_unregister_driver(&lpuart_reg);
+
+	return 0;
+}
+
+static void __exit lpuart_serial_exit(void) {
+	platform_driver_unregister(&lpuart_uart_driver);
+	uart_unregister_driver(&lpuart_reg);
+}
+
+module_init(lpuart_serial_init);
+module_exit(lpuart_serial_exit);
I think you can call uart_register_driver and uart_unregister_driver
in .probe and .remove hook, and then you can simply use
module_platform_driver for lpuart_uart_driver.
[Lu Jingchang-B35083] 
  For multiple dts uart nodes, each node will call .probe once. If the uart_register_driver is called from .probe without any conditioning check, it will then be called more than once, but the uart_register_deiver can only register the same uart driver once. So I think current arrangement will be more reasonable. Thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help