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

Lu Jingchang-B35083
2013-05-29T06:58:08Z

>> +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!