Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: lantiq: Make driver modular

Add changes so Lantiq serial driver can be compiled as a module.

Signed-off-by: Rahul Tanwar <rahul.tanwar@linux.intel.com>
Link: https://lore.kernel.org/r/ad9422de006c317401bfa5fe61bdd4293dd29b5e.1589176044.git.rahul.tanwar@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rahul Tanwar and committed by
Greg Kroah-Hartman
ad406341 ea7d3fd8

+28 -5
+3 -1
drivers/tty/serial/Kconfig
··· 1034 1034 boot time.) 1035 1035 1036 1036 config SERIAL_LANTIQ 1037 - bool "Lantiq serial driver" 1037 + tristate "Lantiq serial driver" 1038 1038 depends on (LANTIQ || X86) || COMPILE_TEST 1039 1039 select SERIAL_CORE 1040 1040 help 1041 1041 Support for UART on Lantiq and Intel SoCs. 1042 + To compile this driver as a module, select M here. The 1043 + module will be called lantiq. 1042 1044 1043 1045 config SERIAL_LANTIQ_CONSOLE 1044 1046 bool "Console on Lantiq UART"
+25 -4
drivers/tty/serial/lantiq.c
··· 15 15 #include <linux/io.h> 16 16 #include <linux/ioport.h> 17 17 #include <linux/lantiq.h> 18 + #include <linux/module.h> 18 19 #include <linux/of_address.h> 19 20 #include <linux/of_irq.h> 20 21 #include <linux/of_platform.h> ··· 824 823 free_irq(ltq_port->common_irq, port); 825 824 } 826 825 827 - static int __init 828 - lqasc_probe(struct platform_device *pdev) 826 + static int lqasc_probe(struct platform_device *pdev) 829 827 { 830 828 struct device_node *node = pdev->dev.of_node; 831 829 struct ltq_uart_port *ltq_port; ··· 908 908 return ret; 909 909 } 910 910 911 + static int lqasc_remove(struct platform_device *pdev) 912 + { 913 + struct uart_port *port = platform_get_drvdata(pdev); 914 + 915 + return uart_remove_one_port(&lqasc_reg, port); 916 + } 917 + 911 918 static const struct ltq_soc_data soc_data_lantiq = { 912 919 .fetch_irq = fetch_irq_lantiq, 913 920 .request_irq = request_irq_lantiq, ··· 932 925 { .compatible = "intel,lgm-asc", .data = &soc_data_intel }, 933 926 {}, 934 927 }; 928 + MODULE_DEVICE_TABLE(of, ltq_asc_match); 935 929 936 930 static struct platform_driver lqasc_driver = { 931 + .probe = lqasc_probe, 932 + .remove = lqasc_remove, 937 933 .driver = { 938 934 .name = DRVNAME, 939 935 .of_match_table = ltq_asc_match, ··· 952 942 if (ret != 0) 953 943 return ret; 954 944 955 - ret = platform_driver_probe(&lqasc_driver, lqasc_probe); 945 + ret = platform_driver_register(&lqasc_driver); 956 946 if (ret != 0) 957 947 uart_unregister_driver(&lqasc_reg); 958 948 959 949 return ret; 960 950 } 961 - device_initcall(init_lqasc); 951 + 952 + static void __exit exit_lqasc(void) 953 + { 954 + platform_driver_unregister(&lqasc_driver); 955 + uart_unregister_driver(&lqasc_reg); 956 + } 957 + 958 + module_init(init_lqasc); 959 + module_exit(exit_lqasc); 960 + 961 + MODULE_DESCRIPTION("Serial driver for Lantiq & Intel gateway SoCs"); 962 + MODULE_LICENSE("GPL v2");