Re: [PATCH] CONSOLE_LP_STRICT Kconfig option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

--- ./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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux