2002-08-29 22:21:19

by Peter Waechtler

[permalink] [raw]
Subject: [PATCH] 26/41 sound/oss/opl3sa.c - convert cli to spinlocks

--- vanilla-2.5.32/sound/oss/opl3sa.c Sat Apr 20 18:25:21 2002
+++ linux-2.5-cli-oss/sound/oss/opl3sa.c Tue Aug 13 15:36:09 2002
@@ -22,6 +22,7 @@

#include <linux/init.h>
#include <linux/module.h>
+#include <linux/spinlock.h>

#undef SB_OK

@@ -37,7 +38,7 @@

static int kilroy_was_here = 0; /* Don't detect twice */
static int mpu_initialized = 0;
-
+static spinlock_t lock=SPIN_LOCK_UNLOCKED;
static int *opl3sa_osp = NULL;

static unsigned char opl3sa_read(int addr)
@@ -45,12 +46,11 @@
unsigned long flags;
unsigned char tmp;

- save_flags(flags);
- cli();
+ spin_lock_irqsave(&lock,flags);
outb((0x1d), 0xf86); /* password */
outb(((unsigned char) addr), 0xf86); /* address */
tmp = inb(0xf87); /* data */
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock,flags);

return tmp;
}
@@ -59,12 +59,11 @@
{
unsigned long flags;

- save_flags(flags);
- cli();
+ spin_lock_irqsave(&lock,flags);
outb((0x1d), 0xf86); /* password */
outb(((unsigned char) addr), 0xf86); /* address */
outb(((unsigned char) data), 0xf87); /* data */
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock,flags);
}

static int __init opl3sa_detect(void)