Skip to contentSkip to conversation

mips: make loongsoon serial driver explicitly modular

PATCH In review Paul Gortmaker 2 participants 2 messages Jan 22, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 52df9ab1.ahF1zl0PTutzrviC%[email protected]

#1 lore raw

PATCH 1/1 mips: make loongsoon serial driver explicitly modular

The file looks as if it is non-modular, but it piggy-backs off CONFIG_SERIAL_8250 which is tristate. If set to "=m" we will get this after the init/module header cleanup:

arch/mips/loongson/common/serial.c:76:1: error: data definition has no type or storage class [-Werror] arch/mips/loongson/common/serial.c:76:1: error: type defaults to 'int' in declaration of 'device_initcall' [-Werror=implicit-int] arch/mips/loongson/common/serial.c:76:1: error: parameter names (without types) in function declaration [-Werror] arch/mips/loongson/common/serial.c:58:19: error: 'serial_init' defined but not used [-Werror=unused-function]
cc1: all warnings being treated as errors
make[3]: *** [arch/mips/loongson/common/serial.o] Error 1

Make it clearly modular, and add a module_exit function, so that we avoid the above breakage.

---

[patch added to init cleanup series:
http://git.kernel.org/cgit/linux/kernel/git/paulg/init.git/ ]

 arch/mips/loongson/common/serial.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/loongson/common/serial.c +7 -2
index 5f2b78a..4d0922f 100644
@@ -11,7 +11,7 @@
  */
 
 #include <linux/io.h>
-#include <linux/init.h>
+#include <linux/module.h>
 #include <linux/serial_8250.h>
 
 #include <asm/bootinfo.h>
@@ -72,5 +72,10 @@ static int __init serial_init(void)
 
 	return platform_device_register(&uart8250_device);
 }
+module_init(serial_init);
 
-device_initcall(serial_init);
+static void __init serial_exit(void)
+{
+	platform_device_unregister(&uart8250_device);
+}
+module_exit(serial_exit);
Signature · 1 line
1.8.5.1
Acked-by on v1 1/1
#2 lore raw

Hi,

Quoted 11 lines · Paul Gortmaker

The file looks as if it is non-modular, but it piggy-backs off CONFIG_SERIAL_8250 which is tristate. If set to "=m" we will get this after the init/module header cleanup:

arch/mips/loongson/common/serial.c:76:1: error: data definition has no type or storage class [-Werror] arch/mips/loongson/common/serial.c:76:1: error: type defaults to 'int' in declaration of 'device_initcall' [-Werror=implicit-int] arch/mips/loongson/common/serial.c:76:1: error: parameter names (without types) in function declaration [-Werror] arch/mips/loongson/common/serial.c:58:19: error: 'serial_init' defined but not used [-Werror=unused-function]
cc1: all warnings being treated as errors
make[3]: *** [arch/mips/loongson/common/serial.o] Error 1

Quoted 7 lines

Make it clearly modular, and add a module_exit function, so that we avoid the above breakage.

as this patch is already in Paul's tree, i will set it to "other maintainer" in the linux-mips patchwork.

Thanks,
John

Quoted 33 lines

---

[patch added to init cleanup series:
http://git.kernel.org/cgit/linux/kernel/git/paulg/init.git/ ]

 arch/mips/loongson/common/serial.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/loongson/common/serial.c +7 -2
index 5f2b78a..4d0922f 100644
@@ -11,7 +11,7 @@
  */
 
 #include <linux/io.h>
-#include <linux/init.h>
+#include <linux/module.h>
 #include <linux/serial_8250.h>
 
 #include <asm/bootinfo.h>
@@ -72,5 +72,10 @@ static int __init serial_init(void)
 
 	return platform_device_register(&uart8250_device);
 }
+module_init(serial_init);
 
-device_initcall(serial_init);
+static void __init serial_exit(void)
+{
+	platform_device_unregister(&uart8250_device);
+}
+module_exit(serial_exit);