mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jean Delvare <jdelvare@suse.de>,
	Struan Bartlett <struan.bartlett@gmail.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	gnomes@lxorguk.ukuu.org.uk, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] ttyprintk: Allow built as a module
Date: Wed,  2 Apr 2014 12:29:42 +0200	[thread overview]
Message-ID: <1396434582-30799-2-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1396434582-30799-1-git-send-email-tiwai@suse.de>

The driver is well written to be used as a module, just the exit call
is missing.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/char/Kconfig     |  2 +-
 drivers/char/ttyprintk.c | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 1386749b48ff..97816b133c7f 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..73606eaaba71 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 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");
-- 
1.9.1


  reply	other threads:[~2014-04-02 10:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 10:29 [PATCH 1/2] ttyprintk: Fix wrong tty_unregister_driver() call in the error path Takashi Iwai
2014-04-02 10:29 ` Takashi Iwai [this message]
2014-04-02 12:31   ` [PATCH 2/2] ttyprintk: Allow built as a module Jean Delvare
2014-04-02 12:42     ` Takashi Iwai
2014-04-02 19:32   ` Greg Kroah-Hartman
2014-04-03  6:13     ` Takashi Iwai
2014-04-05 11:15       ` Samo Pogačnik
2014-04-02 12:24 ` [PATCH 1/2] ttyprintk: Fix wrong tty_unregister_driver() call in the error path Jean Delvare
2014-04-03  6:10   ` Takashi Iwai
2014-04-03  8:00     ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396434582-30799-2-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=arnd@arndb.de \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdelvare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwab@linux-m68k.org \
    --cc=struan.bartlett@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®