fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / oss / aci.c
index ac3c481..3bfac37 100644 (file)
 #include <linux/module.h> 
 #include <linux/proc_fs.h>
 #include <linux/slab.h>
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
+
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include "sound_config.h"
 
 int aci_port;  /* as determined by bit 4 in the OPTi 929 MC4 register */
-int aci_idcode[2];     /* manufacturer and product ID */
+static int aci_idcode[2];      /* manufacturer and product ID */
 int aci_version;       /* ACI firmware version */
 
 EXPORT_SYMBOL(aci_port);
-EXPORT_SYMBOL(aci_idcode);
 EXPORT_SYMBOL(aci_version);
 
 #include "aci.h"
@@ -80,26 +80,26 @@ static int aci_micpreamp=3; /* microphone preamp-level that can't be    *
                         * checked with ACI versions prior to 0xb0      */
 
 static int mixer_device;
-static struct semaphore aci_sem;
+static struct mutex aci_mutex;
 
 #ifdef MODULE
 static int reset;
-MODULE_PARM(reset,"i");
+module_param(reset, bool, 0);
 MODULE_PARM_DESC(reset,"When set to 1, reset aci mixer.");
 #else
 static int reset = 1;
 #endif
 
 static int ide=-1;
-MODULE_PARM(ide,"i");
+module_param(ide, int, 0);
 MODULE_PARM_DESC(ide,"1 enable, 0 disable ide-port - untested"
                 " default: do nothing");
 static int wss=-1;
-MODULE_PARM(wss,"i");
+module_param(wss, int, 0);
 MODULE_PARM_DESC(wss,"change between ACI/WSS-mixer; use 0 and 1 - untested"
                 " default: do nothing; for PCM1-pro only");
 
-#if DEBUG
+#ifdef DEBUG
 static void print_bits(unsigned char c)
 {
        int j;
@@ -184,7 +184,7 @@ static int busy_wait(void)
 static inline int aci_rawwrite(unsigned char byte)
 {
        if (busy_wait() >= 0) {
-#if DEBUG
+#ifdef DEBUG
                printk(KERN_DEBUG "aci_rawwrite(%d)\n", byte);
 #endif
                outb(byte, COMMAND_REGISTER);
@@ -199,7 +199,7 @@ static inline int aci_rawread(void)
 
        if (busy_wait() >= 0) {
                byte=inb(STATUS_REGISTER);
-#if DEBUG
+#ifdef DEBUG
                printk(KERN_DEBUG "%d = aci_rawread()\n", byte);
 #endif
                return byte;
@@ -213,7 +213,7 @@ int aci_rw_cmd(int write1, int write2, int write3)
        int write[] = {write1, write2, write3};
        int read = -EINTR, i;
 
-       if (down_interruptible(&aci_sem))
+       if (mutex_lock_interruptible(&aci_mutex))
                goto out;
 
        for (i=0; i<3; i++) {
@@ -228,7 +228,7 @@ int aci_rw_cmd(int write1, int write2, int write3)
        }
        
        read = aci_rawread();
-out_up:        up(&aci_sem);
+out_up:        mutex_unlock(&aci_mutex);
 out:   return read;
 }
 
@@ -604,7 +604,7 @@ static int __init attach_aci(void)
        char *boardname;
        int i, rc = -EBUSY;
 
-       init_MUTEX(&aci_sem);
+       mutex_init(&aci_mutex);
 
        outb(0xE3, 0xf8f); /* Write MAD16 password */
        aci_port = (inb(0xf90) & 0x10) ?