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 @@
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/string.h>
#include <linux/spinlock.h>
#include <asm/page.h>
#include <asm/oplib.h>
......@@ -17,6 +18,11 @@
#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;
......
......@@ -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);
......@@ -78,9 +78,13 @@
#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;
}
......
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