fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / pci / emu10k1 / memory.c
index 68c795c..4fcaefe 100644 (file)
@@ -24,6 +24,8 @@
 #include <sound/driver.h>
 #include <linux/pci.h>
 #include <linux/time.h>
+#include <linux/mutex.h>
+
 #include <sound/core.h>
 #include <sound/emu10k1.h>
 
@@ -285,6 +287,8 @@ int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *b
        return err;
 }
 
+EXPORT_SYMBOL(snd_emu10k1_memblk_map);
+
 /*
  * page allocation for DMA
  */
@@ -302,10 +306,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
        hdr = emu->memhdr;
        snd_assert(hdr, return NULL);
 
-       down(&hdr->block_mutex);
+       mutex_lock(&hdr->block_mutex);
        blk = search_empty(emu, runtime->dma_bytes);
        if (blk == NULL) {
-               up(&hdr->block_mutex);
+               mutex_unlock(&hdr->block_mutex);
                return NULL;
        }
        /* fill buffer addresses but pointers are not stored so that
@@ -318,14 +322,14 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
                if (idx >= sgbuf->pages) {
                        printk(KERN_ERR "emu: pages overflow! (%d-%d) for %d\n",
                               blk->first_page, blk->last_page, sgbuf->pages);
-                       up(&hdr->block_mutex);
+                       mutex_unlock(&hdr->block_mutex);
                        return NULL;
                }
 #endif
                addr = sgbuf->table[idx].addr;
                if (! is_valid_page(emu, addr)) {
                        printk(KERN_ERR "emu: failure page = %d\n", idx);
-                       up(&hdr->block_mutex);
+                       mutex_unlock(&hdr->block_mutex);
                        return NULL;
                }
                emu->page_addr_table[page] = addr;
@@ -337,10 +341,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst
        err = snd_emu10k1_memblk_map(emu, blk);
        if (err < 0) {
                __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk);
-               up(&hdr->block_mutex);
+               mutex_unlock(&hdr->block_mutex);
                return NULL;
        }
-       up(&hdr->block_mutex);
+       mutex_unlock(&hdr->block_mutex);
        return (struct snd_util_memblk *)blk;
 }
 
@@ -369,22 +373,23 @@ snd_emu10k1_synth_alloc(struct snd_emu10k1 *hw, unsigned int size)
        struct snd_emu10k1_memblk *blk;
        struct snd_util_memhdr *hdr = hw->memhdr; 
 
-       down(&hdr->block_mutex);
+       mutex_lock(&hdr->block_mutex);
        blk = (struct snd_emu10k1_memblk *)__snd_util_mem_alloc(hdr, size);
        if (blk == NULL) {
-               up(&hdr->block_mutex);
+               mutex_unlock(&hdr->block_mutex);
                return NULL;
        }
        if (synth_alloc_pages(hw, blk)) {
                __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk);
-               up(&hdr->block_mutex);
+               mutex_unlock(&hdr->block_mutex);
                return NULL;
        }
        snd_emu10k1_memblk_map(hw, blk);
-       up(&hdr->block_mutex);
+       mutex_unlock(&hdr->block_mutex);
        return (struct snd_util_memblk *)blk;
 }
 
+EXPORT_SYMBOL(snd_emu10k1_synth_alloc);
 
 /*
  * free a synth sample area
@@ -396,17 +401,18 @@ snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *memblk)
        struct snd_emu10k1_memblk *blk = (struct snd_emu10k1_memblk *)memblk;
        unsigned long flags;
 
-       down(&hdr->block_mutex);
+       mutex_lock(&hdr->block_mutex);
        spin_lock_irqsave(&emu->memblk_lock, flags);
        if (blk->mapped_page >= 0)
                unmap_memblk(emu, blk);
        spin_unlock_irqrestore(&emu->memblk_lock, flags);
        synth_free_pages(emu, blk);
         __snd_util_mem_free(hdr, memblk);
-       up(&hdr->block_mutex);
+       mutex_unlock(&hdr->block_mutex);
        return 0;
 }
 
+EXPORT_SYMBOL(snd_emu10k1_synth_free);
 
 /* check new allocation range */
 static void get_single_page_range(struct snd_util_memhdr *hdr,
@@ -538,6 +544,8 @@ int snd_emu10k1_synth_bzero(struct snd_emu10k1 *emu, struct snd_util_memblk *blk
        return 0;
 }
 
+EXPORT_SYMBOL(snd_emu10k1_synth_bzero);
+
 /*
  * copy_from_user(blk + offset, data, size)
  */
@@ -566,3 +574,5 @@ int snd_emu10k1_synth_copy_from_user(struct snd_emu10k1 *emu, struct snd_util_me
        } while (offset < end_offset);
        return 0;
 }
+
+EXPORT_SYMBOL(snd_emu10k1_synth_copy_from_user);