Commit a1952ca9 authored by David S. Miller's avatar David S. Miller

SPARC64 NS87303: Replace cli/sti with spinlocking.

parent 0b9daf11
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/spinlock.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/oplib.h> #include <asm/oplib.h>
...@@ -17,6 +18,11 @@ ...@@ -17,6 +18,11 @@
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/spitfire.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 } }; struct prom_cpuinfo linux_cpus[NR_CPUS] __initdata = { { 0 } };
unsigned prom_cpu_nodes[NR_CPUS]; unsigned prom_cpu_nodes[NR_CPUS];
int linux_num_cpus = 0; int linux_num_cpus = 0;
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <asm/isa.h> #include <asm/isa.h>
#endif #endif
#include <asm/a.out.h> #include <asm/a.out.h>
#include <asm/ns87303.h>
struct poll { struct poll {
int fd; int fd;
...@@ -373,3 +374,6 @@ EXPORT_SYMBOL(kbd_pt_regs); ...@@ -373,3 +374,6 @@ EXPORT_SYMBOL(kbd_pt_regs);
#ifdef CONFIG_DEBUG_BUGVERBOSE #ifdef CONFIG_DEBUG_BUGVERBOSE
EXPORT_SYMBOL(do_BUG); EXPORT_SYMBOL(do_BUG);
#endif #endif
/* for ns8703 */
EXPORT_SYMBOL(ns87303_lock);
...@@ -78,9 +78,13 @@ ...@@ -78,9 +78,13 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/spinlock.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
extern spinlock_t ns87303_lock;
static __inline__ int ns87303_modify(unsigned long port, unsigned int index, static __inline__ int ns87303_modify(unsigned long port, unsigned int index,
unsigned char clr, unsigned char set) unsigned char clr, unsigned char set)
{ {
...@@ -96,14 +100,16 @@ static __inline__ int ns87303_modify(unsigned long port, unsigned int index, ...@@ -96,14 +100,16 @@ static __inline__ int ns87303_modify(unsigned long port, unsigned int index,
if (index > 0x0d) if (index > 0x0d)
return -EINVAL; return -EINVAL;
save_flags(flags); cli(); spin_lock_irqsave(&ns87303_lock, flags);
outb(index, port); outb(index, port);
value = inb(port + 1); value = inb(port + 1);
value &= ~(reserved[index] | clr); value &= ~(reserved[index] | clr);
value |= set; value |= set;
outb(value, port + 1); outb(value, port + 1);
outb(value, port + 1); outb(value, port + 1);
restore_flags(flags);
spin_unlock_irqrestore(&ns87303_lock, flags);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment