patch-2.3.1 linux/drivers/char/lp.c

Next file: linux/drivers/char/msbusmouse.c
Previous file: linux/drivers/char/keyboard.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.0/linux/drivers/char/lp.c linux/drivers/char/lp.c
@@ -187,15 +187,7 @@
 /* if you have more than 3 printers, remember to increase LP_NO */
 #define LP_NO 3
 
-struct lp_struct lp_table[LP_NO] =
-{
-	[0 ... LP_NO-1] = {NULL, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT,
-			   NULL,
-#ifdef LP_STATS
-			   0, 0, {0},
-#endif
-			   NULL, 0, 0, 0}
-};
+struct lp_struct lp_table[LP_NO];
 
 /* Test if printer is ready */
 #define	LP_READY(status)	((status) & LP_PBUSY)
@@ -737,6 +729,7 @@
 		LP_F(minor) &= ~LP_BUSY;
 		return -ENOMEM;
 	}
+	init_waitqueue_head(&(lp_table[minor].wait_q));
 	return 0;
 }
 
@@ -928,6 +921,24 @@
 	unsigned int count = 0;
 	unsigned int i;
 	struct parport *port;
+
+	for(i = 0; i < LP_NO; i++) {
+		lp_table[i].dev = NULL;
+		lp_table[i].flags = 0;
+		lp_table[i].chars = LP_INIT_CHAR;
+		lp_table[i].time = LP_INIT_TIME;
+		lp_table[i].wait = LP_INIT_WAIT;
+		lp_table[i].lp_buffer = NULL;
+#ifdef LP_STATS
+		lp_table[i].lastcall = 0;
+		lp_table[i].runchars = 0;
+		memset(&lp_table[i].stats, 0, sizeof(struct lp_stats));
+#endif
+		init_waitqueue_head(&lp_table[i].wait_q);
+		lp_table[i].last_error = 0;
+		lp_table[i].irq_detected = 0;
+		lp_table[i].irq_missed = 0;
+	}
 
 	switch (parport_nr[0])
 	{

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)