Skip to contentSkip to conversation

CONSOLE_LP_STRICT Kconfig option

PATCH In review Luca Falavigna 2 participants 3 messages Feb 14, 2006 – Feb 15, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CONSOLE_LP_STRICT Kconfig option

This patch, built against kernel version 2.6.16-rc3, provides a Kconfig option in order to easily enable or disable CONSOLE_LP_STRICT variable in drivers/char/lp.c without modifying it directly.

--- linux-2.6.16-rc3/drivers/char/lp.c.orig 2006-01-08
16:48:14.000000000 +0100
+++ linux-2.6.16-rc3/drivers/char/lp.c 2006-02-14 13:43:41.000000000
+0100
@@ -686,9 +686,13 @@ 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
- * non-zero to get the latter behaviour. */
-#define CONSOLE_LP_STRICT 1
+ * stall until the printer is happy again. If CONSOLE_LP_STRICT is
+ * non-zero to, we get the latter behaviour. */
+#ifdef CONFIG_LP_CONSOLE_STRICT
+# define CONSOLE_LP_STRICT 1
+#else
+# define CONSOLE_LP_STRICT 0
+#endif

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

@@ -697,7 +701,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. */
--- linux-2.6.16-rc3/drivers/char/Kconfig.orig 2006-02-14
00:14:08.000000000 +0100
+++ linux-2.6.16-rc3/drivers/char/Kconfig 2006-02-14
13:47:33.000000000 +0100
@@ -512,14 +512,21 @@ config LP_CONSOLE
doing that; to actually get it to happen you need to pass the option "console=lp0" to the kernel at boot time.

-      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.

-
If unsure, say N.

+config LP_CONSOLE_STRICT

+    bool "Wait for a ready printer"
+    depends on LP_CONSOLE
+    default y
+    ---help---
+      With this option enabled, 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 turning this option off (at your own risk), you
+      can make the kernel continue when this happens, but it will lose
+      some kernel messages.

+
+ If unsure, say Y
+
config PPDEV
tristate "Support for user-space parallel port device drivers" depends on PARPORT

Regards,

--
Luca

#1 lore raw
Quoted 3 lines · On Tue, 14 Feb 2006 22:05:37 +0100 Luca Falavigna wrote:

This patch, built against kernel version 2.6.16-rc3, provides a Kconfig option in order to easily enable or disable CONSOLE_LP_STRICT variable in drivers/char/lp.c without modifying it directly.

The patch does not apply cleanly to 2.6.16-rc3 -- because tabs have been converted to spaces, either by your email client or by using copy-n-paste to create the email.

Couple of typo corrections below.

Quoted 7 lines

--- linux-2.6.16-rc3/drivers/char/lp.c.orig 2006-01-08
16:48:14.000000000 +0100
+++ linux-2.6.16-rc3/drivers/char/lp.c 2006-02-14 13:43:41.000000000
+0100

Review static struct file_operations lp_fops = · line 690

Quoted 8 lines
(quoted diff) +2 -3
@@ -686,9 +686,13 @@ 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
- * non-zero to get the latter behaviour. */
-#define CONSOLE_LP_STRICT 1
+ * stall until the printer is happy again. If CONSOLE_LP_STRICT is
+ * non-zero to, we get the latter behaviour. */

* too,

Quoted 22 lines
(quoted diff) +6 -2
+#ifdef CONFIG_LP_CONSOLE_STRICT
+# define CONSOLE_LP_STRICT 1
+#else
+# define CONSOLE_LP_STRICT 0
+#endif
 
 /* The console must be locked when we get here. */
 
@@ -697,7 +701,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. */
--- linux-2.6.16-rc3/drivers/char/Kconfig.orig    2006-02-14

00:14:08.000000000 +0100
+++ linux-2.6.16-rc3/drivers/char/Kconfig 2006-02-14
13:47:33.000000000 +0100

Review config LP_CONSOLE · line 519

