Skip to content

Commit

Permalink
ttyprintk: Allow built as a module
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
tiwai authored and gregkh committed Apr 16, 2014
1 parent 7d1c285 commit b24313a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/char/Kconfig
Expand Up @@ -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---
Expand Down
13 changes: 12 additions & 1 deletion drivers/char/ttyprintk.c
Expand Up @@ -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;
Expand Down Expand Up @@ -214,4 +214,15 @@ static int __init ttyprintk_init(void)
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");

0 comments on commit b24313a

Please sign in to comment.