patch-2.4.0-test10 linux/drivers/video/mdacon.c

Next file: linux/drivers/video/newport_con.c
Previous file: linux/drivers/video/macfb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test9/linux/drivers/video/mdacon.c linux/drivers/video/mdacon.c
@@ -37,6 +37,7 @@
 #include <linux/vt_kern.h>
 #include <linux/vt_buffer.h>
 #include <linux/selection.h>
+#include <linux/spinlock.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
 #include <linux/init.h>
@@ -44,6 +45,7 @@
 #include <asm/io.h>
 #include <asm/vga.h>
 
+static spinlock_t mda_lock = SPIN_LOCK_UNLOCKED;
 
 /* description of the hardware layout */
 
@@ -80,7 +82,6 @@
 MODULE_PARM(mda_last_vc,  "1-255i");
 #endif
 
-
 /* MDA register values
  */
 
@@ -110,39 +111,38 @@
 {
 	unsigned long flags;
 
-	save_flags(flags); cli();
+	spin_lock_irqsave(&mda_lock, flags);	
 
 	outb_p(reg, mda_index_port); 
 	outb_p(val, mda_value_port);
 
-	restore_flags(flags);
+	spin_unlock_irqrestore(&mda_lock, flags);
 }
 
 static void write_mda_w(unsigned int val, unsigned char reg)
 {
 	unsigned long flags;
 
-	save_flags(flags); cli();
+	spin_lock_irqsave(&mda_lock, flags);
 
 	outb_p(reg,   mda_index_port); outb_p(val >> 8,   mda_value_port);
 	outb_p(reg+1, mda_index_port); outb_p(val & 0xff, mda_value_port);
 
-	restore_flags(flags);
+	spin_unlock_irqrestore(&mda_lock, flags);
 }
 
 static int test_mda_b(unsigned char val, unsigned char reg)
 {
 	unsigned long flags;
 
-	save_flags(flags); cli();
+	spin_lock_irqsave(&mda_lock, flags);
 
 	outb_p(reg, mda_index_port); 
 	outb  (val, mda_value_port);
 
 	udelay(20); val = (inb_p(mda_value_port) == val);
 
-	restore_flags(flags);
-
+	spin_unlock_irqrestore(&mda_lock, flags);
 	return val;
 }
 
@@ -422,7 +422,8 @@
 static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
 {
 	for (; count > 0; count--) {
-		scr_writew(scr_readw(p) ^ 0x0800, p++);
+		scr_writew(scr_readw(p) ^ 0x0800, p);
+		p++;
 	}
 }
 
@@ -585,7 +586,7 @@
  *  The console `switch' structure for the MDA based console
  */
 
-struct consw mda_con = {
+const struct consw mda_con = {
 	con_startup:		mdacon_startup,
 	con_init:		mdacon_init,
 	con_deinit:		mdacon_deinit,

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