fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / pci / korg1212 / korg1212.c
index 4eddb51..345eefe 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/slab.h>
 #include <linux/wait.h>
 #include <linux/moduleparam.h>
+#include <linux/mutex.h>
 
 #include <sound/core.h>
 #include <sound/info.h>
@@ -325,7 +326,7 @@ struct snd_korg1212 {
         int irq;
 
         spinlock_t    lock;
-       struct semaphore open_mutex;
+       struct mutex open_mutex;
 
        struct timer_list timer;        /* timer callback for checking ack of stop request */
        int stop_pending_cnt;           /* counter for stop pending check */
@@ -667,13 +668,13 @@ static int snd_korg1212_OpenCard(struct snd_korg1212 * korg1212)
 {
        K1212_DEBUG_PRINTK("K1212_DEBUG: OpenCard [%s] %d\n",
                           stateName[korg1212->cardState], korg1212->opencnt);
-       down(&korg1212->open_mutex);
+       mutex_lock(&korg1212->open_mutex);
         if (korg1212->opencnt++ == 0) {
                snd_korg1212_TurnOffIdleMonitor(korg1212);
                snd_korg1212_setCardState(korg1212, K1212_STATE_OPEN);
        }
 
-       up(&korg1212->open_mutex);
+       mutex_unlock(&korg1212->open_mutex);
         return 1;
 }
 
@@ -682,9 +683,9 @@ static int snd_korg1212_CloseCard(struct snd_korg1212 * korg1212)
        K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard [%s] %d\n",
                           stateName[korg1212->cardState], korg1212->opencnt);
 
-       down(&korg1212->open_mutex);
+       mutex_lock(&korg1212->open_mutex);
        if (--(korg1212->opencnt)) {
-               up(&korg1212->open_mutex);
+               mutex_unlock(&korg1212->open_mutex);
                return 0;
        }
 
@@ -695,7 +696,7 @@ static int snd_korg1212_CloseCard(struct snd_korg1212 * korg1212)
                        K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard - RC = %d [%s]\n",
                                           rc, stateName[korg1212->cardState]);
                if (rc != K1212_CMDRET_Success) {
-                       up(&korg1212->open_mutex);
+                       mutex_unlock(&korg1212->open_mutex);
                         return 0;
                }
         } else if (korg1212->cardState > K1212_STATE_SETUP) {
@@ -707,7 +708,7 @@ static int snd_korg1212_CloseCard(struct snd_korg1212 * korg1212)
                 snd_korg1212_setCardState(korg1212, K1212_STATE_READY);
        }
 
-       up(&korg1212->open_mutex);
+       mutex_unlock(&korg1212->open_mutex);
         return 0;
 }
 
@@ -1118,14 +1119,11 @@ static void snd_korg1212_OnDSPDownloadComplete(struct snd_korg1212 *korg1212)
        snd_korg1212_setCardState(korg1212, K1212_STATE_DSP_COMPLETE);
 }
 
-static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id)
 {
         u32 doorbellValue;
         struct snd_korg1212 *korg1212 = dev_id;
 
-       if(irq != korg1212->irq)
-               return IRQ_NONE;
-
         doorbellValue = readl(korg1212->inDoorbellPtr);
 
         if (!doorbellValue)
@@ -1139,7 +1137,6 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs
 
        korg1212->inIRQ++;
 
-
         switch (doorbellValue) {
                 case K1212_DB_DSPDownloadDone:
                         K1212_DEBUG_PRINTK("K1212_DEBUG: IRQ DNLD count - %ld, %x, [%s].\n",
@@ -2084,7 +2081,7 @@ static void __devinit snd_korg1212_proc_init(struct snd_korg1212 *korg1212)
        struct snd_info_entry *entry;
 
        if (! snd_card_proc_new(korg1212->card, "korg1212", &entry))
-               snd_info_set_text_ops(entry, korg1212, 1024, snd_korg1212_proc_read);
+               snd_info_set_text_ops(entry, korg1212, snd_korg1212_proc_read);
 }
 
 static int
@@ -2179,7 +2176,7 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
 
         init_waitqueue_head(&korg1212->wait);
         spin_lock_init(&korg1212->lock);
-       init_MUTEX(&korg1212->open_mutex);
+       mutex_init(&korg1212->open_mutex);
        init_timer(&korg1212->timer);
        korg1212->timer.function = snd_korg1212_timer_func;
        korg1212->timer.data = (unsigned long)korg1212;
@@ -2236,7 +2233,7 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
         }
 
         err = request_irq(pci->irq, snd_korg1212_interrupt,
-                          SA_INTERRUPT|SA_SHIRQ,
+                          IRQF_SHARED,
                           "korg1212", korg1212);
 
         if (err) {