ttyprintk: Allow built as a module
authorTakashi Iwai <tiwai@suse.de>
Wed, 2 Apr 2014 12:45:22 +0000 (14:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Apr 2014 21:21:06 +0000 (14:21 -0700)
The driver is well written to be used as a module, just the exit call
is missing.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/Kconfig
drivers/char/ttyprintk.c

index fbae63e3d304350261e536159e960ab70b5ba409..6e9f74a5c0950369be357b60a320fcac21578d45 100644 (file)
@@ -40,7 +40,7 @@ config SGI_MBCS
 source "drivers/tty/serial/Kconfig"
 
 config TTY_PRINTK
-       bool "TTY driver to output user messages via printk"
+       tristate "TTY driver to output user messages via printk"
        depends on EXPERT && TTY
        default n
        ---help---
index 2a39c57903644593eefbe09fc08d6bc973f8e5cf..a15ce4ef39cd97cbef47f5ca31579700ffb0e572 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/device.h>
 #include <linux/serial.h>
 #include <linux/tty.h>
-#include <linux/export.h>
+#include <linux/module.h>
 
 struct ttyprintk_port {
        struct tty_port port;
@@ -214,4 +214,15 @@ error:
        tty_port_destroy(&tpk_port.port);
        return ret;
 }
+
+static void __exit ttyprintk_exit(void)
+{
+       tty_unregister_driver(ttyprintk_driver);
+       put_tty_driver(ttyprintk_driver);
+       tty_port_destroy(&tpk_port.port);
+}
+
 device_initcall(ttyprintk_init);
+module_exit(ttyprintk_exit);
+
+MODULE_LICENSE("GPL");