All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Falavigna <dktrkranz@gmail.com>
To: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: ak@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] CONSOLE_LP_STRICT Kconfig option
Date: Fri, 14 Apr 2006 00:45:45 +0200	[thread overview]
Message-ID: <443ED499.6040903@gmail.com> (raw)
In-Reply-To: <20060412120904.e2fce912.rdunlap@xenotime.net>

Randy.Dunlap ha scritto:
> I think that if you make it a module_param() and use (root-) writeable
> permissions on it, it's just a variable that can be changed after the
> driver is loaded and running.
> 
> Andi, did you want just a boot-time option or a run-time (changeable) option?

Here is a patch (built against 2.6.17-rc1) which does use of __setup()
call to dynamically adjust console_lp_strict value.
Actually the only way to get console line printer working is to enable
it at system startup so I adjusted Kconfig parameters accordingly.
Feel free to submit any feedback.



Signed-off-by: Luca Falavigna <dktrkranz@gmail.com>

--- ./drivers/char/lp.c.orig	2006-01-08 16:48:14.000000000 +0100
+++ ./drivers/char/lp.c	2006-04-14 00:31:57.000000000 +0200
@@ -686,9 +686,17 @@ static struct file_operations lp_fops =
 #define CONSOLE_LP 0

 /* If the printer is out of paper, we can either lose the messages or
- * stall until the printer is happy again.  Define CONSOLE_LP_STRICT
+ * stall until the printer is happy again.  Setting console_lp_strict
  * non-zero to get the latter behaviour. */
-#define CONSOLE_LP_STRICT 1
+static unsigned int console_lp_strict = 1;
+
+static int __init console_lp_strict_setup (char *str)
+{
+	console_lp_strict = simple_strtol(str, NULL, 0);
+	return 1;
+}
+
+__setup("console_lp_strict=", console_lp_strict_setup);

 /* The console must be locked when we get here. */

@@ -697,7 +705,7 @@ static void lp_console_write (struct con
 {
 	struct pardevice *dev = lp_table[CONSOLE_LP].dev;
 	struct parport *port = dev->port;
-	ssize_t written;
+	ssize_t written = 0;

 	if (parport_claim (dev))
 		/* Nothing we can do. */
@@ -737,9 +745,9 @@ static void lp_console_write (struct con
 				written = parport_write (port, crlf, i);
 				if (written > 0)
 					i -= written, crlf += written;
-			} while (i > 0 && (CONSOLE_LP_STRICT || written > 0));
+			} while (i > 0 && (console_lp_strict || written > 0));
 		}
-	} while (count > 0 && (CONSOLE_LP_STRICT || written > 0));
+	} while (count > 0 && (console_lp_strict || written > 0));

 	parport_release (dev);
 }
--- ./drivers/char/Kconfig.orig	2006-04-13 20:52:52.000000000 +0200
+++ ./drivers/char/Kconfig	2006-04-14 00:27:34.000000000 +0200
@@ -506,7 +506,7 @@ config PRINTER

 config LP_CONSOLE
 	bool "Support for console on line printer"
-	depends on PRINTER
+	depends on PRINTER = y
 	---help---
 	  If you want kernel messages to be printed out as they occur, you
 	  can have a console on the printer. This option adds support for
@@ -515,9 +515,9 @@ config LP_CONSOLE

 	  If the printer is out of paper (or off, or unplugged, or too
 	  busy..) the kernel will stall until the printer is ready again.
-	  By defining CONSOLE_LP_STRICT to 0 (at your own risk) you
-	  can make the kernel continue when this happens,
-	  but it'll lose the kernel messages.
+	  By passing the option "console_lp_strict=0" to the kernel at
+	  boot time (at your own risk) you can make the kernel continue
+	  when this happens, but it will lose the kernel messages.

 	  If unsure, say N.


Regards,

-- 
Luca

  reply	other threads:[~2006-04-13 22:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-14 14:46 [PATCH] CONSOLE_LP_STRICT Kconfig option Luca Falavigna
2006-02-14 14:59 ` Andi Kleen
2006-02-15  9:03   ` Luca Falavigna
2006-04-11 22:17     ` Randy.Dunlap
     [not found]       ` <ff1cadb20604121153k6552ea84maf58b44869412f2@mail.gmail.com>
2006-04-12 19:09         ` Randy.Dunlap
2006-04-13 22:45           ` Luca Falavigna [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-02-14 21:05 Luca Falavigna
2006-02-15  3:33 ` Randy.Dunlap
2006-02-15  8:29   ` Luca Falavigna

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=443ED499.6040903@gmail.com \
    --to=dktrkranz@gmail.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /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.