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

From: pwaechtler@mac.com
Date: Thu Aug 29 2002 - 14:56:27 EST


--- 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)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Aug 31 2002 - 22:00:28 EST