All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Waugh <twaugh@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: lp and LP_CONSOLE
Date: Fri, 10 Aug 2001 00:44:52 +0100	[thread overview]
Message-ID: <20010810004452.D1629@redhat.com> (raw)

Here is a patch to prevent lp from being pinned in memory when
CONFIG_LP_CONSOLE is enabled.

Tim.
*/

2001-08-09  Tim Waugh  <twaugh@redhat.com>

	* drivers/char/lp.c: Don't pin module down in memory if console
	code is enabled; use unregister_console instead.

--- linux/drivers/char/lp.c.con	Fri Aug 10 00:23:17 2001
+++ linux/drivers/char/lp.c	Fri Aug 10 00:43:56 2001
@@ -147,6 +147,10 @@
 
 static unsigned int lp_count = 0;
 
+#ifdef CONFIG_LP_CONSOLE
+static struct parport *console_registered; // initially NULL
+#endif /* CONFIG_LP_CONSOLE */
+
 #undef LP_DEBUG
 
 /* --- low-level port access ----------------------------------- */
@@ -674,8 +678,8 @@
 #ifdef CONFIG_LP_CONSOLE
 	if (!nr) {
 		if (port->modes & PARPORT_MODE_SAFEININT) {
-			MOD_INC_USE_COUNT;
 			register_console (&lpcons);
+			console_registered = port;
 			printk (KERN_INFO "lp%d: console ready\n", CONSOLE_LP);
 		} else
 			printk (KERN_ERR "lp%d: cannot run console on %s\n",
@@ -720,6 +724,12 @@
 static void lp_detach (struct parport *port)
 {
 	/* Write this some day. */
+#ifdef CONFIG_LP_CONSOLE
+	if (console_registered == port) {
+		unregister_console (&lpcons);
+		console_registered = NULL;
+	}
+#endif /* CONFIG_LP_CONSOLE */
 }
 
 static struct parport_driver lp_driver = {

                 reply	other threads:[~2001-08-09 23:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20010810004452.D1629@redhat.com \
    --to=twaugh@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.