fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / pci / mixart / mixart.c
index b218e1d..21386da 100644 (file)
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
 #include <linux/moduleparam.h>
+#include <linux/mutex.h>
+
 #include <sound/core.h>
 #include <sound/initval.h>
 #include <sound/info.h>
@@ -589,7 +592,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
        /*  set up format for the stream */
        format = params_format(hw);
 
-       down(&mgr->setup_mutex);
+       mutex_lock(&mgr->setup_mutex);
 
        /* update the stream levels */
        if( stream->pcm_number <= MIXART_PCM_DIGITAL ) {
@@ -628,7 +631,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
                                bufferinfo[i].available_length,
                                subs->number);
        }
-       up(&mgr->setup_mutex);
+       mutex_unlock(&mgr->setup_mutex);
 
        return err;
 }
@@ -700,7 +703,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
        int err = 0;
        int pcm_number;
 
-       down(&mgr->setup_mutex);
+       mutex_lock(&mgr->setup_mutex);
 
        if ( pcm == chip->pcm ) {
                pcm_number = MIXART_PCM_ANALOG;
@@ -758,7 +761,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
        }
 
  _exit_open:
-       up(&mgr->setup_mutex);
+       mutex_unlock(&mgr->setup_mutex);
 
        return err;
 }
@@ -775,7 +778,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
        int err = 0;
        int pcm_number;
 
-       down(&mgr->setup_mutex);
+       mutex_lock(&mgr->setup_mutex);
 
        if ( pcm == chip->pcm ) {
                pcm_number = MIXART_PCM_ANALOG;
@@ -836,7 +839,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
        }
 
  _exit_open:
-       up(&mgr->setup_mutex);
+       mutex_unlock(&mgr->setup_mutex);
 
        return err;
 }
@@ -849,7 +852,7 @@ static int snd_mixart_close(struct snd_pcm_substream *subs)
        struct mixart_mgr *mgr = chip->mgr;
        struct mixart_stream *stream = subs->runtime->private_data;
 
-       down(&mgr->setup_mutex);
+       mutex_lock(&mgr->setup_mutex);
 
        snd_printdd("snd_mixart_close C%d/P%d/Sub%d\n", chip->chip_idx, stream->pcm_number, subs->number);
 
@@ -868,7 +871,7 @@ static int snd_mixart_close(struct snd_pcm_substream *subs)
        stream->status    = MIXART_STREAM_STATUS_FREE;
        stream->substream = NULL;
 
-       up(&mgr->setup_mutex);
+       mutex_unlock(&mgr->setup_mutex);
        return 0;
 }
 
@@ -1063,7 +1066,7 @@ static int snd_mixart_free(struct mixart_mgr *mgr)
 
        /* release irq  */
        if (mgr->irq >= 0)
-               free_irq(mgr->irq, (void *)mgr);
+               free_irq(mgr->irq, mgr);
 
        /* reset board if some firmware was loaded */
        if(mgr->dsp_loaded) {
@@ -1106,13 +1109,13 @@ static long long snd_mixart_BA0_llseek(struct snd_info_entry *entry,
        offset = offset & ~3; /* 4 bytes aligned */
 
        switch(orig) {
-       case 0:  /* SEEK_SET */
+       case SEEK_SET:
                file->f_pos = offset;
                break;
-       case 1:  /* SEEK_CUR */
+       case SEEK_CUR:
                file->f_pos += offset;
                break;
-       case 2:  /* SEEK_END, offset is negative */
+       case SEEK_END: /* offset is negative */
                file->f_pos = MIXART_BA0_SIZE + offset;
                break;
        default:
@@ -1132,13 +1135,13 @@ static long long snd_mixart_BA1_llseek(struct snd_info_entry *entry,
        offset = offset & ~3; /* 4 bytes aligned */
 
        switch(orig) {
-       case 0:  /* SEEK_SET */
+       case SEEK_SET:
                file->f_pos = offset;
                break;
-       case 1:  /* SEEK_CUR */
+       case SEEK_CUR:
                file->f_pos += offset;
                break;
-       case 2: /* SEEK_END, offset is negative */
+       case SEEK_END: /* offset is negative */
                file->f_pos = MIXART_BA1_SIZE + offset;
                break;
        default:
@@ -1241,7 +1244,6 @@ static void __devinit snd_mixart_proc_init(struct snd_mixart *chip)
        /* text interface to read perf and temp meters */
        if (! snd_card_proc_new(chip->card, "board_info", &entry)) {
                entry->private_data = chip;
-               entry->c.text.read_size = 1024;
                entry->c.text.read = snd_mixart_proc_read;
        }
 
@@ -1288,7 +1290,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
        pci_set_master(pci);
 
        /* check if we can restrict PCI DMA transfers to 32 bits */
-       if (pci_set_dma_mask(pci, 0xffffffff) < 0) {
+       if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) {
                snd_printk(KERN_ERR "architecture does not support 32bit PCI busmaster DMA\n");
                pci_disable_device(pci);
                return -ENXIO;
@@ -1317,7 +1319,8 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
                                                   pci_resource_len(pci, i));
        }
 
-       if (request_irq(pci->irq, snd_mixart_interrupt, SA_INTERRUPT|SA_SHIRQ, CARD_NAME, (void *)mgr)) {
+       if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED,
+                       CARD_NAME, mgr)) {
                snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
                snd_mixart_free(mgr);
                return -EBUSY;
@@ -1335,12 +1338,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
        mgr->msg_fifo_writeptr = 0;
 
        spin_lock_init(&mgr->msg_lock);
-       init_MUTEX(&mgr->msg_mutex);
+       mutex_init(&mgr->msg_mutex);
        init_waitqueue_head(&mgr->msg_sleep);
        atomic_set(&mgr->msg_processed, 0);
 
        /* init setup mutex*/
-       init_MUTEX(&mgr->setup_mutex);
+       mutex_init(&mgr->setup_mutex);
 
        /* init message taslket */
        tasklet_init(&mgr->msg_taskq, snd_mixart_msg_tasklet, (unsigned long) mgr);