> Hi James,
>
> I think you missed to remove one restore_flags().....
> (There could be more, I only looked shortly at your patch)
Yeap. I didn't remove the restore_flag calls. Fixed now. Here is the
correct patch. I tested to see if it compiles against a test-9 kernel.
It does. That is the problem with fixing code that you don't have the
hardware for. You can't find those stupid mistakes before you post a
possible patch :-( It is next to impossible to find a MDA card. *shameless
plug *
--- mdacon.c.orig Wed Oct 11 18:09:01 2000
+++ mdacon.c Mon Oct 16 23:03:26 2000
@@ -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;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:10 EST