2002-08-29 22:20:13

by Peter Waechtler

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

--- vanilla-2.5.32/sound/oss/mad16.c Sat Aug 10 00:08:54 2002
+++ linux-2.5-cli-oss/sound/oss/mad16.c Tue Aug 13 15:37:01 2002
@@ -43,7 +43,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/gameport.h>
-
+#include <linux/spinlock.h>
#include "sound_config.h"

#include "ad1848.h"
@@ -53,7 +53,7 @@
static int mad16_conf;
static int mad16_cdsel;
static struct gameport gameport;
-
+static spinlock_t lock=SPIN_LOCK_UNLOCKED;
static int already_initialized = 0;

#define C928 1
@@ -106,8 +106,7 @@
unsigned long flags;
unsigned char tmp;

- save_flags(flags);
- cli();
+ spin_lock_irqsave(&lock,flags);

switch (board_type) /* Output password */
{
@@ -142,7 +141,7 @@
if (!c924pnp)
tmp = inb(port); else
tmp = inb(port-0x80);
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock,flags);

return tmp;
}
@@ -151,8 +150,7 @@
{
unsigned long flags;

- save_flags(flags);
- cli();
+ spin_lock_irqsave(&lock,flags);

switch (board_type) /* Output password */
{
@@ -185,7 +183,7 @@
if (!c924pnp)
outb(((unsigned char) (value & 0xff)), port); else
outb(((unsigned char) (value & 0xff)), port-0x80);
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock,flags);
}

static int __init detect_c930(void)