]> git.hungrycats.org Git - linux/commitdiff
SPARC64 NS87303: Replace cli/sti with spinlocking.
authorDavid S. Miller <davem@nuts.ninka.net>
Sat, 3 Aug 2002 19:08:54 +0000 (12:08 -0700)
committerDavid S. Miller <davem@nuts.ninka.net>
Sat, 3 Aug 2002 19:08:54 +0000 (12:08 -0700)
arch/sparc64/kernel/devices.c
arch/sparc64/kernel/sparc64_ksyms.c
include/asm-sparc64/ns87303.h

index a8f580248482371856633a2ede0109c2dcb08a66..07b4746390b6caf191c044321ec088d1ae464146 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/string.h>
+#include <linux/spinlock.h>
 
 #include <asm/page.h>
 #include <asm/oplib.h>
 #include <asm/smp.h>
 #include <asm/spitfire.h>
 
+/* Used to synchronize acceses to NatSemi SUPER I/O chip configure
+ * operations in asm/ns87303.h
+ */
+spinlock_t ns87303_lock = SPIN_LOCK_UNLOCKED;
+
 struct prom_cpuinfo linux_cpus[NR_CPUS] __initdata = { { 0 } };
 unsigned prom_cpu_nodes[NR_CPUS];
 int linux_num_cpus = 0;
index e66cfd14fe3290d2ea35571cf725e1da9542c45b..41208bd8aa82391ecf1f6c6a58f020af6c764291 100644 (file)
@@ -52,6 +52,7 @@
 #include <asm/isa.h>
 #endif
 #include <asm/a.out.h>
+#include <asm/ns87303.h>
 
 struct poll {
        int fd;
@@ -373,3 +374,6 @@ EXPORT_SYMBOL(kbd_pt_regs);
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 EXPORT_SYMBOL(do_BUG);
 #endif
+
+/* for ns8703 */
+EXPORT_SYMBOL(ns87303_lock);
index 89ac8c4ad36d6a41fa5dd2ff4be8c206a0e30a77..fee7d95e54d5b33337463da704908ba1dac106cd 100644 (file)
 
 #ifdef __KERNEL__
 
+#include <linux/spinlock.h>
+
 #include <asm/system.h>
 #include <asm/io.h>
 
+extern spinlock_t ns87303_lock;
+
 static __inline__ int ns87303_modify(unsigned long port, unsigned int index,
                                     unsigned char clr, unsigned char set)
 {
@@ -96,14 +100,16 @@ static __inline__ int ns87303_modify(unsigned long port, unsigned int index,
        if (index > 0x0d)
                return -EINVAL;
 
-       save_flags(flags); cli();
+       spin_lock_irqsave(&ns87303_lock, flags);
+
        outb(index, port);
        value = inb(port + 1);
        value &= ~(reserved[index] | clr);
        value |= set;
        outb(value, port + 1);
        outb(value, port + 1);
-       restore_flags(flags);
+
+       spin_unlock_irqrestore(&ns87303_lock, flags);
 
        return 0;
 }