Quoted 8 lines
(quoted diff) +7 -0
@@ -512,14 +512,21 @@ config LP_CONSOLE
 
+config LP_CONSOLE_STRICT
+    bool "Wait for a ready printer"
+    depends on LP_CONSOLE
+    default y
+    ---help---
+      With this option enabled, if the printer is out of paper (or off,
+      or unplugged, or too busy..) the kernel will stall until the printer

* add comma: ,

Review config LP_CONSOLE · line 528

Quoted 9 lines
(quoted diff) +6 -0
+      is ready again. By turning this option off (at your own risk), you
+      can make the kernel continue when this happens, but it will lose
+      some kernel messages.
+
+      If unsure, say Y
+
 config PPDEV
     tristate "Support for user-space parallel port device drivers"
     depends on PARPORT

---
~Randy

#2 lore raw

Randy.Dunlap ha scritto:

Quoted 3 lines

The patch does not apply cleanly to 2.6.16-rc3 -- because tabs have been converted to spaces, either by your email client or by using copy-n-paste to create the email.

Here is what happens when you use Outlook ;)

drivers/char/lp.c renamed from drivers/char/lp.c.orig +8 -4
@@ -686,9 +686,13 @@ 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
- * non-zero to get the latter behaviour. */
-#define CONSOLE_LP_STRICT 1
+ * stall until the printer is happy again. If CONSOLE_LP_STRICT is
+ * non-zero, we get the latter behaviour. */
+#ifdef CONFIG_LP_CONSOLE_STRICT
+# define CONSOLE_LP_STRICT 1
+#else
+# define CONSOLE_LP_STRICT 0
+#endif
 
 /* The console must be locked when we get here. */
 
@@ -697,7 +701,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. */
drivers/char/Kconfig renamed from drivers/char/Kconfig.orig +13 -6
@@ -512,14 +512,21 @@ config LP_CONSOLE
 	  doing that; to actually get it to happen you need to pass the
 	  option "console=lp0" to the kernel at boot time.
 
-	  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.
-
 	  If unsure, say N.
 
+config LP_CONSOLE_STRICT
+	bool "Wait for a ready printer"
+	depends on LP_CONSOLE
+	default y
+	---help---
+	  With this option enabled, 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 turning this option off (at your own risk), you
+	  can make the kernel continue when this happens, but it will lose
+	  some kernel messages.
+	
+	  If unsure, say Y
+
 config PPDEV
 	tristate "Support for user-space parallel port device drivers"
 	depends on PARPORT

I attach a copy of this patch to this email in order to avoid these problems (at least I hope so)

Regards,

Signature · 1 line
Luca
drivers/char/lp.c renamed from drivers/char/lp.c.orig +8 -4
@@ -686,9 +686,13 @@ 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
- * non-zero to get the latter behaviour. */
-#define CONSOLE_LP_STRICT 1
+ * stall until the printer is happy again. If CONSOLE_LP_STRICT is
+ * non-zero, we get the latter behaviour. */
+#ifdef CONFIG_LP_CONSOLE_STRICT
+# define CONSOLE_LP_STRICT 1
+#else
+# define CONSOLE_LP_STRICT 0
+#endif
 
 /* The console must be locked when we get here. */
 
@@ -697,7 +701,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. */
drivers/char/Kconfig renamed from drivers/char/Kconfig.orig +13 -6
@@ -512,14 +512,21 @@ config LP_CONSOLE
 	  doing that; to actually get it to happen you need to pass the
 	  option "console=lp0" to the kernel at boot time.
 
-	  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.
-
 	  If unsure, say N.
 
+config LP_CONSOLE_STRICT
+	bool "Wait for a ready printer"
+	depends on LP_CONSOLE
+	default y
+	---help---
+	  With this option enabled, 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 turning this option off (at your own risk), you
+	  can make the kernel continue when this happens, but it will lose
+	  some kernel messages.
+	  
+	  If unsure, say Y
+
 config PPDEV
 	tristate "Support for user-space parallel port device drivers"
 	depends on PARPORT