summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-04-02 14:45:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-04-16 14:21:06 -0700
commitb24313a82cf24e90170671ea74360b3e6ef3a91f (patch)
treed0668a79aed447a520f453d2161abd858c4a87e7 /drivers/char
parent7d1c2858c49095ab748f55354b89dbd6b18d28b9 (diff)
downloadlinux-b24313a82cf24e90170671ea74360b3e6ef3a91f.tar.gz
linux-b24313a82cf24e90170671ea74360b3e6ef3a91f.tar.bz2
linux-b24313a82cf24e90170671ea74360b3e6ef3a91f.zip
ttyprintk: Allow built as a module
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>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/ttyprintk.c13
2 files changed, 13 insertions, 2 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index fbae63e3d304..6e9f74a5c095 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -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---
diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
index 2a39c5790364..a15ce4ef39cd 100644
--- a/drivers/char/ttyprintk.c
+++ b/drivers/char/ttyprintk.c
@@ -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");